コード例 #1
0
        public RenderTexture2dCommand(Vector2 min, Vector2 max, TextureBufferObject t, float alpha = 1.0f, bool isDepthBuffer = false)
            : base()
        {
            myMin   = min;
            myMax   = max;
            myAlpha = alpha;

            myVerts             = new V3T2B4[4];
            myVerts[0].Position = new Vector3(min.X, min.Y, 0); myVerts[0].TexCoord = new Vector2(0, 0); myVerts[0].Color = new Color4(1.0f, 1.0f, 1.0f, alpha).toUInt();
            myVerts[1].Position = new Vector3(max.X, min.Y, 0); myVerts[1].TexCoord = new Vector2(1, 0); myVerts[1].Color = new Color4(1.0f, 1.0f, 1.0f, alpha).toUInt();
            myVerts[2].Position = new Vector3(max.X, max.Y, 0); myVerts[2].TexCoord = new Vector2(1, 1); myVerts[2].Color = new Color4(1.0f, 1.0f, 1.0f, alpha).toUInt();
            myVerts[3].Position = new Vector3(min.X, max.Y, 0); myVerts[3].TexCoord = new Vector2(0, 1); myVerts[3].Color = new Color4(1.0f, 1.0f, 1.0f, alpha).toUInt();

            renderState.setTexture(t.id, 0, TextureTarget.Texture2D);
            renderState.setIndexBuffer(theIBO.id);
            renderState.setVertexBuffer(theVBO.id, 0, 0, V3T2B4.stride);
            renderState.setUniform(new UniformData(0, Uniform.UniformType.Bool, false));
            renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            renderState.setUniform(new UniformData(23, Uniform.UniformType.Int, 0));
            renderState.setUniform(new UniformData(25, Uniform.UniformType.Bool, isDepthBuffer));

            pipelineState = new PipelineState();
            pipelineState.shaderState.shaderProgram = theShader;
            pipelineState.vaoState.vao      = theVAO;
            pipelineState.depthTest.enabled = false;
            pipelineState.blending.enabled  = alpha < 1.0f;
            pipelineState.generateId();
        }
コード例 #2
0
ファイル: debugCanvas.cs プロジェクト: bholcomb/gameEngine
        public void addTexture2d(Vector2 start, Vector2 end, TextureBufferObject t, bool LinearDepth)
        {
            CanvasRenderCommand cmd = nextCommand(PrimitiveType.Triangles, Projection.ORTHO, t.textureId, Fill.SOLID, false);

            cmd.renderState.setTexture(t.textureId, 0, TextureTarget.TextureBuffer);
            cmd.renderState.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));
            cmd.renderState.setUniform(new UniformData(23, Uniform.UniformType.Int, 0));

            UInt32 baseVertex = (UInt32)myVertCount;

            Vector2 mid1 = new Vector2(end.X, start.Y);
            Vector2 mid2 = new Vector2(start.X, end.Y);

            addVertex(new Vector3(start), uvSolid, Color4.White);
            addVertex(new Vector3(mid1), uvSolid, Color4.White);
            addVertex(new Vector3(end), uvSolid, Color4.White);
            addVertex(new Vector3(mid2), uvSolid, Color4.White);

            addIndex(cmd, baseVertex);
            addIndex(cmd, baseVertex + 1);
            addIndex(cmd, baseVertex + 2);

            addIndex(cmd, baseVertex);
            addIndex(cmd, baseVertex + 2);
            addIndex(cmd, baseVertex + 3);
        }
コード例 #3
0
ファイル: debugRenderer.cs プロジェクト: bholcomb/gameEngine
        public static void addTexture(Vector2 min, Vector2 max, TextureBufferObject t, bool isDepth, double time)
        {
            if (myIsEnabled == false)
            {
                return;
            }
            DebugRenderTexture2DCommand rc = new DebugRenderTexture2DCommand(min, max, t, isDepth, time);

            myCommands.Add(rc);
        }
コード例 #4
0
 public DebugRenderTexture2DCommand(Vector2 min, Vector2 max, TextureBufferObject t, bool isDepth, double time)
     : base(false, time)
 {
     myMin            = min;
     myMax            = max;
     myTextureBuffer  = t;
     myLayer          = 0;
     myTextureType    = TextureTarget.TextureBuffer;
     myLinearizeDepth = isDepth;
 }
コード例 #5
0
 public TextureBufferSampler(TextureBufferObject tbo, int unit)
     : base(null, unit)
 {
     myTbo = tbo;
 }