X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FScene.cc;h=452cc134cc85359894bac9877649806424f54938;hp=9b4d1fdf65ee3544cd29bc176a08bc3bdc3e9787;hb=2d77fb5fb3480f522658f30af6addd5146530517;hpb=64e3c3202d2c1956759fb4da36ca329816c9369a diff --git a/src/Scene.cc b/src/Scene.cc index 9b4d1fd..452cc13 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include //#include @@ -156,9 +157,10 @@ struct Scene::Impl : public Mf::Library std::string mTexture; //Mf::Octree::Ptr mOctree; - std::list< boost::shared_ptr > mObjects; + std::list< boost::shared_ptr > mObjects; + std::list< Mf::Line<2> > mLines; - Mf::Aabb mBounds; + Mf::Aabb<3> mBounds; enum AXIS @@ -219,7 +221,7 @@ struct Scene::Impl : public Mf::Library } - static int loadBox(Mf::Script& script, Mf::Aabb& aabb) + static int loadBox(Mf::Script& script, Mf::Aabb<3>& aabb) { Mf::Script::Value table[] = { @@ -413,6 +415,14 @@ struct Scene::Impl : public Mf::Library Quad* quad = new Quad(demotedVertices, mTexture, indices[h][w]); quad->setSurface(surface); + if (surface != Quad::NONE) + { + // need a 2d line for collisions + // assuming the camera always looks directly to -z when the + // scene is built, simply demoting the vector again should + // project the points to the xy-plane + } + boost::shared_ptr quadPtr(quad); //mOctree->insert(quadPtr); mObjects.push_back(quadPtr); @@ -545,7 +555,7 @@ bool Scene::checkForCollision(Character& character) std::list< boost::shared_ptr >::const_iterator it; int collisions = 0; - Mf::Sphere sphere = character.getSphere(); + Mf::Sphere<3> sphere = character.getSphere(); for (it = objects.begin(); it != objects.end(); ++it) {