public static Poly CreatePoly(Basic_PolyType type, byte[] file, int address) { switch (type) { case Basic_PolyType.Triangles: return new Triangle(file, address); case Basic_PolyType.Quads: return new Quad(file, address); case Basic_PolyType.NPoly: case Basic_PolyType.Strips: return new Strip(file, address); } throw new ArgumentException("Unknown poly type!", "type"); }
public static Poly CreatePoly(Basic_PolyType type, byte[] file, int address) { switch (type) { case Basic_PolyType.Triangles: return(new Triangle(file, address)); case Basic_PolyType.Quads: return(new Quad(file, address)); case Basic_PolyType.NPoly: case Basic_PolyType.Strips: return(new Strip(file, address)); } throw new ArgumentException("Unknown poly type!", "type"); }
public static Poly CreatePoly(Basic_PolyType type) { switch (type) { case Basic_PolyType.Triangles: return new Triangle(); case Basic_PolyType.Quads: return new Quad(); case Basic_PolyType.NPoly: case Basic_PolyType.Strips: throw new ArgumentException( "Cannot create strip-type poly without additional information.\nUse Strip.Strip(int NumVerts, bool Reverse) instead.", "type"); } throw new ArgumentException("Unknown poly type!", "type"); }
public static Poly CreatePoly(Basic_PolyType type) { switch (type) { case Basic_PolyType.Triangles: return(new Triangle()); case Basic_PolyType.Quads: return(new Quad()); case Basic_PolyType.NPoly: case Basic_PolyType.Strips: throw new ArgumentException( "Cannot create strip-type poly without additional information.\nUse Strip.Strip(int NumVerts, bool Reverse) instead.", "type"); } throw new ArgumentException("Unknown poly type!", "type"); }
public NJS_MESHSET(Basic_PolyType polyType, int polyCount, bool hasPolyNormal, bool hasUV, bool hasVColor) { if (polyType == Basic_PolyType.NPoly | polyType == Basic_PolyType.Strips) { throw new ArgumentException("Cannot create a Poly of that type!\nTry another overload to create Strip-type Polys.", "polyType"); } PolyName = "poly_" + Extensions.GenerateIdentifier(); PolyType = polyType; Poly[] polys = new Poly[polyCount]; int striptotal = 0; for (int i = 0; i < polys.Length; i++) { polys[i] = SAModel.Poly.CreatePoly(PolyType); striptotal += polys[i].Indexes.Length; } Poly = new ReadOnlyCollection <Poly>(polys); if (hasPolyNormal) { PolyNormalName = "polynormal_" + Extensions.GenerateIdentifier(); PolyNormal = new Vertex[polys.Length]; for (int i = 0; i < polys.Length; i++) { PolyNormal[i] = new Vertex(); } } if (hasVColor) { VColorName = "vcolor_" + Extensions.GenerateIdentifier(); VColor = new Color[striptotal]; } if (hasUV) { UVName = "uv_" + Extensions.GenerateIdentifier(); UV = new UV[striptotal]; for (int i = 0; i < striptotal; i++) { UV[i] = new UV(); } } }
public NJS_MESHSET(Basic_PolyType polyType, int polyCount, bool hasPolyNormal, bool hasUV, bool hasVColor) { if (polyType == Basic_PolyType.NPoly | polyType == Basic_PolyType.Strips) { throw new ArgumentException("Cannot create a Poly of that type!\nTry another overload to create Strip-type Polys.", "polyType"); } PolyName = "poly_" + Extensions.GenerateIdentifier(); PolyType = polyType; Poly[] polys = new Poly[polyCount]; int striptotal = 0; for (int i = 0; i < polys.Length; i++) { polys[i] = SAModel.Poly.CreatePoly(PolyType); striptotal += polys[i].Indexes.Length; } Poly = new ReadOnlyCollection<Poly>(polys); if (hasPolyNormal) { PolyNormalName = "polynormal_" + Extensions.GenerateIdentifier(); PolyNormal = new Vertex[polys.Length]; for (int i = 0; i < polys.Length; i++) PolyNormal[i] = new Vertex(); } if (hasVColor) { VColorName = "vcolor_" + Extensions.GenerateIdentifier(); VColor = new Color[striptotal]; } if (hasUV) { UVName = "uv_" + Extensions.GenerateIdentifier(); UV = new UV[striptotal]; for (int i = 0; i < striptotal; i++) UV[i] = new UV(); } }