summaryrefslogtreecommitdiffstats
path: root/src/Level.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Level.cpp')
-rw-r--r--src/Level.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Level.cpp b/src/Level.cpp
index 2867ab9..9b2aa78 100644
--- a/src/Level.cpp
+++ b/src/Level.cpp
@@ -53,14 +53,14 @@ boost::shared_ptr<Level> Level::loadLevel(const std::string &filename) {
}
for(std::list<Room>::iterator room = level->rooms.begin(); room != level->rooms.end(); ++room) {
- for(std::list<BSPTree::TriangleRecord>::iterator wall = room->walls.begin(); wall != room->walls.end(); ++wall) {
- boost::shared_ptr<WallData> wallData = boost::dynamic_pointer_cast<WallData>(wall->data);
+ for(std::list<TriangleRecord>::iterator wall = room->walls.begin(); wall != room->walls.end(); ++wall) {
+ boost::shared_ptr<WallData> wallData = boost::dynamic_pointer_cast<WallData>(wall->getData());
if(!wallData->texture.empty()) {
std::map<std::string, unsigned>::iterator texture = level->textures.find(wallData->texture);
if(texture != level->textures.end())
- wall->triangle.setTexture(texture->second);
+ wall->getTriangle().setTexture(texture->second);
}
}
}
@@ -149,11 +149,11 @@ void Level::loadTextures(xmlNodePtr texturesNode) {
}
}
-BSPTree::TriangleRecord Level::loadWall(xmlNodePtr wallNode) {
+TriangleRecord Level::loadWall(xmlNodePtr wallNode) {
boost::shared_ptr<WallData> wallData(new WallData);
- BSPTree::TriangleRecord wall;
- wall.data = wallData;
+ TriangleRecord wall;
+ wall.setData(wallData);
xmlChar *data = xmlGetProp(wallNode, (xmlChar*)"texture");
@@ -172,39 +172,39 @@ BSPTree::TriangleRecord Level::loadWall(xmlNodePtr wallNode) {
if(++vertexNum > 2)
break;
- wall.triangle.setVertex(vertexNum, loadVector(node));
+ wall.getTriangle().setVertex(vertexNum, loadVector(node));
}
else if(!xmlStrcmp(node->name, (xmlChar*)"normal")) {
if(vertexNum < 0)
continue;
- wall.triangle.setNormal(vertexNum, loadVector(node));
+ wall.getTriangle().setNormal(vertexNum, loadVector(node));
}
else if(!xmlStrcmp(node->name, (xmlChar*)"texcoords")) {
if(vertexNum < 0) continue;
data = xmlGetProp(node, (xmlChar*)"s");
if(data) {
- wall.triangle.getTexCoords(vertexNum)[0] = atof((char*)data);
+ wall.getTriangle().getTexCoords(vertexNum)[0] = atof((char*)data);
xmlFree(data);
}
data = xmlGetProp(node, (xmlChar*)"t");
if(data) {
- wall.triangle.getTexCoords(vertexNum)[1] = atof((char*)data);
+ wall.getTriangle().getTexCoords(vertexNum)[1] = atof((char*)data);
xmlFree(data);
}
}
}
- vmml::vec3f normal = wall.triangle.computeNormal();
+ vmml::vec3f normal = wall.getTriangle().computeNormal();
if(normal.squared_length() > 0) {
normal.normalize();
for(int i = 0; i < 3; ++i) {
- if(wall.triangle.getNormal(i).squared_length() == 0)
- wall.triangle.setNormal(i, normal);
+ if(wall.getTriangle().getNormal(i).squared_length() == 0)
+ wall.getTriangle().setNormal(i, normal);
}
}