Ejemplo n.º 1
0
        public void Shutdown()
        {
            //_TextureShader?.Shutdown();
            //_TextureShader = null;


            //_DebugWindow?.Shutdown();
            //_DebugWindow = null;

            //_RenderTexture?.Shutdown();
            //_RenderTexture = null;

            _Data = null;
            _Data = null;

            _DataHeader = null;
            _DataHeader = null;

            CpuUsage_?.Shutdown();
            CpuUsage_ = null;



            _AxisMini?.Shutdown();
            _AxisMini = null;

            FontShader_?.Shutdown();
            FontShader_ = null;

            //_Cpu?.Shutdown();
            //_Cpu = null;

            //_Fps = null;

            _Position = null;

            _Timer = null;

            _ColorShader?.Shutdown();
            _ColorShader = null;

            _Camera = null;

            _Direct3D?.Shutdown();
            _Direct3D = null;

            _Input?.Shutdown();
            _Input = null;

            ShutdownButtons();
            return;
        }
Ejemplo n.º 2
0
        public AxisRosette(AxisRosette ax, Device device)
        {
            _Line     = new VectorLine[3];
            _Triangle = new Triangle[3];

            _Line[0] = new VectorLine(ax._Line[0], device);
            _Line[1] = new VectorLine(ax._Line[1], device);
            _Line[2] = new VectorLine(ax._Line[2], device);

            _Triangle[0] = new Triangle(ax._Triangle[0], device);
            _Triangle[1] = new Triangle(ax._Triangle[1], device);
            _Triangle[2] = new Triangle(ax._Triangle[2], device);
        }
Ejemplo n.º 3
0
        public bool Initialize(IntPtr hwnd, int screenWidth, int screenHeight, string path)
        {
            float cameraX, cameraY, cameraZ, rotX, rotY, rotZ;

            screenheight_ = screenHeight;
            screenwidth_  = screenWidth;
            SaveHeight    = screenHeight;
            SaveWidth     = screenWidth;
            _hwnd         = hwnd;
            _Input        = new Input();
            if (!_Input.Initialize(screenWidth, screenHeight))
            {
                MessageBox.Show("Could not initialize the input object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            _Direct3D = new D3DX();
            if (!_Direct3D.Initialize(screenWidth, screenHeight, VSYNC_ENABLED, hwnd, FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR))
            {
                MessageBox.Show("Could not initialize DirectX 11.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            _ColorShader = new ColorShader();
            if (!_ColorShader.Initialize(_Direct3D.Device))
            {
                MessageBox.Show("Could not initialize the color shader object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            _MonoShader = new MonocolorShader();
            if (!_MonoShader.Initialize(_Direct3D.Device))
            {
                MessageBox.Show("Could not initialize the monocolor shader object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            graph = new Graph();
            if (!graph.Initialize(_Direct3D, _DataHeader, _Data, path))
            {
                MessageBox.Show("Could not initialize the graph object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            _AxisMini = new AxisRosette();
            if (!_AxisMini.Initialize(_Direct3D, 30.0f))
            {
                MessageBox.Show("Could not initialize the axis object.", "Error", MessageBoxButtons.OK);
                return(false);
            }
            #region Camera
            _Camera = new Camera
            {
                Position = new Vector3(0.0f, 0.0f, -1.0f)
            };
            _Camera.Render();
            _baseViewMatrix = _Camera._viewMatrix;

            cameraX = 0;
            cameraY = 0;
            cameraZ = 0;

            rotX = 0.0f;
            rotY = 0.0f;
            rotZ = 0.0f;

            _Camera.Position = new Vector3(cameraX, cameraY, cameraZ);
            _Camera.Rotation = new Vector3(rotX, rotY, rotZ);

            _Position = new Position();

            _Position.SetPosition(cameraX, cameraY, cameraZ);
            _Position.SetRotation(rotX, rotY, rotZ);
            _Position.SetOffSet(graph.terrain.Width / 2.0f, 0, graph.terrain.Height / 2.0f);
            _Position.SetRadious(graph.terrain.Width / 2.0f);
            _Position.orbit = true;
            #endregion
            _Timer = new Timer();
            if (!_Timer.Initialize())
            {
                MessageBox.Show("Could not initialize the timer object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            //// Create the fps object.
            //_Fps = new FpsClass;
            //if (!_Fps) return false;
            //_Fps.Initialize();

            //_Cpu = new CpuClass;
            //if (!_Cpu) return false;
            //_Cpu.Initialize();

            if (!InitializeText())
            {
                return(false);
            }

            _DebugLine = new VectorLine();
            if (!_DebugLine.Initialize(_Direct3D.Device))
            {
                return(false);
            }
            _DebugLine.Color = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);

            if (!InitializeButtons())
            {
                return(false);
            }

            //_RenderTexture = new RenderTexture();
            //if (!_RenderTexture.Initialize(_Direct3D.Device, screenWidth, screenHeight)) return false;

            //_DebugWindow = new DebugWindowClass;
            //if (!_DebugWindow) return false;

            //result = _DebugWindow.Initialize(_Direct3D.GetDevice(), screenWidth, screenHeight, 100, 100);
            //if (!result)
            //{
            //    MessageBox.Show("Could not initialize the debug window object.", L"Error", MessageBoxButtons.OK);
            //    return false;
            //}

            //_TextureShader = new TextureShaderClass;
            //if (!_TextureShader) return false;

            //result = _TextureShader.Initialize(_Direct3D.GetDevice(), hwnd);
            //if (!result)
            //{
            //    MessageBox.Show("Could not initialize the texture shader object.", L"Error", MessageBoxButtons.OK);
            //    return false;
            //}
            return(true);
        }