38 #include <osg/StateAttribute>
40 #include "WDemoGeometry.h"
41 #include "WMTemplateRenderPipelines.h"
42 #include "core/graphicsEngine/WGEManagedGroupNode.h"
43 #include "core/graphicsEngine/WGERequirement.h"
44 #include "core/graphicsEngine/callbacks/WGENodeMaskCallback.h"
45 #include "core/graphicsEngine/offscreen/WGEOffscreenRenderNode.h"
46 #include "core/graphicsEngine/shaders/WGEShader.h"
47 #include "core/kernel/WKernel.h"
71 return "Template Render Pipelines";
77 return "Show how to use colormapping in your modules.";
95 m_showHUD =
m_properties->addProperty(
"Show HUD",
"Check to enable the debugging texture HUD.",
true );
150 osg::ref_ptr< WGEGroupNode > rootNode =
new WGEGroupNode();
154 osg::ref_ptr< osg::MatrixTransform > sceneNode =
new osg::MatrixTransform();
155 sceneNode->setMatrix( osg::Matrixd::rotate( 1.57, 1.0, 0.0, 0.0 ) );
162 plane->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
163 plane->getOrCreateStateSet()->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
166 sceneNode->addChild( spheres );
167 sceneNode->addChild( plane );
174 osg::ref_ptr< WGEOffscreenRenderNode > offscreen(
187 osg::ref_ptr< WGEOffscreenRenderPass > renderToTexture = offscreen->addGeometryRenderPass(
196 osg::ref_ptr< WGEOffscreenRenderPass > edgeDetection = offscreen->addTextureProcessingPass(
202 osg::ref_ptr< WGEOffscreenRenderPass > celShading = offscreen->addTextureProcessingPass(
208 osg::ref_ptr< WGEOffscreenRenderPass > finalPass = offscreen->addFinalOnScreenPass(
217 osg::ref_ptr< osg::Texture2D > geometryColor = renderToTexture->attach(
218 WGECamera::COLOR_BUFFER0,
221 osg::ref_ptr< osg::Texture2D > geometryDepth = renderToTexture->attach( WGECamera::DEPTH_BUFFER );
227 edgeDetection->bind( geometryDepth, 0 );
228 celShading->bind( geometryColor, 0 );
233 osg::ref_ptr< osg::Texture2D > edges = edgeDetection->attach(
234 WGECamera::COLOR_BUFFER0,
238 osg::ref_ptr< osg::Texture2D > colors = celShading->attach(
239 WGECamera::COLOR_BUFFER0,
244 finalPass->bind( colors, 0 );
245 finalPass->bind( edges, 1 );
248 finalPass->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
251 rootNode->insert( offscreen );
261 WBoundingBox bbox( -100.0, -100.0, -100.0, 200.0, 200.0, 200.0 );
264 rootNode->insert( cullProxy );
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
Class to encapsulate boost::condition_variable_any.
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
This callback is useful to en-/disable nodes using the node mask based on properties.
This type of node basically is a convenience class for managing and creating offscreen renderings.
This requirement ensures an up and running WGE.
Class encapsulating the OSG Program class for a more convenient way of adding and modifying shader.
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
std::shared_ptr< WGraphicsEngine > getGraphicsEngine() const
Returns pointer to currently running instance of graphics engine.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
virtual void properties()
Initialize the properties for this module.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual ~WMTemplateRenderPipelines()
Destructor.
virtual void connectors()
Initialize the connectors this module is using.
virtual void moduleMain()
Entry point after loading the module.
std::shared_ptr< WCondition > m_propCondition
A condition for property updates.
WMTemplateRenderPipelines()
Constuctor.
virtual void requirements()
Initialize requirements for this module.
WPropBool m_showHUD
Enable debug hud.
virtual const std::string getName() const
Gives back the name of this module.
Class representing a single module of OpenWalnut.
boost::filesystem::path m_localPath
The path where the module binary resides in.
Requirements m_requirements
The list of requirements.
virtual void properties()
Initialize properties in this function.
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
std::shared_ptr< WProperties > m_properties
The property object for the module.
void ready()
Call this whenever your module is ready and can react on property changes.
WConditionSet m_moduleState
The internal state of the module.
virtual void connectors()
Initialize connectors in this function.
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
osg::ref_ptr< osg::Node > createSphereGeometry()
Create several spheres.
osg::ref_ptr< osg::Node > createPlaneGeometry()
Create a plane.
osg::ref_ptr< osg::Node > generateCullProxy(const WBoundingBox &bbox)
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling.