Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions engine/src/components/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically.
*/

static hash<float> hash_float;

Transform::Transform() :
m_position(Vector3()),
m_rotation(Vector3()),
Expand Down Expand Up @@ -269,11 +271,9 @@ void Transform::cleanDirty() const {
m_worldQuaternion = m_parent->worldQuaternion() * m_worldQuaternion;
m_worldTransform = m_parent->worldTransform() * m_worldTransform;
}
int32_t buffer[16];
memcpy(buffer, &m_worldTransform[0], sizeof(float) * 16);
m_hash = 0;
m_hash = 16;
for(int i = 0; i < 16; i++) {
m_hash ^= buffer[i];
m_hash ^= hash_float(m_worldTransform[i]) + 0x9e3779b9 + (m_hash << 6 ) + (m_hash >> 2);
}
m_dirty = false;
}