diff --git a/.gitmodules b/.gitmodules index 90a497d..03466a2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/lib/J3DUltra b/lib/J3DUltra index 2165575..1fb9a2c 160000 --- a/lib/J3DUltra +++ b/lib/J3DUltra @@ -1 +1 @@ -Subproject commit 2165575d51ff599cd321e847f94b38af1200e17c +Subproject commit 1fb9a2cbb838de05c5dc8d0a7886d3a1311279e9 diff --git a/lib/fmt b/lib/fmt index 1e0c6cd..02c5d63 160000 --- a/lib/fmt +++ b/lib/fmt @@ -1 +1 @@ -Subproject commit 1e0c6cdc3ba05fe740860ded5e92ee33792c3f11 +Subproject commit 02c5d637c5ca02c62d7346537e131833d8d78d8a diff --git a/lib/imgui b/lib/imgui index 6d70c2d..f63c95a 160000 --- a/lib/imgui +++ b/lib/imgui @@ -1 +1 @@ -Subproject commit 6d70c2dc739a42ae08b51813f0143ff854db7f2c +Subproject commit f63c95a076a401721ceaf21f30d4f12e8c40cb2c diff --git a/src/DOM/GalaxyDOMNode.cpp b/src/DOM/GalaxyDOMNode.cpp index e573500..c95fa1d 100644 --- a/src/DOM/GalaxyDOMNode.cpp +++ b/src/DOM/GalaxyDOMNode.cpp @@ -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; } \ No newline at end of file diff --git a/src/DOM/PathDOMNode.cpp b/src/DOM/PathDOMNode.cpp index 738296e..15708e6 100644 --- a/src/DOM/PathDOMNode.cpp +++ b/src/DOM/PathDOMNode.cpp @@ -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(EDOMNodeType::PathPoint)){ + auto points = GetChildrenOfType(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), diff --git a/src/DOM/ZoneDOMNode.cpp b/src/DOM/ZoneDOMNode.cpp index 46677fc..85a03a5 100644 --- a/src/DOM/ZoneDOMNode.cpp +++ b/src/DOM/ZoneDOMNode.cpp @@ -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); @@ -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(){ @@ -669,6 +673,8 @@ std::map> SZoneDOMNode::LoadMainZone( AddChild(layer); } + Children.shrink_to_fit(); + return zoneTransforms; } diff --git a/src/UAreaRenderer.cpp b/src/UAreaRenderer.cpp index 12d8cc9..2a9f967 100644 --- a/src/UAreaRenderer.cpp +++ b/src/UAreaRenderer.cpp @@ -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); diff --git a/src/UStarForgeContext.cpp b/src/UStarForgeContext.cpp index f849785..abdfd30 100644 --- a/src/UStarForgeContext.cpp +++ b/src/UStarForgeContext.cpp @@ -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); @@ -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);