OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreTextureDefinition.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __CompositorTextureDefinitionBase_H__
30 #define __CompositorTextureDefinitionBase_H__
31 
32 #include "OgreHeaderPrefix.h"
35 #include "OgreIdString.h"
36 #include "OgreId.h"
37 
38 namespace Ogre
39 {
55  {
56  public:
58  {
62  NUM_TEXTURES_SOURCES
63  };
64 
66  {
70  };
71 
74  {
75  public:
77  uint width; // 0 means adapt to target width
78  uint height; // 0 means adapt to target height
79  float widthFactor; // multiple of target width to use (if width = 0)
80  float heightFactor; // multiple of target height to use (if height = 0)
81  PixelFormatList formatList; // more than one means MRT
82  bool fsaa; // FSAA enabled; True = Use main target's, False = disable
83  BoolSetting hwGammaWrite; // Do sRGB gamma correction on write (only 8-bit per channel formats)
84  uint16 depthBufferId;//Depth Buffer's pool ID.
85 
104 
105  TextureDefinition( IdString _name ) : name(_name), width(0), height(0), widthFactor(1.0f),
106  heightFactor(1.0f), fsaa(true), hwGammaWrite(BoolUndefined), depthBufferId(1),
107  fsaaExplicitResolve(false) {}
108  };
109 
110  protected:
111  friend class CompositorNode;
112  friend class CompositorWorkspace;
115 
121 
126 
127  static inline uint32 encodeTexSource( size_t index, TextureSource textureSource )
128  {
129  assert( index <= 0x3FFFFFFF && "Texture Source Index out of supported range" );
130  return (index & 0x3FFFFFFF)|(textureSource<<30);
131  }
132 
133  static void decodeTexSource( uint32 encodedVal, size_t &outIdx, TextureSource &outTexSource );
134 
135  public:
136  TextureDefinitionBase( TextureSource defaultSource );
137 
139  size_t getNumInputChannels(void) const;
140 
166  virtual IdString addTextureSourceName( const String &name, size_t index,
167  TextureSource textureSource );
168 
181  void getTextureSource( IdString name, size_t &index, TextureSource &textureSource ) const;
182 
189  void setNumLocalTextureDefinitions( size_t numTDs ) { mLocalTextureDefs.reserve( numTDs ); }
190 
205  TextureDefinition* addTextureDefinition( const String &name );
206 
230  static void createTextures( const TextureDefinitionVec &textureDefs,
231  CompositorChannelVec &inOutTexContainer,
232  IdType id, bool uniqueNames,
233  const RenderTarget *finalTarget, RenderSystem *renderSys );
234 
235  static CompositorChannel createTexture( const TextureDefinition &textureDef,
236  const String &texName, const RenderTarget *finalTarget,
237  RenderSystem *renderSys );
238 
240  static void destroyTextures( CompositorChannelVec &inOutTexContainer, RenderSystem *renderSys );
241 
259  static void recreateResizableTextures( const TextureDefinitionVec &textureDefs,
260  CompositorChannelVec &inOutTexContainer,
261  const RenderTarget *finalTarget,
262  RenderSystem *renderSys,
263  const CompositorNodeVec &connectedNodes,
264  const CompositorPassVec *passes );
265  };
266 
269 }
270 
271 #include "OgreHeaderSuffix.h"
272 
273 #endif
A 'canvas' which can receive the results of a rendering operation.
unsigned int uint32
Definition: OgrePlatform.h:420
#define _OgreExport
Definition: OgrePlatform.h:255
vector< CompositorPass * >::type CompositorPassVec
A compositor workspace is the main interface to render into an RT, be it a RenderWindow or an RTT (Re...
bool fsaaExplicitResolve
In D3D9, reading from an fsaa texture is not possible, hence it always has to be resolved before usin...
TextureSource mDefaultLocalTextureSource
TextureSource to use by addLocalTextureDefinition.
NameToChannelMap mNameToChannelMap
Similar to.
vector< PixelFormat >::type PixelFormatList
map< IdString, uint32 >::type NameToChannelMap
TextureDefinitionVec mLocalTextureDefs
Centralized class for dealing with declarations of textures in Node & Workspace definitions.
Compositor nodes are the core subject of compositing.
Ogre::uint32 IdType
Big projects with lots, lots of units for very long periods of time (MMORPGs?) may want to define thi...
Definition: OgreId.h:36
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
vector< TextureDefinition >::type TextureDefinitionVec
We got the texture through an input channel.
Hashed string.
Definition: OgreIdString.h:94
A channel in the compositor transports textures between nodes.
static uint32 encodeTexSource(size_t index, TextureSource textureSource)
_StringBase String
Definition: OgreCommon.h:53
vector< CompositorChannel >::type CompositorChannelVec
unsigned short uint16
Definition: OgrePlatform.h:421
void setNumLocalTextureDefinitions(size_t numTDs)
Reserves enough memory for all texture definitions.
Defines the functionality of a 3D API.
vector< CompositorNode * >::type CompositorNodeVec
unsigned int uint