예제 #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
        public ForwardRender()
        {
            _glContext = GL.GetCurrent(true);
            _graphics  = Graphics.GetCurrent(true);

            ScreenSize = _graphics.ScreenSize;
        }
예제 #3
0
파일: MeshRenderer.cs 프로젝트: xorza/NetGL
        public MeshRenderer()
        {
            _glContext = GL.GetCurrent(true);
            _graphics  = Graphics.GetCurrent(true);
            _sharedMeshVaoCollection = _graphics.MeshVaoCollection;
            _vao        = null;
            _isDisposed = false;

            Assert.NotNull(_glContext);
            Assert.NotNull(_graphics);
            Assert.NotNull(_sharedMeshVaoCollection);
        }
예제 #4
0
        public DeferredRender()
        {
            _glContext = GL.GetCurrent(true);
            _graphics  = Graphics.GetCurrent(true);

            var shader = new ShaderProgram();

            shader.Code         = Resources.Deferred_2pass;
            _secondPassMaterial = new Material(shader, RenderQueue.CustomShaderOpaque);

            ScreenSize = _graphics.ScreenSize;
        }