|
@@ -52,7 +52,7 @@ SceneGraph::SceneGraph(Allocator& a, uint32_t index)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
-void SceneGraph::create(uint32_t count, const StringId32* name, const Matrix4x4* local, int32_t* parent)
|
|
|
|
|
|
|
+void SceneGraph::create(const Matrix4x4& root, uint32_t count, const StringId32* name, const Matrix4x4* local, int32_t* parent)
|
|
|
{
|
|
{
|
|
|
char* mem = (char*) m_allocator->allocate(count * (sizeof(uint8_t) + sizeof(Matrix4x4) + sizeof(Matrix4x4) + sizeof(int32_t) + sizeof(StringId32)));
|
|
char* mem = (char*) m_allocator->allocate(count * (sizeof(uint8_t) + sizeof(Matrix4x4) + sizeof(Matrix4x4) + sizeof(int32_t) + sizeof(StringId32)));
|
|
|
|
|
|
|
@@ -64,11 +64,20 @@ void SceneGraph::create(uint32_t count, const StringId32* name, const Matrix4x4*
|
|
|
m_parents = (int32_t*) mem; mem += sizeof(int32_t) * count;
|
|
m_parents = (int32_t*) mem; mem += sizeof(int32_t) * count;
|
|
|
m_names = (StringId32*) mem; mem += sizeof(StringId32) * count;
|
|
m_names = (StringId32*) mem; mem += sizeof(StringId32) * count;
|
|
|
|
|
|
|
|
- memset(m_flags, (int) LOCAL_DIRTY, sizeof(uint8_t) * count);
|
|
|
|
|
|
|
+ memset(m_flags, (int) CLEAN, sizeof(uint8_t) * count);
|
|
|
memcpy(m_local_poses, local, sizeof(Matrix4x4) * count);
|
|
memcpy(m_local_poses, local, sizeof(Matrix4x4) * count);
|
|
|
memcpy(m_parents, parent, sizeof(int32_t) * count);
|
|
memcpy(m_parents, parent, sizeof(int32_t) * count);
|
|
|
memcpy(m_names, name, sizeof(StringId32) * count);
|
|
memcpy(m_names, name, sizeof(StringId32) * count);
|
|
|
|
|
|
|
|
|
|
+ // Compute initial world poses
|
|
|
|
|
+ for (uint32_t i = 1; i < m_num_nodes; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ m_world_poses[i] = root * m_local_poses[i];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ m_world_poses[0] = root;
|
|
|
|
|
+ m_flags[0] = WORLD_DIRTY;
|
|
|
|
|
+
|
|
|
update();
|
|
update();
|
|
|
}
|
|
}
|
|
|
|
|
|