]> Dogcows Code - chaz/yoink/blobdiff - src/Scene.cc
experimental shapes hierarchy and raycasting
[chaz/yoink] / src / Scene.cc
index 9b4d1fdf65ee3544cd29bc176a08bc3bdc3e9787..452cc134cc85359894bac9877649806424f54938 100644 (file)
@@ -34,6 +34,7 @@
 #include <Moof/Entity.hh>
 #include <Moof/Exception.hh>
 #include <Moof/Library.hh>
 #include <Moof/Entity.hh>
 #include <Moof/Exception.hh>
 #include <Moof/Library.hh>
+#include <Moof/Line.hh>
 #include <Moof/Log.hh>
 #include <Moof/Math.hh>
 //#include <Moof/Octree.hh>
 #include <Moof/Log.hh>
 #include <Moof/Math.hh>
 //#include <Moof/Octree.hh>
@@ -156,9 +157,10 @@ struct Scene::Impl : public Mf::Library<Impl>
        std::string                             mTexture;
 
        //Mf::Octree<Quad>::Ptr mOctree;
        std::string                             mTexture;
 
        //Mf::Octree<Quad>::Ptr mOctree;
-       std::list< boost::shared_ptr<Impl::Quad> > mObjects;
+       std::list< boost::shared_ptr<Impl::Quad> >      mObjects;
+       std::list< Mf::Line<2> >                                        mLines;
 
 
-       Mf::Aabb                                mBounds;
+       Mf::Aabb<3>                             mBounds;
 
 
        enum AXIS
 
 
        enum AXIS
@@ -219,7 +221,7 @@ struct Scene::Impl : public Mf::Library<Impl>
        }
 
 
        }
 
 
-       static int loadBox(Mf::Script& script, Mf::Aabb& aabb)
+       static int loadBox(Mf::Script& script, Mf::Aabb<3>& aabb)
        {
                Mf::Script::Value table[] =
                {
        {
                Mf::Script::Value table[] =
                {
@@ -413,6 +415,14 @@ struct Scene::Impl : public Mf::Library<Impl>
                                Quad* quad = new Quad(demotedVertices, mTexture, indices[h][w]);
                                quad->setSurface(surface);
 
                                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<Quad> quadPtr(quad);
                                //mOctree->insert(quadPtr);
                                mObjects.push_back(quadPtr);
                                boost::shared_ptr<Quad> quadPtr(quad);
                                //mOctree->insert(quadPtr);
                                mObjects.push_back(quadPtr);
@@ -545,7 +555,7 @@ bool Scene::checkForCollision(Character& character)
        std::list< boost::shared_ptr<Impl::Quad> >::const_iterator it;
 
        int collisions = 0;
        std::list< boost::shared_ptr<Impl::Quad> >::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)
        {
 
        for (it = objects.begin(); it != objects.end(); ++it)
        {
This page took 0.020884 seconds and 4 git commands to generate.