示例#1
0
 public static void Rect(int x, int y, int w, int h, VTex2D img, Vector4 tc, Vector4 bc)
 {
     Bind();
     GenQuad(x, y, w, h, tc, bc);
     img.Bind(0);
     DrawQuad();
     img.Release(0);
     // GL.Begin(BeginMode.Quads);
     // GL.Vertex2(x, y);
     //GL.Vertex2(x + width, y);
     //GL.Vertex2(x + width, y + height);
     //GL.Vertex2(x, y + height);
     //GL.End();
     Release();
 }
示例#2
0
        public virtual void Release()
        {
            if (TCol != null)
            {
                TCol.Release(0);
            }

            if (TNorm != null)
            {
                TNorm.Release(1);
            }
            if (TEnv != null)
            {
                TEnv.Release(2);
            }
            Active = null;
        }
示例#3
0
 public override void Release(VTex2D bb)
 {
     BFX.Release();
     bb.Release(0);
 }
示例#4
0
        public static void Line(int x, int y, int x2, int y2, Vector4 c1, Vector4 c2)
        {
            float a1 = x;
            float b1 = y;
            float a2 = x2;
            float b2 = y2;

            float steps = 0;
            float d1    = Math.Abs(a2 - a1);
            float d2    = Math.Abs(b2 - b1);

            if (d1 > d2)
            {
                steps = d1;
            }
            else
            {
                steps = d2;
            }
            float xi = (a2 - a1) / steps;
            float yi = (b2 - b1) / steps;
            float dx = a1;
            float dy = b1;

            WhiteTex.Bind(0);
            Vector4 vc  = Vector4.One;
            float   cr1 = c1.X;
            float   cg1 = c1.Y;
            float   cb1 = c1.Z;
            float   ca1 = c1.W;
            float   ri  = (c2.X - cr1) / steps;
            float   gi  = (c2.Y - cg1) / steps;
            float   bi  = (c2.Z - cb1) / steps;
            float   ai  = (c2.W - ca1) / steps;

            xi *= 2;
            yi *= 2;
            ri *= 2;
            gi *= 2;
            bi *= 2;
            ai *= 2;

            for (int i = 0; i < steps; i += 2)
            {
                // RectRaw((int)dx,(int) dy, 2, 2, Vector4.One,Vector4.One);

                vc.X = cr1;
                vc.Y = cg1;
                vc.Z = cb1;
                vc.W = ca1;
                GenQuad((int)dx, (int)dy, 2, 2, vc, vc);

                DrawQuad();

                dx  += xi;
                dy  += yi;
                cr1 += ri;
                cg1 += gi;
                cb1 += bi;
                ca1 += ai;
            }
            WhiteTex.Release(0);
        }