private void Deserialize(BinaryReader reader, GC_VertexFlags flags, byte type) { // GXBegin // type, vtxfmt, nverts this.type = type; //type = reader.GetByte(); nVerts = reader.GetUInt16(); verts = new GC_Vertex[nVerts]; for (int i = 0; i < verts.Length; i++) { verts[i] = new GC_Vertex(reader, flags, type); } }
public GC_Vertex(BinaryReader reader, GC_VertexFlags flags, byte type) { this.type = type; if (type == 0x98) { Deserialize_0x98(reader, flags); } else if (type == 0x99) { //Deserialize_0x99(reader, flags); ; } else { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } }
private void Deserialize_0x99(BinaryReader reader, GC_VertexFlags flags) { if (BitCompare(flags, GC_VertexFlags.GX_VA_POS)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_NRM)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_CLR0)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_CLR1)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX0)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX1)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX2)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX3)) { throw new NotImplementedException(reader.BaseStream.Position.ToString("X")); } if (BitCompare(flags, GC_VertexFlags.GX_VA_NBT)) { throw new NotImplementedException(); } }
private void Deserialize_0x98(BinaryReader reader, GC_VertexFlags flags) { if (BitCompare(flags, GC_VertexFlags.GX_VA_POS)) { position = reader.GetVector3Position(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_NRM)) { normal = reader.GetVector3Normal(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_CLR0)) { color0 = reader.GetColor32(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_CLR1)) { color1 = reader.GetColor32(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX0)) { tex0 = reader.GetVector2(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX1)) { tex1 = reader.GetVector2(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX2)) { tex2 = reader.GetVector2(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_TEX3)) { tex3 = reader.GetVector2(); } if (BitCompare(flags, GC_VertexFlags.GX_VA_NBT)) { matrix_1 = reader.GetVector3Generic(false); matrix_2 = reader.GetVector3Generic(false); matrix_3 = reader.GetVector3Generic(false); } }
public static bool BitCompare(GC_VertexFlags flags, GC_VertexFlags compare) { return((flags & compare) > 0); }
public GC_VertexStrip(BinaryReader reader, GC_VertexFlags flags, byte type) { Deserialize(reader, flags, type); }