Exemplo n.º 1
0
        public void OnRender()
        {
            vao.Bind();
            _shader.Bind();

            Matrix4 lampMatrix = Matrix4.Identity;

            lampMatrix *= Matrix4.CreateScale(0.1f);
            lampMatrix *= Matrix4.CreateTranslation(Position);

            _shader.SetMatrix4("Model", lampMatrix);
            _shader.SetMatrix4("View", Camera.ViewMatrix);
            _shader.SetMatrix4("Projection", Camera.ProjectionMatrix);

            vao.Draw();
        }
Exemplo n.º 2
0
        public void OnRender()
        {
            if (!(Context.CurrentPipeline is ScreenPipeline))
            {
                return;
            }

            vao.Bind();

            _shader.Bind();
            _shader.SetMatrix4("Model", GetModelMatrix());
            SourceTexture.Bind(0);
            _shader.SetInt("screenTexture", 0);

            GraphicsDevice.Default.CullFace = false;
            vao.Draw();
            GraphicsDevice.Default.CullFace = true;
        }
Exemplo n.º 3
0
        public void OnRender()
        {
            //return;

            vao.Bind();
            _shader.Bind();

            _shader.SetMatrix4("View", Camera.GetViewMatrix(Vector3.Zero));
            _shader.SetMatrix4("Projection", Camera.ProjectionMatrix);

            txt.Bind(0);
            _shader.SetInt("Skybox", 0);

            GraphicsDevice.Default.DepthMask = false;
            //GL.DepthFunc(DepthFunction.Equal);
            GraphicsDevice.Default.DepthFunc = DepthFunction.Lequal;
            vao.Draw();
            GraphicsDevice.Default.DepthFunc = DepthFunction.Less;
            GraphicsDevice.Default.DepthMask = true;
        }
Exemplo n.º 4
0
        private void RenderPass2(RenderContext context, Camera camera)
        {
            Pass = DeferredPass.Pass2;
            ObjectManager.PushDebugGroup("OnRender LightShader", this);

            _DefLightShader.Bind();

            GPosition.Bind(TextureUnit.Texture0);
            GNormal.Bind(TextureUnit.Texture1);
            GAlbedoSpec.Bind(TextureUnit.Texture2);
            GMaterial.Bind(TextureUnit.Texture3);

            if (Renderer.Current.UseShadows)
            {
                context.GetPipeline <DirectionalShadowRenderPipeline>().FrameBuffer.GetDestinationTexture().Bind(TextureUnit.Texture4);
                _DefLightShader.SetInt("DirectionalShadowMap", 4);
                context.GetPipeline <PointShadowRenderPipeline>().FrameBuffer.GetDestinationTexture().Bind(TextureUnit.Texture5);
                _DefLightShader.SetInt("PointShadowMap", 5);
            }

            _DefLightShader.SetVector3("ViewPos", camera.Position);
            _DefLightShader.SetFloat("FarPlane", camera.FarPlane);

            // TODO: Move to Pass1
            //_DefLightShader.SetMaterial("material", Material.Default);

            _DefLightShader.BindBlock("LightsArray", context.LightBinding);
            _DefLightShader.SetInt("LightCount", context.LightObjects.Count);

            context.GetPipeline <ForwardRenderPipeline>().FrameBuffer.Bind();
            vao.Bind();
            GL.Disable(EnableCap.DepthTest);
            vao.Draw();
            GL.Enable(EnableCap.DepthTest);

            ObjectManager.PopDebugGroup();
        }