+ if ((it = rootObj.find("u_scale")) != rootObj.end())
+ {
+ (*it).second->get(width);
+ }
+
+ if ((it = rootObj.find("blend")) != rootObj.end())
+ {
+ (*it).second->get(blending);
+ }
+
+ if ((it = rootObj.find("fog")) != rootObj.end())
+ {
+ (*it).second->get(fog);
+ }
+
+
+ Vector4 vertices[2][width+1];
+
+ Matrix4 transposedTransform = transform;
+ transposedTransform.transpose();
+
+ Scalar xf;
+ Scalar increment = 1.0 / Scalar(width);
+
+ for (int h = 0; h <= 1; ++h)
+ {
+ xf = 0.0;
+ for (int w = 0; w <= width; ++w, xf += increment)
+ {
+ vertices[h][w] = Vector4(xf, Scalar(h), 0.0, 1.0) *
+ transposedTransform;
+ }
+ }
+
+ for (int w = 0; w < width; ++w)
+ {
+ Vector3 quadVertices[4];
+
+ demoteVector(quadVertices[0], vertices[0][w]);
+ demoteVector(quadVertices[1], vertices[0][w+1]);
+ demoteVector(quadVertices[2], vertices[1][w+1]);
+ demoteVector(quadVertices[3], vertices[1][w]);
+
+ Quad* quad = new Quad(quadVertices, texture, index);
+ quad->setBlending(blending);
+ quad->setFog(fog);
+
+ boost::shared_ptr<Quad> quadPtr(quad);
+
+ objects.push_back(quadPtr);
+ }
+ }
+
+
+ void loadFromFile()
+ {
+ std::string filePath = Scene::getPathToResource(getName());
+
+ Deserializer deserializer(filePath, true);
+ SerializablePtr root = deserializer.deserialize();
+
+ std::map<std::string,SerializablePtr> rootObj;
+ std::map<std::string,SerializablePtr>::iterator it;
+
+ if (!root || !root->get(rootObj))
+ {
+ std::cerr << "error loading scene file" << std::endl;
+ return;
+ }
+
+ if ((it = rootObj.find("playfield_bounds")) != rootObj.end())
+ {
+ loadBox(playfieldBounds, (*it).second);
+ }
+ if ((it = rootObj.find("maximum_bounds")) != rootObj.end())
+ {
+ loadBox(maximumBounds, (*it).second);
+ }
+ if ((it = rootObj.find("instructions")) != rootObj.end())
+ {
+ loadInstructions((*it).second);
+ }