public GLScene() { InitializeComponent(); my_UpdateShader = false; my_GenerateGeometries = false; my_Geometries = new List <GLGeometry>(); my_LightCount = 0; my_UpdateLights = false; my_Lights = new List <GLLight>(); //Set a default Light GLLight l1 = new GLLight(LightType.DirectionalLight) { Direction = new Vector3D(-0.5, -0.5, -3.0), Ambient = Color.FromRgb(255, 255, 255), Diffuse = Color.FromRgb(255, 255, 255), Specular = Color.FromRgb(255, 255, 255) }; AddLight(l1); my_Background = Colors.Black; //Set the default camera my_CamStartPos = new Vector3D(0.0, 0.0, 10.0); my_CamStartTarget = new Vector3D(0.0, 0.0, 0.0); my_CamStartUpDir = new Vector3D(0.0, 1.0, 0.0); my_Camera = new FixedCamera(my_CamStartPos, my_CamStartTarget, my_CamStartUpDir); MousebuttonDown = false; MouseSensitivity = 0.5; SceneIsLoaded = false; }
/// <summary> /// Adds a Light to the scene. /// <para>All the Lights parameters are set on the fragment shader at the next render pass.</para> /// </summary> /// <param name="light">A GLLight or derived class.</param> public void AddLight(GLLight light) { light.Index = my_LightCount; my_Lights.Add(light); my_LightCount++; my_UpdateLights = true; }