Exemplo n.º 1
0
        public LineBuffer(GraphicsContext graphics, Int32 maxNumOfLines)
        {
            if (shaderProgram == null)
            {
                shaderProgram = LineB.CreateLineShader();
            }

            this.graphics = graphics;

            this.maxNumOfLines = maxNumOfLines;

            bufferVerties = new float[maxNumOfLines * VERTEX_SIZE_PER_LINE];
            bufferColors  = new float[maxNumOfLines * COLOR_SIZE_PER_LINE];

            //
            vertexBuffer = new VertexBuffer(
                maxNumOfLines * NUM_OF_VERTEX_PER_LINE,
                VertexFormat.Float3,
                VertexFormat.Float4);

            //TODO:rectAppScreenを指定する。
            unitScreenMatrix = new Matrix4(
                2.0f / graphics.Screen.Rectangle.Width, 0.0f, 0.0f, 0.0f,
                0.0f, -2.0f / graphics.Screen.Rectangle.Height, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f,
                -1.0f, 1.0f, 0.0f, 1.0f
                );
        }
Exemplo n.º 2
0
        public void Add(LineB line)
        {
            if (cnt >= maxNumOfLines)
            {
                return;
            }

            bufferVerties[cnt * VERTEX_SIZE_PER_LINE]     = line.Position0.X;
            bufferVerties[cnt * VERTEX_SIZE_PER_LINE + 1] = line.Position0.Y;
            bufferVerties[cnt * VERTEX_SIZE_PER_LINE + 2] = line.Position0.Z;

            bufferVerties[cnt * VERTEX_SIZE_PER_LINE + 3] = line.Position1.X;
            bufferVerties[cnt * VERTEX_SIZE_PER_LINE + 4] = line.Position1.Y;
            bufferVerties[cnt * VERTEX_SIZE_PER_LINE + 5] = line.Position1.Z;

            bufferColors[cnt * COLOR_SIZE_PER_LINE]     = line.Color0.R;
            bufferColors[cnt * COLOR_SIZE_PER_LINE + 1] = line.Color0.G;
            bufferColors[cnt * COLOR_SIZE_PER_LINE + 2] = line.Color0.B;
            bufferColors[cnt * COLOR_SIZE_PER_LINE + 3] = line.Color0.A;

            bufferColors[cnt * COLOR_SIZE_PER_LINE + 4] = line.Color1.R;
            bufferColors[cnt * COLOR_SIZE_PER_LINE + 5] = line.Color1.G;
            bufferColors[cnt * COLOR_SIZE_PER_LINE + 6] = line.Color1.B;
            bufferColors[cnt * COLOR_SIZE_PER_LINE + 7] = line.Color1.A;

            ++cnt;
        }
Exemplo n.º 3
0
        public void Add(LineB line)
        {
            if( cnt >= maxNumOfLines)
                return;

            bufferVerties[cnt*VERTEX_SIZE_PER_LINE]=line.Position0.X;
            bufferVerties[cnt*VERTEX_SIZE_PER_LINE+1]=line.Position0.Y;
            bufferVerties[cnt*VERTEX_SIZE_PER_LINE+2]=line.Position0.Z;

            bufferVerties[cnt*VERTEX_SIZE_PER_LINE+3]=line.Position1.X;
            bufferVerties[cnt*VERTEX_SIZE_PER_LINE+4]=line.Position1.Y;
            bufferVerties[cnt*VERTEX_SIZE_PER_LINE+5]=line.Position1.Z;

            bufferColors[cnt*COLOR_SIZE_PER_LINE]=line.Color0.R;
            bufferColors[cnt*COLOR_SIZE_PER_LINE+1]=line.Color0.G;
            bufferColors[cnt*COLOR_SIZE_PER_LINE+2]=line.Color0.B;
            bufferColors[cnt*COLOR_SIZE_PER_LINE+3]=line.Color0.A;

            bufferColors[cnt*COLOR_SIZE_PER_LINE+4]=line.Color1.R;
            bufferColors[cnt*COLOR_SIZE_PER_LINE+5]=line.Color1.G;
            bufferColors[cnt*COLOR_SIZE_PER_LINE+6]=line.Color1.B;
            bufferColors[cnt*COLOR_SIZE_PER_LINE+7]=line.Color1.A;

            ++cnt;
        }