Example #1
0
        public virtual void PrecompileGLCmds(qfiles.dmdl_t model)
        {
            model.textureCoordBuf = globalModelTextureCoordBuf.Slice();
            model.vertexIndexBuf  = globalModelVertexIndexBuf.Slice();
            ArrayList tmp   = new ArrayList();
            var       count = 0;

            Int32[] order      = model.glCmds;
            var     orderIndex = 0;

            while (true)
            {
                count = order[orderIndex++];
                if (count == 0)
                {
                    break;
                }
                tmp.Add(count);
                if (count < 0)
                {
                    count = -count;
                }
                else
                {
                }

                do
                {
                    globalModelTextureCoordBuf.Put(BitConverter.ToSingle(BitConverter.GetBytes(order[orderIndex + 0])));
                    globalModelTextureCoordBuf.Put(BitConverter.ToSingle(BitConverter.GetBytes(order[orderIndex + 1])));
                    globalModelVertexIndexBuf.Put(order[orderIndex + 2]);
                    orderIndex += 3;
                }while (--count != 0);
            }

            Int32 size = tmp.Count;

            model.counts        = new Int32[size];
            model.indexElements = new Int32Buffer[size];
            count = 0;
            var pos = 0;

            for (var i = 0; i < model.counts.Length; i++)
            {
                count           = (( Int32 )tmp[i]);
                model.counts[i] = count;
                count           = (count < 0) ? -count : count;
                model.vertexIndexBuf.Position = pos;
                model.indexElements[i]        = model.vertexIndexBuf.Slice();
                model.indexElements[i].Limit  = count;
                pos += count;
            }
        }
Example #2
0
 static Surf( )
 {
     globalPolygonInterleavedBuf.Position = glpoly_t.STRIDE - 2;
     globalPolygonTexCoord1Buf            = globalPolygonInterleavedBuf.Slice();
     globalPolygonInterleavedBuf.Position = 0;
 }