PixelLightAPI  .
SNMRotationMoveDirection.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMRotationMoveDirection.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_ROTATIONMOVEDIRECTION_H__
00024 #define __PLSCENE_SCENENODEMODIFIER_ROTATIONMOVEDIRECTION_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 rotating a scene node into the direction it's moving
00048 *
00049 *  @remarks
00050 *    Rotates the scene node into the movement direction by using the current and
00051 *    previous scene node position.
00052 */
00053 class SNMRotationMoveDirection : public SNMTransform {
00054 
00055 
00056     //[-------------------------------------------------------]
00057     //[ RTTI interface                                        ]
00058     //[-------------------------------------------------------]
00059     pl_class(PLS_RTTI_EXPORT, SNMRotationMoveDirection, "PLScene", PLScene::SNMTransform, "Scene node modifier class rotating a scene node into the direction it's moving")
00060         // Attributes
00061         pl_attribute(Offset,    PLMath::Vector3,    PLMath::Vector3(0.0f, 0.0f, 0.0f),  ReadWrite,  DirectValue,    "Rotation offset to add in degree, [0, 360]",   "")
00062         pl_attribute(UpVector,  PLMath::Vector3,    PLMath::Vector3(0.0f, 1.0f, 0.0f),  ReadWrite,  DirectValue,    "Up vector",                                    "")
00063         // Constructors
00064         pl_constructor_1(ParameterConstructor,  SceneNode&, "Parameter constructor",    "")
00065     pl_class_end
00066 
00067 
00068     //[-------------------------------------------------------]
00069     //[ Public functions                                      ]
00070     //[-------------------------------------------------------]
00071     public:
00072         /**
00073         *  @brief
00074         *    Constructor
00075         *
00076         *  @param[in] cSceneNode
00077         *    Owner scene node
00078         */
00079         PLS_API SNMRotationMoveDirection(SceneNode &cSceneNode);
00080 
00081         /**
00082         *  @brief
00083         *    Destructor
00084         */
00085         PLS_API virtual ~SNMRotationMoveDirection();
00086 
00087 
00088     //[-------------------------------------------------------]
00089     //[ Protected virtual SceneNodeModifier functions         ]
00090     //[-------------------------------------------------------]
00091     protected:
00092         PLS_API virtual void OnActivate(bool bActivate) override;
00093 
00094 
00095     //[-------------------------------------------------------]
00096     //[ Private functions                                     ]
00097     //[-------------------------------------------------------]
00098     private:
00099         /**
00100         *  @brief
00101         *    Called when the scene node modifier needs to be updated
00102         */
00103         void OnUpdate();
00104 
00105 
00106     //[-------------------------------------------------------]
00107     //[ Private event handlers                                ]
00108     //[-------------------------------------------------------]
00109     private:
00110         PLCore::EventHandler<> EventHandlerUpdate;
00111 
00112 
00113     //[-------------------------------------------------------]
00114     //[ Private data                                          ]
00115     //[-------------------------------------------------------]
00116     private:
00117         PLMath::Vector3 m_vLastPos; /**< The last scene node position */
00118 
00119 
00120 };
00121 
00122 
00123 //[-------------------------------------------------------]
00124 //[ Namespace                                             ]
00125 //[-------------------------------------------------------]
00126 } // PLScene
00127 
00128 
00129 #endif // __PLSCENE_SCENENODEMODIFIER_ROTATIONMOVEDIRECTION_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