integrating tinyxml into level, adding lights to compositions
This commit is contained in:
parent
8108003d52
commit
086e13ac8e
@ -40,10 +40,20 @@
|
||||
<zOffset>0.0</zOffset>
|
||||
<scale>1.0</scale>
|
||||
</object>
|
||||
<object>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>1.0</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<rColour>1.0</rColour>
|
||||
<gColour>1.0</gColour>
|
||||
<bColour>1.0</bColour>
|
||||
<intensity>5.0</intensity>
|
||||
<scale>0.0</scale>
|
||||
</object>
|
||||
</composition>
|
||||
|
||||
<composition>
|
||||
<typeID>100</typeID>
|
||||
<typeID>99</typeID>
|
||||
<object>
|
||||
<filePath>../Levels/Geometry/Column.obj</filePath>
|
||||
<xOffset>0.0</xOffset>
|
||||
@ -66,3 +76,21 @@
|
||||
<scale>1.0</scale>
|
||||
</object>
|
||||
</composition>
|
||||
|
||||
<composition>
|
||||
<typeID>120</typeID>
|
||||
<object>
|
||||
<filePath>../Levels/Geometry/switch_inner.obj</filePath>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>0.0</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<scale>1.0</scale>
|
||||
</object>
|
||||
<object>
|
||||
<filePath>../Levels/Geometry/switch_outer.obj</filePath>
|
||||
<xOffset>0.0</xOffset>
|
||||
<yOffset>0.0</yOffset>
|
||||
<zOffset>0.0</zOffset>
|
||||
<scale>1.0</scale>
|
||||
</object>
|
||||
</composition>
|
||||
|
@ -30,7 +30,7 @@ Converter::Converter(std::string level){
|
||||
}else{
|
||||
XMLElement* thisComposition = doc->FirstChildElement("composition");
|
||||
int idGreen, idBlue;
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
|
||||
thisComposition->QueryIntAttribute("idGreen", &idGreen);
|
||||
thisComposition->QueryIntAttribute("idBlue", &idBlue);
|
||||
if(idGreen > nextID[0] || (idGreen == nextID[0] && idBlue > nextID[1])){
|
||||
@ -96,7 +96,7 @@ std::vector<unsigned int> Converter::newComposition(unsigned int type, float pos
|
||||
void Converter::updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ){
|
||||
XMLElement* thisComposition = doc->FirstChildElement("composition");
|
||||
int idGreen, idBlue;
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
|
||||
thisComposition->QueryIntAttribute("idGreen", &idGreen);
|
||||
thisComposition->QueryIntAttribute("idBlue", &idBlue);
|
||||
if(idGreen == idG && idBlue == idB){
|
||||
@ -109,7 +109,7 @@ void Converter::updateComposition(unsigned int idG, unsigned int idB, float posX
|
||||
void Converter::deleteComposition(unsigned int idG, unsigned int idB){
|
||||
XMLElement* thisComposition = doc->FirstChildElement("composition");
|
||||
int idGreen, idBlue;
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
|
||||
thisComposition->QueryIntAttribute("idGreen", &idGreen);
|
||||
thisComposition->QueryIntAttribute("idBlue", &idBlue);
|
||||
if(idGreen == idG && idBlue == idB){
|
||||
@ -129,7 +129,7 @@ std::vector<unsigned int> Converter::getNextID(){
|
||||
|
||||
/* finding a typeID in compositions:
|
||||
XMLElement* thisComposition = compositions->FirstChildElement("composition");
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
|
||||
int thisType;
|
||||
thisComposition->QueryIntAttribute("typeID", &thisType);
|
||||
if(thisType == type){
|
||||
|
32
level.cc
32
level.cc
@ -17,6 +17,7 @@ Level::~Level() {
|
||||
}
|
||||
}
|
||||
|
||||
using namespace tinyxml2;
|
||||
void Level::load() {
|
||||
|
||||
this->physics = Physics();
|
||||
@ -25,7 +26,7 @@ void Level::load() {
|
||||
// currently hard coded should later read this stuff out of a file
|
||||
this->camera = Camera(glm::vec2(-0.8f, 0.0f), 3.0f);
|
||||
|
||||
/*Loading Objects via xml:
|
||||
//Loading Objects via xml:
|
||||
XMLDocument* doc = new XMLDocument();
|
||||
const char* xmlFile = ("../Levels/ObjectSetups/Level" + levelNum + ".xml").c_str();
|
||||
doc->LoadFile(xmlFile);
|
||||
@ -40,20 +41,33 @@ void Level::load() {
|
||||
printf("Could not open Compositions!\n");
|
||||
exit(-1);
|
||||
}
|
||||
XMLElement* thisComposition = compositions->FirstChildElement("composition");
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
|
||||
XMLElement* thisComposition = doc->FirstChildElement("composition");
|
||||
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
|
||||
int thisType;
|
||||
thisComposition->QueryIntAttribute("typeID", &thisType);
|
||||
if(thisType == type){
|
||||
...
|
||||
XMLElement* compositionType = compositions->FirstChildElement("composition");
|
||||
for(; compositionType; compositionType=compositionType->NextSiblingElement("composition")){
|
||||
int compositionID;
|
||||
compositionType->QueryIntAttribute("typeID", &compositionID);
|
||||
if(thisType == compositionID){
|
||||
XMLElement* object = compositionType->FirstChildElement("object");
|
||||
for(; object; object=object->NextSiblingElement("object")){
|
||||
|
||||
}
|
||||
XMLElement* light = compositionType->FirstChildElement("light");
|
||||
for(; light; light=light->NextSiblingElement("light")){
|
||||
|
||||
}
|
||||
//Model model = Model("MarbleSmooth.obj", 0.75f);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//add player
|
||||
Model model = Model("MarbleSmooth.obj", 0.75f);
|
||||
Material material = Material("marbleTexture_small.png", 0.1f, 0.5f, 0.5f, 3.0f);
|
||||
Object* object = new Object(model, material, glm::vec3(2.0f, 10.0f, 2.0f),
|
||||
Model marbleModel = Model("MarbleSmooth.obj", 0.75f);
|
||||
Material marbleMaterial = Material("marbleTexture_small.png", 0.1f, 0.5f, 0.5f, 3.0f);
|
||||
Object* object = new Object(marbleModel, marbleMaterial, glm::vec3(2.0f, 10.0f, 2.0f),
|
||||
glm::vec3(0.0f, 0.0f, 0.0f));
|
||||
objects.push_back(object);
|
||||
physicObjects.push_back(object);
|
||||
|
2
level.hh
2
level.hh
@ -9,7 +9,7 @@
|
||||
#include "material.hh"
|
||||
#include "camera.hh"
|
||||
#include "physics.hh"
|
||||
#include "converter/tinyxml2.hh"
|
||||
#include "tinyxml2.hh"
|
||||
|
||||
class Level {
|
||||
public:
|
||||
|
2258
tinyxml2.cc
Executable file
2258
tinyxml2.cc
Executable file
File diff suppressed because it is too large
Load Diff
2091
tinyxml2.hh
Executable file
2091
tinyxml2.hh
Executable file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user