private void AddTrianglesGroupDoodads(TriangleCollection s, ModelInstance mi, Vec3D world_dir, Vec3D world_off, float rot)
        {
            sequence++;
            float dx = mi.pos.x;
            float dy = mi.pos.y;
            float dz = mi.pos.z;

            rotate(dx, dz, rot + 90f, out dx, out dz);

            dx += world_off.x;
            dy += world_off.y;
            dz += world_off.z;

            Quaternion q;

            q.x = mi.dir.z;
            q.y = mi.dir.x;
            q.z = mi.dir.y;
            q.w = mi.w;
            Matrix4 rotMatrix = new Matrix4();

            rotMatrix.makeQuaternionRotate(q);

            Model m = mi.model;

            if (m.boundingTriangles == null)
            {
            }
            else
            {
                // We got boiuding stuff, that is better
                int   nBoundingVertices = m.boundingVertices.Length / 3;
                int[] vertices          = new int[nBoundingVertices];

                for (uint i = 0; i < nBoundingVertices; i++)
                {
                    uint  off = i * 3;
                    float x   = m.boundingVertices[off];
                    float y   = m.boundingVertices[off + 2];
                    float z   = m.boundingVertices[off + 1];
                    x *= mi.sc;
                    y *= mi.sc;
                    z *= -mi.sc;

                    Vector pos;
                    pos.x = x;
                    pos.y = y;
                    pos.z = z;
                    Vector new_pos = rotMatrix.mutiply(pos);
                    x = pos.x;
                    y = pos.y;
                    z = pos.z;

                    float dir_x = world_dir.z;
                    float dir_y = world_dir.y - 90;
                    float dir_z = -world_dir.x;

                    rotate(z, y, dir_x, out z, out y);
                    rotate(x, y, dir_z, out x, out y);
                    rotate(x, z, dir_y, out x, out z);

                    float xx = x + dx;
                    float yy = y + dy;
                    float zz = -z + dz;

                    float finalx = ChunkReader.ZEROPOINT - zz;
                    float finaly = ChunkReader.ZEROPOINT - xx;
                    float finalz = yy;
                    vertices[i] = s.AddVertex(finalx, finaly, finalz);
                }

                int nBoundingTriangles = m.boundingTriangles.Length / 3;
                for (uint i = 0; i < nBoundingTriangles; i++)
                {
                    uint off = i * 3;
                    int  v0  = vertices[m.boundingTriangles[off]];
                    int  v1  = vertices[m.boundingTriangles[off + 1]];
                    int  v2  = vertices[m.boundingTriangles[off + 2]];
                    s.AddTriangle(v0, v2, v1, ChunkedTriangleCollection.TriangleFlagModel, sequence);
                }
            }
        }
        void AddTrianglesGroupDoodads(TriangleCollection s, ModelInstance mi, Vec3D world_dir, Vec3D world_off, float rot)
        {
            float dx = mi.pos.x;
            float dy = mi.pos.y;
            float dz = mi.pos.z;

            rotate(dx, dz, rot + 90f, out dx, out dz);


            dx += world_off.x;
            dy += world_off.y;
            dz += world_off.z;


            Quaternion q;

            q.x = -mi.dir.z; q.y = mi.dir.x; q.z = mi.dir.y; q.w = mi.w;
            Matrix4 rotMatrix = new Matrix4();

            rotMatrix.makeQuaternionRotate(q);


            Model m = mi.model;

            if (m.boundingTriangles == null)
            {
                /*
                 * // /cry no bouding info, revert to normal vertices
                 *
                 * ModelView mv = m.view[0]; // View number 1 ?!?!
                 * int[] vertices = new int[m.vertices.Length / 3];
                 * for (uint i = 0; i < m.vertices.Length / 3; i++)
                 * {
                 *  float x = m.vertices[i * 3];
                 *  float y = m.vertices[i * 3 + 2];
                 *  float z = m.vertices[i * 3 + 1];
                 *  x *= mi.sc;
                 *  y *= mi.sc;
                 *  z *= -mi.sc;
                 *
                 *  Vector pos; pos.x = x; pos.y = y; pos.z = z;
                 *  Vector new_pos = rotMatrix.mutiply(pos);
                 *  x = pos.x; y = pos.y; z = pos.z;
                 *
                 *  rotate(x, z, (world_dir.y - 90), out x, out z);
                 *  rotate(y, z, -world_dir.x, out y, out z);
                 *  rotate(x, y, world_dir.z, out x, out y);
                 *
                 *  float xx = x + dx;
                 *  float yy = y + dy;
                 *  float zz = -z + dz;
                 *
                 *  float finalx = ChunkReader.ZEROPOINT - zz;
                 *  float finaly = ChunkReader.ZEROPOINT - xx;
                 *  float finalz = yy;
                 *
                 *  vertices[i] = s.AddVertex(finalx, finaly, finalz);
                 * }
                 *
                 *
                 * for (int i = 0; i < mv.triangleList.Length / 3; i++)
                 * {
                 *  int off = i * 3;
                 *  UInt16 vi0 = mv.triangleList[off];
                 *  UInt16 vi1 = mv.triangleList[off + 1];
                 *  UInt16 vi2 = mv.triangleList[off + 2];
                 *
                 *  int ind0 = mv.indexList[vi0];
                 *  int ind1 = mv.indexList[vi1];
                 *  int ind2 = mv.indexList[vi2];
                 *
                 *  int v0 = vertices[ind0];
                 *  int v1 = vertices[ind1];
                 *  int v2 = vertices[ind2];
                 *  s.AddTriangle(v0, v1, v2, ChunkedTriangleCollection.TriangleFlagModel);
                 * }
                 */
            }
            else
            {
                // We got boiuding stuff, that is better
                int   nBoundingVertices = m.boundingVertices.Length / 3;
                int[] vertices          = new int[nBoundingVertices];

                for (uint i = 0; i < nBoundingVertices; i++)
                {
                    uint  off = i * 3;
                    float x   = m.boundingVertices[off];
                    float y   = m.boundingVertices[off + 2];
                    float z   = m.boundingVertices[off + 1];
                    x *= mi.sc;
                    y *= mi.sc;
                    z *= -mi.sc;

                    Vector pos; pos.x = x; pos.y = y; pos.z = z;
                    Vector new_pos    = rotMatrix.mutiply(pos);
                    x = pos.x; y = pos.y; z = pos.z;

                    rotate(x, z, (world_dir.y - 90), out x, out z);
                    rotate(y, z, -world_dir.x, out y, out z);
                    rotate(x, y, world_dir.z, out x, out y);

                    float xx = x + dx;
                    float yy = y + dy;
                    float zz = -z + dz;

                    float finalx = ChunkReader.ZEROPOINT - zz;
                    float finaly = ChunkReader.ZEROPOINT - xx;
                    float finalz = yy;
                    vertices[i] = s.AddVertex(finalx, finaly, finalz);
                }


                int nBoundingTriangles = m.boundingTriangles.Length / 3;
                for (uint i = 0; i < nBoundingTriangles; i++)
                {
                    uint off = i * 3;
                    int  v0  = vertices[m.boundingTriangles[off]];
                    int  v1  = vertices[m.boundingTriangles[off + 1]];
                    int  v2  = vertices[m.boundingTriangles[off + 2]];
                    s.AddTriangle(v0, v1, v2, ChunkedTriangleCollection.TriangleFlagModel);
                }
            }
        }