Debugging. Had to comment out the loading of physics because it crashed the programm.

This commit is contained in:
Steffen Fündgens 2014-12-12 18:38:12 +01:00
parent 3504a2d209
commit 4ddc21d3c9

View File

@ -82,6 +82,7 @@ void Level::load() {
glm::vec3(0.0f, 0.0f, 0.0f)); glm::vec3(0.0f, 0.0f, 0.0f));
objects.push_back(skydomeObject); objects.push_back(skydomeObject);
skydome = skydomeObject; skydome = skydomeObject;
//load lighting parameters //load lighting parameters
float rColour, gColour, bColour, alpha, xOffset, yOffset, zOffset, intensity; float rColour, gColour, bColour, alpha, xOffset, yOffset, zOffset, intensity;
XMLElement* ambientElement = doc->FirstChildElement("ambientLight"); XMLElement* ambientElement = doc->FirstChildElement("ambientLight");
@ -89,7 +90,7 @@ void Level::load() {
errorCheck(ambientElement->FirstChildElement("gColour")->QueryFloatText(&gColour)); errorCheck(ambientElement->FirstChildElement("gColour")->QueryFloatText(&gColour));
errorCheck(ambientElement->FirstChildElement("bColour")->QueryFloatText(&bColour)); errorCheck(ambientElement->FirstChildElement("bColour")->QueryFloatText(&bColour));
ambientLight = glm::vec3(rColour,gColour,bColour); ambientLight = glm::vec3(rColour,gColour,bColour);
XMLElement* fogElement = doc->FirstChildElement("ambientLight"); XMLElement* fogElement = doc->FirstChildElement("fogColour");
errorCheck(fogElement->FirstChildElement("rColour")->QueryFloatText(&rColour)); errorCheck(fogElement->FirstChildElement("rColour")->QueryFloatText(&rColour));
errorCheck(fogElement->FirstChildElement("gColour")->QueryFloatText(&gColour)); errorCheck(fogElement->FirstChildElement("gColour")->QueryFloatText(&gColour));
errorCheck(fogElement->FirstChildElement("bColour")->QueryFloatText(&bColour)); errorCheck(fogElement->FirstChildElement("bColour")->QueryFloatText(&bColour));
@ -104,6 +105,7 @@ void Level::load() {
errorCheck(directionalElement->FirstChildElement("bColour")->QueryFloatText(&bColour)); errorCheck(directionalElement->FirstChildElement("bColour")->QueryFloatText(&bColour));
errorCheck(directionalElement->FirstChildElement("intensity")->QueryFloatText(&intensity)); errorCheck(directionalElement->FirstChildElement("intensity")->QueryFloatText(&intensity));
directionalLight = Light(glm::vec3(xOffset,yOffset,zOffset), glm::vec3(rColour,gColour,bColour), intensity); directionalLight = Light(glm::vec3(xOffset,yOffset,zOffset), glm::vec3(rColour,gColour,bColour), intensity);
//load Objects //load Objects
std::vector<int*> objectIdentifiers; //The first entry is the index in objects, the others are idGreen, idBlue and objectNum. std::vector<int*> objectIdentifiers; //The first entry is the index in objects, the others are idGreen, idBlue and objectNum.
XMLDocument* compositions = new XMLDocument(); XMLDocument* compositions = new XMLDocument();
@ -193,7 +195,7 @@ void Level::load() {
objectIdentifier[2] = idBlue; objectIdentifier[2] = idBlue;
objectIdentifier[3] = objectNum; objectIdentifier[3] = objectNum;
objectIdentifiers.push_back(objectIdentifier); objectIdentifiers.push_back(objectIdentifier);
// /*
physicObjects.push_back(object); physicObjects.push_back(object);
const char* charPhysicType = objectData->FirstChildElement("physicType")->GetText(); const char* charPhysicType = objectData->FirstChildElement("physicType")->GetText();
if(charPhysicType == NULL){ if(charPhysicType == NULL){
@ -206,22 +208,23 @@ void Level::load() {
errorCheck(objectData->FirstChildElement("radius")->QueryFloatText(&radius)); errorCheck(objectData->FirstChildElement("radius")->QueryFloatText(&radius));
errorCheck(objectData->FirstChildElement("mass")->QueryFloatText(&mass)); errorCheck(objectData->FirstChildElement("mass")->QueryFloatText(&mass));
this->physics.addPlayer(radius, *object, mass, physicObjects.size()); this->physics.addPlayer(radius, *object, mass, physicObjects.size());
} }else if (physicType.compare("Box") == 0){
if (physicType.compare("Box") == 0){
float width, height, length, mass; float width, height, length, mass;
errorCheck(objectData->FirstChildElement("width")->QueryFloatText(&width)); errorCheck(objectData->FirstChildElement("width")->QueryFloatText(&width));
errorCheck(objectData->FirstChildElement("height")->QueryFloatText(&height)); errorCheck(objectData->FirstChildElement("height")->QueryFloatText(&height));
errorCheck(objectData->FirstChildElement("length")->QueryFloatText(&length)); errorCheck(objectData->FirstChildElement("length")->QueryFloatText(&length));
errorCheck(objectData->FirstChildElement("mass")->QueryFloatText(&mass)); errorCheck(objectData->FirstChildElement("mass")->QueryFloatText(&mass));
this->physics.addBox(width, height, length, *object, mass, physicObjects.size()); this->physics.addBox(width, height, length, *object, mass, physicObjects.size());
} }else if (physicType.compare("TriangleMeshBody") == 0){
if (physicType.compare("TriangleMeshBody") == 0){
float mass, dampningL, dampningA; float mass, dampningL, dampningA;
errorCheck(objectData->FirstChildElement("mass")->QueryFloatText(&mass)); errorCheck(objectData->FirstChildElement("mass")->QueryFloatText(&mass));
errorCheck(objectData->FirstChildElement("dampningL")->QueryFloatText(&dampningL)); errorCheck(objectData->FirstChildElement("dampningL")->QueryFloatText(&dampningL));
errorCheck(objectData->FirstChildElement("dampningA")->QueryFloatText(&dampningA)); errorCheck(objectData->FirstChildElement("dampningA")->QueryFloatText(&dampningA));
this->physics.addTriangleMeshBody(*object, mass, dampningL, dampningA, physicObjects.size()); this->physics.addTriangleMeshBody(*object, mass, dampningL, dampningA, physicObjects.size());
} else{
printf("XMLError: Not a valid physicType.\n");
} }
*/
if(compositionType == 20){ if(compositionType == 20){
cameraCenter = object; cameraCenter = object;
} }