private static PolygonList GetSingleResultPolygonList(Polygon resultPolygon) { PolygonList result = new PolygonList(); result.Add(resultPolygon); return(result); }
private void ReadPolygonList(EndianBinaryReader reader) { while (true) { var header = reader.ReadUInt16(); var flags = ( byte )(header >> 8); var type = ( ChunkType )( byte )header; if (type == ChunkType.End) { break; } else if (type == ChunkType.Null) { continue; } Chunk16 chunk; switch (type) { case ChunkType.BlendAlpha: chunk = new BlendAlphaChunk(); break; case ChunkType.MipmapDAdjust: chunk = new MipmapDAdjustChunk(); break; case ChunkType.SpecularExponent: chunk = new SpecularExponentChunk(); break; case ChunkType.CachePolygonList: chunk = new CachePolygonListChunk(); break; case ChunkType.DrawPolygonList: chunk = new DrawPolygonListChunk(); break; case ChunkType.TextureId: chunk = new TextureIdChunk(); break; case ChunkType.TextureId2: chunk = new TextureId2Chunk(); break; case ChunkType.MaterialDiffuse: chunk = new MaterialDiffuseChunk(); break; case ChunkType.MaterialAmbient: chunk = new MaterialAmbientChunk(); break; case ChunkType.MaterialDiffuseAmbient: chunk = new MaterialDiffuseAmbientChunk(); break; case ChunkType.MaterialSpecular: chunk = new MaterialSpecularChunk(); break; case ChunkType.MaterialDiffuseSpecular: chunk = new MaterialDiffuseSpecularChunk(); break; case ChunkType.MaterialAmbientSpecular: chunk = new MaterialAmbientSpecularChunk(); break; case ChunkType.MaterialDiffuseAmbientSpecular: chunk = new MaterialDiffuseAmbientSpecularChunk(); break; case ChunkType.MaterialBump: chunk = new MaterialBumpChunk(); break; case ChunkType.MaterialDiffuse2: chunk = new MaterialDiffuse2Chunk(); break; case ChunkType.MaterialAmbient2: chunk = new MaterialAmbient2Chunk(); break; case ChunkType.MaterialDiffuseAmbient2: chunk = new MaterialDiffuseAmbient2Chunk(); break; case ChunkType.MaterialSpecular2: chunk = new MaterialSpecular2Chunk(); break; case ChunkType.MaterialDiffuseSpecular2: chunk = new MaterialDiffuseSpecular2Chunk(); break; case ChunkType.MaterialAmbientSpecular2: chunk = new MaterialAmbientSpecular2Chunk(); break; case ChunkType.MaterialDiffuseAmbientSpecular2: chunk = new MaterialDiffuseAmbientSpecular2Chunk(); break; case ChunkType.Strip: chunk = new StripChunk(); break; case ChunkType.StripUVN: chunk = new StripUVNChunk(); break; case ChunkType.StripUVH: chunk = new StripUVHChunk(); break; case ChunkType.StripVN: chunk = new StripVNChunk(); break; case ChunkType.StripUVNVN: chunk = new StripUVNVNChunk(); break; case ChunkType.StripUVHVN: chunk = new StripUVHVNChunk(); break; case ChunkType.StripD8: chunk = new StripD8Chunk(); break; case ChunkType.StripUVND8: chunk = new StripUVND8Chunk(); break; case ChunkType.StripUVHD8: chunk = new StripUVHD8Chunk(); break; case ChunkType.Strip2: chunk = new Strip2Chunk(); break; case ChunkType.StripUVN2: chunk = new StripUVN2Chunk(); break; case ChunkType.StripUVH2: chunk = new StripUVH2Chunk(); break; case ChunkType.VolumeTristrip: chunk = new VolumeTristripChunk(); break; default: throw new NotImplementedException($"Found unexpected chunk type in polygon list: {type}"); } chunk.ReadBody(-1, flags, reader); PolygonList.Add(chunk); } }