Procházet zdrojové kódy

add const to some functions parameters and create shape in constructor

mikymod před 12 roky
rodič
revize
7312d2c868
2 změnil soubory, kde provedl 9 přidání a 6 odebrání
  1. 6 3
      engine/physics/Actor.cpp
  2. 3 3
      engine/physics/Actor.h

+ 6 - 3
engine/physics/Actor.cpp

@@ -69,6 +69,9 @@ Actor::Actor(PhysicsGraph& pg, int32_t sg_node, ActorType::Enum type, const Vect
 	}
 
 	m_mat = device()->physx()->createMaterial(0.5f, 0.5f, 0.5f);
+
+	// FIXME
+	create_sphere(Vector3(0, 0, 0), 2.0f);
 }
 
 //-----------------------------------------------------------------------------
@@ -81,21 +84,21 @@ Actor::~Actor()
 }
 
 //-----------------------------------------------------------------------------
-void Actor::create_sphere(Vector3& position, float radius)
+void Actor::create_sphere(const Vector3& position, float radius)
 {
 	Shape shape(m_actor->createShape(physx::PxSphereGeometry(radius), *m_mat));
 	m_physics_graph.create(m_sg_node, shape);
 }
 
 //-----------------------------------------------------------------------------
-void Actor::create_box(Vector3& position, float a, float b, float c)
+void Actor::create_box(const Vector3& position, float a, float b, float c)
 {
 	Shape shape(m_actor->createShape(physx::PxBoxGeometry(a, b, c), *m_mat));
 	m_physics_graph.create(m_sg_node, shape);
 }
 
 //-----------------------------------------------------------------------------
-void Actor::create_plane(Vector3& position, Vector3& normal)
+void Actor::create_plane(const Vector3& position, const Vector3& normal)
 {
 	// TODO
 }

+ 3 - 3
engine/physics/Actor.h

@@ -48,9 +48,9 @@ struct Actor
 					Actor(PhysicsGraph& pg, int32_t sg_node, ActorType::Enum type, const Vector3& pos, const Quaternion& rot);
 					~Actor();
 
-	void			create_sphere(Vector3& position, float radius);
-	void			create_box(Vector3& position, float a, float b, float c);
-	void			create_plane(Vector3& position, Vector3& normal);
+	void			create_sphere(const Vector3& position, float radius);
+	void			create_box(const Vector3& position, float a, float b, float c);
+	void			create_plane(const Vector3& position, const Vector3& normal);
 
 	void			enable_gravity();
 	void			disable_gravity();