PixelLightAPI  .
SNMEgoLookController.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMEgoLookController.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_SNMEGOLOOKCONTROLLER_H__
00024 #define __PLENGINE_CONTROLLER_SNMEGOLOOKCONTROLLER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLEngine/Controller/SNMLookController.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLEngine {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Scene node rotation input controller modifier class with 3D restriction
00046 *
00047 *  @note
00048 *    - Primary intended for rapid prototyping
00049 *    - Restricted 3D rotation via Euler angles
00050 *    - The up-vector is automatically calculated by using the set scene node rotation quaternion
00051 */
00052 class SNMEgoLookController : public SNMLookController {
00053 
00054 
00055     //[-------------------------------------------------------]
00056     //[ RTTI interface                                        ]
00057     //[-------------------------------------------------------]
00058     pl_class(PL_RTTI_EXPORT, SNMEgoLookController, "PLEngine", PLEngine::SNMLookController, "Scene node rotation input controller modifier class with 3D restriction")
00059         // Attributes
00060         pl_attribute(UpVector,      PLMath::Vector3,    PLMath::Vector3(0.0f, 1.0f, 0.0f),  ReadWrite,  DirectValue,    "Up vector",                                                                                                            "")
00061         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.",   "")
00062         // Constructors
00063         pl_constructor_1(ParameterConstructor,  PLScene::SceneNode&,    "Parameter constructor",    "")
00064         // Slots
00065         pl_slot_0(OnRotation,   "Called when the scene node rotation changed",  "")
00066     pl_class_end
00067 
00068 
00069     //[-------------------------------------------------------]
00070     //[ Public functions                                      ]
00071     //[-------------------------------------------------------]
00072     public:
00073         /**
00074         *  @brief
00075         *    Constructor
00076         *
00077         *  @param[in] cSceneNode
00078         *    Owner scene node
00079         */
00080         PL_API SNMEgoLookController(PLScene::SceneNode &cSceneNode);
00081 
00082         /**
00083         *  @brief
00084         *    Destructor
00085         */
00086         PL_API virtual ~SNMEgoLookController();
00087 
00088 
00089     //[-------------------------------------------------------]
00090     //[ Protected virtual PLScene::SceneNodeModifier functions ]
00091     //[-------------------------------------------------------]
00092     protected:
00093         PL_API virtual void OnActivate(bool bActivate) override;
00094 
00095 
00096     //[-------------------------------------------------------]
00097     //[ Protected virtual SNMLookController functions         ]
00098     //[-------------------------------------------------------]
00099     protected:
00100         PL_API virtual void OnUpdate() override;
00101 
00102 
00103     //[-------------------------------------------------------]
00104     //[ Private functions                                     ]
00105     //[-------------------------------------------------------]
00106     private:
00107         /**
00108         *  @brief
00109         *    Called when the scene node rotation changed
00110         */
00111         void OnRotation();
00112 
00113 
00114     //[-------------------------------------------------------]
00115     //[ Private data                                          ]
00116     //[-------------------------------------------------------]
00117     private:
00118         PLMath::Vector3 m_vUpVector;    /**< Up vector */
00119         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] */
00120         float           m_fYaw;         /**< Y rotation axis: Yaw (also called 'heading') change is turning to the left or right - in degree [0, 360] */
00121         bool            m_bListen;      /**< Listen to rotation signals? */
00122 
00123 
00124 };
00125 
00126 
00127 //[-------------------------------------------------------]
00128 //[ Namespace                                             ]
00129 //[-------------------------------------------------------]
00130 } // PLEngine
00131 
00132 
00133 #endif // __PLENGINE_CONTROLLER_SNMEGOLOOKCONTROLLER_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