Ejemplo n.º 1
0
        protected override void DoInitialize()
        {
            base.DoInitialize();

            this.vVertexBuffer = this.RenderUnit.Model.GetVertexAttributeBuffer(SlicesModel.position);

            var    bmp     = new Bitmap(1, 1);
            var    bmpG    = Graphics.FromImage(bmp);
            var    font    = new Font("Arial", 256, GraphicsUnit.Pixel);
            string text    = "煮";
            SizeF  bigSize = bmpG.MeasureString(text, font);
            var    bitmap  = new Bitmap((int)Math.Ceiling(bigSize.Width), (int)Math.Ceiling(bigSize.Height));

            using (var g = Graphics.FromImage(bitmap))
            { g.DrawString(text, font, Brushes.White, 0, 0); }
            Texture volume = AmberLoader.Load(bitmap);

            volume.TextureUnitIndex = 0;
            Texture lut = TransferFunctionLoader.Load();

            lut.TextureUnitIndex = 1;

            {
                RenderMethod  method  = this.RenderUnit.Methods[(int)RenderMode.Default];
                ShaderProgram program = method.Program;
                program.SetUniform("volume", volume);
            }
            {
                RenderMethod  method  = this.RenderUnit.Methods[(int)RenderMode.Classification];
                ShaderProgram program = method.Program;
                program.SetUniform("volume", volume);
                program.SetUniform("lut", lut);
            }
        }
Ejemplo n.º 2
0
        protected override void DoInitialize()
        {
            base.DoInitialize();

            this.vVertexBuffer = this.model.GetVertexAttributeBuffer(SlicesModel.position);

            Texture volume = Engine256Loader.Load();

            volume.TextureUnitIndex = 0;
            Texture lut = TransferFunctionLoader.Load();

            lut.TextureUnitIndex = 1;

            {
                RenderUnit    unit    = this.RenderUnits[(int)RenderMode.Default];
                ShaderProgram program = unit.Program;
                program.SetUniform("volume", volume);
            }
            {
                RenderUnit    unit    = this.RenderUnits[(int)RenderMode.Classification];
                ShaderProgram program = unit.Program;
                program.SetUniform("volume", volume);
                program.SetUniform("lut", lut);
            }
        }