Jelajahi Sumber

Add SceneGraph::set_world_pose()

Daniele Bartolini 10 tahun lalu
induk
melakukan
932258c64b
2 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 6 0
      src/world/scene_graph.cpp
  2. 2 0
      src/world/scene_graph.h

+ 6 - 0
src/world/scene_graph.cpp

@@ -188,6 +188,12 @@ Matrix4x4 SceneGraph::world_pose(TransformInstance i) const
 	return _data.world[i.i];
 }
 
+void SceneGraph::set_world_pose(TransformInstance i, const Matrix4x4& pose)
+{
+	_data.world[i.i] = pose;
+	_data.changed[i.i] = true;
+}
+
 uint32_t SceneGraph::num_nodes() const
 {
 	return _data.size;

+ 2 - 0
src/world/scene_graph.h

@@ -64,6 +64,8 @@ struct SceneGraph
 	/// @copydoc SceneGraph::world_position()
 	Matrix4x4 world_pose(TransformInstance i) const;
 
+	void set_world_pose(TransformInstance i, const Matrix4x4& pose);
+
 	/// Returns the number of nodes in the graph.
 	uint32_t num_nodes() const;