Пример #1
0
        //Load resources
        private bool Load()
        {
            _camera          = new FreeLookCamera(Width, Height);
            _camera.Position = new Vector3(0, 1, 0);

            string data = Path.Combine(System.Windows.Forms.Application.StartupPath, "Data") + @"\";

            GL.Enable(EnableCap.CullFace);

            _crate = new Texture2D(data + "crate001.jpg");
            _blub  = new Texture2D(data + "blub.png");

            _gbuffer = new GBuffer();
            _gbuffer.Init(Width, Height);

            _cube   = new Cube();
            _sphere = new Sphere(1f, 25, 25);
            _quad   = new Quad();
            _fsQuad = new FullscreenQuad();

            _geomShader   = new GeomShader(data);
            _pointShader  = new PointLightShader(data);
            _flatShader   = new FlatShader(data);
            _finalCombine = new FinalCombineShader(data);

            _boxes = new List <Box>();
            //Setup scene boxes
            _boxes.Add(new Box(new Vector3(0, 1f, 0), new Vector3(0, 0, 0), new Vector3(1, 1f, 1)));
            _boxes.Add(new Box(new Vector3(0, -1f, 0), new Vector3(0, 0, 0), new Vector3(10, 1f, 10)));

            //Setup lights
            _pointLights = new List <PointLight>();
            _pointLights.Add(new PointLight(new Vector3(0, 2.5f, 0), 10, new Vector3(1, 1, 1), 1));
            _pointLights.Add(new PointLight(new Vector3(3, 2.5f, 3), 5, new Vector3(0, 0, 1), 2));

            return(true);
        }
Пример #2
0
        //Load resources
        private bool Load()
        {
            _camera = new FreeLookCamera(Width, Height);
            _camera.Position = new Vector3(0, 1, 0);

            string data = Path.Combine(System.Windows.Forms.Application.StartupPath, "Data") + @"\";

            GL.Enable(EnableCap.CullFace);

            _crate = new Texture2D(data + "crate001.jpg");
            _blub = new Texture2D(data + "blub.png");

            _gbuffer = new GBuffer();
            _gbuffer.Init(Width, Height);

            _cube = new Cube();
            _sphere = new Sphere(1f, 25, 25);
            _quad = new Quad();
            _fsQuad = new FullscreenQuad();

            _geomShader = new GeomShader(data);
            _pointShader = new PointLightShader(data);
            _flatShader = new FlatShader(data);
            _finalCombine = new FinalCombineShader(data);

            _boxes = new List<Box>();
            //Setup scene boxes
            _boxes.Add(new Box(new Vector3(0, 1f, 0), new Vector3(0, 0, 0), new Vector3(1, 1f, 1)));
            _boxes.Add(new Box(new Vector3(0, -1f, 0), new Vector3(0, 0, 0), new Vector3(10, 1f, 10)));

            //Setup lights
            _pointLights = new List<PointLight>();
            _pointLights.Add(new PointLight(new Vector3(0, 2.5f, 0), 10, new Vector3(1, 1, 1), 1));
            _pointLights.Add(new PointLight(new Vector3(3, 2.5f, 3), 5, new Vector3(0, 0, 1), 2));

            return true;
        }