Public Member Functions | |
META_Node (osgPPU, Processor) | |
Processor () | |
Processor (const Processor &, const osg::CopyOp ©op=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 () |
Unit * | findUnit (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 |
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.
osgPPU::Processor::Processor | ( | ) |
Initialize the ppu system.
virtual osgPPU::Processor::~Processor | ( | ) | [virtual] |
Release the system. This will free used memory and close all ppus.
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 | ) |
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.
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.
unit | Pointer to the unit to remove |
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 |
) |
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.
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.
unit | Pointer to the unit which is updated |
Copyright (C) 2008 by Art Tevs (LGPL)