/// <summary> /// Copies over the light properties of the newLightProperties into the i-th /// light parameters of the class /// </summary> /// <param name="i"> copies into the i-th light parameters of the instance </param> /// <param name="newLightProperties"> the properties to be copied </param> public void CopyLightParameters(int i, LightParameters newLightProperties) { if (i < NumLights) { lights[i].Copy(newLightProperties); } else { throw new IndexOutOfRangeException(); } }
/// <summary> /// copy from another LightParameter to this /// </summary> /// <param name="other"> copy from another light params to this </param> public void Copy(LightParameters other) { position.Copy(other.position); intensities.Copy(other.intensities); coneDirection.Copy(other.intensities); attenuation = other.attenuation; ambientCoefficient = other.ambientCoefficient; coneAngle = other.coneAngle; exponent = other.exponent; type = other.type; attenuationType = other.attenuationType; status = other.status; }
/// <summary> /// Initialize the graphics manager /// </summary> public static void Init(Camera activeCamera) { ActiveCamera = activeCamera; ParticleSystemManager.Init(); UIManagerSpriteRenderer.Init(); // initialize with 20 lights; to change the number of lights, need to change it in the shader manually too ActiveLightSystem = new Light(20); { LightParameters light0 = ActiveLightSystem.GetLightParameters(0); light0.UseDirectionalPreset(); light0.intensities = new Vector4(1.3f, 1.2f, 1.0f, 0); light0.status = LightParameters.STATUS_ON; light0.position = Vector4.Normalize(new Vector4(-1, 1, 0, 0)); } { LightParameters light1 = ActiveLightSystem.GetLightParameters(1); light1.UseDirectionalPreset(); light1.status = LightParameters.STATUS_ON; light1.intensities = new Vector4(0.8f, 0.8f, 0.8f, 0); light1.position = Vector4.Normalize(new Vector4(1, -1, 0, 0)); } { LightParameters light2 = ActiveLightSystem.GetLightParameters(2); light2.UseDirectionalPreset(); light2.status = LightParameters.STATUS_ON; light2.intensities = new Vector4(1.2f, 1.2f, 1.2f, 0); light2.position = Vector4.Normalize(new Vector4(-1, 0, 1, 0)); } { LightParameters light3 = ActiveLightSystem.GetLightParameters(3); light3.UseDirectionalPreset(); light3.status = LightParameters.STATUS_ON; light3.intensities = new Vector4(1.3f, 1.3f, 1.3f, 0); light3.position = Vector4.Normalize(new Vector4(1, 0, -1, 0)); } LoadAllShaders(); ParticleSystems = new List <BaseParticleSystem>(); }