Ejemplo n.º 1
0
        public OglPipeline(
            OglConstBuffer buffer,
            OglRenderTarget renderTarget,
            OglRasterizer rasterizer,
            OglShader shader)
        {
            _buffer       = buffer;
            _renderTarget = renderTarget;
            _rasterizer   = rasterizer;
            _shader       = shader;

            // These values match OpenGL's defaults
            _old = new GalPipelineState
            {
                FrontFace = GalFrontFace.Ccw,

                CullFaceEnabled = false,
                CullFace        = GalCullFace.Back,

                DepthTestEnabled  = false,
                DepthWriteEnabled = true,
                DepthFunc         = GalComparisonOp.Less,
                DepthRangeNear    = 0,
                DepthRangeFar     = 1,

                StencilTestEnabled = false,

                StencilBackFuncFunc = GalComparisonOp.Always,
                StencilBackFuncRef  = 0,
                StencilBackFuncMask = UInt32.MaxValue,
                StencilBackOpFail   = GalStencilOp.Keep,
                StencilBackOpZFail  = GalStencilOp.Keep,
                StencilBackOpZPass  = GalStencilOp.Keep,
                StencilBackMask     = UInt32.MaxValue,

                StencilFrontFuncFunc = GalComparisonOp.Always,
                StencilFrontFuncRef  = 0,
                StencilFrontFuncMask = UInt32.MaxValue,
                StencilFrontOpFail   = GalStencilOp.Keep,
                StencilFrontOpZFail  = GalStencilOp.Keep,
                StencilFrontOpZPass  = GalStencilOp.Keep,
                StencilFrontMask     = UInt32.MaxValue,

                BlendIndependent = false,

                PrimitiveRestartEnabled = false,
                PrimitiveRestartIndex   = 0
            };

            for (int index = 0; index < GalPipelineState.RenderTargetsCount; index++)
            {
                _old.Blends[index] = BlendState.Default;

                _old.ColorMasks[index] = ColorMaskState.Default;
            }
        }
Ejemplo n.º 2
0
        public OglRenderer()
        {
            Buffer = new OglConstBuffer();

            Texture = new OglTexture();

            RenderTarget = new OglRenderTarget(Texture as OglTexture);

            Rasterizer = new OglRasterizer();

            Shader = new OglShader(Buffer as OglConstBuffer);

            Pipeline = new OglPipeline(
                Buffer       as OglConstBuffer,
                RenderTarget as OglRenderTarget,
                Rasterizer   as OglRasterizer,
                Shader       as OglShader);

            _actionsQueue = new ConcurrentQueue <Action>();
        }