Skip to content

Commit

Permalink
update libraries to reduced memory usage variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Astral-C committed Sep 9, 2024
1 parent 9cafbd0 commit d25089a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[submodule "lib/J3DUltra"]
path = lib/J3DUltra
url = https://github.com/Sage-of-Mirrors/J3DUltra.git
branch = reduced-memory-usage
[submodule "lib/imgui"]
path = lib/imgui
url = https://github.com/ocornut/imgui.git
Expand Down
3 changes: 3 additions & 0 deletions src/DOM/GalaxyDOMNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ bool SGalaxyDOMNode::LoadGalaxy(std::filesystem::path galaxy_path, EGameType gam
scenario->Deserialize(&mScenarioData, entry);
}
}

Children.shrink_to_fit();

mGalaxyLoaded = true;
return true;
}
4 changes: 3 additions & 1 deletion src/DOM/PathDOMNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ void SPathDOMNode::Render(USceneCamera* cam, glm::mat4 referenceFrame){
void SPathDOMNode::Update(){
mRenderer.mPath.clear();
mRenderer.isClosed = mIsClosed;
for(auto point : GetChildrenOfType<SPathPointDOMNode>(EDOMNodeType::PathPoint)){
auto points = GetChildrenOfType<SPathPointDOMNode>(EDOMNodeType::PathPoint);
mRenderer.mPath.reserve(points.size());
for(auto point : points){
CPathPoint pnt = {
.Position = point->GetPosition(),
.Color = glm::vec4((float)(mColor >> 16 & 0xFF) / 255.0f, (float)(mColor >> 8 & 0xFF) / 255.0f, (float)(mColor & 0xFF) / 255.0f, 1.0f),
Expand Down
6 changes: 6 additions & 0 deletions src/DOM/ZoneDOMNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ void SZoneDOMNode::LoadZone(std::filesystem::path zonePath, EGameType game){
layer->LoadLayerObjects(layerCommonObjects);
layer->LoadLayerPaths(layerCommonPaths);
layer->LoadLayerStarts(layerCommonStarts);
layer->Children.shrink_to_fit();

AddChild(layer);

Expand All @@ -518,12 +519,15 @@ void SZoneDOMNode::LoadZone(std::filesystem::path zonePath, EGameType game){

layer->LoadLayerObjects(layerObjects);
layer->LoadLayerStarts(layerStarts);
layer->Children.shrink_to_fit();

AddChild(layer);
}

mZoneArchiveLoaded = true;

Children.shrink_to_fit();

}

void SZoneDOMNode::SaveZone(){
Expand Down Expand Up @@ -669,6 +673,8 @@ std::map<std::string, std::pair<glm::mat4, int32_t>> SZoneDOMNode::LoadMainZone(
AddChild(layer);
}

Children.shrink_to_fit();

return zoneTransforms;
}

Expand Down
4 changes: 4 additions & 0 deletions src/UAreaRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ void CAreaRenderer::Init() {
}
}

Cylinder.shrink_to_fit();
Sphere.shrink_to_fit();
Bowl.shrink_to_fit();

glBindBuffer(GL_ARRAY_BUFFER, mShapeBuffers[BOX_BASE]);
glBufferData(GL_ARRAY_BUFFER, sizeof(CShapeVertex) * Box.size(), &Box[0], GL_STATIC_DRAW);

Expand Down
3 changes: 0 additions & 3 deletions src/UStarForgeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ void UStarForgeContext::Render(float deltaTime) {
glBindTexture(GL_TEXTURE_2D, 0);
glBindRenderbuffer(GL_RENDERBUFFER, 0);

assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);

ImGui::DockBuilderRemoveNode(mMainDockSpaceID); // clear any previous layout
ImGui::DockBuilderAddNode(mMainDockSpaceID, dockFlags | ImGuiDockNodeFlags_DockSpace);
Expand Down Expand Up @@ -372,8 +371,6 @@ void UStarForgeContext::Render(float deltaTime) {
GLenum attachments[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
glDrawBuffers(2, attachments);

assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);


J3D::Picking::ResizeFramebuffer((uint32_t)winSize.x, (uint32_t)winSize.y);

Expand Down

0 comments on commit d25089a

Please sign in to comment.