+
+ indices[h] = row;
+ }
+ }
+ else
+ {
+ logError("invalid tiles in tilemap instruction");
+ return;
+ }
+
+ Vector4 vertices[height+1][width+1];
+
+ Matrix4 transposedTransform = transform;
+ transposedTransform.transpose();
+
+ for (int h = 0; h <= height; ++h)
+ {
+ for (int w = 0; w <= width; ++w)
+ {
+ vertices[h][w] = Vector4(Scalar(w), Scalar(h), 0.0, 1.0) *
+ transposedTransform;
+ }
+ }
+
+ for (int h = 0; h < height; ++h)
+ {
+ for (int w = 0; w < width; ++w)
+ {
+ if (indices[h][w] == Tilemap::NO_TILE) continue;
+
+ Vector3 quadVertices[4];
+
+ demoteVector(quadVertices[0], vertices[h][w]);
+ demoteVector(quadVertices[1], vertices[h][w+1]);
+ demoteVector(quadVertices[2], vertices[h+1][w+1]);
+ demoteVector(quadVertices[3], vertices[h+1][w]);
+
+ Quad* quad = new Quad(quadVertices, texture, indices[h][w]);
+ boost::shared_ptr<Quad> quadPtr(quad);
+
+ octree->insert(quadPtr);
+ }
+ }
+ }
+
+ void loadBillboard(SerializableP root, const Matrix4& transform,
+ const std::string& texture)
+ {
+ Serializable::Map rootObj;
+ Serializable::Map::iterator it;
+
+ Tilemap::Index index = 0;
+ long width = 1;
+ bool blending = false;
+ bool fog = false;
+
+ if (root->get(rootObj))
+ {
+ if ((it = rootObj.find("tile")) != rootObj.end())
+ {
+ Serializable::Integer value;
+ if ((*it).second->get(value))