osgPPU::Processor Class Reference

Main processor used to setup the unit pipeline. More...


Public Member Functions

 META_Node (osgPPU, Processor)
 Processor ()
 Processor (const Processor &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual ~Processor ()
virtual void traverse (osg::NodeVisitor &nv)
void setCamera (osg::Camera *camera)
const osg::Camera * getCamera () const
osg::Camera * getCamera ()
void dirtyUnitSubgraph ()
bool isDirtyUnitSubgraph () const
void markUnitSubgraphNonDirty ()
UnitfindUnit (const std::string &name)
bool removeUnit (Unit *unit)
osg::BoundingSphere computeBound () const
void useColorClamp (bool useColorClamp=true)
virtual void onViewportChange ()

Protected Member Functions

virtual void init ()
virtual void onUnitInit (Unit *)
virtual void onUnitUpdate (Unit *)

Protected Attributes

osg::observer_ptr< osg::Camera > mCamera

Friends

class SetupUnitRenderingVisitor


Detailed Description

Main processor used to setup the unit pipeline.

The processor acts as a group node. The underlying graph can contain units or other kind of nodes. However only units can be drawed in the apropriate way. The attached camera must provide a valid viewport and color attachment (texture) which will be used as input for the pipeline.

The ppus are applied in a pipeline, so the output of one ppu is an input to the next one. At the end of the pipeline there should be a bypassout ppu specified which do render the result into the frame buffer.

A processor can also be used to do some multipass computation on input data. In that case it is not neccessary to output the resulting data on the screen, but you can use the output texture of the last ppu for any other purpose.


Constructor & Destructor Documentation

osgPPU::Processor::Processor (  ) 

Initialize the ppu system.

virtual osgPPU::Processor::~Processor (  )  [virtual]

Release the system. This will free used memory and close all ppus.


Member Function Documentation

virtual void osgPPU::Processor::traverse ( osg::NodeVisitor &  nv  )  [virtual]

Traverse method to traverse the subgraph. The unit pipeline will be updated and drawed on the according node visitor types. The visitor has to provide valid osg::FrameStamp so that the time get updated too.

void osgPPU::Processor::setCamera ( osg::Camera *  camera  ) 

Add a camera which texture attachment can be used as input to the pipeline. The camera object must be setted up to render into a texture. A bypass ppu (Unit) as first in the pipeline can bypass the camera attachment into the pipeline.

Parameters:
camera Camera object to use input from.

const osg::Camera* osgPPU::Processor::getCamera (  )  const

Get camera used for this pipeline. This method returns the camera object specified with setCamera().

void osgPPU::Processor::dirtyUnitSubgraph (  ) 

Mark the underlying unit subgraph as dirty. This is required as soon as you have changed the unit graph. Call this method to let processor initilize the underlying graph properly (setup all inputs and so on).

bool osgPPU::Processor::isDirtyUnitSubgraph (  )  const

Check whenever the subgraph is valid. A subgraph is valid if it can be traversed by default osg traversal's, hence if it does not contain any cycles. You have to traverse the processor with a CullTraverser first to resolve the cycles automatically. Afterwards the subgraph became valid.

void osgPPU::Processor::markUnitSubgraphNonDirty (  ) 

Force to mark the subgraph as non-dirty. It is not recommended to traverse the graph without initializing it first. Otherwise there could be cycles which will end up in seg faults. Use this method only if you know what you are doing.

Unit* osgPPU::Processor::findUnit ( const std::string &  name  ) 

Search in the subgraph for a unit. To be able to find the unit you have to use unique names for it, however this is not a strict rule. If nothing found return NULL.

Parameters:
name Unique name of the unit.

bool osgPPU::Processor::removeUnit ( Unit unit  ) 

Remove a unit from the processor's subgraph. The method will use the visitor to remove the unit from the graph. The subgraph of the unit will be marked as dirty, so that it gets reorganized on the next traverse. All the input units of the removed unit will be afterwards input units for the children of the removed unit.

Parameters:
unit Pointer to the unit to remove
Returns:
true on success otherwise false

osg::BoundingSphere osgPPU::Processor::computeBound (  )  const

Overridden method from osg::Node to allow computation of bounding box. This is needed to prevent traversion of this computation down to all childs. This method do always returns empty bounding sphere.

void osgPPU::Processor::useColorClamp ( bool  useColorClamp = true  ) 

Set wether or not osg::Clamp should be used in the osgPPU pipelines. This can be a problem when a graphics driver does not support glClamp. By default osg::Clamp will be used. If you do not want osg::Clamp in the pipelines be sure to set to false before init() is called.

virtual void osgPPU::Processor::onViewportChange (  )  [virtual]

Call this method whenever your main viewport of any of the used cameras or a size of used external textures has changed. Processor will notify every unit of the viewport change.

NOTE: You can also use dirtyUnitSubgraph(), however this will run the whole initialization process again, which costs time. A call that just viewport changed require usually less time to complete.

virtual void osgPPU::Processor::init (  )  [protected, virtual]

Init method which will be called automagically if processor became dirty.

virtual void osgPPU::Processor::onUnitInit ( Unit  )  [protected, virtual]

Callback method which will be called as soon as a unit is get initialized. Use this method to catch up the initialization process of a unit.

Parameters:
unit Pointer to the unit which is initialized

virtual void osgPPU::Processor::onUnitUpdate ( Unit  )  [protected, virtual]

Callback method for derived classes to detect whenever a unit is get updated. This method is called once per frame for every unit whenever it is updated.

Parameters:
unit Pointer to the unit which is updated


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

Back to Homepage of osgPPU

Copyright (C) 2008 by Art Tevs (LGPL)