예제 #1
0
        public PreviewRenderer(Size size)
        {
            _graphics  = Graphics.GetCurrent(true);
            _glContext = _graphics.GLContext;
            _size      = size;

            _renderer = new MeshRenderer();

            _frameBuffer = new Framebuffer(_size, _glContext.MaxSamples);
            _frameBuffer.AddColorRenderbuffer(FramebufferAttachment.ColorAttachment0);
            _frameBuffer.AddDepthRenderbuffer();
            _frameBuffer.CheckStatus(true);

            _lights[0] = new Light()
            {
                Type = LightType.Directional, Position = Vector3.One, Diffuse = Vector3.One, Direction = -Vector3.One.Normalized
            };
            _lights[1] = new Light()
            {
                Type = LightType.Directional, Position = -Vector3.One, Diffuse = Vector3.One, Direction = Vector3.One.Normalized
            };

            _defaultMaterial = new Material(MaterialType.DiffuseColor, ShadingTechnique.Forward, RenderQueue.Opaque);

            BackgroundColor = new Vector4(0);
        }
예제 #2
0
        private void ChangeScreenSize()
        {
            Disposer.Dispose(ref _backbuffer);
            _backbuffer = new Framebuffer(_screenSize, SampleCount);
            _backbuffer.Bind();
            var renderBuffer = _backbuffer.AddColorRenderbuffer(FramebufferAttachment.ColorAttachment0);

            _backbuffer.AddDepthRenderbuffer();
            _backbuffer.CheckStatus(true);

            _renderTechnique.ScreenSize = _screenSize;

            //_uiRender = new UIRender(renderBuffer);
        }