예제 #1
0
        static void V(VertexP3fT2fC4b v)
        {
            FastColour AAA = FastColour.Unpack(v.Colour);

            GL.Color4ub(AAA.R, AAA.G, AAA.B, AAA.A);
            GL.TexCoord2f(v.U, v.V);
            GL.Vertex3f(v.X, v.Y, v.Z);
        }
예제 #2
0
        public static void Make2DQuad(TextureRec xy, TextureRec uv,
                                      VertexP3fT2fC4b[] vertices, ref int index)
        {
            float x1 = xy.U1, y1 = xy.V1, x2 = xy.U2, y2 = xy.V2;

                        #if USE_DX
            x1 -= 0.5f; x2 -= 0.5f;
            y1 -= 0.5f; y2 -= 0.5f;
                        #endif
            vertices[index++] = new VertexP3fT2fC4b(x1, y1, 0, uv.U1, uv.V1, FastColour.White);
            vertices[index++] = new VertexP3fT2fC4b(x2, y1, 0, uv.U2, uv.V1, FastColour.White);
            vertices[index++] = new VertexP3fT2fC4b(x2, y2, 0, uv.U2, uv.V2, FastColour.White);
            vertices[index++] = new VertexP3fT2fC4b(x1, y2, 0, uv.U1, uv.V2, FastColour.White);
        }
예제 #3
0
        public static void Make2DQuad(ref Texture tex, int col,
                                      VertexP3fT2fC4b[] vertices, ref int index)
        {
            float x1 = tex.X, y1 = tex.Y, x2 = tex.X + tex.Width, y2 = tex.Y + tex.Height;

                        #if USE_DX
            // NOTE: see "https://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx",
            // i.e. the msdn article called "Directly Mapping Texels to Pixels (Direct3D 9)" for why we have to do this.
            x1 -= 0.5f; x2 -= 0.5f;
            y1 -= 0.5f; y2 -= 0.5f;
                        #endif
            vertices[index++] = new VertexP3fT2fC4b(x1, y1, 0, tex.U1, tex.V1, col);
            vertices[index++] = new VertexP3fT2fC4b(x2, y1, 0, tex.U2, tex.V1, col);
            vertices[index++] = new VertexP3fT2fC4b(x2, y2, 0, tex.U2, tex.V2, col);
            vertices[index++] = new VertexP3fT2fC4b(x1, y2, 0, tex.U1, tex.V2, col);
        }
예제 #4
0
        public virtual void Draw2DTexture(ref Texture tex, FastColour col)
        {
            float x1 = tex.X1, y1 = tex.Y1, x2 = tex.X2, y2 = tex.Y2;

                        #if USE_DX
            // NOTE: see "https://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx",
            // i.e. the msdn article called "Directly Mapping Texels to Pixels (Direct3D 9)" for why we have to do this.
            x1 -= 0.5f; x2 -= 0.5f;
            y1 -= 0.5f; y2 -= 0.5f;
                        #endif
            texVerts[0] = new VertexP3fT2fC4b(x1, y1, 0, tex.U1, tex.V1, col);
            texVerts[1] = new VertexP3fT2fC4b(x2, y1, 0, tex.U2, tex.V1, col);
            texVerts[2] = new VertexP3fT2fC4b(x2, y2, 0, tex.U2, tex.V2, col);
            texVerts[3] = new VertexP3fT2fC4b(x1, y2, 0, tex.U1, tex.V2, col);
            SetBatchFormat(VertexFormat.P3fT2fC4b);
            UpdateDynamicIndexedVb(DrawMode.Triangles, texVb, texVerts, 4, 6);
        }
예제 #5
0
 static void V(VertexP3fT2fC4b v)
 {
     GL.Color4ub(v.Col.R, v.Col.G, v.Col.B, v.Col.A);
     GL.TexCoord2f(v.U, v.V);
     GL.Vertex3f(v.X, v.Y, v.Z);
 }