PixelLightAPI  .
SNMPositionRandomAnimation.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMPositionRandomAnimation.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 __PLSCENE_SCENENODEMODIFIER_POSITIONRANDOMANIMATION_H__
00024 #define __PLSCENE_SCENENODEMODIFIER_POSITIONRANDOMANIMATION_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 *    Random position animation scene node modifier class
00048 *
00049 *  @remarks
00050 *    Animates the position of the scene nodes over time.
00051 */
00052 class SNMPositionRandomAnimation : public SNMTransform {
00053 
00054 
00055     //[-------------------------------------------------------]
00056     //[ RTTI interface                                        ]
00057     //[-------------------------------------------------------]
00058     pl_class(PLS_RTTI_EXPORT, SNMPositionRandomAnimation, "PLScene", PLScene::SNMTransform, "Random position animation scene node modifier class")
00059         // Attributes
00060         pl_attribute(Speed,         float,              1.0f,                   ReadWrite,  DirectValue,    "Animation speed",                                                  "")
00061         pl_attribute(Radius,        float,              10.0f,                  ReadWrite,  DirectValue,    "Animation radius",                                                 "")
00062         pl_attribute(FixPosition,   PLMath::Vector3,    PLMath::Vector3::Zero,  ReadWrite,  DirectValue,    "Position, if default, the initial scene node position is used",    "")
00063         // Constructors
00064         pl_constructor_1(ParameterConstructor,  PLScene::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 SNMPositionRandomAnimation(SceneNode &cSceneNode);
00080 
00081         /**
00082         *  @brief
00083         *    Destructor
00084         */
00085         PLS_API virtual ~SNMPositionRandomAnimation();
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         float m_fTimer; /**< Animation timer */
00118 
00119 
00120 };
00121 
00122 
00123 //[-------------------------------------------------------]
00124 //[ Namespace                                             ]
00125 //[-------------------------------------------------------]
00126 } // PLScene
00127 
00128 
00129 #endif // __PLSCENE_SCENENODEMODIFIER_POSITIONRANDOMANIMATION_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