Ejemplo n.º 1
0
 //重载点描述,使它渲染时产生偏移
 public override void DrawImmediateModeVertex(Vector position, Color color, Point uvs)
 {
     Gl.glColor4f(color.Red, color.Green, color.Blue, color.Alpha);
     Gl.glTexCoord2f(uvs.X, uvs.Y);
     Gl.glVertex3d(position.X+dx, position.Y+dy, position.Z+dz);
 }
Ejemplo n.º 2
0
 //更改坐标后,整个顶点序列都要改变(z轴是否也需要变化)
 public void SetPosition(Vector position)
 {
     InitVertexPosition(position, GetWidth(), GetHeight());
 }
Ejemplo n.º 3
0
 //顶点处理
 public virtual void DrawImmediateModeVertex(Vector position, Color color, Point uvs)
 {
     Gl.glColor4f(color.Red, color.Green, color.Blue, color.Alpha);
     Gl.glTexCoord2f(uvs.X, uvs.Y);
     Gl.glVertex3d(position.X, position.Y, position.Z);
 }
Ejemplo n.º 4
0
        //初始化顶点(根据一个中心点)
        public void InitVertexPosition(Vector position, double width, double height)
        {
            double halfWidth = width / 2;
            double halfHeight = height / 2;
            //Clockwise creation of two triangles to make 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);
        }