Example #1
0
 public static void amVectorSet(AppMain.NNS_VECTOR2D pDst, float x, float y)
 {
     pDst.x = x;
     pDst.y = y;
 }
Example #2
0
    private static void nnDrawPrimitive2DCore(uint mode, object vtx, int count, float pri)
    {
        if ((double)pri > -(double)AppMain.nngClip2d.n_clip || -(double)AppMain.nngClip2d.f_clip > (double)pri)
        {
            return;
        }
        switch (AppMain.nndrawprim2d.nnsFormat)
        {
        case 0:
            AppMain.mppAssertNotImpl();
            break;

        case 1:
            AppMain.NNS_PRIM2D_PC[] nnsPriM2DPcArray = (AppMain.NNS_PRIM2D_PC[])vtx;
            Vector3[]         vbuf = AppMain._nnDrawPrimitive2DCore.vbuf;
            AppMain.RGBA_U8[] cbuf = AppMain._nnDrawPrimitive2DCore.cbuf;
            int count1             = 0;
            OpenGL.glVertexPointer(3, 5126U, 0, (OpenGL.GLVertexData) new AppMain.Vector3_VertexData(vbuf));
            OpenGL.glColorPointer(4, 5121U, 0, (OpenGL.GLVertexData) new AppMain.RGBA_U8_ColorData(cbuf, 0));
            for (int index = 0; index < count; ++index)
            {
                AppMain.NNS_VECTOR2D pos = nnsPriM2DPcArray[index].Pos;
                uint col = nnsPriM2DPcArray[index].Col;
                AppMain.nnConvert2DTo3D(ref vbuf[count1], pos.x, pos.y, pri);
                cbuf[count1].r = (byte)(col >> 24);
                cbuf[count1].g = (byte)(col >> 16);
                cbuf[count1].b = (byte)(col >> 8);
                cbuf[count1].a = (byte)col;
                ++count1;
                if (count1 >= 6)
                {
                    OpenGL.glDrawArrays(mode, 0, count1);
                    switch (mode)
                    {
                    case 3:
                        vbuf[0] = vbuf[5];
                        cbuf[0] = cbuf[5];
                        count1  = 1;
                        continue;

                    case 5:
                        vbuf[0] = vbuf[4];
                        vbuf[1] = vbuf[5];
                        cbuf[0] = cbuf[4];
                        cbuf[1] = cbuf[5];
                        count1  = 2;
                        continue;

                    default:
                        count1 = 0;
                        continue;
                    }
                }
            }
            if (count1 <= 0)
            {
                break;
            }
            OpenGL.glDrawArrays(mode, 0, count1);
            break;

        case 2:
            AppMain.mppAssertNotImpl();
            break;
        }
    }
Example #3
0
 public AppMain.NNS_VECTOR2D Assign(AppMain.NNS_VECTOR2D vec)
 {
     this.x = vec.x;
     this.y = vec.y;
     return(this);
 }