Skip to content

Commit

Permalink
[render] DrawableMeshUniforms update color directly from mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Jan 27, 2025
1 parent feff3a8 commit 79b02f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vclib/render/include/vclib/bgfx/drawable/drawable_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DrawableMeshBGFX : public AbstractDrawableMesh, public MeshType
mMRB = MeshRenderBuffers<MeshType>(*this);
mMRS.setRenderCapabilityFrom(*this);
mMeshRenderSettingsUniforms.updateSettings(mMRS);
mMeshUniforms.update(mMRB);
mMeshUniforms.update(*this);
}

void swap(DrawableMeshBGFX& other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ class DrawableMeshUniforms
DrawableMeshUniforms() = default;

template<MeshConcept MeshType>
void update(const MeshRenderData<MeshType>& mrb)
void update(const MeshType& m)
{
std::copy(
mrb.meshColorBufferData(),
mrb.meshColorBufferData() + 4,
mMeshColor);
if constexpr (HasColor<MeshType>) {
mMeshColor[0] = m.color().redF();
mMeshColor[1] = m.color().greenF();
mMeshColor[2] = m.color().blueF();
mMeshColor[3] = m.color().alphaF();
}
}

void bind() const
Expand Down

0 comments on commit 79b02f0

Please sign in to comment.