postEffectVis.h
Engine/source/postFx/postEffectVis.h
Classes:
class
class
class
Structure representing a single 'opened' PostEffect including GuiControls for displaying any input/target textures.
Public Defines
define
PFXVIS() <>::instance()
Returns the PostEffectVis singleton.
Detailed Description
Public Defines
PFXVIS() <>::instance()
Returns the PostEffectVis singleton.
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 _POSTEFFECTVIS_H_ 25#define _POSTEFFECTVIS_H_ 26 27#ifndef _TSINGLETON_H_ 28#include "core/util/tSingleton.h" 29#endif 30 31#ifndef _POST_EFFECT_H_ 32#include "postFx/postEffect.h" 33#endif 34 35class GuiWindowCtrl; 36class GuiBitmapCtrl; 37class GuiControl; 38 39class PostEffectVis 40{ 41 // Protected constructor. 42 // Use PFXVIS define to access singleton. 43 PostEffectVis(); 44 friend class ManagedSingleton<PostEffectVis>; 45 46public: 47 48 ~PostEffectVis(); 49 50 /// Open visualization windows for all input and target textures. 51 void open( PostEffect *pfx ); 52 53 /// Close all visualization windows. 54 void clear(); 55 56 /// Hide or show all visualization windows. 57 void setVisible( bool visible ); 58 59 /// Callback from PostEffectManager at the start of a frame. 60 void onStartOfFrame(); 61 62 /// Callback from PostEffect to update visualization. 63 void onPFXProcessed( PostEffect *pfx ); 64 65 /// Callback when a visualization window is closed. 66 void onWindowClosed( GuiWindowCtrl *ctrl ); 67 68protected: 69 70 /// Get or create the content control, the parent of all visualization windows. 71 GuiControl* _getContentControl(); 72 73protected: 74 75 enum TexIndex 76 { 77 Target = 0, 78 Input1, 79 Input2, 80 Input3, 81 Input4, 82 TexCount 83 }; 84 85 /// Structure representing a single 'opened' PostEffect 86 /// including GuiControls for displaying any input/target textures. 87 struct VisWindow 88 { 89 PostEffect *pfx; 90 GuiWindowCtrl *window[TexCount]; 91 GuiBitmapCtrl *bmp[TexCount]; 92 }; 93 94 void _setDefaultCaption( VisWindow &vis, U32 texIndex ); 95 96 typedef Vector< VisWindow> VisVector; 97 98 VisVector mWindows; 99 100 GuiControl *mContent; 101 102public: 103 104 // For ManagedSingleton. 105 static const char* getSingletonName() { return "PostEffectVis"; } 106}; 107 108class PfxVis 109{ 110 DECLARE_STATIC_CLASS(PfxVis) 111}; 112 113/// Returns the PostEffectVis singleton. 114#define PFXVIS ManagedSingleton<PostEffectVis>::instance() 115 116#endif // _POSTEFFECTVIS_H_ 117