Exemplo n.º 1
0
        public override void Load()
        {
            /* create camera */

            _testCamera = new Camera(MathHelper.DegreesToRadians(45.0f), 3.0f / 2.0f, 1.00f, 1000.0f);
            _testCamera.Position = new Vector3(0.0f, 10.0f, 10.0f);

            AddGameObject(_testCamera);
            SetCurrentCamera(_testCamera.CameraComponent);

            ShaderProgram.SetAmbientColor(new Vector4(0.5f, 0.5f, 0.5f, 1.0f));

            /* add a point light */

            var pointlight = new PointLight();
            pointlight.Ambient = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            pointlight.Diffuse = new Vector4(1.0f, 1.0f, 0.8f, 1.0f);

            _testLight = new LightObject(pointlight);
            _testLight.Position = new Vector3(0, 500, 0);
            AddGameObject(_testLight);

            SetCurrentLight(_testLight.LightComponent);

            /* add some test cubes */

            _testCube = new Cube(1.0f, 1.0f, 1.0f);
            _testCube.Material.Ambient = new Vector4(0.1f, 0.1f, 0.1f, 0.0f);
            _testCube.Material.Diffuse = new Vector4(1.0f, 0.0f, 0.0f, 0.0f);
            _testCube.Position = new Vector3(0.0f, 0.0f, 0.0f);

            AddGameObject(_testCube);

            /* let the camera follow the testcube */
            _testCamera.CameraComponent.Target = _testCube.Position;

            var floor = new Cube(10.0f, 1.0f, 10.0f);
            floor.Position = new Vector3(0.0f, -1.0f, 0.0f);
            floor.Material.Ambient = new Vector4(0.1f, 0.1f, 0.1f, 0.0f);
            floor.Material.Diffuse = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);

            AddGameObject(floor);

            for (int i = 0; i < 10; i++)
            {
                var cube = new Cube(1.0f, 1.0f, 1.0f);
                cube.Material.Ambient = new Vector4(0.1f, 0.1f, 0.1f, 0);
                cube.Material.Diffuse = new Vector4(i / 10.0f, i / 10.0f, i / 10.0f, 0);

                cube.Position = new Vector3(4.5f, 0.0f, -4.5f + i);

                AddGameObject(cube);
            }
        }
Exemplo n.º 2
0
        private void MaterialDlg_Load(object sender, EventArgs e)
        {
            if (_pointLight == null) _pointLight = new PointLight();

            ShowColors();
        }