public Vertex(Vector <float> vec, float u, float v, ArxColor color) { posX = vec[0]; posY = vec[1]; posZ = vec[2]; texU = u; texV = v; this.color = color; }
public static Polygon Create(Vector <float> center, Vector <float> eulers, float scale, ArxColor color) { Polygon p = new Polygon(); var a = Vector <float> .Build.Dense(new float[] { -0.5f, 0, -0.5f }); var b = Vector <float> .Build.Dense(new float[] { 0.5f, 0, -0.5f }); var c = Vector <float> .Build.Dense(new float[] { -0.5f, 0, 0.5f }); var d = Vector <float> .Build.Dense(new float[] { 0.5f, 0, 0.5f }); var m = Helper.CreateRotationMatrix(eulers); m = m * Helper.CreateScaleMatrix(scale); a *= m; b *= m; c *= m; d *= m; a += center; b += center; c += center; d += center; p.vertices[0] = new Vertex(a, 0, 0, color); p.vertices[1] = new Vertex(b, 1, 0, color); p.vertices[2] = new Vertex(c, 0, 1, color); p.vertices[3] = new Vertex(d, 1, 1, color); var n = Vector <float> .Build.Dense(new float[] { 0, 1, 0 }); n *= m; n = n.Normalize(1); p.norm = new SavedVector3(n); p.norm2 = new SavedVector3(n); p.normals[0] = new SavedVector3(n); p.normals[1] = new SavedVector3(n); p.normals[2] = new SavedVector3(n); p.normals[3] = new SavedVector3(n); p.type = PolyType.QUAD; p.area = scale * scale; return(p); }