Code rework. Basically cleaned up a mess of tabs and whitespaces.
This commit is contained in:
parent
b2398ba643
commit
47fded52ce
@ -15,7 +15,6 @@ class Converter {
|
|||||||
std::vector<int> newComposition(int type, float posX, float posZ);//creates a new composition and returns its ID
|
std::vector<int> newComposition(int type, float posX, float posZ);//creates a new composition and returns its ID
|
||||||
void deleteComposition(int idG, int idB);
|
void deleteComposition(int idG, int idB);
|
||||||
void save(); //writes the xml to file
|
void save(); //writes the xml to file
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void errorCheck(XMLError error);
|
void errorCheck(XMLError error);
|
||||||
std::vector<int> nextID;
|
std::vector<int> nextID;
|
||||||
|
@ -217,7 +217,6 @@ glm::mat4 Graphics::buildViewMatrix(Level* level) {
|
|||||||
|
|
||||||
return glm::lookAt((level->getCameraCenter()->getPosition() + level->getCamera()->getVector()),
|
return glm::lookAt((level->getCameraCenter()->getPosition() + level->getCamera()->getVector()),
|
||||||
level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f));
|
level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Graphics::getFarPlane() {
|
float Graphics::getFarPlane() {
|
||||||
|
1
main.cc
1
main.cc
@ -142,7 +142,6 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
double lastUpdate=0.0f;
|
double lastUpdate=0.0f;
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
double now = glfwGetTime()- startTimeInSeconds;
|
double now = glfwGetTime()- startTimeInSeconds;
|
||||||
|
10
physics.cc
10
physics.cc
@ -24,7 +24,6 @@ void Physics::init(std::string geometryPath) //prepares bullet by creating all i
|
|||||||
|
|
||||||
void Physics::takeUpdateStep(float timeDiff)
|
void Physics::takeUpdateStep(float timeDiff)
|
||||||
{
|
{
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
if(counter<1)
|
if(counter<1)
|
||||||
{
|
{
|
||||||
@ -53,7 +52,7 @@ void Physics::takeUpdateStep(float timeDiff)
|
|||||||
position.setY(playerBall->getCenterOfMassPosition().getY() + 1);
|
position.setY(playerBall->getCenterOfMassPosition().getY() + 1);
|
||||||
|
|
||||||
btVector3 dir = cameraBody->getCenterOfMassPosition() - position;
|
btVector3 dir = cameraBody->getCenterOfMassPosition() - position;
|
||||||
float str = 50 * dir.length() / cameraBody->getInvMass();
|
float str = 50 * dir.length() / cameraBody->getInvMass(); //getInvMass() returns the inverted mass
|
||||||
cameraBody->applyCentralForce(-dir*str); //scale the force by camera mass
|
cameraBody->applyCentralForce(-dir*str); //scale the force by camera mass
|
||||||
counter=0;
|
counter=0;
|
||||||
float speed = cameraBody->getLinearVelocity().length();
|
float speed = cameraBody->getLinearVelocity().length();
|
||||||
@ -66,7 +65,7 @@ void Physics::takeUpdateStep(float timeDiff)
|
|||||||
}
|
}
|
||||||
world->stepSimulation(timeDiff);
|
world->stepSimulation(timeDiff);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
void Physics::removePositionConstraint(int bodyIndice) //remover function for deleting all pos constraints on one body
|
void Physics::removePositionConstraint(int bodyIndice) //remover function for deleting all pos constraints on one body
|
||||||
{
|
{
|
||||||
for(unsigned i = 0; i < allPositionConstraints.size(); i++)
|
for(unsigned i = 0; i < allPositionConstraints.size(); i++)
|
||||||
@ -273,7 +272,6 @@ void Physics::addBox(float width, float height, float length, Entity entity, flo
|
|||||||
box->calculateLocalInertia((btScalar)mass,inertia);
|
box->calculateLocalInertia((btScalar)mass,inertia);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,box,inertia);
|
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,box,inertia);
|
||||||
|
|
||||||
btRigidBody* body = new btRigidBody(info);
|
btRigidBody* body = new btRigidBody(info);
|
||||||
@ -306,7 +304,6 @@ void Physics::addSphere(float rad, Entity entity, float mass, float dampningL, f
|
|||||||
|
|
||||||
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,sphere,inertia);
|
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,sphere,inertia);
|
||||||
|
|
||||||
|
|
||||||
btRigidBody* body = new btRigidBody(info);
|
btRigidBody* body = new btRigidBody(info);
|
||||||
|
|
||||||
body->setDamping(dampningL, dampningA);
|
body->setDamping(dampningL, dampningA);
|
||||||
@ -319,7 +316,6 @@ void Physics::addSphere(float rad, Entity entity, float mass, float dampningL, f
|
|||||||
|
|
||||||
if(bodies.size() != indice)
|
if(bodies.size() != indice)
|
||||||
throw std::invalid_argument( "Bodies out of Sync" );
|
throw std::invalid_argument( "Bodies out of Sync" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Physics::addCamera() //Camera Creator automatically called when player is created
|
void Physics::addCamera() //Camera Creator automatically called when player is created
|
||||||
@ -344,7 +340,6 @@ void Physics::addCamera() //Camera Creator automatically called when player is c
|
|||||||
cameraBody->setGravity(btVector3(0,0,0));
|
cameraBody->setGravity(btVector3(0,0,0));
|
||||||
|
|
||||||
cameraBody->setSleepingThresholds(0,0); //very important, otherwise camera may go to sleep, aka not move until next collision
|
cameraBody->setSleepingThresholds(0,0); //very important, otherwise camera may go to sleep, aka not move until next collision
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +389,6 @@ void Physics::updateCameraPos(glm::vec2 mouseMovement, float strength)
|
|||||||
change *= strength / cameraBody->getInvMass();
|
change *= strength / cameraBody->getInvMass();
|
||||||
|
|
||||||
cameraBody->applyCentralForce(change);
|
cameraBody->applyCentralForce(change);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//use the crossproduct to correctly apply a torque to the palyer if function called
|
//use the crossproduct to correctly apply a torque to the palyer if function called
|
||||||
|
@ -81,7 +81,7 @@ class Physics {
|
|||||||
void addCamera(); //Do NOT impliment before Player has been created;
|
void addCamera(); //Do NOT impliment before Player has been created;
|
||||||
|
|
||||||
btDynamicsWorld* world = NULL; //contains physical attributes of the world.
|
btDynamicsWorld* world = NULL; //contains physical attributes of the world.
|
||||||
btDispatcher* dispatcher; //
|
btDispatcher* dispatcher;
|
||||||
btCollisionConfiguration* colConfig; //defines the type of collision detection.
|
btCollisionConfiguration* colConfig; //defines the type of collision detection.
|
||||||
btBroadphaseInterface* broadphase; //defines how objects are culled from collision detection.
|
btBroadphaseInterface* broadphase; //defines how objects are culled from collision detection.
|
||||||
btConstraintSolver* solver; //solver for forces and impulses.
|
btConstraintSolver* solver; //solver for forces and impulses.
|
||||||
|
@ -27,7 +27,6 @@ void Terrain::load() {
|
|||||||
}
|
}
|
||||||
this->makeTriangleMesh();
|
this->makeTriangleMesh();
|
||||||
heightmapChanged = false; //no need to make a TriangleMesh again before rendering
|
heightmapChanged = false; //no need to make a TriangleMesh again before rendering
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain::makeTriangleMesh(){
|
void Terrain::makeTriangleMesh(){
|
||||||
|
Loading…
Reference in New Issue
Block a user