فهرست منبع

Add parameter to set default position and rotation

Daniele Bartolini 12 سال پیش
والد
کامیت
8345209935
2فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 4 1
      engine/Mesh.cpp
  2. 3 1
      engine/Mesh.h

+ 4 - 1
engine/Mesh.cpp

@@ -34,10 +34,13 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-void Mesh::create(const MeshResource* mr)
+void Mesh::create(const MeshResource* mr, const Vec3& pos, const Quat& rot)
 {
 	m_vbuffer = mr->m_vbuffer;
 	m_ibuffer = mr->m_ibuffer;
+
+	set_local_position(pos);
+	set_local_rotation(rot);
 }
 
 //-----------------------------------------------------------------------------

+ 3 - 1
engine/Mesh.h

@@ -27,6 +27,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "RendererTypes.h"
+#include "Vec3.h"
+#include "Quat.h"
 #include "Mat4.h"
 
 namespace crown
@@ -36,7 +38,7 @@ struct MeshResource;
 
 struct Mesh
 {
-	void			create(const MeshResource* mr);
+	void			create(const MeshResource* mr, const Vec3& pos = Vec3::ZERO, const Quat& rot = Quat::IDENTITY);
 
 	Vec3			local_position() const;
 	Quat			local_rotation() const;