From f0c8437bfab32631fb45831480d0e70022507257 Mon Sep 17 00:00:00 2001 From: Andrew Copland Date: Fri, 22 Nov 2024 12:39:54 +0000 Subject: [PATCH] Remove VBO and JobRequest get/setters --- src/GeoPatch.cpp | 24 ++++++++++++------------ src/GeoPatch.h | 29 +---------------------------- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/GeoPatch.cpp b/src/GeoPatch.cpp index d5a71781f6..a59092a7d7 100644 --- a/src/GeoPatch.cpp +++ b/src/GeoPatch.cpp @@ -104,7 +104,7 @@ GeoPatch::GeoPatch(const RefCountedPtr &ctx_, GeoSphere *gs, GeoPatch::~GeoPatch() { - ClearHasJobRequest(); + m_hasJobRequest = false; for (int i = 0; i < NUM_KIDS; i++) { m_kids[i].reset(); } @@ -115,9 +115,9 @@ GeoPatch::~GeoPatch() void GeoPatch::UpdateVBOs(Graphics::Renderer *renderer) { PROFILE_SCOPED() - if (NeedToUpdateVBOs()) { + if (m_needUpdateVBOs) { assert(renderer); - ClearNeedToUpdateVBOs(); + m_needUpdateVBOs = false; //create buffer and upload data auto vbd = Graphics::VertexBufferDesc::FromAttribSet(Graphics::ATTRIB_POSITION | Graphics::ATTRIB_NORMAL | Graphics::ATTRIB_DIFFUSE | Graphics::ATTRIB_UV0); @@ -384,7 +384,7 @@ void GeoPatch::LODUpdate(const vector3d &campos, const Graphics::Frustum &frustu { PROFILE_SCOPED() // there should be no LOD update when we have active split requests - if (HasJobRequest()) + if (m_hasJobRequest) return; bool canSplit = true; @@ -407,8 +407,8 @@ void GeoPatch::LODUpdate(const vector3d &campos, const Graphics::Frustum &frustu return; // we can see this patch so submit the jobs! - assert(!HasJobRequest()); - SetHasJobRequest(); + assert(!m_hasJobRequest); + m_hasJobRequest = true; SQuadSplitRequest *ssrd = new SQuadSplitRequest(m_corners->m_v0, m_corners->m_v1, m_corners->m_v2, m_corners->m_v3, m_clipCentroid.Normalized(), m_depth, m_geosphere->GetSystemBody()->GetPath(), m_PatchID, m_ctx->GetEdgeLen() - 2, @@ -436,8 +436,8 @@ void GeoPatch::LODUpdate(const vector3d &campos, const Graphics::Frustum &frustu void GeoPatch::RequestSinglePatch() { if (!HasHeightData()) { - assert(!HasJobRequest()); - SetHasJobRequest(); + assert(!m_hasJobRequest); + m_hasJobRequest = true; SSingleSplitRequest *ssrd = new SSingleSplitRequest(m_corners->m_v0, m_corners->m_v1, m_corners->m_v2, m_corners->m_v3, m_clipCentroid.Normalized(), m_depth, m_geosphere->GetSystemBody()->GetPath(), m_PatchID, m_ctx->GetEdgeLen() - 2, m_ctx->GetFrac(), m_geosphere->GetTerrain()); m_job = Pi::GetAsyncJobQueue()->Queue(new SinglePatchJob(ssrd)); @@ -457,7 +457,7 @@ void GeoPatch::ReceiveHeightmaps(SQuadSplitResult *psr) psr->OnCancel(); } } else { - assert(HasJobRequest()); + assert(m_hasJobRequest); const int newDepth = m_depth + 1; for (int i = 0; i < NUM_KIDS; i++) { assert(!m_kids[i]); @@ -472,7 +472,7 @@ void GeoPatch::ReceiveHeightmaps(SQuadSplitResult *psr) for (int i = 0; i < NUM_KIDS; i++) { m_kids[i]->ReceiveHeightResult(psr->data(i)); } - ClearHasJobRequest(); + m_hasJobRequest = false; } } @@ -480,10 +480,10 @@ void GeoPatch::ReceiveHeightmap(const SSingleSplitResult *psr) { PROFILE_SCOPED() assert(nullptr != psr); - assert(HasJobRequest()); + assert(m_hasJobRequest); ReceiveHeightResult(psr->data()); - ClearHasJobRequest(); + m_hasJobRequest = false; } void GeoPatch::ReceiveHeightResult(const SSplitResultData &data) diff --git a/src/GeoPatch.h b/src/GeoPatch.h index e9a1f635df..f3eb1df8b4 100644 --- a/src/GeoPatch.h +++ b/src/GeoPatch.h @@ -84,7 +84,7 @@ class GeoPatch { merge &= m_kids[i]->canBeMerged(); } } - merge &= !(HasJobRequest()); + merge &= !(m_hasJobRequest); return merge; } @@ -104,33 +104,6 @@ class GeoPatch { m_needUpdateVBOs = HasHeightData(); } -private: - - inline bool NeedToUpdateVBOs() const - { - return m_needUpdateVBOs; - } - - inline void ClearNeedToUpdateVBOs() - { - m_needUpdateVBOs = false; - } - - inline void SetHasJobRequest() - { - m_hasJobRequest = true; - } - - inline bool HasJobRequest() const - { - return m_hasJobRequest; - } - - inline void ClearHasJobRequest() - { - m_hasJobRequest = false; - } - private: static const int NUM_KIDS = 4;