private void Load(StructureValueCollection values, IModelSubmesh[] submeshes)
        {
            IndexBufferStart = (int)values.GetInteger("index buffer start");
            IndexBufferCount = (int)values.GetInteger("index buffer count");
            VertexBufferCount = (int)values.GetInteger("vertex buffer count");

            int submeshIndex = (int)values.GetInteger("parent submesh index");
            Submesh = submeshes[submeshIndex];
        }
        private void LoadVertexGroups(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo, IModelSubmesh[] submeshes)
        {
            int count = (int)values.GetInteger("number of vertex groups");
            uint address = values.GetInteger("vertex group table address");
            var layout = buildInfo.GetLayout("model vertex group");
            var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

            VertexGroups = (from entry in entries
                            select new ThirdGenModelVertexGroup(entry, submeshes)).ToArray();
        }
Example #3
0
        public void ProcessSubmeshIndices(IModelSubmesh submesh, ushort[] indices, int baseIndex)
        {
            _output.WriteLine("# baseIndex = {0}", baseIndex);

            // Models use triangle strips
            // TODO: Do we need to account for back-face culling here?
            for (int i = 2; i < indices.Length; i++)
            {
                int v0 = indices[i - 2] + 1 + baseIndex;
                int v1 = indices[i - 1] + 1 + baseIndex;
                int v2 = indices[i] + 1 + baseIndex;
                if (v0 == v1 || v0 == v2 || v1 == v2)
                    continue; // Throw the triangle out

                // TODO: We should probably check if the vertices actually have normals and texture coordinates on them
                _output.WriteLine("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}", v0, v1, v2);
            }
        }
Example #4
0
 public void EndSubmeshVertices(IModelSubmesh submesh)
 {
 }
Example #5
0
 public void BeginSubmeshVertices(IModelSubmesh submesh)
 {
 }
 public ThirdGenModelVertexGroup(StructureValueCollection values, IModelSubmesh[] submeshes)
 {
     Load(values, submeshes);
 }