예제 #1
0
파일: Window.cs 프로젝트: Dmihawk/Terrain
        public bool Initialise(Dimension size, IntPtr windowHandle)
        {
            var result = true;

            try
            {
                _directX = new DirectX();
                result  &= _directX.Initialise(size, windowHandle);

                _input  = new Input();
                result &= _input.Initialise(size, windowHandle);

                _shaderManager = new ShaderManager();
                result        &= _shaderManager.Initialise(_directX, windowHandle);

                _player = new Player
                {
                    Position = new Coordinate3D <float>(31.0f, 18.0f, 7.0f),
                    Rotation = new Coordinate3D <float>(11.0f, 23.0f, 0.0f)
                };

                _camera = new Camera();
                _camera.SetPosition(new Coordinate3D <float>(0, 0, -10));
                _camera.Render();
                _camera.RenderBaseViewMatrix();

                _frameCounter = new FrameCounter();
                _frameCounter.Initialise();

                _userInterface = new UserInterface();
                result        &= _userInterface.Initialise(_directX, size);

                _terrain = new Terrain();
                result  &= _terrain.Initialise(_directX.Device, "heightmap01.bmp", "dirt03.bmp");

                _groundModel = new Object();
                result      &= _groundModel.Initialise(_directX.Device, "plane01.txt", "rock015.bmp");

                _quadTree = new QuadTree();
                result   &= _quadTree.Initialise(_terrain, _directX.Device);

                _foliage = new Foliage();
                result  &= _foliage.Initialise(_directX.Device, _quadTree, "grass01.bmp", 2500);

                _frustrum = new Frustrum();

                _skyDome = new SkyDome();
                result  &= _skyDome.Initialise(_directX.Device);

                _skyPlane = new SkyPlane();
                result   &= _skyPlane.Initialze(_directX.Device, "cloud001.bmp", "perturb001.bmp");

                return(result);
            }
            catch (Exception ex)
            {
                //Log.WriteToFile(ErrorLevel.Error, "Window.Initialise", ex, true);

                return(false);
            }
        }