예제 #1
0
        public void BindShadowMap(BindableContainer a_bindableContainer)
        {
            if (m_shadowBuffer != null)
            {
                int mapCount = m_light.MapCount;
                for (int i = 0; i < mapCount; ++i)
                {
                    GL.ActiveTexture(TextureUnit.Texture0 + a_bindableContainer.Textures);
                    GL.BindTexture(TextureTarget.Texture2D, m_shadowMap[i]);
                    GL.Uniform1(16 + i, a_bindableContainer.Textures++);

                    Matrix4 view = m_light.GetView(i);
                    Matrix4 proj = m_light.GetProjection(i);

                    Matrix4 viewProj = view * proj;

                    GL.UniformMatrix4(32 + i, false, ref viewProj);

                    GL.Uniform1(48 + i, m_splits[i + 1]);
                }
            }

#if DEBUG_INFO
            Pipeline.GLError("Directional Light: Bind Shadow Map: ");
#endif
        }