private GeosphereDemo(IntPtr hInstance) : base(hInstance) { MainWindowCaption = "Geosphere Demo"; _lastMousePos = new Point(); _camera = new LookAtCamera(); _camera.LookAt(new Vector3(0, 2, -15), new Vector3(), Vector3.UnitY); _dirLights = new[] { new DirectionalLight { Ambient = new Color4( 0.2f, 0.2f, 0.2f), Diffuse = new Color4(0.7f, 0.7f, 0.7f), Specular = new Color4(0.8f, 0.8f, 0.8f), Direction = new Vector3(-0.57735f, -0.57735f, 0.57735f) }, new DirectionalLight { Ambient = new Color4(0,0,0), Diffuse = new Color4(1.0f, 0.4f, 0.4f, 0.4f), Specular = new Color4(1.0f, 0.2f, 0.2f, 0.2f), Direction = new Vector3(-0.707f, -0.707f, 0) }, new DirectionalLight { Ambient = new Color4(0,0,0), Diffuse = new Color4(1.0f,0.2f, 0.2f, 0.2f), Specular = new Color4(0.2f,0.2f,0.2f), Direction = new Vector3(0, 0, -1) } }; }
public CameraDemo(IntPtr hInstance) : base(hInstance) { _lightCount = 3; Enable4XMsaa = true; MainWindowCaption = "Camera Demo"; _lastMousePos = new Point(); _useFpsCamera = true; _cam = new FpsCamera { Position = new Vector3(0, 2, -15) }; _cam2 = new LookAtCamera(); _cam2.LookAt(new Vector3(0, 2, -15), new Vector3(), Vector3.UnitY); _gridWorld = Matrix.Identity; _boxWorld = Matrix.Scaling(3.0f, 1.0f, 3.0f) * Matrix.Translation(0, 0.5f, 0); _skullWorld = Matrix.Scaling(0.5f, 0.5f, 0.5f) * Matrix.Translation(0, 1.0f, 0); for (var i = 0; i < 5; i++) { _cylWorld[i * 2] = Matrix.Translation(-5.0f, 1.5f, -10.0f + i * 5.0f); _cylWorld[i * 2 + 1] = Matrix.Translation(5.0f, 1.5f, -10.0f + i * 5.0f); _sphereWorld[i * 2] = Matrix.Translation(-5.0f, 3.5f, -10.0f + i * 5.0f); _sphereWorld[i * 2 + 1] = Matrix.Translation(5.0f, 3.5f, -10.0f + i * 5.0f); } _dirLights = new[] { new DirectionalLight { Ambient = new Color4( 0.2f, 0.2f, 0.2f), Diffuse = new Color4(0.5f, 0.5f, 0.5f), Specular = new Color4(0.5f, 0.5f, 0.5f), Direction = new Vector3(0.57735f, -0.57735f, 0.57735f) }, new DirectionalLight { Ambient = new Color4(0,0,0), Diffuse = new Color4(1.0f, 0.2f, 0.2f, 0.2f), Specular = new Color4(1.0f, 0.25f, 0.25f, 0.25f), Direction = new Vector3(-0.57735f, -0.57735f, 0.57735f) }, new DirectionalLight { Ambient = new Color4(0,0,0), Diffuse = new Color4(1.0f,0.2f, 0.2f, 0.2f), Specular = new Color4(0,0,0), Direction = new Vector3(0, -0.707f, -0.707f) } }; _gridMat = new Material { Ambient = new Color4(0.8f, 0.8f, 0.8f), Diffuse = new Color4(0.8f, 0.8f, 0.8f), Specular = new Color4(16.0f, 0.8f, 0.8f, 0.8f) }; _cylinderMat = new Material { Ambient = Color.White, Diffuse = Color.White, Specular = new Color4(16.0f, 0.8f, 0.8f, 0.8f) }; _sphereMat = new Material { Ambient = new Color4(0.6f, 0.8f, 0.9f), Diffuse = new Color4(0.6f, 0.8f, 0.9f), Specular = new Color4(16.0f, 0.9f, 0.9f, 0.9f) }; _boxMat = new Material { Ambient = Color.White, Diffuse = Color.White, Specular = new Color4(16.0f, 0.8f, 0.8f, 0.8f) }; _skullMat = new Material { Ambient = new Color4(0.4f, 0.4f, 0.4f), Diffuse = new Color4(0.8f, 0.8f, 0.8f), Specular = new Color4(16.0f, 0.8f, 0.8f, 0.8f) }; }