PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMLightRandomAnimation.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_LIGHTRANDOMANIMATION_H__ 00024 #define __PLSCENE_SCENENODEMODIFIER_LIGHTRANDOMANIMATION_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLGraphics/Color/Color3.h> 00032 #include "PLScene/Scene/SceneNodeModifier.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLScene { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Scene node modifier class for a random light color animation 00047 * 00048 * @remarks 00049 * Animates the color of the light scene node over time. 00050 */ 00051 class SNMLightRandomAnimation : public SceneNodeModifier { 00052 00053 00054 //[-------------------------------------------------------] 00055 //[ Public definitions ] 00056 //[-------------------------------------------------------] 00057 public: 00058 /** 00059 * @brief 00060 * Flags (SceneNodeModifier flags extension) 00061 */ 00062 enum EFlags { 00063 Multiply = 1<<2, /**< Multiply the color to the fix color, if not set, the color is added to the fix color */ 00064 NR = 1<<3, /**< Do NOT manipulate the red color component */ 00065 NG = 1<<4, /**< Do NOT manipulate the green color component */ 00066 NB = 1<<5 /**< Do NOT manipulate the blue color component */ 00067 }; 00068 pl_enum(EFlags) 00069 pl_enum_base(SceneNodeModifier::EFlags) 00070 pl_enum_value(Multiply, "Multiply the color to the fix color, if not set, the color is added to the fix color") 00071 pl_enum_value(NR, "Do NOT manipulate the red color component") 00072 pl_enum_value(NG, "Do NOT manipulate the green color component") 00073 pl_enum_value(NB, "Do NOT manipulate the blue color component") 00074 pl_enum_end 00075 00076 00077 //[-------------------------------------------------------] 00078 //[ RTTI interface ] 00079 //[-------------------------------------------------------] 00080 pl_class(PLS_RTTI_EXPORT, SNMLightRandomAnimation, "PLScene", PLScene::SceneNodeModifier, "Scene node modifier class for a random light color animation") 00081 // Properties 00082 pl_properties 00083 pl_property("SceneNodeClass", "PLScene::SNLight") 00084 pl_properties_end 00085 // Attributes 00086 pl_attribute(Speed, float, 2.0f, ReadWrite, DirectValue, "Animation speed", "") 00087 pl_attribute(Radius, float, 0.5f, ReadWrite, DirectValue, "Animation radius", "") 00088 pl_attribute(FixColor, PLGraphics::Color3, PLGraphics::Color3(0.5f, 0.5f, 0.5f), ReadWrite, DirectValue, "Fix color", "") 00089 pl_attribute(Color, PLGraphics::Color3, PLGraphics::Color3(1.0f, 1.0f, 1.0f), ReadWrite, DirectValue, "Color to apply", "") 00090 // Overwritten SceneNodeModifier attributes 00091 pl_attribute(Flags, pl_flag_type(EFlags), 0, ReadWrite, GetSet, "Flags", "") 00092 // Constructors 00093 pl_constructor_1(ParameterConstructor, SceneNode&, "Parameter constructor", "") 00094 // Slots 00095 pl_slot_0(OnUpdate, "Called when the scene node modifier needs to be updated", "") 00096 pl_class_end 00097 00098 00099 //[-------------------------------------------------------] 00100 //[ Public functions ] 00101 //[-------------------------------------------------------] 00102 public: 00103 /** 00104 * @brief 00105 * Constructor 00106 * 00107 * @param[in] cSceneNode 00108 * Owner scene node 00109 */ 00110 PLS_API SNMLightRandomAnimation(SceneNode &cSceneNode); 00111 00112 /** 00113 * @brief 00114 * Destructor 00115 */ 00116 PLS_API virtual ~SNMLightRandomAnimation(); 00117 00118 00119 //[-------------------------------------------------------] 00120 //[ Protected virtual SceneNodeModifier functions ] 00121 //[-------------------------------------------------------] 00122 protected: 00123 PLS_API virtual void OnActivate(bool bActivate) override; 00124 00125 00126 //[-------------------------------------------------------] 00127 //[ Private functions ] 00128 //[-------------------------------------------------------] 00129 private: 00130 /** 00131 * @brief 00132 * Called when the scene node modifier needs to be updated 00133 */ 00134 void OnUpdate(); 00135 00136 00137 //[-------------------------------------------------------] 00138 //[ Private data ] 00139 //[-------------------------------------------------------] 00140 private: 00141 float m_fTimer; /**< Animation timer */ 00142 00143 00144 }; 00145 00146 00147 //[-------------------------------------------------------] 00148 //[ Namespace ] 00149 //[-------------------------------------------------------] 00150 } // PLScene 00151 00152 00153 #endif // __PLSCENE_SCENENODEMODIFIER_LIGHTRANDOMANIMATION_H__
|