[DEV] rename member of function ==> OK

This commit is contained in:
Edouard DUPIN 2017-06-12 22:25:27 +02:00
parent 64da8e8c51
commit c58ef697ce
20 changed files with 195 additions and 195 deletions

View File

@ -20,13 +20,13 @@ using namespace reactphysics3d;
* @param id The ID of the body * @param id The ID of the body
*/ */
RigidBody::RigidBody(const Transform& transform, CollisionWorld& world, bodyindex id) RigidBody::RigidBody(const Transform& transform, CollisionWorld& world, bodyindex id)
: CollisionBody(transform, world, id), mInitMass(float(1.0)), : CollisionBody(transform, world, id), m_initMass(float(1.0)),
mCenterOfMassLocal(0, 0, 0), mCenterOfMassWorld(transform.getPosition()), m_centerOfMassLocal(0, 0, 0), m_centerOfMassWorld(transform.getPosition()),
m_isGravityEnabled(true), mLinearDamping(float(0.0)), mAngularDamping(float(0.0)), m_isGravityEnabled(true), m_linearDamping(float(0.0)), m_angularDamping(float(0.0)),
m_jointsList(NULL) { m_jointsList(NULL) {
// Compute the inverse mass // Compute the inverse mass
m_massInverse = float(1.0) / mInitMass; m_massInverse = float(1.0) / m_initMass;
} }
// Destructor // Destructor
@ -60,8 +60,8 @@ void RigidBody::setType(BodyType type) {
if (m_type == STATIC) { if (m_type == STATIC) {
// Reset the velocity to zero // Reset the velocity to zero
mLinearVelocity.setToZero(); m_linearVelocity.setToZero();
mAngularVelocity.setToZero(); m_angularVelocity.setToZero();
} }
// If it is a static or a kinematic body // If it is a static or a kinematic body
@ -69,13 +69,13 @@ void RigidBody::setType(BodyType type) {
// Reset the inverse mass and inverse inertia tensor to zero // Reset the inverse mass and inverse inertia tensor to zero
m_massInverse = float(0.0); m_massInverse = float(0.0);
mInertiaTensorLocal.setToZero(); m_inertiaTensorLocal.setToZero();
mInertiaTensorLocalInverse.setToZero(); m_inertiaTensorLocalInverse.setToZero();
} }
else { // If it is a dynamic body else { // If it is a dynamic body
m_massInverse = float(1.0) / mInitMass; m_massInverse = float(1.0) / m_initMass;
mInertiaTensorLocalInverse = mInertiaTensorLocal.getInverse(); m_inertiaTensorLocalInverse = m_inertiaTensorLocal.getInverse();
} }
// Awake the body // Awake the body
@ -89,8 +89,8 @@ void RigidBody::setType(BodyType type) {
askForBroadPhaseCollisionCheck(); askForBroadPhaseCollisionCheck();
// Reset the force and torque on the body // Reset the force and torque on the body
mExternalForce.setToZero(); m_externalForce.setToZero();
mExternalTorque.setToZero(); m_externalTorque.setToZero();
} }
// Set the local inertia tensor of the body (in local-space coordinates) // Set the local inertia tensor of the body (in local-space coordinates)
@ -102,10 +102,10 @@ void RigidBody::setInertiaTensorLocal(const Matrix3x3& inertiaTensorLocal) {
if (m_type != DYNAMIC) return; if (m_type != DYNAMIC) return;
mInertiaTensorLocal = inertiaTensorLocal; m_inertiaTensorLocal = inertiaTensorLocal;
// Compute the inverse local inertia tensor // Compute the inverse local inertia tensor
mInertiaTensorLocalInverse = mInertiaTensorLocal.getInverse(); m_inertiaTensorLocalInverse = m_inertiaTensorLocal.getInverse();
} }
// Set the local center of mass of the body (in local-space coordinates) // Set the local center of mass of the body (in local-space coordinates)
@ -117,14 +117,14 @@ void RigidBody::setCenterOfMassLocal(const Vector3& centerOfMassLocal) {
if (m_type != DYNAMIC) return; if (m_type != DYNAMIC) return;
const Vector3 oldCenterOfMass = mCenterOfMassWorld; const Vector3 oldCenterOfMass = m_centerOfMassWorld;
mCenterOfMassLocal = centerOfMassLocal; m_centerOfMassLocal = centerOfMassLocal;
// Compute the center of mass in world-space coordinates // Compute the center of mass in world-space coordinates
mCenterOfMassWorld = m_transform * mCenterOfMassLocal; m_centerOfMassWorld = m_transform * m_centerOfMassLocal;
// Update the linear velocity of the center of mass // Update the linear velocity of the center of mass
mLinearVelocity += mAngularVelocity.cross(mCenterOfMassWorld - oldCenterOfMass); m_linearVelocity += m_angularVelocity.cross(m_centerOfMassWorld - oldCenterOfMass);
} }
// Set the mass of the rigid body // Set the mass of the rigid body
@ -135,13 +135,13 @@ void RigidBody::setMass(float mass) {
if (m_type != DYNAMIC) return; if (m_type != DYNAMIC) return;
mInitMass = mass; m_initMass = mass;
if (mInitMass > float(0.0)) { if (m_initMass > float(0.0)) {
m_massInverse = float(1.0) / mInitMass; m_massInverse = float(1.0) / m_initMass;
} }
else { else {
mInitMass = float(1.0); m_initMass = float(1.0);
m_massInverse = float(1.0); m_massInverse = float(1.0);
} }
} }
@ -253,10 +253,10 @@ void RigidBody::setLinearVelocity(const Vector3& linearVelocity) {
if (m_type == STATIC) return; if (m_type == STATIC) return;
// Update the linear velocity of the current body state // Update the linear velocity of the current body state
mLinearVelocity = linearVelocity; m_linearVelocity = linearVelocity;
// If the linear velocity is not zero, awake the body // If the linear velocity is not zero, awake the body
if (mLinearVelocity.lengthSquare() > float(0.0)) { if (m_linearVelocity.lengthSquare() > float(0.0)) {
setIsSleeping(false); setIsSleeping(false);
} }
} }
@ -271,10 +271,10 @@ void RigidBody::setAngularVelocity(const Vector3& angularVelocity) {
if (m_type == STATIC) return; if (m_type == STATIC) return;
// Set the angular velocity // Set the angular velocity
mAngularVelocity = angularVelocity; m_angularVelocity = angularVelocity;
// If the velocity is not zero, awake the body // If the velocity is not zero, awake the body
if (mAngularVelocity.lengthSquare() > float(0.0)) { if (m_angularVelocity.lengthSquare() > float(0.0)) {
setIsSleeping(false); setIsSleeping(false);
} }
} }
@ -289,13 +289,13 @@ void RigidBody::setTransform(const Transform& transform) {
// Update the transform of the body // Update the transform of the body
m_transform = transform; m_transform = transform;
const Vector3 oldCenterOfMass = mCenterOfMassWorld; const Vector3 oldCenterOfMass = m_centerOfMassWorld;
// Compute the new center of mass in world-space coordinates // Compute the new center of mass in world-space coordinates
mCenterOfMassWorld = m_transform * mCenterOfMassLocal; m_centerOfMassWorld = m_transform * m_centerOfMassLocal;
// Update the linear velocity of the center of mass // Update the linear velocity of the center of mass
mLinearVelocity += mAngularVelocity.cross(mCenterOfMassWorld - oldCenterOfMass); m_linearVelocity += m_angularVelocity.cross(m_centerOfMassWorld - oldCenterOfMass);
// Update the broad-phase state of the body // Update the broad-phase state of the body
updateBroadPhaseState(); updateBroadPhaseState();
@ -305,15 +305,15 @@ void RigidBody::setTransform(const Transform& transform) {
// the collision shapes attached to the body. // the collision shapes attached to the body.
void RigidBody::recomputeMassInformation() { void RigidBody::recomputeMassInformation() {
mInitMass = float(0.0); m_initMass = float(0.0);
m_massInverse = float(0.0); m_massInverse = float(0.0);
mInertiaTensorLocal.setToZero(); m_inertiaTensorLocal.setToZero();
mInertiaTensorLocalInverse.setToZero(); m_inertiaTensorLocalInverse.setToZero();
mCenterOfMassLocal.setToZero(); m_centerOfMassLocal.setToZero();
// If it is STATIC or KINEMATIC body // If it is STATIC or KINEMATIC body
if (m_type == STATIC || m_type == KINEMATIC) { if (m_type == STATIC || m_type == KINEMATIC) {
mCenterOfMassWorld = m_transform.getPosition(); m_centerOfMassWorld = m_transform.getPosition();
return; return;
} }
@ -321,22 +321,22 @@ void RigidBody::recomputeMassInformation() {
// Compute the total mass of the body // Compute the total mass of the body
for (ProxyShape* shape = m_proxyCollisionShapes; shape != NULL; shape = shape->m_next) { for (ProxyShape* shape = m_proxyCollisionShapes; shape != NULL; shape = shape->m_next) {
mInitMass += shape->getMass(); m_initMass += shape->getMass();
mCenterOfMassLocal += shape->getLocalToBodyTransform().getPosition() * shape->getMass(); m_centerOfMassLocal += shape->getLocalToBodyTransform().getPosition() * shape->getMass();
} }
if (mInitMass > float(0.0)) { if (m_initMass > float(0.0)) {
m_massInverse = float(1.0) / mInitMass; m_massInverse = float(1.0) / m_initMass;
} }
else { else {
mInitMass = float(1.0); m_initMass = float(1.0);
m_massInverse = float(1.0); m_massInverse = float(1.0);
} }
// Compute the center of mass // Compute the center of mass
const Vector3 oldCenterOfMass = mCenterOfMassWorld; const Vector3 oldCenterOfMass = m_centerOfMassWorld;
mCenterOfMassLocal *= m_massInverse; m_centerOfMassLocal *= m_massInverse;
mCenterOfMassWorld = m_transform * mCenterOfMassLocal; m_centerOfMassWorld = m_transform * m_centerOfMassLocal;
// Compute the total mass and inertia tensor using all the collision shapes // Compute the total mass and inertia tensor using all the collision shapes
for (ProxyShape* shape = m_proxyCollisionShapes; shape != NULL; shape = shape->m_next) { for (ProxyShape* shape = m_proxyCollisionShapes; shape != NULL; shape = shape->m_next) {
@ -352,7 +352,7 @@ void RigidBody::recomputeMassInformation() {
// Use the parallel axis theorem to convert the inertia tensor w.r.t the collision shape // Use the parallel axis theorem to convert the inertia tensor w.r.t the collision shape
// center int32_to a inertia tensor w.r.t to the body origin. // center int32_to a inertia tensor w.r.t to the body origin.
Vector3 offset = shapeTransform.getPosition() - mCenterOfMassLocal; Vector3 offset = shapeTransform.getPosition() - m_centerOfMassLocal;
float offsetSquare = offset.lengthSquare(); float offsetSquare = offset.lengthSquare();
Matrix3x3 offsetMatrix; Matrix3x3 offsetMatrix;
offsetMatrix[0].setAllValues(offsetSquare, float(0.0), float(0.0)); offsetMatrix[0].setAllValues(offsetSquare, float(0.0), float(0.0));
@ -363,14 +363,14 @@ void RigidBody::recomputeMassInformation() {
offsetMatrix[2] += offset * (-offset.z); offsetMatrix[2] += offset * (-offset.z);
offsetMatrix *= shape->getMass(); offsetMatrix *= shape->getMass();
mInertiaTensorLocal += inertiaTensor + offsetMatrix; m_inertiaTensorLocal += inertiaTensor + offsetMatrix;
} }
// Compute the local inverse inertia tensor // Compute the local inverse inertia tensor
mInertiaTensorLocalInverse = mInertiaTensorLocal.getInverse(); m_inertiaTensorLocalInverse = m_inertiaTensorLocal.getInverse();
// Update the linear velocity of the center of mass // Update the linear velocity of the center of mass
mLinearVelocity += mAngularVelocity.cross(mCenterOfMassWorld - oldCenterOfMass); m_linearVelocity += m_angularVelocity.cross(m_centerOfMassWorld - oldCenterOfMass);
} }
// Update the broad-phase state for this body (because it has moved for instance) // Update the broad-phase state for this body (because it has moved for instance)
@ -379,7 +379,7 @@ void RigidBody::updateBroadPhaseState() const {
PROFILE("RigidBody::updateBroadPhaseState()"); PROFILE("RigidBody::updateBroadPhaseState()");
DynamicsWorld& world = static_cast<DynamicsWorld&>(m_world); DynamicsWorld& world = static_cast<DynamicsWorld&>(m_world);
const Vector3 displacement = world.m_timeStep * mLinearVelocity; const Vector3 displacement = world.m_timeStep * m_linearVelocity;
// For all the proxy collision shapes of the body // For all the proxy collision shapes of the body
for (ProxyShape* shape = m_proxyCollisionShapes; shape != NULL; shape = shape->m_next) { for (ProxyShape* shape = m_proxyCollisionShapes; shape != NULL; shape = shape->m_next) {

View File

@ -34,33 +34,33 @@ class RigidBody : public CollisionBody {
// -------------------- Attributes -------------------- // // -------------------- Attributes -------------------- //
/// Intial mass of the body /// Intial mass of the body
float mInitMass; float m_initMass;
/// Center of mass of the body in local-space coordinates. /// Center of mass of the body in local-space coordinates.
/// The center of mass can therefore be different from the body origin /// The center of mass can therefore be different from the body origin
Vector3 mCenterOfMassLocal; Vector3 m_centerOfMassLocal;
/// Center of mass of the body in world-space coordinates /// Center of mass of the body in world-space coordinates
Vector3 mCenterOfMassWorld; Vector3 m_centerOfMassWorld;
/// Linear velocity of the body /// Linear velocity of the body
Vector3 mLinearVelocity; Vector3 m_linearVelocity;
/// Angular velocity of the body /// Angular velocity of the body
Vector3 mAngularVelocity; Vector3 m_angularVelocity;
/// Current external force on the body /// Current external force on the body
Vector3 mExternalForce; Vector3 m_externalForce;
/// Current external torque on the body /// Current external torque on the body
Vector3 mExternalTorque; Vector3 m_externalTorque;
/// Local inertia tensor of the body (in local-space) with respect to the /// Local inertia tensor of the body (in local-space) with respect to the
/// center of mass of the body /// center of mass of the body
Matrix3x3 mInertiaTensorLocal; Matrix3x3 m_inertiaTensorLocal;
/// Inverse of the inertia tensor of the body /// Inverse of the inertia tensor of the body
Matrix3x3 mInertiaTensorLocalInverse; Matrix3x3 m_inertiaTensorLocalInverse;
/// Inverse of the mass of the body /// Inverse of the mass of the body
float m_massInverse; float m_massInverse;
@ -69,13 +69,13 @@ class RigidBody : public CollisionBody {
bool m_isGravityEnabled; bool m_isGravityEnabled;
/// Material properties of the rigid body /// Material properties of the rigid body
Material mMaterial; Material m_material;
/// Linear velocity damping factor /// Linear velocity damping factor
float mLinearDamping; float m_linearDamping;
/// Angular velocity damping factor /// Angular velocity damping factor
float mAngularDamping; float m_angularDamping;
/// First element of the linked list of joints involving this body /// First element of the linked list of joints involving this body
JointListElement* m_jointsList; JointListElement* m_jointsList;
@ -215,7 +215,7 @@ class RigidBody : public CollisionBody {
* @return The mass (in kilograms) of the body * @return The mass (in kilograms) of the body
*/ */
inline float RigidBody::getMass() const { inline float RigidBody::getMass() const {
return mInitMass; return m_initMass;
} }
// Return the linear velocity // Return the linear velocity
@ -223,7 +223,7 @@ inline float RigidBody::getMass() const {
* @return The linear velocity vector of the body * @return The linear velocity vector of the body
*/ */
inline Vector3 RigidBody::getLinearVelocity() const { inline Vector3 RigidBody::getLinearVelocity() const {
return mLinearVelocity; return m_linearVelocity;
} }
// Return the angular velocity of the body // Return the angular velocity of the body
@ -231,7 +231,7 @@ inline Vector3 RigidBody::getLinearVelocity() const {
* @return The angular velocity vector of the body * @return The angular velocity vector of the body
*/ */
inline Vector3 RigidBody::getAngularVelocity() const { inline Vector3 RigidBody::getAngularVelocity() const {
return mAngularVelocity; return m_angularVelocity;
} }
// Return the local inertia tensor of the body (in local-space coordinates) // Return the local inertia tensor of the body (in local-space coordinates)
@ -239,7 +239,7 @@ inline Vector3 RigidBody::getAngularVelocity() const {
* @return The 3x3 inertia tensor matrix of the body (in local-space coordinates) * @return The 3x3 inertia tensor matrix of the body (in local-space coordinates)
*/ */
inline const Matrix3x3& RigidBody::getInertiaTensorLocal() const { inline const Matrix3x3& RigidBody::getInertiaTensorLocal() const {
return mInertiaTensorLocal; return m_inertiaTensorLocal;
} }
// Return the inertia tensor in world coordinates. // Return the inertia tensor in world coordinates.
@ -254,7 +254,7 @@ inline const Matrix3x3& RigidBody::getInertiaTensorLocal() const {
inline Matrix3x3 RigidBody::getInertiaTensorWorld() const { inline Matrix3x3 RigidBody::getInertiaTensorWorld() const {
// Compute and return the inertia tensor in world coordinates // Compute and return the inertia tensor in world coordinates
return m_transform.getOrientation().getMatrix() * mInertiaTensorLocal * return m_transform.getOrientation().getMatrix() * m_inertiaTensorLocal *
m_transform.getOrientation().getMatrix().getTranspose(); m_transform.getOrientation().getMatrix().getTranspose();
} }
@ -274,7 +274,7 @@ inline Matrix3x3 RigidBody::getInertiaTensorInverseWorld() const {
// INVERSE WORLD TENSOR IN THE CLASS AND UPLDATE IT WHEN THE ORIENTATION OF THE BODY CHANGES // INVERSE WORLD TENSOR IN THE CLASS AND UPLDATE IT WHEN THE ORIENTATION OF THE BODY CHANGES
// Compute and return the inertia tensor in world coordinates // Compute and return the inertia tensor in world coordinates
return m_transform.getOrientation().getMatrix() * mInertiaTensorLocalInverse * return m_transform.getOrientation().getMatrix() * m_inertiaTensorLocalInverse *
m_transform.getOrientation().getMatrix().getTranspose(); m_transform.getOrientation().getMatrix().getTranspose();
} }
@ -299,7 +299,7 @@ inline void RigidBody::enableGravity(bool isEnabled) {
* @return A reference to the material of the body * @return A reference to the material of the body
*/ */
inline Material& RigidBody::getMaterial() { inline Material& RigidBody::getMaterial() {
return mMaterial; return m_material;
} }
// Set a new material for this rigid body // Set a new material for this rigid body
@ -307,7 +307,7 @@ inline Material& RigidBody::getMaterial() {
* @param material The material you want to set to the body * @param material The material you want to set to the body
*/ */
inline void RigidBody::setMaterial(const Material& material) { inline void RigidBody::setMaterial(const Material& material) {
mMaterial = material; m_material = material;
} }
// Return the linear velocity damping factor // Return the linear velocity damping factor
@ -315,7 +315,7 @@ inline void RigidBody::setMaterial(const Material& material) {
* @return The linear damping factor of this body * @return The linear damping factor of this body
*/ */
inline float RigidBody::getLinearDamping() const { inline float RigidBody::getLinearDamping() const {
return mLinearDamping; return m_linearDamping;
} }
// Set the linear damping factor. This is the ratio of the linear velocity // Set the linear damping factor. This is the ratio of the linear velocity
@ -325,7 +325,7 @@ inline float RigidBody::getLinearDamping() const {
*/ */
inline void RigidBody::setLinearDamping(float linearDamping) { inline void RigidBody::setLinearDamping(float linearDamping) {
assert(linearDamping >= float(0.0)); assert(linearDamping >= float(0.0));
mLinearDamping = linearDamping; m_linearDamping = linearDamping;
} }
// Return the angular velocity damping factor // Return the angular velocity damping factor
@ -333,7 +333,7 @@ inline void RigidBody::setLinearDamping(float linearDamping) {
* @return The angular damping factor of this body * @return The angular damping factor of this body
*/ */
inline float RigidBody::getAngularDamping() const { inline float RigidBody::getAngularDamping() const {
return mAngularDamping; return m_angularDamping;
} }
// Set the angular damping factor. This is the ratio of the angular velocity // Set the angular damping factor. This is the ratio of the angular velocity
@ -343,7 +343,7 @@ inline float RigidBody::getAngularDamping() const {
*/ */
inline void RigidBody::setAngularDamping(float angularDamping) { inline void RigidBody::setAngularDamping(float angularDamping) {
assert(angularDamping >= float(0.0)); assert(angularDamping >= float(0.0));
mAngularDamping = angularDamping; m_angularDamping = angularDamping;
} }
// Return the first element of the linked list of joints involving this body // Return the first element of the linked list of joints involving this body
@ -366,10 +366,10 @@ inline JointListElement* RigidBody::getJointsList() {
inline void RigidBody::setIsSleeping(bool isSleeping) { inline void RigidBody::setIsSleeping(bool isSleeping) {
if (isSleeping) { if (isSleeping) {
mLinearVelocity.setToZero(); m_linearVelocity.setToZero();
mAngularVelocity.setToZero(); m_angularVelocity.setToZero();
mExternalForce.setToZero(); m_externalForce.setToZero();
mExternalTorque.setToZero(); m_externalTorque.setToZero();
} }
Body::setIsSleeping(isSleeping); Body::setIsSleeping(isSleeping);
@ -394,7 +394,7 @@ inline void RigidBody::applyForceToCenterOfMass(const Vector3& force) {
} }
// Add the force // Add the force
mExternalForce += force; m_externalForce += force;
} }
// Apply an external force to the body at a given point (in world-space coordinates). // Apply an external force to the body at a given point (in world-space coordinates).
@ -419,8 +419,8 @@ inline void RigidBody::applyForce(const Vector3& force, const Vector3& point) {
} }
// Add the force and torque // Add the force and torque
mExternalForce += force; m_externalForce += force;
mExternalTorque += (point - mCenterOfMassWorld).cross(force); m_externalTorque += (point - m_centerOfMassWorld).cross(force);
} }
// Apply an external torque to the body. // Apply an external torque to the body.
@ -442,14 +442,14 @@ inline void RigidBody::applyTorque(const Vector3& torque) {
} }
// Add the torque // Add the torque
mExternalTorque += torque; m_externalTorque += torque;
} }
/// Update the transform of the body after a change of the center of mass /// Update the transform of the body after a change of the center of mass
inline void RigidBody::updateTransformWithCenterOfMass() { inline void RigidBody::updateTransformWithCenterOfMass() {
// Translate the body according to the translation of the center of mass position // Translate the body according to the translation of the center of mass position
m_transform.setPosition(mCenterOfMassWorld - m_transform.getOrientation() * mCenterOfMassLocal); m_transform.setPosition(m_centerOfMassWorld - m_transform.getOrientation() * m_centerOfMassLocal);
} }
} }

View File

@ -25,7 +25,7 @@ class TriangleMesh {
protected: protected:
/// All the triangle arrays of the mesh (one triangle array per part) /// All the triangle arrays of the mesh (one triangle array per part)
std::vector<TriangleVertexArray*> mTriangleArrays; std::vector<TriangleVertexArray*> m_triangleArrays;
public: public:
@ -47,18 +47,18 @@ class TriangleMesh {
// Add a subpart of the mesh // Add a subpart of the mesh
inline void TriangleMesh::addSubpart(TriangleVertexArray* triangleVertexArray) { inline void TriangleMesh::addSubpart(TriangleVertexArray* triangleVertexArray) {
mTriangleArrays.push_back(triangleVertexArray ); m_triangleArrays.push_back(triangleVertexArray );
} }
// Return a pointer to a given subpart (triangle vertex array) of the mesh // Return a pointer to a given subpart (triangle vertex array) of the mesh
inline TriangleVertexArray* TriangleMesh::getSubpart(uint32_t indexSubpart) const { inline TriangleVertexArray* TriangleMesh::getSubpart(uint32_t indexSubpart) const {
assert(indexSubpart < mTriangleArrays.size()); assert(indexSubpart < m_triangleArrays.size());
return mTriangleArrays[indexSubpart]; return m_triangleArrays[indexSubpart];
} }
// Return the number of subparts of the mesh // Return the number of subparts of the mesh
inline uint32_t TriangleMesh::getNbSubparts() const { inline uint32_t TriangleMesh::getNbSubparts() const {
return mTriangleArrays.size(); return m_triangleArrays.size();
} }
} }

View File

@ -29,11 +29,11 @@ TriangleVertexArray::TriangleVertexArray(uint32_t nbVertices, void* verticesStar
m_numberVertices = nbVertices; m_numberVertices = nbVertices;
m_verticesStart = reinterpret_cast<unsigned char*>(verticesStart); m_verticesStart = reinterpret_cast<unsigned char*>(verticesStart);
m_verticesStride = verticesStride; m_verticesStride = verticesStride;
mNbTriangles = nbTriangles; m_numberTriangles = nbTriangles;
mIndicesStart = reinterpret_cast<unsigned char*>(indexesStart); m_indicesStart = reinterpret_cast<unsigned char*>(indexesStart);
mIndicesStride = indexesStride; m_indicesStride = indexesStride;
mVertexDataType = vertexDataType; m_vertexDataType = vertexDataType;
mIndexDataType = indexDataType; m_indexDataType = indexDataType;
} }
// Destructor // Destructor

View File

@ -43,20 +43,20 @@ class TriangleVertexArray {
int32_t m_verticesStride; int32_t m_verticesStride;
/// Number of triangles in the array /// Number of triangles in the array
uint32_t mNbTriangles; uint32_t m_numberTriangles;
/// Pointer to the first vertex index of the array /// Pointer to the first vertex index of the array
unsigned char* mIndicesStart; unsigned char* m_indicesStart;
/// Stride (number of bytes) between the beginning of two indices in /// Stride (number of bytes) between the beginning of two indices in
/// the array /// the array
int32_t mIndicesStride; int32_t m_indicesStride;
/// Data type of the vertices in the array /// Data type of the vertices in the array
VertexDataType mVertexDataType; VertexDataType m_vertexDataType;
/// Data type of the indices in the array /// Data type of the indices in the array
IndexDataType mIndexDataType; IndexDataType m_indexDataType;
public: public:
@ -95,12 +95,12 @@ class TriangleVertexArray {
// Return the vertex data type // Return the vertex data type
inline TriangleVertexArray::VertexDataType TriangleVertexArray::getVertexDataType() const { inline TriangleVertexArray::VertexDataType TriangleVertexArray::getVertexDataType() const {
return mVertexDataType; return m_vertexDataType;
} }
// Return the index data type // Return the index data type
inline TriangleVertexArray::IndexDataType TriangleVertexArray::getIndexDataType() const { inline TriangleVertexArray::IndexDataType TriangleVertexArray::getIndexDataType() const {
return mIndexDataType; return m_indexDataType;
} }
// Return the number of vertices // Return the number of vertices
@ -110,7 +110,7 @@ inline uint32_t TriangleVertexArray::getNbVertices() const {
// Return the number of triangles // Return the number of triangles
inline uint32_t TriangleVertexArray::getNbTriangles() const { inline uint32_t TriangleVertexArray::getNbTriangles() const {
return mNbTriangles; return m_numberTriangles;
} }
// Return the vertices stride (number of bytes) // Return the vertices stride (number of bytes)
@ -120,7 +120,7 @@ inline int32_t TriangleVertexArray::getVerticesStride() const {
// Return the indices stride (number of bytes) // Return the indices stride (number of bytes)
inline int32_t TriangleVertexArray::getIndicesStride() const { inline int32_t TriangleVertexArray::getIndicesStride() const {
return mIndicesStride; return m_indicesStride;
} }
// Return the pointer to the start of the vertices array // Return the pointer to the start of the vertices array
@ -130,7 +130,7 @@ inline unsigned char* TriangleVertexArray::getVerticesStart() const {
// Return the pointer to the start of the indices array // Return the pointer to the start of the indices array
inline unsigned char* TriangleVertexArray::getIndicesStart() const { inline unsigned char* TriangleVertexArray::getIndicesStart() const {
return mIndicesStart; return m_indicesStart;
} }
} }

View File

@ -11,7 +11,7 @@
using namespace reactphysics3d; using namespace reactphysics3d;
// Constructor // Constructor
TrianglesStore::TrianglesStore() : mNbTriangles(0) { TrianglesStore::TrianglesStore() : m_numberTriangles(0) {
} }

View File

@ -31,7 +31,7 @@ class TrianglesStore {
TriangleEPA mTriangles[MAX_TRIANGLES]; TriangleEPA mTriangles[MAX_TRIANGLES];
/// Number of triangles /// Number of triangles
int32_t mNbTriangles; int32_t m_numberTriangles;
// -------------------- Methods -------------------- // // -------------------- Methods -------------------- //
@ -72,23 +72,23 @@ class TrianglesStore {
// Clear all the storage // Clear all the storage
inline void TrianglesStore::clear() { inline void TrianglesStore::clear() {
mNbTriangles = 0; m_numberTriangles = 0;
} }
// Return the number of triangles // Return the number of triangles
inline int32_t TrianglesStore::getNbTriangles() const { inline int32_t TrianglesStore::getNbTriangles() const {
return mNbTriangles; return m_numberTriangles;
} }
inline void TrianglesStore::setNbTriangles(int32_t backup) { inline void TrianglesStore::setNbTriangles(int32_t backup) {
mNbTriangles = backup; m_numberTriangles = backup;
} }
// Return the last triangle // Return the last triangle
inline TriangleEPA& TrianglesStore::last() { inline TriangleEPA& TrianglesStore::last() {
assert(mNbTriangles > 0); assert(m_numberTriangles > 0);
return mTriangles[mNbTriangles - 1]; return mTriangles[m_numberTriangles - 1];
} }
// Create a new triangle // Create a new triangle
@ -97,11 +97,11 @@ inline TriangleEPA* TrianglesStore::newTriangle(const Vector3* vertices,
TriangleEPA* newTriangle = NULL; TriangleEPA* newTriangle = NULL;
// If we have not reached the maximum number of triangles // If we have not reached the maximum number of triangles
if (mNbTriangles != MAX_TRIANGLES) { if (m_numberTriangles != MAX_TRIANGLES) {
newTriangle = &mTriangles[mNbTriangles++]; newTriangle = &mTriangles[m_numberTriangles++];
new (newTriangle) TriangleEPA(v0, v1, v2); new (newTriangle) TriangleEPA(v0, v1, v2);
if (!newTriangle->computeClosestPoint(vertices)) { if (!newTriangle->computeClosestPoint(vertices)) {
mNbTriangles--; m_numberTriangles--;
newTriangle = NULL; newTriangle = NULL;
} }
} }

View File

@ -35,8 +35,8 @@ void BallAndSocketJoint::initBeforeSolve(const ConstraintSolverData& constraintS
m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second; m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second;
// Get the bodies center of mass and orientations // Get the bodies center of mass and orientations
const Vector3& x1 = m_body1->mCenterOfMassWorld; const Vector3& x1 = m_body1->m_centerOfMassWorld;
const Vector3& x2 = m_body2->mCenterOfMassWorld; const Vector3& x2 = m_body2->m_centerOfMassWorld;
const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation(); const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation();
const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation(); const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation();

View File

@ -43,8 +43,8 @@ void FixedJoint::initBeforeSolve(const ConstraintSolverData& constraintSolverDat
m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second; m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second;
// Get the bodies positions and orientations // Get the bodies positions and orientations
const Vector3& x1 = m_body1->mCenterOfMassWorld; const Vector3& x1 = m_body1->m_centerOfMassWorld;
const Vector3& x2 = m_body2->mCenterOfMassWorld; const Vector3& x2 = m_body2->m_centerOfMassWorld;
const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation(); const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation();
const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation(); const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation();

View File

@ -58,8 +58,8 @@ void HingeJoint::initBeforeSolve(const ConstraintSolverData& constraintSolverDat
m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second; m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second;
// Get the bodies positions and orientations // Get the bodies positions and orientations
const Vector3& x1 = m_body1->mCenterOfMassWorld; const Vector3& x1 = m_body1->m_centerOfMassWorld;
const Vector3& x2 = m_body2->mCenterOfMassWorld; const Vector3& x2 = m_body2->m_centerOfMassWorld;
const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation(); const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation();
const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation(); const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation();

View File

@ -57,8 +57,8 @@ void SliderJoint::initBeforeSolve(const ConstraintSolverData& constraintSolverDa
m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second; m_indexBody2 = constraintSolverData.mapBodyToConstrainedVelocityIndex.find(m_body2)->second;
// Get the bodies positions and orientations // Get the bodies positions and orientations
const Vector3& x1 = m_body1->mCenterOfMassWorld; const Vector3& x1 = m_body1->m_centerOfMassWorld;
const Vector3& x2 = m_body2->mCenterOfMassWorld; const Vector3& x2 = m_body2->m_centerOfMassWorld;
const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation(); const Quaternion& orientationBody1 = m_body1->getTransform().getOrientation();
const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation(); const Quaternion& orientationBody2 = m_body2->getTransform().getOrientation();

View File

@ -70,8 +70,8 @@ void ContactSolver::initializeForIsland(float dt, Island* island) {
assert(body2 != NULL); assert(body2 != NULL);
// Get the position of the two bodies // Get the position of the two bodies
const Vector3& x1 = body1->mCenterOfMassWorld; const Vector3& x1 = body1->m_centerOfMassWorld;
const Vector3& x2 = body2->mCenterOfMassWorld; const Vector3& x2 = body2->m_centerOfMassWorld;
// Initialize the int32_ternal contact manifold structure using the external // Initialize the int32_ternal contact manifold structure using the external
// contact manifold // contact manifold

View File

@ -180,7 +180,7 @@ void DynamicsWorld::int32_tegrateRigidBodiesPositions() {
} }
// Get current position and orientation of the body // Get current position and orientation of the body
const Vector3& currentPosition = bodies[b]->mCenterOfMassWorld; const Vector3& currentPosition = bodies[b]->m_centerOfMassWorld;
const Quaternion& currentOrientation = bodies[b]->getTransform().getOrientation(); const Quaternion& currentOrientation = bodies[b]->getTransform().getOrientation();
// Update the new constrained position and orientation of the body // Update the new constrained position and orientation of the body
@ -208,11 +208,11 @@ void DynamicsWorld::updateBodiesState() {
uint32_t index = m_mapBodyToConstrainedVelocityIndex.find(bodies[b])->second; uint32_t index = m_mapBodyToConstrainedVelocityIndex.find(bodies[b])->second;
// Update the linear and angular velocity of the body // Update the linear and angular velocity of the body
bodies[b]->mLinearVelocity = m_constrainedLinearVelocities[index]; bodies[b]->m_linearVelocity = m_constrainedLinearVelocities[index];
bodies[b]->mAngularVelocity = m_constrainedAngularVelocities[index]; bodies[b]->m_angularVelocity = m_constrainedAngularVelocities[index];
// Update the position of the center of mass of the body // Update the position of the center of mass of the body
bodies[b]->mCenterOfMassWorld = m_constrainedPositions[index]; bodies[b]->m_centerOfMassWorld = m_constrainedPositions[index];
// Update the orientation of the body // Update the orientation of the body
bodies[b]->m_transform.setOrientation(m_constrainedOrientations[index].getUnit()); bodies[b]->m_transform.setOrientation(m_constrainedOrientations[index].getUnit());
@ -298,10 +298,10 @@ void DynamicsWorld::int32_tegrateRigidBodiesVelocities() {
// Integrate the external force to get the new velocity of the body // Integrate the external force to get the new velocity of the body
m_constrainedLinearVelocities[indexBody] = bodies[b]->getLinearVelocity() + m_constrainedLinearVelocities[indexBody] = bodies[b]->getLinearVelocity() +
m_timeStep * bodies[b]->m_massInverse * bodies[b]->mExternalForce; m_timeStep * bodies[b]->m_massInverse * bodies[b]->m_externalForce;
m_constrainedAngularVelocities[indexBody] = bodies[b]->getAngularVelocity() + m_constrainedAngularVelocities[indexBody] = bodies[b]->getAngularVelocity() +
m_timeStep * bodies[b]->getInertiaTensorInverseWorld() * m_timeStep * bodies[b]->getInertiaTensorInverseWorld() *
bodies[b]->mExternalTorque; bodies[b]->m_externalTorque;
// If the gravity has to be applied to this rigid body // If the gravity has to be applied to this rigid body
if (bodies[b]->isGravityEnabled() && m_isGravityEnabled) { if (bodies[b]->isGravityEnabled() && m_isGravityEnabled) {

View File

@ -290,8 +290,8 @@ inline void DynamicsWorld::resetBodiesForceAndTorque() {
// For each body of the world // For each body of the world
std::set<RigidBody*>::iterator it; std::set<RigidBody*>::iterator it;
for (it = m_rigidBodies.begin(); it != m_rigidBodies.end(); ++it) { for (it = m_rigidBodies.begin(); it != m_rigidBodies.end(); ++it) {
(*it)->mExternalForce.setToZero(); (*it)->m_externalForce.setToZero();
(*it)->mExternalTorque.setToZero(); (*it)->m_externalTorque.setToZero();
} }
} }

View File

@ -11,7 +11,7 @@
using namespace reactphysics3d; using namespace reactphysics3d;
// Constructor // Constructor
Timer::Timer(double timeStep) : m_timeStep(timeStep), mIsRunning(false) { Timer::Timer(double timeStep) : m_timeStep(timeStep), m_isRunning(false) {
assert(timeStep > 0.0); assert(timeStep > 0.0);
} }

View File

@ -39,16 +39,16 @@ class Timer {
double m_timeStep; double m_timeStep;
/// Last time the timer has been updated /// Last time the timer has been updated
long double mLastUpdateTime; long double m_lastUpdateTime;
/// Time difference between the two last timer update() calls /// Time difference between the two last timer update() calls
long double mDeltaTime; long double m_deltaTime;
/// Used to fix the time step and avoid strange time effects /// Used to fix the time step and avoid strange time effects
double mAccumulator; double m_accumulator;
/// True if the timer is running /// True if the timer is running
bool mIsRunning; bool m_isRunning;
// -------------------- Methods -------------------- // // -------------------- Methods -------------------- //
@ -115,47 +115,47 @@ inline void Timer::setTimeStep(double timeStep) {
// Return the current time // Return the current time
inline long double Timer::getPhysicsTime() const { inline long double Timer::getPhysicsTime() const {
return mLastUpdateTime; return m_lastUpdateTime;
} }
// Return if the timer is running // Return if the timer is running
inline bool Timer::getIsRunning() const { inline bool Timer::getIsRunning() const {
return mIsRunning; return m_isRunning;
} }
// Start the timer // Start the timer
inline void Timer::start() { inline void Timer::start() {
if (!mIsRunning) { if (!m_isRunning) {
// Get the current system time // Get the current system time
mLastUpdateTime = getCurrentSystemTime(); m_lastUpdateTime = getCurrentSystemTime();
mAccumulator = 0.0; m_accumulator = 0.0;
mIsRunning = true; m_isRunning = true;
} }
} }
// Stop the timer // Stop the timer
inline void Timer::stop() { inline void Timer::stop() {
mIsRunning = false; m_isRunning = false;
} }
// True if it's possible to take a new step // True if it's possible to take a new step
inline bool Timer::isPossibleToTakeStep() const { inline bool Timer::isPossibleToTakeStep() const {
return (mAccumulator >= m_timeStep); return (m_accumulator >= m_timeStep);
} }
// Take a new step => update the timer by adding the timeStep value to the current time // Take a new step => update the timer by adding the timeStep value to the current time
inline void Timer::nextStep() { inline void Timer::nextStep() {
assert(mIsRunning); assert(m_isRunning);
// Update the accumulator value // Update the accumulator value
mAccumulator -= m_timeStep; m_accumulator -= m_timeStep;
} }
// Compute the int32_terpolation factor // Compute the int32_terpolation factor
inline float Timer::computeInterpolationFactor() { inline float Timer::computeInterpolationFactor() {
return (float(mAccumulator / m_timeStep)); return (float(m_accumulator / m_timeStep));
} }
// Compute the time since the last update() call and add it to the accumulator // Compute the time since the last update() call and add it to the accumulator
@ -165,13 +165,13 @@ inline void Timer::update() {
long double currentTime = getCurrentSystemTime(); long double currentTime = getCurrentSystemTime();
// Compute the delta display time between two display frames // Compute the delta display time between two display frames
mDeltaTime = currentTime - mLastUpdateTime; m_deltaTime = currentTime - m_lastUpdateTime;
// Update the current display time // Update the current display time
mLastUpdateTime = currentTime; m_lastUpdateTime = currentTime;
// Update the accumulator value // Update the accumulator value
mAccumulator += mDeltaTime; m_accumulator += m_deltaTime;
} }
} }

View File

@ -11,25 +11,25 @@
using namespace reactphysics3d; using namespace reactphysics3d;
// Constructor // Constructor
Transform::Transform() : mPosition(Vector3(0.0, 0.0, 0.0)), mOrientation(Quaternion::identity()) { Transform::Transform() : m_position(Vector3(0.0, 0.0, 0.0)), m_orientation(Quaternion::identity()) {
} }
// Constructor // Constructor
Transform::Transform(const Vector3& position, const Matrix3x3& orientation) Transform::Transform(const Vector3& position, const Matrix3x3& orientation)
: mPosition(position), mOrientation(Quaternion(orientation)) { : m_position(position), m_orientation(Quaternion(orientation)) {
} }
// Constructor // Constructor
Transform::Transform(const Vector3& position, const Quaternion& orientation) Transform::Transform(const Vector3& position, const Quaternion& orientation)
: mPosition(position), mOrientation(orientation) { : m_position(position), m_orientation(orientation) {
} }
// Copy-constructor // Copy-constructor
Transform::Transform(const Transform& transform) Transform::Transform(const Transform& transform)
: mPosition(transform.mPosition), mOrientation(transform.mOrientation) { : m_position(transform.m_position), m_orientation(transform.m_orientation) {
} }

View File

@ -25,10 +25,10 @@ class Transform {
// -------------------- Attributes -------------------- // // -------------------- Attributes -------------------- //
/// Position /// Position
Vector3 mPosition; Vector3 m_position;
/// Orientation /// Orientation
Quaternion mOrientation; Quaternion m_orientation;
public : public :
@ -99,28 +99,28 @@ class Transform {
// Return the position of the transform // Return the position of the transform
inline const Vector3& Transform::getPosition() const { inline const Vector3& Transform::getPosition() const {
return mPosition; return m_position;
} }
// Set the origin of the transform // Set the origin of the transform
inline void Transform::setPosition(const Vector3& position) { inline void Transform::setPosition(const Vector3& position) {
mPosition = position; m_position = position;
} }
// Return the rotation matrix // Return the rotation matrix
inline const Quaternion& Transform::getOrientation() const { inline const Quaternion& Transform::getOrientation() const {
return mOrientation; return m_orientation;
} }
// Set the rotation matrix of the transform // Set the rotation matrix of the transform
inline void Transform::setOrientation(const Quaternion& orientation) { inline void Transform::setOrientation(const Quaternion& orientation) {
mOrientation = orientation; m_orientation = orientation;
} }
// Set the transform to the identity transform // Set the transform to the identity transform
inline void Transform::setToIdentity() { inline void Transform::setToIdentity() {
mPosition = Vector3(0.0, 0.0, 0.0); m_position = Vector3(0.0, 0.0, 0.0);
mOrientation = Quaternion::identity(); m_orientation = Quaternion::identity();
} }
// Set the transform from an OpenGL transform matrix // Set the transform from an OpenGL transform matrix
@ -128,28 +128,28 @@ inline void Transform::setFromOpenGL(float* openglMatrix) {
Matrix3x3 matrix(openglMatrix[0], openglMatrix[4], openglMatrix[8], Matrix3x3 matrix(openglMatrix[0], openglMatrix[4], openglMatrix[8],
openglMatrix[1], openglMatrix[5], openglMatrix[9], openglMatrix[1], openglMatrix[5], openglMatrix[9],
openglMatrix[2], openglMatrix[6], openglMatrix[10]); openglMatrix[2], openglMatrix[6], openglMatrix[10]);
mOrientation = Quaternion(matrix); m_orientation = Quaternion(matrix);
mPosition.setAllValues(openglMatrix[12], openglMatrix[13], openglMatrix[14]); m_position.setAllValues(openglMatrix[12], openglMatrix[13], openglMatrix[14]);
} }
// Get the OpenGL matrix of the transform // Get the OpenGL matrix of the transform
inline void Transform::getOpenGLMatrix(float* openglMatrix) const { inline void Transform::getOpenGLMatrix(float* openglMatrix) const {
const Matrix3x3& matrix = mOrientation.getMatrix(); const Matrix3x3& matrix = m_orientation.getMatrix();
openglMatrix[0] = matrix[0][0]; openglMatrix[1] = matrix[1][0]; openglMatrix[0] = matrix[0][0]; openglMatrix[1] = matrix[1][0];
openglMatrix[2] = matrix[2][0]; openglMatrix[3] = 0.0; openglMatrix[2] = matrix[2][0]; openglMatrix[3] = 0.0;
openglMatrix[4] = matrix[0][1]; openglMatrix[5] = matrix[1][1]; openglMatrix[4] = matrix[0][1]; openglMatrix[5] = matrix[1][1];
openglMatrix[6] = matrix[2][1]; openglMatrix[7] = 0.0; openglMatrix[6] = matrix[2][1]; openglMatrix[7] = 0.0;
openglMatrix[8] = matrix[0][2]; openglMatrix[9] = matrix[1][2]; openglMatrix[8] = matrix[0][2]; openglMatrix[9] = matrix[1][2];
openglMatrix[10] = matrix[2][2]; openglMatrix[11] = 0.0; openglMatrix[10] = matrix[2][2]; openglMatrix[11] = 0.0;
openglMatrix[12] = mPosition.x; openglMatrix[13] = mPosition.y; openglMatrix[12] = m_position.x; openglMatrix[13] = m_position.y;
openglMatrix[14] = mPosition.z; openglMatrix[15] = 1.0; openglMatrix[14] = m_position.z; openglMatrix[15] = 1.0;
} }
// Return the inverse of the transform // Return the inverse of the transform
inline Transform Transform::getInverse() const { inline Transform Transform::getInverse() const {
const Quaternion& invQuaternion = mOrientation.getInverse(); const Quaternion& invQuaternion = m_orientation.getInverse();
Matrix3x3 invMatrix = invQuaternion.getMatrix(); Matrix3x3 invMatrix = invQuaternion.getMatrix();
return Transform(invMatrix * (-mPosition), invQuaternion); return Transform(invMatrix * (-m_position), invQuaternion);
} }
// Return an int32_terpolated transform // Return an int32_terpolated transform
@ -157,11 +157,11 @@ inline Transform Transform::int32_terpolateTransforms(const Transform& oldTransf
const Transform& newTransform, const Transform& newTransform,
float int32_terpolationFactor) { float int32_terpolationFactor) {
Vector3 int32_terPosition = oldTransform.mPosition * (float(1.0) - int32_terpolationFactor) + Vector3 int32_terPosition = oldTransform.m_position * (float(1.0) - int32_terpolationFactor) +
newTransform.mPosition * int32_terpolationFactor; newTransform.m_position * int32_terpolationFactor;
Quaternion int32_terOrientation = Quaternion::slerp(oldTransform.mOrientation, Quaternion int32_terOrientation = Quaternion::slerp(oldTransform.m_orientation,
newTransform.mOrientation, newTransform.m_orientation,
int32_terpolationFactor); int32_terpolationFactor);
return Transform(int32_terPosition, int32_terOrientation); return Transform(int32_terPosition, int32_terOrientation);
@ -174,18 +174,18 @@ inline Transform Transform::identity() {
// Return the transformed vector // Return the transformed vector
inline Vector3 Transform::operator*(const Vector3& vector) const { inline Vector3 Transform::operator*(const Vector3& vector) const {
return (mOrientation.getMatrix() * vector) + mPosition; return (m_orientation.getMatrix() * vector) + m_position;
} }
// Operator of multiplication of a transform with another one // Operator of multiplication of a transform with another one
inline Transform Transform::operator*(const Transform& transform2) const { inline Transform Transform::operator*(const Transform& transform2) const {
return Transform(mPosition + mOrientation.getMatrix() * transform2.mPosition, return Transform(m_position + m_orientation.getMatrix() * transform2.m_position,
mOrientation * transform2.mOrientation); m_orientation * transform2.m_orientation);
} }
// Return true if the two transforms are equal // Return true if the two transforms are equal
inline bool Transform::operator==(const Transform& transform2) const { inline bool Transform::operator==(const Transform& transform2) const {
return (mPosition == transform2.mPosition) && (mOrientation == transform2.mOrientation); return (m_position == transform2.m_position) && (m_orientation == transform2.m_orientation);
} }
// Return true if the two transforms are different // Return true if the two transforms are different
@ -196,8 +196,8 @@ inline bool Transform::operator!=(const Transform& transform2) const {
// Assignment operator // Assignment operator
inline Transform& Transform::operator=(const Transform& transform) { inline Transform& Transform::operator=(const Transform& transform) {
if (&transform != this) { if (&transform != this) {
mPosition = transform.mPosition; m_position = transform.m_position;
mOrientation = transform.mOrientation; m_orientation = transform.m_orientation;
} }
return *this; return *this;
} }

View File

@ -28,7 +28,7 @@
// Constructor // Constructor
Timer::Timer() : mIsRunning(false) { Timer::Timer() : m_isRunning(false) {
} }

View File

@ -53,16 +53,16 @@ class Timer {
// -------------------- Attributes -------------------- // // -------------------- Attributes -------------------- //
/// Last time the timer has been updated /// Last time the timer has been updated
long double mLastUpdateTime; long double m_lastUpdateTime;
/// Time difference between the two last timer update() calls /// Time difference between the two last timer update() calls
long double mDeltaTime; long double m_d*eltaTime;
/// Used to fix the time step and avoid strange time effects /// Used to fix the time step and avoid strange time effects
double mAccumulator; double m_accumulator;
/// True if the timer is running /// True if the timer is running
bool mIsRunning; bool m_isRunning;
// -------------------- Methods -------------------- // // -------------------- Methods -------------------- //
@ -112,47 +112,47 @@ class Timer {
// Return the current time // Return the current time
inline long double Timer::getPhysicsTime() const { inline long double Timer::getPhysicsTime() const {
return mLastUpdateTime; return m_lastUpdateTime;
} }
// Return if the timer is running // Return if the timer is running
inline bool Timer::isRunning() const { inline bool Timer::isRunning() const {
return mIsRunning; return m_isRunning;
} }
// Start the timer // Start the timer
inline void Timer::start() { inline void Timer::start() {
if (!mIsRunning) { if (!m_isRunning) {
// Get the current system time // Get the current system time
mLastUpdateTime = getCurrentSystemTime(); m_lastUpdateTime = getCurrentSystemTime();
mAccumulator = 0.0; m_accumulator = 0.0;
mIsRunning = true; m_isRunning = true;
} }
} }
// Stop the timer // Stop the timer
inline void Timer::stop() { inline void Timer::stop() {
mIsRunning = false; m_isRunning = false;
} }
// True if it's possible to take a new step // True if it's possible to take a new step
inline bool Timer::isPossibleToTakeStep(float timeStep) const { inline bool Timer::isPossibleToTakeStep(float timeStep) const {
return (mAccumulator >= timeStep); return (m_accumulator >= timeStep);
} }
// Take a new step => update the timer by adding the timeStep value to the current time // Take a new step => update the timer by adding the timeStep value to the current time
inline void Timer::nextStep(float timeStep) { inline void Timer::nextStep(float timeStep) {
assert(mIsRunning); assert(m_isRunning);
// Update the accumulator value // Update the accumulator value
mAccumulator -= timeStep; m_accumulator -= timeStep;
} }
// Compute the int32_terpolation factor // Compute the int32_terpolation factor
inline float Timer::computeInterpolationFactor(float timeStep) { inline float Timer::computeInterpolationFactor(float timeStep) {
return (float(mAccumulator) / timeStep); return (float(m_accumulator) / timeStep);
} }
// Compute the time since the last update() call and add it to the accumulator // Compute the time since the last update() call and add it to the accumulator
@ -162,13 +162,13 @@ inline void Timer::update() {
long double currentTime = getCurrentSystemTime(); long double currentTime = getCurrentSystemTime();
// Compute the delta display time between two display frames // Compute the delta display time between two display frames
mDeltaTime = currentTime - mLastUpdateTime; m_d*eltaTime = currentTime - m_lastUpdateTime;
// Update the current display time // Update the current display time
mLastUpdateTime = currentTime; m_lastUpdateTime = currentTime;
// Update the accumulator value // Update the accumulator value
mAccumulator += mDeltaTime; m_accumulator += m_d*eltaTime;
} }
#endif #endif