diff options
author | Stijn Buys <ingar@osirion.org> | 2011-01-29 13:04:59 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-01-29 13:04:59 +0000 |
commit | 7129e31075e021112ba6a859af29513e69671626 (patch) | |
tree | 22a3c3d9ef85be6d819fac3592715216701f9d2c /src | |
parent | 5067041f2a712674c256344a8017eb7f99f1d1a6 (diff) |
code cleanups.
Diffstat (limited to 'src')
-rw-r--r-- | src/model/mapfile.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index f3f347f..7efd44b 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -398,7 +398,7 @@ bool MapFile::read_patchdef() // http://www.cc.gatech.edu/classes/AY2002/cs4451_spring/groups/group3/index.html#bpatches2 // // patchvertices[][] are the control points as read from the .map file - // mesh[][] is a subdivideXsubdivide quad mesh calculated for each set of 9 control points in the patch + // mesh[][] is a subdivide X subdivide quad mesh calculated for each set of 9 control points in the patch // binomial coefficient const float binom[3] = {1.0f, 2.0f, 1.0f}; @@ -520,7 +520,7 @@ bool MapFile::read_patchdef() mesh[i+1][j+1] * SCALE, mesh[i][j+1] * SCALE, mesh[i][j] * SCALE); - primitives->add_triangle(triangle); + map_collisiontriangles.add(*triangle); triangle = new Triangle( mesh[i+1][j+1] * SCALE, @@ -1201,7 +1201,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t if (map_load_clip) { // clip materials are loaded into the CollisionMesh for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); tris_it++) { - Triangle *triangle = (*tris_it); + Triangle *triangle = (*tris_it); //model->collisionmesh()->add_triangle(triangle->v0(), triangle->v1(), triangle->v2()); map_collisiontriangles.add(*triangle); } @@ -1918,17 +1918,18 @@ Model * MapFile::load(std::string const &name) if (mapfile.map_load_clip) { if (mapfile.map_collisiontriangles.size()) { - // create a collision mesh instance for the model - model->set_collisionmesh(new CollisionMesh(name)); + CollisionMesh *collisionmesh = new CollisionMesh(name); // add clip triangles to collision mesh for (TriangleList::iterator it = mapfile.map_collisiontriangles.begin(); it != mapfile.map_collisiontriangles.end(); it++) { Triangle *triangle = (*it); - model->collisionmesh()->add_triangle(triangle->v0() - map_center, triangle->v1() - map_center, triangle->v2() - map_center); + collisionmesh->add_triangle(triangle->v0() - map_center, triangle->v1() - map_center, triangle->v2() - map_center); } - // add the collision mesh to the registry - CollisionMesh::add(model->collisionmesh()); + // register the mesh + CollisionMesh::add(collisionmesh); + model->set_collisionmesh(collisionmesh); + con_debug << " " << mapfile.name() << " " << model->collisionmesh()->size() << " collision triangles" << std::endl; } } |