Пример #1
0
        public void LoadRawData(ref BinaryReader br, byte[] buffer)
        {
            int triangle_count = ((((IndexCount / 3) + 1) * 6) / 2) / 3;

            m_Mesh = new EnhancedMesh(IndexCount);

            //load verts
            m_Mesh.AllocateVertexBuffer(MeshFormat.Model, (int)VertexCount);
            for (int v = 0; v < VertexCount; v++)
            {
                m_Mesh.LoadH1ModelVertexData(v, ref br, buffer, UScale, VScale, MapfileVersion.XHALO1);
            }
            m_Mesh.UpdateDxBuffer();

            //load indices
            m_Mesh.AllocateAndLoadH1XboxIndexBuffer(PrimitiveType.TriangleStrip, IndexCount, ref br, true);
            //m_Mesh.AllocateAndLoadIndexBuffer(PrimitiveType.TriangleStrip, IndexCount+1, ref br, true);
        }
Пример #2
0
        public void LoadRawData(ref BinaryReader br, byte[] buffer)
        {
            m_Mesh = new EnhancedMesh(TriangleCount);

            //Trace.WriteLine(string.Format("vertex_position = {0:X}", br.BaseStream.Position + 0x40));

            //load verts
            m_Mesh.AllocateVertexBuffer(MeshFormat.Model, (int)VertexCount);
            for (int v = 0; v < VertexCount; v++)
            {
                //version arg only cares if it is xbox, other versions use default (uncompressed) behavior
                m_Mesh.LoadH1ModelVertexData(v, ref br, buffer, UScale, VScale, MapfileVersion.HALOPC);
            }
            m_Mesh.UpdateDxBuffer();

            //Trace.WriteLine(string.Format("index_position = {0:X}", br.BaseStream.Position + 0x40));

            //load indices
            int index_count = (TriangleCount / 3 + 1) * 6;

            m_Mesh.AllocateAndLoadIndexBuffer(PrimitiveType.TriangleStrip, TriangleCount + 1, ref br, true);
        }