Exemplo n.º 1
0
        public unsafe HighlightDrawer(IGraphicsInfra infra, IBlurDrawer blurDrawer, IQuadDrawer quadDrawer, IBleedDrawer bleedDrawer, IOffScreenContainer offScreenContainer)
        {
            this.infra              = infra;
            this.blurDrawer         = blurDrawer;
            this.quadDrawer         = quadDrawer;
            this.bleedDrawer        = bleedDrawer;
            this.offScreenContainer = offScreenContainer;

            #region Shader Text
            const string vertexShaderText =
                @"#version 150
in vec4 in_position;

void main()
{
    gl_Position = in_position;
}
";

            const string fragmentShaderText =
                @"#version 150
out vec4 out_color;

void main()
{
    out_color = vec4(1, 1, 1, 1);
}
";
            #endregion

            var vs = infra.GlContext.Create.VertexShader(vertexShaderText);
            var fs = infra.GlContext.Create.FragmentShader(fragmentShaderText);
            program = infra.GlContext.Create.Program(new ShaderProgramDescription
            {
                VertexShaders        = vs.EnumSelf(),
                FragmentShaders      = fs.EnumSelf(),
                VertexAttributeNames = new[] { "in_position" }
            });

            var vertices = new[]
            {
                new Vector4(-1, 1, 0.5f, 1),
                new Vector4(-1, -1, 0.5f, 1),
                new Vector4(1, 1, 0.5f, 1),
                new Vector4(1, -1, 0.5f, 1)
            };

            IBuffer vb;

            fixed(Vector4 *pVertices = vertices)
            vb = infra.GlContext.Create.Buffer(BufferTarget.Array, vertices.Length * sizeof(Vector4), BufferUsageHint.StaticDraw, (IntPtr)pVertices);

            vao = infra.GlContext.Create.VertexArray();
            vao.SetVertexAttributeF(0, vb, VertexAttributeDimension.Four, VertexAttribPointerType.Float, false, sizeof(Vector4), 0);

            drawSpotFramebuffer = infra.GlContext.Create.Framebuffer();
        }
Exemplo n.º 2
0
 public SceneRendererFactory(IGraphicsInfra infra, ISkyboxDrawer skyboxDrawer,
                             IVisualElementHandlerContainer handlerContainer, IBlurDrawer blurDrawer,
                             ISketchDrawer sketchDrawer, IVeilDrawer veilDrawer, IHighlightDrawer highlightDrawer)
 {
     this.infra            = infra;
     this.skyboxDrawer     = skyboxDrawer;
     this.handlerContainer = handlerContainer;
     this.blurDrawer       = blurDrawer;
     this.sketchDrawer     = sketchDrawer;
     this.veilDrawer       = veilDrawer;
     this.highlightDrawer  = highlightDrawer;
 }
Exemplo n.º 3
0
        public SceneRenderer(IGraphicsInfra infra, ISkyboxDrawer skyboxDrawer, 
            IVisualElementHandlerContainer handlerContainer, IBlurDrawer blurDrawer, 
            ISketchDrawer sketchDrawer, IVeilDrawer veilDrawer, IHighlightDrawer highlightDrawer)
        {
            this.infra = infra;
            this.skyboxDrawer = skyboxDrawer;
            this.handlerContainer = handlerContainer;
            this.blurDrawer = blurDrawer;
            this.sketchDrawer = sketchDrawer;
            this.veilDrawer = veilDrawer;
            this.highlightDrawer = highlightDrawer;

            regularQueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            focusedQueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            overlayQueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            opaqueSubqueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            transparentSubqueue= new List<Tuple3<RenderQueueItem, IVisualElementHandler, float>>();
        }