예제 #1
0
        public void SetActiveShader(ShaderProgram shader)
        {
            if (shader == null)
            {
                Logger.LogError(Logger.ErrorState.Critical, "SetActiveShader, no shader given");
                return;
            }
            if (activeProgram != shader)
            {
                activeProgram = shader;
                activeProgram.Use();

                ShaderUniformManager man = ShaderUniformManager.GetSingleton();
                if (man.DoesShaderUseCamera(activeProgram))
                {
                    RenderCamera();
                }
                if (man.DoesShaderUseLights(activeProgram))
                {
                    RenderActiveLights();
                }
                if (man.DoesShaderSupportUniform(activeProgram, ShaderUniformName.CubeMap))
                {
                    MaterialManager matMan = MaterialManager.GetSingleton();
                    matMan.SetFromMaterialToShader(activeSkybox, ShaderUniformName.CubeMap, activeProgram);
                    if (man.DoesShaderSupportUniform(activeProgram, ShaderUniformName.SkyboxRotationMatrix))
                    {
                        int rotLoc = activeProgram.GetUniformLocation(ShaderUniformName.SkyboxRotationMatrix);
                        activeProgram.SetMatrix4Uniform(rotLoc, ref activeSkyboxRotation);
                    }
                }
            }
        }
예제 #2
0
 public void SetToShader(ShaderProgram program, int location)
 {
     program.SetMatrix4Uniform(location, ref matrix);
     Error.checkGLError("Matrix4Uniform.SetToShader " + program.programName + " Matrix: " + name + " to " + location);
 }