public static void SetLightInfo(ShadowInfo info) { GL.UseProgram(Program); Matrix4 mat = info.matrix; GL.UniformMatrix4(lightWVPLocation, false, ref mat); GL.ActiveTexture(TextureUnit.Texture3); GL.BindTexture(TextureTarget.Texture2D, info.texture); }
private static void SetShadowedSpotlights(ShadowInfo[] pLights) { GL.UseProgram(Program); GL.Uniform1(numShadowCastersLocation, pLights.Length); for (int i = 0; i < pLights.Length && i < MAX_SHADOWCASTERS; i++) { GL.Uniform3(shadowcasterLocations[i].Color, pLights[i].Color.X, pLights[i].Color.Y, pLights[i].Color.Z); GL.Uniform1(shadowcasterLocations[i].AmbientIntensity, pLights[i].AmbientIntensity); GL.Uniform1(shadowcasterLocations[i].DiffuseIntensity, pLights[i].DiffuseIntensity); GL.Uniform3(shadowcasterLocations[i].Position, pLights[i].Position.X, pLights[i].Position.Y, pLights[i].Position.Z); Vector3 Direction = pLights[i].Direction; Direction.Normalize(); GL.Uniform3(shadowcasterLocations[i].Direction, Direction.X, Direction.Y, Direction.Z); GL.Uniform1(shadowcasterLocations[i].Cutoff, Math.Cos(ToRadian(pLights[i].Cutoff))); GL.Uniform1(shadowcasterLocations[i].Constant, pLights[i].Constant); GL.Uniform1(shadowcasterLocations[i].Linear, pLights[i].Linear); GL.Uniform1(shadowcasterLocations[i].Exp, pLights[i].Exp); GL.Uniform1(shadowcasterLocations[i].Brightness, pLights[i].brightness); GL.Uniform1(shadowcasterLocations[i].Cheap, pLights[i].Cheap ? 1 : 0 ); } }
public static void AddLightsource(ShadowInfo info) { _lights.Add(info); }