basicSceneObjectLightingPlugin.h
Engine/source/lighting/basic/basicSceneObjectLightingPlugin.h
Classes:
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _BASICSCENEOBJECTLIGHTINGPLUGIN_H_ 25#define _BASICSCENEOBJECTLIGHTINGPLUGIN_H_ 26 27#ifndef _SCENEOBJECTLIGHTINGPLUGIN_H_ 28#include "scene/sceneObjectLightingPlugin.h" 29#endif 30 31#ifndef _SCENEOBJECT_H_ 32#include "scene/sceneObject.h" 33#endif 34 35#ifndef _TSINGLETON_H_ 36#include "core/util/tSingleton.h" 37#endif 38 39 40class ShadowBase; 41 42class BasicSceneObjectLightingPlugin : public SceneObjectLightingPlugin 43{ 44private: 45 46 ShadowBase* mShadow; 47 SceneObject* mParentObject; 48 49 static Vector<BasicSceneObjectLightingPlugin*> smPluginInstances; 50 51public: 52 BasicSceneObjectLightingPlugin(SceneObject* parent); 53 ~BasicSceneObjectLightingPlugin(); 54 55 static Vector<BasicSceneObjectLightingPlugin*>* getPluginInstances() { return &smPluginInstances; } 56 57 static void cleanupPluginInstances(); 58 static void resetAll(); 59 60 const F32 getScore() const; 61 62 // Called from BasicLightManager 63 virtual void updateShadow( SceneRenderState *state ); 64 virtual void renderShadow( SceneRenderState *state ); 65 66 // Called by statics 67 virtual U32 packUpdate(SceneObject* obj, U32 checkMask, NetConnection *conn, U32 mask, BitStream *stream) { return 0; } 68 virtual void unpackUpdate(SceneObject* obj, NetConnection *conn, BitStream *stream) { } 69 70 virtual void reset(); 71}; 72 73class BasicSceneObjectPluginFactory : public ManagedSingleton< BasicSceneObjectPluginFactory > 74{ 75protected: 76 77 /// Called from the light manager on activation. 78 /// @see LightManager::addActivateCallback 79 void _onLMActivate( const char *lm, bool enable ); 80 81 void _onDecalManagerClear(); 82 83 void removeLightPlugin(SceneObject* obj); 84 void addLightPlugin(SceneObject* obj); 85 void addToExistingObjects(); 86 87 bool mEnabled; 88 89public: 90 91 BasicSceneObjectPluginFactory(); 92 ~BasicSceneObjectPluginFactory(); 93 94 // For ManagedSingleton. 95 static const char* getSingletonName() { return "BasicSceneObjectPluginFactory"; } 96 97 void _setEnabled(); 98}; 99 100#endif // !_BASICSCENEOBJECTLIGHTINGPLUGIN_H_ 101