public WPVertexBuffer(PhoneRenderer mder, Vector3D[] verts, Vector2D[] tex, Vector3D[] norms) { renderer = mder; vertices = verts; normals = norms; texcoords = tex; }
public override _3DAPI.VertexBuffer CreateVertexBuffer(Vector3D[] vertices, Vector2D[] texcoords, Vector3D[] normals) { return new WPVertexBuffer(this, vertices, texcoords, normals); }
public static void plotRectangle(out Vector3D[] vertices,out Vector2D[] texcoords, float x, float y, float z, float width, float height) { List<Vector3D> points = new List<Vector3D>(); //First triangle //0,0,0 points.Add(new Vector3D(x,y,z)); //0,1,0 points.Add(new Vector3D(x,y+height,z)); //1,1,0 points.Add(new Vector3D(x+width,y+height,z)); //Second triangle //1,1,0 points.Add(new Vector3D(x+width,y+height,z)); //1,0,0 points.Add(new Vector3D(x+width,y,z)); //0,0,0 points.Add(new Vector3D(x,y,z)); //Create texcoords List<Vector2D> t = new List<Vector2D>(); //0,0 t.Add(new Vector2D(0,0)); //0,1 t.Add(new Vector2D(0,.5f)); //1,1 t.Add(new Vector2D(.5f,.5f)); //1,1 t.Add(new Vector2D(1,1)); //1,0 t.Add(new Vector2D(1,.5f)); //0,0 t.Add(new Vector2D(.5f,.5f)); vertices = points.ToArray(); texcoords = t.ToArray(); }
/// <summary> ///Creates a generic vertex buffer /// </summary> /// <returns> /// A <see cref="VertexBuffer"/> /// </returns> public abstract VertexBuffer CreateVertexBuffer(Vector3D[] vertices, Vector2D[] texcoords, Vector3D[] normals);
public GlVertexNotSupportedBuffer(Vector3D[] vertices, Vector2D[] texcoords, Vector3D[] normals, GLRenderer nder) { verts = vertices; texc = texcoords; norms = normals; renderer = nder; }
/// <summary> /// Creates a quad /// </summary> /// <param name="vertices">Input vertices specific to this quad</param> /// <param name="texcoords">Input texcoords specific to this quad</param> /// <param name="normals">Input normals specific to this quad</param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> /// <param name="cx"></param> /// <param name="cy"></param> /// <param name="cz"></param> /// <param name="inputnormals"></param> /// <param name="inputtexcoords"></param> public static void CreateQuad(out Vector3D[] vertices, out Vector2D[] texcoords,out Vector3D[] normals, float x, float y, float z, float cx, float cy, float cz, Vector3D[] inputnormals, Vector2D[] inputtexcoords) { Vector3D[] verts; Vector2D[] faketexcoords; Vector3D[] norms; plotQuad(out verts, out faketexcoords, x, y, z, cx - x, cy - y, cz - z); vertices = verts; normals = inputnormals; //TODO: Calculate the NEW texcoords through subtraction List<Vector2D> texc = new List<Vector2D>(); for(int i = 0;i<vertices.Length;i++) { texc.Add(new Vector2D(faketexcoords[i].X - inputtexcoords[i].X, faketexcoords[i].Y - inputtexcoords[i].Y)); } texcoords = texc.ToArray(); }
public GlVertexBuffer(Vector3D[] vertices, Vector2D[] _texcoords, Vector3D[] _normals, GLRenderer _rend) { renderer = _rend; verts = vertices; texcoords = _texcoords; normals = _normals; for (int i = 0; i < texcoords.Length; i++) { texcoords[i].Y *= -1; } }
public override VertexBuffer CreateVertexBuffer(Vector3D[] vertices, Vector2D[] texcoords, Vector3D[] normals) { if (BasicShader.supportsShaders) { Console.WriteLine("SHADER"); GlVertexBuffer mbuff = new GlVertexBuffer(vertices, texcoords, normals, this); return mbuff; } else { Console.WriteLine("NSSS"); GlVertexNotSupportedBuffer mbuff = new GlVertexNotSupportedBuffer(vertices, texcoords, normals, this); return mbuff; } }
public DXVertBuffer(DirectEngine mgine,Vector3D[] vertices,Vector3D[] normals, Vector2D[] texcoords) { engine = mgine; verts = vertices; norms = normals; texas = texcoords; }
public Vertex(Vector3D Position, Vector3D normal, Vector2D Texture) { position = new Vector3(Position.X,Position.Y,Position.Z); Normal = new Vector3(normal.X,normal.Y,normal.Z); texcoord = new Vector2(Texture.X,Texture.Y); }
public override _3DAPI.VertexBuffer CreateVertexBuffer(Vector3D[] vertices, Vector2D[] texcoords, Vector3D[] normals) { for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vector3D(-vertices[i].X, vertices[i].Y, vertices[i].Z); } return new DXVertBuffer(this, vertices, normals, texcoords); }