Esempio n. 1
0
        public MyAirplane(Device d3d, System.Drawing.Font font, Microsoft.DirectX.DirectSound.Device dsound, Landscape l)
        {
            measure.Start();
            d3dxfont   = new Microsoft.DirectX.Direct3D.Font(d3d, font);
            myAirplane = new airplane(d3d);
            landscape  = l;
            idevice    = new InputDevice();
            d3dDevice  = d3d;
            gunshots   = new ShootingClass(d3d, dsound);
            //	didev=di;
            rotation = new Quaternion();
            rotation = Quaternion.Identity;
            rotation.RotateYawPitchRoll((float)Math.PI, 0f, 0f);

            // the airplane starts with 20º angle (landed)
            //	rotation.RotateYawPitchRoll(0, -0.34906585f, 0);

            m_matOrientation = new Matrix();
            m_matOrientation.Translate(0, 0, 0);

            m_vPosition   = new Vector3(1, 1, -10);
            prepos        = m_vPosition;
            m_vVelocity   = new Vector3(0, 0, 0);
            gravityVector = new Vector3(0, 0, 0);
            liftVector    = new Vector3(0, 0, 0);
            trustVector   = new Vector3(0, 0, 0);
            dragVector    = new Vector3(0, 0, 0);
            speedVector   = new Vector3(0, 0, 0);
            mass          = weight / gravity;

            m_matView = new Matrix();
            oldView   = new Matrix();
        }
Esempio n. 2
0
        private void InitializeGraphics()
        {
            m_cullinfo = new CULLINFO();

            InitD3D();

            InitDSound();

            DplayForm dialog = new DplayForm();

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                StartServer();
            }
            else
            {
                InitDirectPlay();
            }
            Cursor.Hide();

            map = new Radar(d3dDevice, this);
            // init objects geometry
            landscape  = new Landscape(d3dDevice);
            myAirplane = new MyAirplane(d3dDevice, this.Font, dsoundDevice, landscape);
            aplane     = new airplane(d3dDevice);

            myAirplane.m_vPosition.X = 22000.0f;
            myAirplane.m_vPosition.Z = 44000.0f;
            myAirplane.m_vPosition.Y = myAirplane.m_vPosition.Y - landscape.Intersect(myAirplane.m_vPosition, new Vector3(0f, -1f, 0f)) + 1.1f;
            myAirplane.prepos        = myAirplane.m_vPosition;

            myhangar = new hangar(d3dDevice);
        }