osgPPU::UnitInOut Class Reference

Compute output texture based on the assigned shaders and input data. More...

Inheritance diagram for osgPPU::UnitInOut:

osgPPU::Unit osgPPU::UnitInMipmapOut osgPPU::UnitInOutModule osgPPU::UnitInResampleOut osgPPU::UnitMipmapInMipmapOut osgPPU::UnitText

Public Types

enum  TextureType {
  TEXTURE_2D,
  TEXTURE_CUBEMAP,
  TEXTURE_3D,
  TEXTURE_2D_ARRAY,
  TEXTURE_RECTANGLE
}
typedef std::map< unsigned int,
unsigned int > 
OutputSliceMap
 Mapping of MRT to ZSlice.

Public Member Functions

 META_Node (osgPPU, UnitInOut)
 UnitInOut ()
 Create default ppfx.
 UnitInOut (const UnitInOut &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual ~UnitInOut ()
 Release it and used memory.
virtual void init ()
 Initialze the default Processor unit.
osg::FrameBufferObject * getFrameBufferObject ()
void setInputBypass (int index)
int getInputBypass () const
void setOutputFace (unsigned int face)
unsigned int getOutputFace () const
void setOutputZSlice (unsigned int slice, unsigned int mrt=0)
unsigned int getOutputZSlice (unsigned int mrt)
const OutputSliceMapgetOutputZSliceMap () const
void setOutputDepth (unsigned int depth)
unsigned int getOutputDepth () const
void setOutputTextureType (TextureType type)
TextureType getOutputTextureType () const
void setOutputInternalFormat (GLenum format)
GLenum getOutputInternalFormat () const
void setOutputTexture (osg::Texture *outTex, int mrt=0)
virtual osg::Texture * getOrCreateOutputTexture (int mrt=0)
void setOutputTextureMap (const TextureMap &map)

Protected Member Functions

virtual bool noticeBeginRendering (osg::RenderInfo &, const osg::Drawable *)
virtual void noticeFinishRendering (osg::RenderInfo &, const osg::Drawable *)
virtual void noticeChangeViewport ()
 Viewport changed.
virtual void assignOutputTexture ()
 Reassign fbo if output textures changes.
virtual void assignOutputPBO ()

Protected Attributes

osg::ref_ptr
< osg::FrameBufferObject > 
mFBO
 Framebuffer object where results are written.
int mBypassedInput
 index of the bypassed input
unsigned int mOutputCubemapFace
 Which face to render cubemaps to.
OutputSliceMap mOutputZSlice
 Slice index to which the output is rendered to.
unsigned int mOutputDepth
 Depth of the 3D texture when used.
TextureType mOutputType
 Output texture type.
GLenum mOutputInternalFormat
 Internal format of the output texture.

Detailed Description

Compute output texture based on the assigned shaders and input data.

InOut PPU, renders the content of input textures with applied shader to the output textures. Rendering is done in background, so no information will leak to the frame buffer.


Member Enumeration Documentation

Type of the texture. The types can be used to specify the type of the output texture of the UnitInOut units.

Enumerator:
TEXTURE_2D  Texture is a osg::Texture2D.
TEXTURE_CUBEMAP  Texture is a osg::TextureCubeMap.
TEXTURE_3D  3D texture is used of the output
TEXTURE_2D_ARRAY  Use 2D texture array.
TEXTURE_RECTANGLE  Use a texture rectangle.


Member Function Documentation

osg::FrameBufferObject* osgPPU::UnitInOut::getFrameBufferObject (  ) 

Get framebuffer object used by this ppu.

void osgPPU::UnitInOut::setInputBypass ( int  index  ) 

UnitInOut can also be used to bypass the input texture to the output and perform rendering on it. This is different from the UnitBypass which does not perform any rendering but bypasses the data. Specify here the index of the input unit, to bypass the input to the output.

Parameters:
index Index of an input unit to bypass to output. Specify -1, to disable this feature.

int osgPPU::UnitInOut::getInputBypass (  )  const

Get bypassed input texture index.

void osgPPU::UnitInOut::setOutputFace ( unsigned int  face  ) 

Set face index to use when rendering to a cubemap

unsigned int osgPPU::UnitInOut::getOutputFace (  )  const

Get face index used when rendering to a cubemap

void osgPPU::UnitInOut::setOutputZSlice ( unsigned int  slice,
unsigned int  mrt = 0 
)

Set slice index which is used to render the output to. These settings have an effect only when using 3D textures as output. The given slice will be defined for each MRT output.

Parameters:
slice Index of the slice (z-offset) to render the results to
mrt MRT index of the output to be rendered to the given slice. This allows to specify which output to connect with which slice

unsigned int osgPPU::UnitInOut::getOutputZSlice ( unsigned int  mrt  ) 

Get Z slice which is used to render the output to if 3D texture is used as output.

const OutputSliceMap& osgPPU::UnitInOut::getOutputZSliceMap (  )  const

Get the mapping between MRT and Z-Offset slices.

See also:
setOutputZSlice()

void osgPPU::UnitInOut::setOutputDepth ( unsigned int  depth  ) 

Specify the depth of the output texture when using a 3D or layered texture as output texture. Is a 2D texture is used as output, then this value specifies the amount of MRT (multiple render targets) which has to be used by this unit.

NOTE: Currently there is no support to specify slices of different 3D or layered textures as MRTs

unsigned int osgPPU::UnitInOut::getOutputDepth (  )  const

Get depth of the output texture. The returned value is the value which you specify by the setOutputDepth() method and might be different to the real output texture depth.

void osgPPU::UnitInOut::setOutputTextureType ( TextureType  type  ) 

Specify the type of the output texture. The next call on getOrCreateOutputTexture() will generate the output texture of the given type if the output texture wasn't generated before. Use this to implement units based not only on 2D textures.

NOTE: Since the output textures must be all of the same type, you have to take care about the correct output type. Default type is TEXTURE_2D.

TextureType osgPPU::UnitInOut::getOutputTextureType (  )  const

Get the type of the output texture. The type can be specified by the setOutputTextureType() method. The type must be equal for all output textures of the same unit.

void osgPPU::UnitInOut::setOutputInternalFormat ( GLenum  format  ) 

Set internal format which will be used by creating the textures. The format specified here will be passed along to the osg::Texture::setInternalFormat() method when creating output textures of a corresponding ppu.

GLenum osgPPU::UnitInOut::getOutputInternalFormat (  )  const

Get internal format which is used by the output textures

void osgPPU::UnitInOut::setOutputTexture ( osg::Texture *  outTex,
int  mrt = 0 
)

Set an output texture.

Parameters:
outTex Texture used as output of this ppu
mrt MRT (multiple rendering target) index of this output

virtual osg::Texture* osgPPU::UnitInOut::getOrCreateOutputTexture ( int  mrt = 0  )  [virtual]

Return output texture for the specified MRT index. If no such exists, then it will be allocated.

Reimplemented from osgPPU::Unit.

Reimplemented in osgPPU::UnitText.

void osgPPU::UnitInOut::setOutputTextureMap ( const TextureMap &  map  ) 

Set a MRT to texture map for output textures

virtual bool osgPPU::UnitInOut::noticeBeginRendering ( osg::RenderInfo &  ,
const osg::Drawable *   
) [protected, virtual]

Here the FBO will be applied, so that Unit can render its output to attached textures. If you overwrite this method in derived class, so you have to take care about FBO handling.

Reimplemented from osgPPU::Unit.

Reimplemented in osgPPU::UnitInMipmapOut, osgPPU::UnitInOutModule, osgPPU::UnitMipmapInMipmapOut, and osgPPU::UnitText.

virtual void osgPPU::UnitInOut::noticeFinishRendering ( osg::RenderInfo &  ,
const osg::Drawable *   
) [protected, virtual]

Drawing is complete. So in our case, we will unbind used FBO and reset it to previous state Derived methods has to take care about correct handling of FBOs!

Reimplemented from osgPPU::Unit.

Reimplemented in osgPPU::UnitInMipmapOut, and osgPPU::UnitInOutModule.


The documentation for this class was generated from the following file:

Back to Homepage of osgPPU

Copyright (C) 2008 by Art Tevs (LGPL)