Code rework. Basically cleaned up a mess of tabs and whitespaces.

This commit is contained in:
Steffen Fündgens 2015-02-13 13:46:41 +01:00
parent b2398ba643
commit 47fded52ce
14 changed files with 353 additions and 363 deletions

View File

@ -15,7 +15,6 @@ class Converter {
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 save(); //writes the xml to file
private:
void errorCheck(XMLError error);
std::vector<int> nextID;

View File

@ -217,7 +217,6 @@ glm::mat4 Graphics::buildViewMatrix(Level* level) {
return glm::lookAt((level->getCameraCenter()->getPosition() + level->getCamera()->getVector()),
level->getCameraCenter()->getPosition(), glm::vec3(0.0f, 1.0f, 0.0f));
}
float Graphics::getFarPlane() {

View File

@ -142,7 +142,6 @@ int main( int argc, char *argv[] )
double lastUpdate=0.0f;
do {
double now = glfwGetTime()- startTimeInSeconds;

View File

@ -24,7 +24,6 @@ void Physics::init(std::string geometryPath) //prepares bullet by creating all i
void Physics::takeUpdateStep(float timeDiff)
{
counter++;
if(counter<1)
{
@ -53,7 +52,7 @@ void Physics::takeUpdateStep(float timeDiff)
position.setY(playerBall->getCenterOfMassPosition().getY() + 1);
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
counter=0;
float speed = cameraBody->getLinearVelocity().length();
@ -66,7 +65,7 @@ void Physics::takeUpdateStep(float timeDiff)
}
world->stepSimulation(timeDiff);
}
//
void Physics::removePositionConstraint(int bodyIndice) //remover function for deleting all pos constraints on one body
{
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);
}
btRigidBody::btRigidBodyConstructionInfo info(mass,motion,box,inertia);
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* body = new btRigidBody(info);
body->setDamping(dampningL, dampningA);
@ -319,7 +316,6 @@ void Physics::addSphere(float rad, Entity entity, float mass, float dampningL, f
if(bodies.size() != indice)
throw std::invalid_argument( "Bodies out of Sync" );
}
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->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();
cameraBody->applyCentralForce(change);
}
//use the crossproduct to correctly apply a torque to the palyer if function called

View File

@ -81,7 +81,7 @@ class Physics {
void addCamera(); //Do NOT impliment before Player has been created;
btDynamicsWorld* world = NULL; //contains physical attributes of the world.
btDispatcher* dispatcher; //
btDispatcher* dispatcher;
btCollisionConfiguration* colConfig; //defines the type of collision detection.
btBroadphaseInterface* broadphase; //defines how objects are culled from collision detection.
btConstraintSolver* solver; //solver for forces and impulses.

View File

@ -27,7 +27,6 @@ void Terrain::load() {
}
this->makeTriangleMesh();
heightmapChanged = false; //no need to make a TriangleMesh again before rendering
}
void Terrain::makeTriangleMesh(){