Ejemplo n.º 1
0
        public Sprite()
        {
            VertexPositions = new Vector[VertexAmount];
            VertexColors = new Color[VertexAmount];
            VertexUVs = new Point[VertexAmount];

            InitVertexPositions(new Vector(0, 0, 0), 1, 1);
            SetColor(new Color(1, 1, 1, 1));
            SetUVs(new Point(0, 0), new Point(1, 1));
        }
Ejemplo n.º 2
0
 public void DrawImmediateModeVertex(Vector position, Color color, Point uvs)
 {
     GL.Color4(color.Red, color.Green, color.Blue, color.Alpha);
     GL.TexCoord2(uvs.X, uvs.Y);
     GL.Vertex3(position.X, position.Y, position.Z);
 }
Ejemplo n.º 3
0
 public void SetPosition(Vector position)
 {
     InitVertexPositions(position, GetWidth(), GetHeight());
 }
Ejemplo n.º 4
0
        private void InitVertexPositions(Vector position, double width, double height)
        {
            var halfWidth = width/2;
            var halfHeight = height/2;

            //clockwise creation of two triangles makes a quad

            //topleft, topright, bottomleft
            VertexPositions[0] = new Vector(position.X - halfWidth, position.Y + halfHeight, position.Z);
            VertexPositions[1] = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z);
            VertexPositions[2] = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z);

            //topright, bottomright, bottomleft
            VertexPositions[3] = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z);
            VertexPositions[4] = new Vector(position.X + halfWidth, position.Y - halfHeight, position.Z);
            VertexPositions[5] = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z);
        }