예제 #1
0
        public void RenderBeforeChildren(RenderEventArgs arg)
        {
            if (!this.IsInitialized)
            {
                this.Initialize();
            }

            var           method  = this.RenderUnit.Methods[0]; // the only render unit in this node.
            ShaderProgram program = method.Program;

            SingleLineModel lineModel   = this.singleLineModel;
            GlyphServer     glyphServer = lineModel.GetGlyphServer();
            Texture         texture     = glyphServer.GlyphsTexture;

            if (texture != null)
            {
                program.SetUniform("glyphTexture", texture);
            }
            var viewport = new int[4];

            GL.Instance.GetIntegerv((uint)GetTarget.Viewport, viewport);
            ICamera camera     = arg.Camera;
            mat4    projection = camera.GetProjectionMatrix();
            mat4    view       = camera.GetViewMatrix();
            mat4    model      = this.GetModelMatrix();

            program.SetUniform("mvpMat", projection * view * model);
            program.SetUniform("screenSize", new ivec2(viewport[2], viewport[3]));
            program.SetUniform("lineSize", new vec2(lineModel.LineWidth, lineModel.LineHeight));
            program.SetUniform("textColor", this.textColor);
            program.SetUniform("backgroundColor", Color.SkyBlue.ToVec4());
            program.SetUniform("fontSize", this.fontSize);

            method.Render();
        }
예제 #2
0
 private SingleLineNode(SingleLineModel model, params RenderMethodBuilder[] builders)
     : base(model, builders)
 {
     this.singleLineModel = model;
 }