PixelLightAPI  .
SNMEgoOrbitingController.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMEgoOrbitingController.h                     *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLENGINE_CONTROLLER_SNMEGOORBITINGCONTROLLER_H__
00024 #define __PLENGINE_CONTROLLER_SNMEGOORBITINGCONTROLLER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLEngine/Controller/SNMOrbitingController.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLEngine {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Scene node modifier class rotating a scene node towards a target scene node using an input controller with 3D restriction
00046 *
00047 *  @remarks
00048 *    When using the unchanged virtual standard controller:
00049 *    Hold the left mouse button to rotate, the right mouse button to zoom and the middle mouse button to pan.
00050 *
00051 *  @note
00052 *    - Primary intended for rapid prototyping
00053 *    - Restricted 3D rotation via Euler angles
00054 *    - The up-vector is automatically calculated by using the set scene node rotation quaternion
00055 */
00056 class SNMEgoOrbitingController : public SNMOrbitingController {
00057 
00058 
00059     //[-------------------------------------------------------]
00060     //[ RTTI interface                                        ]
00061     //[-------------------------------------------------------]
00062     pl_class(PL_RTTI_EXPORT, SNMEgoOrbitingController, "PLEngine", PLEngine::SNMOrbitingController, "Scene node modifier class rotating a scene node towards a target scene node using an input controller with 3D restriction")
00063         // Attributes
00064         pl_attribute(UpVector,      PLMath::Vector3,    PLMath::Vector3(0.0f, 1.0f, 0.0f),  ReadWrite,  DirectValue,    "Up vector",                                                                                                            "")
00065         pl_attribute(RollFactor,    float,              0.25f,                              ReadWrite,  DirectValue,    "Roll factor. If there's an absolute z-axis (e.g. when using a 3D mouse), apply roll -> looks & feels more natural.",   "")
00066         // Constructors
00067         pl_constructor_1(ParameterConstructor,  PLScene::SceneNode&,    "Parameter constructor",    "")
00068         // Slots
00069         pl_slot_0(OnRotation,   "Called when the scene node rotation changed",  "")
00070     pl_class_end
00071 
00072 
00073     //[-------------------------------------------------------]
00074     //[ Public functions                                      ]
00075     //[-------------------------------------------------------]
00076     public:
00077         /**
00078         *  @brief
00079         *    Constructor
00080         *
00081         *  @param[in] cSceneNode
00082         *    Owner scene node
00083         */
00084         PL_API SNMEgoOrbitingController(PLScene::SceneNode &cSceneNode);
00085 
00086         /**
00087         *  @brief
00088         *    Destructor
00089         */
00090         PL_API virtual ~SNMEgoOrbitingController();
00091 
00092 
00093     //[-------------------------------------------------------]
00094     //[ Protected virtual PLScene::SceneNodeModifier functions ]
00095     //[-------------------------------------------------------]
00096     protected:
00097         PL_API virtual void OnActivate(bool bActivate) override;
00098 
00099 
00100     //[-------------------------------------------------------]
00101     //[ Protected virtual SNMEgoOrbitingController functions  ]
00102     //[-------------------------------------------------------]
00103     protected:
00104         PL_API virtual void OnUpdate() override;
00105 
00106 
00107     //[-------------------------------------------------------]
00108     //[ Private functions                                     ]
00109     //[-------------------------------------------------------]
00110     private:
00111         /**
00112         *  @brief
00113         *    Called when the scene node rotation changed
00114         */
00115         void OnRotation();
00116 
00117 
00118     //[-------------------------------------------------------]
00119     //[ Private data                                          ]
00120     //[-------------------------------------------------------]
00121     private:
00122         PLMath::Vector3 m_vUpVector;    /**< Up vector */
00123         float           m_fPitch;       /**< X rotation axis: Pitch (also called 'bank') change is moving the nose down and the tail up (or vice-versa) - in degree [-89.9, 89.9] */
00124         float           m_fYaw;         /**< Y rotation axis: Yaw (also called 'heading') change is turning to the left or right - in degree [0, 360] */
00125         bool            m_bListen;      /**< Listen to rotation signals? */
00126 
00127 
00128 };
00129 
00130 
00131 //[-------------------------------------------------------]
00132 //[ Namespace                                             ]
00133 //[-------------------------------------------------------]
00134 } // PLEngine
00135 
00136 
00137 #endif // __PLENGINE_CONTROLLER_SNMEGOORBITINGCONTROLLER_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:02
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported