Skip to content

Commit

Permalink
Traktor: Prevent calculating instance mesh world bounding boxes each …
Browse files Browse the repository at this point in the history
…frame.
  • Loading branch information
apistol78 committed Feb 29, 2024
1 parent c6240ca commit 3d93cca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/Mesh/Instance/InstanceMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void InstanceMesh::build(
{
*ptr++ = packInstanceMeshData(
instance->transform,
m_renderMesh->getBoundingBox().transform(instance->transform)
instance->boundingBox
);
}
m_instanceBuffer->unlock();
Expand Down Expand Up @@ -261,6 +261,7 @@ InstanceMesh::Instance* InstanceMesh::allocateInstance()
Instance* instance = new Instance();
instance->mesh = this;
instance->transform = Transform::identity();
instance->boundingBox = m_renderMesh->getBoundingBox();
m_instances.push_back(instance);
return instance;
}
Expand All @@ -278,6 +279,7 @@ void InstanceMesh::Instance::setTransform(const Transform& transform)
{
this->mesh->m_instanceBufferDirty = true;
this->transform = transform;
this->boundingBox = this->mesh->m_renderMesh->getBoundingBox().transform(transform);
}

}
1 change: 1 addition & 0 deletions code/Mesh/Instance/InstanceMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class T_DLLCLASS InstanceMesh : public IMesh
{
InstanceMesh* mesh;
Transform transform;
Aabb3 boundingBox;

void setTransform(const Transform& transform);
};
Expand Down

0 comments on commit 3d93cca

Please sign in to comment.