コード例 #1
0
ファイル: Light.cs プロジェクト: Etny/Yahtzee-Quest
 public virtual void CalculateShadows(FrameBuffer fb, Shader depthShader, Action <Shader> render)
 {
     fb.BindTexture(ShadowMap, GLEnum.DepthAttachment);
     depthShader.SetMat4("lightSpace", LightSpace);
     Util.GLClear();
     render(depthShader);
 }
コード例 #2
0
ファイル: Light.cs プロジェクト: Etny/Yahtzee-Quest
        public override void CalculateShadows(FrameBuffer fb, Shader shader, Action <Shader> render)
        {
            shader.SetVec3("lightPos", Position);

            for (int i = 0; i < 6; i++)
            {
                fb.BindTexture(ShadowMap, GLEnum.DepthAttachment, GLEnum.TextureCubeMapPositiveX + i);
                Util.GLClear();
                shader.SetMat4("lightSpace", LightSpace * CubeLookAts[i]);
                render(shader);
            }
        }
コード例 #3
0
        public FrameBuffer Render(FrameBuffer renderFrameBuffer)
        {
            Texture renderTexture = renderFrameBuffer.BoundTexture;

            if (postProcessShaders.Count <= 0)
            {
                return(renderFrameBuffer);
            }


            var destination = texture2;
            var source      = renderTexture;

            for (int i = 0; i < postProcessShaders.Count; i++)
            {
                Shader shader     = postProcessShaders[i];
                bool   lastShader = i >= postProcessShaders.Count - 1;

                if (!lastShader)
                {
                    postProBuffer.Use();
                    postProBuffer.BindTexture(destination);
                }
                else
                {
                    renderFrameBuffer.Use();
                }

                //Util.GLClear();
                source.BindToUnit(0);
                QuadMesh.ScreenQuad.Draw(shader);

                if (lastShader)
                {
                    break;
                }

                if (i == 0)
                {
                    source = texture1;
                }

                var temp = destination;
                destination = source;
                source      = temp;
            }

            return(renderFrameBuffer);
        }