]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Scene.cc
considerable refactoring
[chaz/yoink] / src / Moof / Scene.cc
index 1f76570f77363f08f81cb65163d6f0556c18f8a8..ccfd4f934060b605ad5de663c9e62bf84414c9e0 100644 (file)
@@ -133,13 +133,13 @@ class Scene::Impl : public Mippleton<Impl>
        };
 
 
-       static void loadBox(Aabb& theBox, SerializablePtr obj)
+       static void loadBox(Aabb& theBox, SerializableP obj)
        {
-               std::vector<SerializablePtr> numbers;
+               Serializable::Array numbers;
 
                if (obj->get(numbers) && numbers.size() == 6)
                {
-                       double num;
+                       Serializable::Float num;
 
                        if (numbers[0]->getNumber(num)) theBox.min[0] = Scalar(num);
                        if (numbers[1]->getNumber(num)) theBox.min[1] = Scalar(num);
@@ -158,10 +158,10 @@ public:
        }
 
 
-       void loadInstructions(SerializablePtr root)
+       void loadInstructions(SerializableP root)
        {
-               std::vector<SerializablePtr> rootObj;
-               std::vector<SerializablePtr>::iterator it;
+               Serializable::Array rootObj;
+               Serializable::Array::iterator it;
 
                if (!root->get(rootObj))
                {
@@ -184,7 +184,7 @@ public:
                                }
                                else if (instruction == "translate")
                                {
-                                       std::vector<SerializablePtr> values;
+                                       Serializable::Array values;
 
                                        ++it;
                                        if ((*it)->get(values))
@@ -193,7 +193,7 @@ public:
 
                                                for (size_t i = 0; i < values.size(); ++i)
                                                {
-                                                       double value;
+                                                       Serializable::Float value;
 
                                                        if (values[i]->getNumber(value))
                                                        {
@@ -208,14 +208,14 @@ public:
                                }
                                else if (instruction == "scale")
                                {
-                                       std::vector<SerializablePtr> values;
+                                       Serializable::Array values;
 
                                        ++it;
                                        if ((*it)->get(values))
                                        {
                                                if (values.size() == 1)
                                                {
-                                                       double value = 1.0;
+                                                       Serializable::Float value = 1.0;
 
                                                        values[0]->getNumber(value);
 
@@ -230,7 +230,7 @@ public:
 
                                                        for (size_t i = 0; i < values.size(); ++i)
                                                        {
-                                                               double value;
+                                                               Serializable::Float value;
 
                                                                if (values[i]->getNumber(value))
                                                                {
@@ -246,7 +246,7 @@ public:
                                }
                                else if (instruction == "rotate")
                                {
-                                       std::vector<SerializablePtr> values;
+                                       Serializable::Array values;
 
                                        ++it;
                                        if ((*it)->get(values))
@@ -255,7 +255,7 @@ public:
                                                {
                                                        std::string axis;
                                                        size_t index = 0;
-                                                       double value = 0.0;
+                                                       Serializable::Float value = 0.0;
 
                                                        if (values[0]->get(axis))
                                                        {
@@ -291,11 +291,11 @@ public:
        }
 
 
-       void loadTilemap(SerializablePtr root, const Matrix4& transform,
+       void loadTilemap(SerializableP root, const Matrix4& transform,
                        const std::string& texture)
        {
-               std::map<std::string,SerializablePtr> rootObj;
-               std::map<std::string,SerializablePtr>::iterator it;
+               Serializable::Map rootObj;
+               Serializable::Map::iterator it;
 
                if (!root->get(rootObj))
                {
@@ -317,13 +317,13 @@ public:
                        return;
                }
 
-               std::vector<SerializablePtr> tiles;
+               Serializable::Array tiles;
 
                if ((it = rootObj.find("tiles")) != rootObj.end() &&
                                (*it).second->get(tiles) &&
                                tiles.size() % width == 0)
                {
-                       std::vector<SerializablePtr>::iterator jt;
+                       Serializable::Array::iterator jt;
                        int w, h;
 
                        height = tiles.size() / width;
@@ -339,7 +339,7 @@ public:
 
                                for (w = 0; w < width && jt != tiles.end(); ++w, ++jt)
                                {
-                                       long index;
+                                       Serializable::Integer index;
 
                                        if ((*jt)->get(index))
                                        {
@@ -391,11 +391,11 @@ public:
                }
        }
 
-       void loadBillboard(SerializablePtr root, const Matrix4& transform,
+       void loadBillboard(SerializableP root, const Matrix4& transform,
                        const std::string& texture)
        {
-               std::map<std::string,SerializablePtr> rootObj;
-               std::map<std::string,SerializablePtr>::iterator it;
+               Serializable::Map rootObj;
+               Serializable::Map::iterator it;
 
                Tilemap::Index  index = 0;
                long                    width = 1;
@@ -406,7 +406,7 @@ public:
                {
                        if ((it = rootObj.find("tile")) != rootObj.end())
                        {
-                               long value;
+                               Serializable::Integer value;
                                if ((*it).second->get(value))
                                {
                                        index = Tilemap::Index(value);
@@ -473,10 +473,10 @@ public:
                std::string filePath = Scene::getPath(getName());
 
                Deserializer    deserializer(filePath, true);
-               SerializablePtr root = deserializer.deserialize();
+               SerializableP   root = deserializer.deserialize();
 
-               std::map<std::string,SerializablePtr> rootObj;
-               std::map<std::string,SerializablePtr>::iterator it;
+               Serializable::Map rootObj;
+               Serializable::Map::iterator it;
 
                if (!root || !root->get(rootObj))
                {
@@ -499,7 +499,7 @@ public:
                }
 
                // create the tree to store the quads
-               octree = OctreePtr(new Octree(maximumBounds));
+               octree = Octree::alloc(maximumBounds);
 
                if ((it = rootObj.find("instructions")) != rootObj.end())
                {
@@ -535,7 +535,7 @@ public:
        Aabb playfieldBounds;
        Aabb maximumBounds;
 
-       OctreePtr octree;
+       OctreeP octree;
 };
 
 
@@ -557,7 +557,7 @@ void Scene::refresh()
 }
 
 
-OctreePtr Scene::getOctree() const
+OctreeP Scene::getOctree() const
 {
        // pass through
        return impl_->octree;
This page took 0.027045 seconds and 4 git commands to generate.