Skip to content

Commit

Permalink
[InventoryCube] Optimized update frequency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Oct 29, 2023
1 parent d8b8974 commit becedd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/client/gui/InventoryCube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ InventoryCube::InventoryCube(float size, bool isEntity)
using namespace BlockGeometry;

void InventoryCube::updateVertexBuffer(const Block &block, u8 state) {
if (!block.id()) return;
if (!block.id() || (block.id() == m_blockID && state == m_blockState)) return;

m_blockID = block.id();
m_blockState = state;

const BlockState &blockState = block.getState(state);

Expand Down
3 changes: 3 additions & 0 deletions source/client/gui/InventoryCube.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class InventoryCube : public Drawable, public gk::Transformable {
bool m_isEntity = false;

View m_view;

u16 m_blockID = 0;
u16 m_blockState = 0;
};

#endif // INVENTORYCUBE_HPP_

0 comments on commit becedd6

Please sign in to comment.