private void SetUpVertices( Line2 line, float height ) { Vector3[] vertex = new Vector3[ 6 ]; // top left vertex[ 0 ] = new Vector3( line.X0, height, line.Y0 ); // bottom left vertex[ 1 ] = new Vector3( line.X0, 0, line.Y0 ); // top right vertex[ 2 ] = new Vector3( line.X1, height, line.Y1 ); // bottom left vertex[ 3 ] = new Vector3( line.X0, 0, line.Y0 ); // bottom right vertex[ 4 ] = new Vector3( line.X1, 0, line.Y1 ); // top right vertex[ 5 ] = new Vector3( line.X1, height, line.Y1 ); Vector2 texTopLeft = Vector2.Zero; Vector2 texTopRight = Vector2.UnitX; Vector2 texBottomLeft = Vector2.UnitY; Vector2 texBottomRight = Vector2.One; Vector3 normal = Vector3.Cross( new Vector3( line.Direction.X, 0, line.Direction.Y ), Vector3.UnitY ); Color color = Color.White; mVertexData[ 0 ] = new VertexPositionNormalColorTexture( vertex[ 0 ], normal, color, texTopLeft ); mVertexData[ 1 ] = new VertexPositionNormalColorTexture( vertex[ 1 ], normal, color, texBottomLeft ); mVertexData[ 2 ] = new VertexPositionNormalColorTexture( vertex[ 2 ], normal, color, texTopRight ); mVertexData[ 3 ] = new VertexPositionNormalColorTexture( vertex[ 3 ], normal, color, texBottomLeft ); mVertexData[ 4 ] = new VertexPositionNormalColorTexture( vertex[ 4 ], normal, color, texBottomRight ); mVertexData[ 5 ] = new VertexPositionNormalColorTexture( vertex[ 5 ], normal, color, texTopRight ); }
private void SetUpVertices() { float w = Width; float h = Height; Vector3[] vertex = new Vector3[ 6 ]; // top left vertex[ 0 ] = new Vector3( 0, 0, 0 ); // top right vertex[ 1 ] = new Vector3( +w, 0, 0 ); // bottom left vertex[ 2 ] = new Vector3( 0, 0, +h ); // bottom left vertex[ 3 ] = new Vector3( 0, 0, +h ); // top right vertex[ 4 ] = new Vector3( +w, 0, 0 ); // bottom right vertex[ 5 ] = new Vector3( +w, 0, +h ); Vector2 texTopLeft = Vector2.Zero; Vector2 texTopRight = Vector2.UnitX; Vector2 texBottomLeft = Vector2.UnitY; Vector2 texBottomRight = Vector2.One; Color color = Color.White; mVertexData[ 0 ] = new VertexPositionNormalColorTexture( vertex[ 0 ], Vector3.UnitY, color, texTopLeft ); mVertexData[ 1 ] = new VertexPositionNormalColorTexture( vertex[ 1 ], Vector3.UnitY, color, texTopRight ); mVertexData[ 2 ] = new VertexPositionNormalColorTexture( vertex[ 2 ], Vector3.UnitY, color, texBottomLeft ); mVertexData[ 3 ] = new VertexPositionNormalColorTexture( vertex[ 3 ], Vector3.UnitY, color, texBottomLeft ); mVertexData[ 4 ] = new VertexPositionNormalColorTexture( vertex[ 4 ], Vector3.UnitY, color, texTopRight ); mVertexData[ 5 ] = new VertexPositionNormalColorTexture( vertex[ 5 ], Vector3.UnitY, color, texBottomRight ); }