PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMScaleKeyframeAnimation.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_SCALEKEYFRAMEANIMATION_H__ 00024 #define __PLSCENE_SCENENODEMODIFIER_SCALEKEYFRAMEANIMATION_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Event/EventHandler.h> 00032 #include "PLScene/Scene/SceneNodeModifiers/SNMTransform.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Forward declarations ] 00037 //[-------------------------------------------------------] 00038 namespace PLCore { 00039 class Chunk; 00040 } 00041 namespace PLRenderer { 00042 class Animation; 00043 } 00044 00045 00046 //[-------------------------------------------------------] 00047 //[ Namespace ] 00048 //[-------------------------------------------------------] 00049 namespace PLScene { 00050 00051 00052 //[-------------------------------------------------------] 00053 //[ Classes ] 00054 //[-------------------------------------------------------] 00055 /** 00056 * @brief 00057 * Keyframe scale animation scene node modifier class 00058 * 00059 * @remarks 00060 * Animates the scale of the scene nodes over time using keyframes. 00061 */ 00062 class SNMScaleKeyframeAnimation : public SNMTransform { 00063 00064 00065 //[-------------------------------------------------------] 00066 //[ Public definition ] 00067 //[-------------------------------------------------------] 00068 public: 00069 /** 00070 * @brief 00071 * Scene node modifier flags (SceneNodeModifier flags extension) 00072 */ 00073 enum EFlags { 00074 PlaybackNoLoop = 1<<2, /**< No loop animation */ 00075 PlaybackPingPong = 1<<3 /**< Ping pong animation */ 00076 }; 00077 pl_enum(EFlags) 00078 pl_enum_base(SNMTransform::EFlags) 00079 pl_enum_value(PlaybackNoLoop, "No loop animation") 00080 pl_enum_value(PlaybackPingPong, "Ping pong animation") 00081 pl_enum_end 00082 00083 00084 //[-------------------------------------------------------] 00085 //[ RTTI interface ] 00086 //[-------------------------------------------------------] 00087 pl_class(PLS_RTTI_EXPORT, SNMScaleKeyframeAnimation, "PLScene", PLScene::SNMTransform, "Keyframe scale animation scene node modifier class") 00088 // Attributes 00089 pl_attribute(Speed, float, 1.0f, ReadWrite, DirectValue, "Animation playback speed", "") 00090 pl_attribute(FramesPerSecond, PLCore::uint32, 24, ReadWrite, DirectValue, "Frames per second", "") 00091 pl_attribute(Keys, PLCore::String, "", ReadWrite, GetSet, "Scale keys (x, y and z) chunk filename", "") 00092 // Overwritten SceneNodeModifier attributes 00093 pl_attribute(Flags, pl_flag_type(EFlags), 0, ReadWrite, GetSet, "Flags", "") 00094 // Constructors 00095 pl_constructor_1(ParameterConstructor, SceneNode&, "Parameter constructor", "") 00096 pl_class_end 00097 00098 00099 //[-------------------------------------------------------] 00100 //[ Public RTTI get/set functions ] 00101 //[-------------------------------------------------------] 00102 public: 00103 PLS_API PLCore::String GetKeys() const; 00104 PLS_API void SetKeys(const PLCore::String &sValue); 00105 00106 00107 //[-------------------------------------------------------] 00108 //[ Public functions ] 00109 //[-------------------------------------------------------] 00110 public: 00111 /** 00112 * @brief 00113 * Constructor 00114 * 00115 * @param[in] cSceneNode 00116 * Owner scene node 00117 */ 00118 PLS_API SNMScaleKeyframeAnimation(SceneNode &cSceneNode); 00119 00120 /** 00121 * @brief 00122 * Destructor 00123 */ 00124 PLS_API virtual ~SNMScaleKeyframeAnimation(); 00125 00126 /** 00127 * @brief 00128 * Returns the chunk holding the keyframe data 00129 * 00130 * @return 00131 * The chunk holding the keyframe data 00132 */ 00133 PLS_API PLCore::Chunk &GetChunk(); 00134 00135 /** 00136 * @brief 00137 * Returns the animation controller 00138 * 00139 * @return 00140 * The animation controller 00141 */ 00142 PLS_API PLRenderer::Animation &GetAnimation(); 00143 00144 00145 //[-------------------------------------------------------] 00146 //[ Protected virtual SceneNodeModifier functions ] 00147 //[-------------------------------------------------------] 00148 protected: 00149 PLS_API virtual void OnActivate(bool bActivate) override; 00150 00151 00152 //[-------------------------------------------------------] 00153 //[ Private functions ] 00154 //[-------------------------------------------------------] 00155 private: 00156 /** 00157 * @brief 00158 * Called when the scene node modifier needs to be updated 00159 */ 00160 void OnUpdate(); 00161 00162 00163 //[-------------------------------------------------------] 00164 //[ Private event handlers ] 00165 //[-------------------------------------------------------] 00166 private: 00167 PLCore::EventHandler<> EventHandlerUpdate; 00168 00169 00170 //[-------------------------------------------------------] 00171 //[ Private data ] 00172 //[-------------------------------------------------------] 00173 private: 00174 PLCore::String m_sKeys; /**< Scale keys (x, y and z) chunk filename */ 00175 PLCore::Chunk *m_pChunk; /**< Chunk holding the keyframe data, always valid! */ 00176 PLRenderer::Animation *m_pAnimation; /**< Animation, always valid! */ 00177 00178 00179 }; 00180 00181 00182 //[-------------------------------------------------------] 00183 //[ Namespace ] 00184 //[-------------------------------------------------------] 00185 } // PLScene 00186 00187 00188 #endif // __PLSCENE_SCENENODEMODIFIER_SCALEKEYFRAMEANIMATION_H__
|