/usr/include/OGRE/OgreCompositorChain.h is in libogre-1.9-dev 1.9.0+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __CompositorChain_H__
#define __CompositorChain_H__
#include "OgrePrerequisites.h"
#include "OgreRenderTargetListener.h"
#include "OgreRenderQueueListener.h"
#include "OgreCompositorInstance.h"
#include "OgreCompositor.h"
#include "OgreViewport.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup Effects
* @{
*/
/** Chain of compositor effects applying to one viewport.
*/
class _OgreExport CompositorChain : public RenderTargetListener, public Viewport::Listener, public CompositorInstAlloc
{
public:
CompositorChain(Viewport *vp);
/** Another gcc warning here, which is no problem because RenderTargetListener is never used
to delete an object.
*/
virtual ~CompositorChain();
/// Data types
typedef vector<CompositorInstance*>::type Instances;
typedef VectorIterator<Instances> InstanceIterator;
/// Identifier for "last" compositor in chain.
static const size_t LAST = (size_t)-1;
/// Identifier for best technique.
static const size_t BEST = 0;
/** Apply a compositor. Initially, the filter is enabled.
@param filter
Filter to apply.
@param addPosition
Position in filter chain to insert this filter at; defaults to the end (last applied filter).
@param scheme
Scheme to use (blank means default).
*/
CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, const String& scheme = StringUtil::BLANK);
/** Remove a compositor.
@param position
Position in filter chain of filter to remove; defaults to the end (last applied filter)
*/
void removeCompositor(size_t position=LAST);
/** Get the number of compositors.
*/
size_t getNumCompositors();
/** Remove all compositors.
*/
void removeAllCompositors();
/** Get compositor instance by position.
*/
CompositorInstance *getCompositor(size_t index);
/** Get compositor instance by name. Returns null if not found.
*/
CompositorInstance *getCompositor(const String& name);
/** Get the original scene compositor instance for this chain (internal use).
*/
CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
/** Get an iterator over the compositor instances. The first compositor in this list is applied first, the last one is applied last.
*/
InstanceIterator getCompositors();
/** Enable or disable a compositor, by position. Disabling a compositor stops it from rendering
but does not free any resources. This can be more efficient than using removeCompositor and
addCompositor in cases the filter is switched on and off a lot.
@param position
Position in filter chain of filter
*/
void setCompositorEnabled(size_t position, bool state);
/** @see RenderTargetListener::preRenderTargetUpdate */
virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
/** @see RenderTargetListener::postRenderTargetUpdate */
virtual void postRenderTargetUpdate(const RenderTargetEvent& evt);
/** @see RenderTargetListener::preViewportUpdate */
virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
/** @see RenderTargetListener::postViewportUpdate */
virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
/** @see Viewport::Listener::viewportCameraChanged */
virtual void viewportCameraChanged(Viewport* viewport);
/** @see Viewport::Listener::viewportDimensionsChanged */
virtual void viewportDimensionsChanged(Viewport* viewport);
/** @see Viewport::Listener::viewportDestroyed */
virtual void viewportDestroyed(Viewport* viewport);
/** Mark state as dirty, and to be recompiled next frame.
*/
void _markDirty();
/** Get viewport that is the target of this chain
*/
Viewport *getViewport();
/** Remove a compositor by pointer. This is internally used by CompositionTechnique to
"weak" remove any instanced of a deleted technique.
*/
void _removeInstance(CompositorInstance *i);
/** Internal method for registering a queued operation for deletion later **/
void _queuedOperation(CompositorInstance::RenderSystemOperation* op);
/** Compile this Composition chain into a series of RenderTarget operations.
*/
void _compile();
/** Get the previous instance in this chain to the one specified.
*/
CompositorInstance* getPreviousInstance(CompositorInstance* curr, bool activeOnly = true);
/** Get the next instance in this chain to the one specified.
*/
CompositorInstance* getNextInstance(CompositorInstance* curr, bool activeOnly = true);
protected:
/// Viewport affected by this CompositorChain
Viewport *mViewport;
/** Plainly renders the scene; implicit first compositor in the chain.
*/
CompositorInstance *mOriginalScene;
/// Postfilter instances in this chain
Instances mInstances;
/// State needs recompile
bool mDirty;
/// Any compositors enabled?
bool mAnyCompositorsEnabled;
String mOriginalSceneScheme;
/// Compiled state (updated with _compile)
CompositorInstance::CompiledState mCompiledState;
CompositorInstance::TargetOperation mOutputOperation;
/// Render System operations queued by last compile, these are created by this
/// instance thus managed and deleted by it. The list is cleared with
/// clearCompilationState()
typedef vector<CompositorInstance::RenderSystemOperation*>::type RenderSystemOperations;
RenderSystemOperations mRenderSystemOperations;
/** Clear compiled state */
void clearCompiledState();
/** Prepare a viewport, the camera and the scene for a rendering operation
*/
void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
/** Restore a viewport, the camera and the scene after a rendering operation
*/
void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
void createOriginalScene();
void destroyOriginalScene();
/// destroy internal resources
void destroyResources(void);
/** Render queue listener used to set up rendering events. */
class _OgreExport RQListener: public RenderQueueListener
{
public:
RQListener() : mOperation(0), mSceneManager(0), mRenderSystem(0), mViewport(0) {}
/** @copydoc RenderQueueListener::renderQueueStarted
*/
virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, bool& skipThisInvocation);
/** @copydoc RenderQueueListener::renderQueueEnded
*/
virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, bool& repeatThisInvocation);
/** Set current operation and target. */
void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs);
/** Notify current destination viewport. */
void notifyViewport(Viewport* vp) { mViewport = vp; }
/** Flush remaining render system operations. */
void flushUpTo(uint8 id);
private:
CompositorInstance::TargetOperation *mOperation;
SceneManager *mSceneManager;
RenderSystem *mRenderSystem;
Viewport* mViewport;
CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
};
RQListener mOurListener;
/// Old viewport settings
unsigned int mOldClearEveryFrameBuffers;
/// Store old scene visibility mask
uint32 mOldVisibilityMask;
/// Store old find visible objects
bool mOldFindVisibleObjects;
/// Store old camera LOD bias
float mOldLodBias;
/// Store old viewport material scheme
String mOldMaterialScheme;
/// Store old shadows enabled flag
bool mOldShadowsEnabled;
};
/** @} */
/** @} */
} // namespace Ogre
#include "OgreHeaderSuffix.h"
#endif // __CompositorChain_H__
|