]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Scene.cc
more cleanup
[chaz/yoink] / src / Moof / Scene.cc
index ccfd4f934060b605ad5de663c9e62bf84414c9e0..454726817a3fc9285616efbcf47e405f6fe24aa8 100644 (file)
@@ -26,7 +26,6 @@
 
 *******************************************************************************/
 
 
 *******************************************************************************/
 
-#include <iostream>
 #include <map>
 #include <vector>
 
 #include <map>
 #include <vector>
 
@@ -34,6 +33,7 @@
 #include "Camera.hh"
 #include "Deserializer.hh"
 #include "Entity.hh"
 #include "Camera.hh"
 #include "Deserializer.hh"
 #include "Entity.hh"
+#include "Log.hh"
 #include "Math.hh"
 #include "Mippleton.hh"
 #include "OpenGL.hh"
 #include "Math.hh"
 #include "Mippleton.hh"
 #include "OpenGL.hh"
@@ -67,7 +67,13 @@ class Scene::Impl : public Mippleton<Impl>
 
                        if (!tilemap_.getTileCoords(tileIndex, texCoords_))
                        {
 
                        if (!tilemap_.getTileCoords(tileIndex, texCoords_))
                        {
-                               std::cerr << "no coords for tile's texture" << std::endl;
+                               logWarning("no index %d in texture %s", tileIndex,
+                                               texture.c_str());
+
+                               texCoords_[0] = texCoords_[1] =
+                                       texCoords_[3] = texCoords_[6] = 0.0;
+                               texCoords_[2] = texCoords_[4] =
+                                       texCoords_[5] = texCoords_[7] = 1.0;
                        }
 
                        aabb_.encloseVertices(vertices, 4);
                        }
 
                        aabb_.encloseVertices(vertices, 4);
@@ -165,7 +171,7 @@ public:
 
                if (!root->get(rootObj))
                {
 
                if (!root->get(rootObj))
                {
-                       std::cerr << "error loading scene instructions" << std::endl;
+                       logError("scene instructions must be an array");
                        return;
                }
 
                        return;
                }
 
@@ -299,7 +305,7 @@ public:
 
                if (!root->get(rootObj))
                {
 
                if (!root->get(rootObj))
                {
-                       std::cerr << "error loading scene tilemap object" << std::endl;
+                       logError("invalid tilemap instruction");
                        return;
                }
 
                        return;
                }
 
@@ -313,7 +319,7 @@ public:
                }
                else
                {
                }
                else
                {
-                       std::cerr << "width is a required field of a tilemap" << std::endl;
+                       logError("missing required field width for tilemap instruction");
                        return;
                }
 
                        return;
                }
 
@@ -352,7 +358,7 @@ public:
                }
                else
                {
                }
                else
                {
-                       std::cerr << "error loading tiles from tilemap object" << std::endl;
+                       logError("invalid tiles in tilemap instruction");
                        return;
                }
 
                        return;
                }
 
@@ -480,7 +486,7 @@ public:
 
                if (!root || !root->get(rootObj))
                {
 
                if (!root || !root->get(rootObj))
                {
-                       std::cerr << "error loading scene file" << std::endl;
+                       logError("no root map in scene file");
                        return;
                }
 
                        return;
                }
 
@@ -494,7 +500,7 @@ public:
                }
                else
                {
                }
                else
                {
-                       std::cerr << "maximum bounds required in scene" << std::endl;
+                       logError("missing required maximum bounds");
                        return;
                }
 
                        return;
                }
 
@@ -506,6 +512,8 @@ public:
                        loadInstructions((*it).second);
                }
 
                        loadInstructions((*it).second);
                }
 
+
+
                octree->sort();
        }
 
                octree->sort();
        }
 
This page took 0.02047 seconds and 4 git commands to generate.