PixelLightAPI  .
SNMRotationFixRoll.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMRotationFixRoll.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 __PLSCENE_SCENENODEMODIFIER_ROTATIONFIXROLL_H__
00024 #define __PLSCENE_SCENENODEMODIFIER_ROTATIONFIXROLL_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Event/EventHandler.h>
00032 #include <PLMath/Vector3.h>
00033 #include "PLScene/Scene/SceneNodeModifiers/SNMTransform.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLScene {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Classes                                               ]
00044 //[-------------------------------------------------------]
00045 /**
00046 *  @brief
00047 *    Scene node modifier class 'correcting' the rotation of a scene node
00048 *
00049 *  @remarks
00050 *    If a scene node has 'full free rotation' there may appear an undesired 'roll' during rotation.
00051 *    This scene node will 'fix' this roll for you. If the up-vector is (0, 1, 0), this will 'flat'
00052 *    the rotation to a rotation on the xz-plane.
00053 */
00054 class SNMRotationFixRoll : public SNMTransform {
00055 
00056 
00057     //[-------------------------------------------------------]
00058     //[ RTTI interface                                        ]
00059     //[-------------------------------------------------------]
00060     pl_class(PLS_RTTI_EXPORT, SNMRotationFixRoll, "PLScene", PLScene::SNMTransform, "Scene node modifier class 'correcting' the rotation of a scene node")
00061         // Attributes
00062         pl_attribute(UpVector,  PLMath::Vector3,    PLMath::Vector3(0.0f, 1.0f, 0.0f),  ReadWrite,  DirectValue,    "Up vector",                                                            "")
00063         pl_attribute(Speed,     float,              5.0f,                               ReadWrite,  DirectValue,    "Fix roll speed, if <=0 rotation is fixed at once and not 'smoothly'",  "Min='0.0'")
00064         // Constructors
00065         pl_constructor_1(ParameterConstructor,  SceneNode&, "Parameter constructor",    "")
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         PLS_API SNMRotationFixRoll(SceneNode &cSceneNode);
00081 
00082         /**
00083         *  @brief
00084         *    Destructor
00085         */
00086         PLS_API virtual ~SNMRotationFixRoll();
00087 
00088 
00089     //[-------------------------------------------------------]
00090     //[ Protected virtual SceneNodeModifier functions         ]
00091     //[-------------------------------------------------------]
00092     protected:
00093         PLS_API virtual void OnActivate(bool bActivate) override;
00094 
00095 
00096     //[-------------------------------------------------------]
00097     //[ Private functions                                     ]
00098     //[-------------------------------------------------------]
00099     private:
00100         /**
00101         *  @brief
00102         *    Called when the scene node modifier needs to be updated
00103         */
00104         void OnUpdate();
00105 
00106 
00107     //[-------------------------------------------------------]
00108     //[ Private event handlers                                ]
00109     //[-------------------------------------------------------]
00110     private:
00111         PLCore::EventHandler<> EventHandlerUpdate;
00112 
00113 
00114 };
00115 
00116 
00117 //[-------------------------------------------------------]
00118 //[ Namespace                                             ]
00119 //[-------------------------------------------------------]
00120 } // PLScene
00121 
00122 
00123 #endif // __PLSCENE_SCENENODEMODIFIER_ROTATIONFIXROLL_H__


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