PixelLightAPI  .
SNMLookController.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMLookController.h                            *
00003  *
00004  *  Copyright (C) 2002-2012 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_SNMLOOKCONTROLLER_H__
00024 #define __PLENGINE_CONTROLLER_SNMLOOKCONTROLLER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLScene/Scene/SceneNodeModifiers/SNMTransform.h>
00032 #include "PLEngine/PLEngine.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLEngine {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Forward declarations                                  ]
00043 //[-------------------------------------------------------]
00044 class LookController;
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Classes                                               ]
00049 //[-------------------------------------------------------]
00050 /**
00051 *  @brief
00052 *    Scene node rotation input controller modifier class without 3D restriction
00053 *
00054 *  @note
00055 *    - Primary intended for rapid prototyping
00056 *    - Unrestricted 3D rotation via rotation quaternion
00057 *    - Combine this modifier with for example "PLScene::SNMRotationFixRoll" to restrict the
00058 *      rotation or directly use the specialized "PLEngine::SNMEgoLookController"-modifier
00059 */
00060 class SNMLookController : public PLScene::SNMTransform {
00061 
00062 
00063     //[-------------------------------------------------------]
00064     //[ Public definition                                     ]
00065     //[-------------------------------------------------------]
00066     public:
00067         /**
00068         *  @brief
00069         *    Scene node modifier flags (PLScene::SceneNodeModifier flags extension)
00070         */
00071         enum EFlags {
00072             UseRotationKey = 1<<2   /**< If this flag is set, it's required to keep the rotation key pressed in order to rotate */
00073         };
00074         pl_enum(EFlags)
00075             pl_enum_base(PLScene::SNMTransform::EFlags)
00076             pl_enum_value(UseRotationKey, "If this flag is set, it's required to keep the rotation key pressed in order to rotate without 3D restriction")
00077         pl_enum_end
00078 
00079 
00080     //[-------------------------------------------------------]
00081     //[ RTTI interface                                        ]
00082     //[-------------------------------------------------------]
00083     pl_class(PL_RTTI_EXPORT, SNMLookController, "PLEngine", PLScene::SNMTransform, "Scene node rotation input controller modifier class")
00084         // Attributes
00085         pl_attribute(InputSemantic, PLCore::String,         "",             ReadWrite,  DirectValue,    "Semantic of this input controller (e.g. \"Camera\")",  "")
00086             // Overwritten PLScene::SceneNodeModifier attributes
00087         pl_attribute(Flags,         pl_flag_type(EFlags),   UseRotationKey, ReadWrite,  GetSet,         "Flags",                                                "")
00088         // Constructors
00089         pl_constructor_1(ParameterConstructor,  PLScene::SceneNode&,    "Parameter constructor",    "")
00090         // Slots
00091         pl_slot_0(OnUpdate, "Called when the scene node modifier needs to be updated",  "")
00092     pl_class_end
00093 
00094 
00095     //[-------------------------------------------------------]
00096     //[ Public functions                                      ]
00097     //[-------------------------------------------------------]
00098     public:
00099         /**
00100         *  @brief
00101         *    Constructor
00102         *
00103         *  @param[in] cSceneNode
00104         *    Owner scene node
00105         */
00106         PL_API SNMLookController(PLScene::SceneNode &cSceneNode);
00107 
00108         /**
00109         *  @brief
00110         *    Destructor
00111         */
00112         PL_API virtual ~SNMLookController();
00113 
00114 
00115     //[-------------------------------------------------------]
00116     //[ Public virtual PLScene::SceneNodeModifier functions   ]
00117     //[-------------------------------------------------------]
00118     public:
00119         PL_API virtual PLInput::Controller *GetInputController() const override;
00120 
00121 
00122     //[-------------------------------------------------------]
00123     //[ Protected virtual PLScene::SceneNodeModifier functions ]
00124     //[-------------------------------------------------------]
00125     protected:
00126         PL_API virtual void InformedOnInit() override;
00127         PL_API virtual void OnActivate(bool bActivate) override;
00128 
00129 
00130     //[-------------------------------------------------------]
00131     //[ Protected virtual SNMLookController functions         ]
00132     //[-------------------------------------------------------]
00133     protected:
00134         /**
00135         *  @brief
00136         *    Called when the scene node modifier needs to be updated
00137         */
00138         PL_API virtual void OnUpdate();
00139 
00140 
00141     //[-------------------------------------------------------]
00142     //[ Protected data                                        ]
00143     //[-------------------------------------------------------]
00144     protected:
00145         LookController *m_pController;  /**< Look input controller instance, always valid! */
00146 
00147 
00148 };
00149 
00150 
00151 //[-------------------------------------------------------]
00152 //[ Namespace                                             ]
00153 //[-------------------------------------------------------]
00154 } // PLEngine
00155 
00156 
00157 #endif // __PLENGINE_CONTROLLER_SNMLOOKCONTROLLER_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:00
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported