Beispiel #1
0
        public override void Draw()
        {
            Location = theObjectGame.Location;
//            Orientation = Quaternion.FromRotationMatrix(Matrix4.CreateFromAxisAngle(Vector3.Up,
//                    -theObjectTurret.Orientation.Angle));
            Orientation = RotationHelper.ReverseQuaternion(RotationHelper.GetQuaternionFromDiretion(theObjectTurret.Orientation));
//
//            Orientation = Quaternion.FromRotationMatrix(Matrix4.CreateFromAxisAngle(Vector3.Up,
//                theObjectTurret.Orientation.CalculateAngle(Vector3.Forward)));

            if (modelMatrixOld)
            {
                UpdateModelMatrix();
            }
            defaultProgram["model_matrix"].SetValue(modelMatrix);
            objTurretBase.Draw();
//            Matrix4 towerModelMatrix = (RotationHelper.ReverseQuaternion(RotationHelper.GetQuaternionFromDiretion(-theObjectTurret.OrientationTower))).Matrix4 * modelMatrix;
//            Matrix4 towerModelMatrix = theObjectTurret.OrientQuaternion.Matrix4 * modelMatrix;
//            Matrix4 towerModelMatrix = Matrix4.CreateFromAxisAngle(Vector3.Up, theObjectTurret.OrientationTower.CalculateAngle(Vector3.Forward)) * modelMatrix;
//            Matrix4 towerModelMatrix = Matrix4.CreateFromAxisAngle(Vector3.Up, theObjectTurret.OrientationTower.CalculateAngle(Vector3.Forward)) * modelMatrix;
//            Matrix4 towerModelMatrix = Matrix4.CreateRotationY(theObjectTurret.OrientationTower) * modelMatrix;
            Matrix4 towerModelMatrix = Matrix4.CreateRotationY(theObjectTurret.OrientationTower) * modelMatrix;

            defaultProgram["model_matrix"].SetValue(towerModelMatrix);
            objTurretTower.Draw();
        }
Beispiel #2
0
        public override void Draw()
        {
            Location = theObjectGame.Location;
//            Orientation = RotationHelper.GetQuaternionFromDiretion(theObjectPlayer.Orientation);
            Orientation = RotationHelper.ReverseQuaternion(RotationHelper.GetQuaternionFromDiretion(theObjectPlayer.Orientation));
//            Orientation = Quaternion.FromAxis(theObjectPlayer.Orientation, Vector3.Zero, Vector3.Zero);
//            Orientation = Quaternion.FromRotationMatrix(Matrix4.CreateFromAxisAngle(Vector3.Up,
//                theObjectPlayer.Orientation.CalculateAngle(Vector3.Forward)));

            base.Draw();
        }