Commit c59bcdf2 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE #298] all classes and modules now use WGECamera directly instead of osg::Camera.

parent 90e384c5
......@@ -48,6 +48,25 @@ WGECamera::WGECamera( int width, int height, ProjectionMode projectionMode )
reset();
}
WGECamera::WGECamera()
: osg::Camera(),
m_DefProjMode( ORTHOGRAPHIC )
{
// needed since OSG 3.2 to ensure a properly initialized stateset. Also works with OSG 3.0
getOrCreateStateSet()->setGlobalDefaults();
// disable all culling
setCullingActive( false );
setCullingMode( osg::CullSettings::NO_CULLING );
// near-far computation is done using the bounding volumes
setComputeNearFarMode(
osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES
// osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR
// osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES
);
}
WGECamera::~WGECamera()
{
// cleanup
......@@ -74,15 +93,15 @@ void WGECamera::reset()
break;
case PERSPECTIVE:
setProjectionMatrixAsPerspective( 30.0, getViewport()->aspectRatio(), 1.0, 1000.0 );
setProjectionResizePolicy( osg::Camera::HORIZONTAL );
setProjectionResizePolicy( WGECamera::HORIZONTAL );
break;
case TWO_D:
resize();
setProjectionResizePolicy( osg::Camera::FIXED );
setProjectionResizePolicy( WGECamera::FIXED );
break;
case TWO_D_UNIT:
resize();
setProjectionResizePolicy( osg::Camera::FIXED );
setProjectionResizePolicy( WGECamera::FIXED );
break;
default:
throw WGEInitFailed( std::string( "Unknown projection mode." ) );
......
......@@ -27,8 +27,6 @@
#include <osg/Camera>
/**
* Class for wrapping around the OSG Camera class. It adds some utility
* functions for simply setting some camera defaults.
......@@ -60,6 +58,11 @@ public:
*/
WGECamera( int width, int height, ProjectionMode projectionMode );
/**
* Constructor which sets defaults
*/
WGECamera();
/**
* Sets the default projection mode used for cameras getting reset.
*
......
......@@ -35,6 +35,7 @@
#include "WGraphicsEngine.h"
#include "WGEViewer.h"
#include "WGECamera.h"
#include "WGEProjectFileIO.h"
......@@ -243,7 +244,7 @@ void WGEProjectFileIO::save( std::ostream& output ) // NOLINT
std::endl;
// grab the main camera
osg::ref_ptr< osg::Camera > cam = WGraphicsEngine::getGraphicsEngine()->getViewer()->getCamera();
osg::ref_ptr< WGECamera > cam = WGraphicsEngine::getGraphicsEngine()->getViewer()->getCamera();
osg::ref_ptr< osgGA::MatrixManipulator > mani = WGraphicsEngine::getGraphicsEngine()->getViewer()->getCameraManipulator();
std::string name = WGraphicsEngine::getGraphicsEngine()->getViewer()->getName();
output << "CAMERA:0:" << name << std::endl;
......
......@@ -37,6 +37,8 @@
#include "../common/WSharedObject.h"
#include "../common/WCondition.h"
#include "WGECamera.h"
#include "animation/WGEAnimationFrameTimer.h"
......@@ -44,7 +46,7 @@
/**
* This class is a screen recorder. It records the frame buffer to files on a per-frame-basis. This class is NOT thread-safe due to performance
* reasons. You should not distribute the instance among multiple threads. It can be applied to <b>ONE</b> camera only by setting it as
* finalDrawCallback (osg::Camera::setFinalDrawCallback). Each camera can only use ONE final draw callback.
* finalDrawCallback (WGECamera::setFinalDrawCallback). Each camera can only use ONE final draw callback.
*
* This class is abstract. Derive your own class and handle image writing.
*
......@@ -52,7 +54,7 @@
*
* \ingroup GE
*/
class WGEScreenCapture: public osg::Camera::DrawCallback
class WGEScreenCapture: public WGECamera::DrawCallback
{
public:
/**
......
......@@ -49,12 +49,12 @@ osg::ref_ptr< osg::Vec3Array > wge::osgVec3Array( const std::vector< WPosition >
return result;
}
osg::Vec3 wge::unprojectFromScreen( const osg::Vec3 screen, osg::ref_ptr< osg::Camera > camera )
osg::Vec3 wge::unprojectFromScreen( const osg::Vec3 screen, osg::ref_ptr< WGECamera > camera )
{
return screen * osg::Matrix::inverse( camera->getViewMatrix() * camera->getProjectionMatrix() * camera->getViewport()->computeWindowMatrix() );
}
osg::Vec4 wge::unprojectFromScreen( const osg::Vec4 screen, osg::ref_ptr< osg::Camera > camera )
osg::Vec4 wge::unprojectFromScreen( const osg::Vec4 screen, osg::ref_ptr< WGECamera > camera )
{
return screen * osg::Matrix::inverse( camera->getViewMatrix() * camera->getProjectionMatrix() * camera->getViewport()->computeWindowMatrix() );
}
......
......@@ -38,7 +38,9 @@
#include "../common/WBoundingBox.h"
#include "../common/WAssert.h"
#include "../common/WPropertyVariable.h"
#include "../graphicsEngine/shaders/WGEPropertyUniform.h"
#include "shaders/WGEPropertyUniform.h"
#include "WGECamera.h"
namespace wge
{
......@@ -76,7 +78,7 @@ namespace wge
*
* \return un-projects a screen coordinate back to world space
*/
osg::Vec3 unprojectFromScreen( const osg::Vec3 screen, osg::ref_ptr< osg::Camera > camera );
osg::Vec3 unprojectFromScreen( const osg::Vec3 screen, osg::ref_ptr< WGECamera > camera );
/**
* Converts screen coordinates into Camera coordinates.
......@@ -87,7 +89,7 @@ namespace wge
*
* \return un-projects a screen coordinate back to world space
*/
osg::Vec4 unprojectFromScreen( const osg::Vec4 screen, osg::ref_ptr< osg::Camera > camera );
osg::Vec4 unprojectFromScreen( const osg::Vec4 screen, osg::ref_ptr< WGECamera > camera );
/**
* creates the same color as the atlas colormap shader from the index
......
......@@ -74,8 +74,9 @@ WGEViewer::WGEViewer( std::string name, osg::ref_ptr<osg::Referenced> wdata, int
m_View = osg::ref_ptr<osgViewer::Viewer>( new osgViewer::Viewer );
#endif
m_View->setCamera( new WGECamera( width, height, projectionMode ) );
m_queryCallback = new QueryCallback( m_View->getCamera(), m_rendered );
osg::ref_ptr< WGECamera > cam( new WGECamera( width, height, projectionMode ) );
m_View->setCamera( cam );
m_queryCallback = new QueryCallback( cam, m_rendered );
m_View->getCamera()->setInitialDrawCallback( m_queryCallback );
m_View->getCamera()->setFinalDrawCallback( m_screenCapture );
......@@ -166,15 +167,15 @@ osg::ref_ptr<osgGA::MatrixManipulator> WGEViewer::getCameraManipulator()
return m_View->getCameraManipulator();
}
void WGEViewer::setCamera( osg::ref_ptr<osg::Camera> camera )
void WGEViewer::setCamera( osg::ref_ptr<WGECamera> camera )
{
m_View->setCamera( camera );
// redraw request?? No since it redraws permanently and uses the new settings
}
osg::ref_ptr<osg::Camera> WGEViewer::getCamera()
osg::ref_ptr<WGECamera> WGEViewer::getCamera()
{
return m_View->getCamera();
return dynamic_cast< WGECamera* >( m_View->getCamera() );
}
void WGEViewer::setScene( osg::ref_ptr< WGEGroupNode > node )
......@@ -277,7 +278,7 @@ WBoolFlag::SPtr WGEViewer::isFrameRendered() const
return m_rendered;
}
WGEViewer::QueryCallback::QueryCallback( osg::ref_ptr<osg::Camera> camera, WBoolFlag::SPtr run ):
WGEViewer::QueryCallback::QueryCallback( osg::ref_ptr<WGECamera> camera, WBoolFlag::SPtr run ):
m_vendor( "" ),
m_run( run ),
m_camera( camera )
......
......@@ -155,14 +155,14 @@ public:
*
* \param camera the OSG camera instance.
*/
void setCamera( osg::ref_ptr<osg::Camera> camera );
void setCamera( osg::ref_ptr< WGECamera > camera );
/**
* Returns the camera currently in use.
*
* \return the camera currently in use.
*/
osg::ref_ptr<osg::Camera> getCamera();
osg::ref_ptr< WGECamera > getCamera();
/**
* Sets the scene graph node to be used for rendering.
......@@ -333,7 +333,7 @@ protected:
/**
* Small class used for querying glGet info during rendering.
*/
class QueryCallback: public osg::Camera::DrawCallback
class QueryCallback: public WGECamera::DrawCallback
{
public:
/**
......@@ -342,7 +342,7 @@ protected:
* \param camera the cam to which this was registered
* \param run notifies the flag when run.
*/
QueryCallback( osg::ref_ptr<osg::Camera> camera, WBoolFlag::SPtr run );
QueryCallback( osg::ref_ptr< WGECamera> camera, WBoolFlag::SPtr run );
/**
* Destructor.
......@@ -377,7 +377,7 @@ protected:
/**
* The camera to which this was connected.
*/
osg::ref_ptr<osg::Camera> m_camera;
osg::ref_ptr< WGECamera > m_camera;
};
/**
......
......@@ -37,7 +37,7 @@ WGEViewerEffect::WGEViewerEffect( std::string name, std::string description, con
{
// setup camera
setClearMask( GL_DEPTH_BUFFER_BIT );
setRenderOrder( osg::Camera::POST_RENDER );
setRenderOrder( WGECamera::POST_RENDER );
setReferenceFrame( osg::Transform::ABSOLUTE_RF );
setProjectionMatrixAsOrtho2D( 0.0, 1.0, 0.0, 1.0 );
setViewMatrix( osg::Matrixd::identity() );
......
......@@ -34,10 +34,12 @@
#include "core/common/WObjectNDIP.h"
#include "core/common/WProperties.h"
#include "WGECamera.h"
/**
* Base class for implementing basic fullscreen effects for the WGEViewer. It uses properties for configuration.
*/
class WGEViewerEffect: public WObjectNDIP< osg::Camera >
class WGEViewerEffect: public WObjectNDIP< WGECamera >
{
public:
/**
......
......@@ -52,7 +52,7 @@ WGEViewerEffectHorizon::WGEViewerEffectHorizon():
m_state->addUniform( new WGEPropertyUniform< WPropColor >( "u_top2Color", top2Color ) );
// default cam is a post render cam. The Horizon needs to be done BEFORE everything else
setRenderOrder( osg::Camera::NESTED_RENDER, 0 );
setRenderOrder( WGECamera::NESTED_RENDER, 0 );
osg::ref_ptr< WGEShader > horizonShader = new WGEShader( "WGECameraHorizon" );
horizonShader->apply( m_geode );
......
......@@ -109,7 +109,7 @@ void WGEViewerEffectImageOverlay::Updater::operator() ( osg::Node* node, osg::No
if( effect->m_viewer )
{
// valid camera? -> update viewport
osg::Camera* cam = effect->m_viewer->getCamera();
WGECamera* cam = effect->m_viewer->getCamera();
if( cam )
{
// valid viewport?
......
......@@ -59,7 +59,7 @@ public:
/**
* Set the reference viewer. Needed as the effect itself is not able to query important camera states. This can be the viewer on which the
* effect is applied but does not have to. Important is a valid osg::Camera, including a properly setup viewport.
* effect is applied but does not have to. Important is a valid WGECamera, including a properly setup viewport.
*
* \param viewer the viewer in which the effect is used.
*/
......
......@@ -28,6 +28,8 @@
#include <osg/Camera>
#include <osg/Node>
#include "../WGECamera.h"
/**
* This callback is useful to update viewport information on several nodes supporting it. The specified type must support an setViewport method.
* This is especially useful to keep offscreen render cameras in sync with the scene cam or to update HUD viewport information. Note that the
......@@ -36,7 +38,7 @@
* \tparam T the type supporting setViewport
* \tparam Source the type from who the viewport should be acquired by using osg::Viewport* getViewport()
*/
template < typename T, typename Source = osg::Camera >
template < typename T, typename Source = WGECamera >
class WGEViewportCallback: public osg::NodeCallback
{
public:
......
......@@ -32,8 +32,8 @@ WGEOffscreenFinalPass::WGEOffscreenFinalPass( size_t textureWidth, size_t textur
WGEOffscreenTexturePass( textureWidth, textureHeight, num )
{
// initialize members
setRenderTargetImplementation( osg::Camera::FRAME_BUFFER );
setRenderOrder( osg::Camera::NESTED_RENDER, 0 );
setRenderTargetImplementation( WGECamera::FRAME_BUFFER );
setRenderOrder( WGECamera::NESTED_RENDER, 0 );
// render before the hud
if( m_hud )
......@@ -57,8 +57,8 @@ WGEOffscreenFinalPass::WGEOffscreenFinalPass( size_t textureWidth, size_t textur
WGEOffscreenTexturePass( textureWidth, textureHeight, hud, name, num )
{
// initialize members
setRenderTargetImplementation( osg::Camera::FRAME_BUFFER );
setRenderOrder( osg::Camera::NESTED_RENDER, 0 );
setRenderTargetImplementation( WGECamera::FRAME_BUFFER );
setRenderOrder( WGECamera::NESTED_RENDER, 0 );
// render before the hud
if( m_hud )
......
......@@ -41,7 +41,7 @@ bool checkTextureSize( size_t size )
return !( ( size > 8192 ) || ( size < 8 ) );
}
WGEOffscreenRenderNode::WGEOffscreenRenderNode( osg::ref_ptr< osg::Camera > reference, size_t width, size_t height, bool noHud ):
WGEOffscreenRenderNode::WGEOffscreenRenderNode( osg::ref_ptr< WGECamera > reference, size_t width, size_t height, bool noHud ):
WGEGroupNode(),
m_referenceCamera( reference ),
m_hud(),
......
......@@ -79,7 +79,7 @@ public:
*
* \param noHud If true, no hud gets displayed showing the created and used textures.
*/
WGEOffscreenRenderNode( osg::ref_ptr< osg::Camera > reference, size_t width = 2048, size_t height = 2048, bool noHud = false );
WGEOffscreenRenderNode( osg::ref_ptr< WGECamera > reference, size_t width = 2048, size_t height = 2048, bool noHud = false );
/**
* Destructor.
......@@ -213,7 +213,7 @@ private:
/**
* The camera to which is used for setting this camera up.
*/
osg::ref_ptr< osg::Camera > m_referenceCamera;
osg::ref_ptr< WGECamera > m_referenceCamera;
/**
* The pointer to the hud used to render all used texture buffers. This can be NULL. It gets distributed to all created render-pass
......
......@@ -34,7 +34,7 @@
#include "WGEOffscreenRenderPass.h"
WGEOffscreenRenderPass::WGEOffscreenRenderPass( size_t textureWidth, size_t textureHeight, int num ):
osg::Camera(),
WGECamera(),
m_width( textureWidth ),
m_height( textureHeight ),
m_fbo( new osg::FrameBufferObject() ),
......@@ -44,13 +44,13 @@ WGEOffscreenRenderPass::WGEOffscreenRenderPass( size_t textureWidth, size_t text
setClearColor( osg::Vec4( 0.0, 0.0, 0.0, 0.0 ) );
setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
setReferenceFrame( osg::Transform::RELATIVE_RF );
setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
setRenderOrder( osg::Camera::PRE_RENDER, num );
setRenderTargetImplementation( WGECamera::FRAME_BUFFER_OBJECT );
setRenderOrder( WGECamera::PRE_RENDER, num );
}
WGEOffscreenRenderPass::WGEOffscreenRenderPass( size_t textureWidth, size_t textureHeight, osg::ref_ptr< WGETextureHud > hud, std::string name,
int num ):
osg::Camera(),
WGECamera(),
m_width( textureWidth ),
m_height( textureHeight ),
m_fbo( new osg::FrameBufferObject() ),
......@@ -61,8 +61,8 @@ WGEOffscreenRenderPass::WGEOffscreenRenderPass( size_t textureWidth, size_t text
setClearColor( osg::Vec4( 0.0, 0.0, 0.0, 0.0 ) );
setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
setReferenceFrame( osg::Transform::RELATIVE_RF );
setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
setRenderOrder( osg::Camera::PRE_RENDER, num );
setRenderTargetImplementation( WGECamera::FRAME_BUFFER_OBJECT );
setRenderOrder( WGECamera::PRE_RENDER, num );
}
WGEOffscreenRenderPass::~WGEOffscreenRenderPass()
......@@ -84,12 +84,12 @@ void WGEOffscreenRenderPass::attach( BufferComponent buffer, osg::ref_ptr< osg::
texture->setNumMipmapLevels( 0 );
// attach
osg::Camera::attach( buffer, texture, 0, 0, true );
WGECamera::attach( buffer, texture, 0, 0, true );
}
void WGEOffscreenRenderPass::attach( BufferComponent buffer, osg::ref_ptr< osg::Image > image )
{
osg::Camera::attach( buffer, image );
WGECamera::attach( buffer, image );
}
osg::ref_ptr< osg::Texture2D > WGEOffscreenRenderPass::attach( BufferComponent buffer, GLint internalFormat )
......@@ -119,14 +119,14 @@ osg::ref_ptr< osg::Texture2D > WGEOffscreenRenderPass::attach( BufferComponent b
void WGEOffscreenRenderPass::detach( BufferComponent buffer )
{
// remove the texture from HUD if existing
if( m_hud && osg::Camera::getBufferAttachmentMap().count( buffer ) )
if( m_hud && WGECamera::getBufferAttachmentMap().count( buffer ) )
{
m_hud->removeTexture( osg::Camera::getBufferAttachmentMap()[ buffer ]._texture );
m_hud->removeTexture( WGECamera::getBufferAttachmentMap()[ buffer ]._texture );
}
m_fbo->setAttachment( buffer, osg::FrameBufferAttachment() );
osg::Camera::detach( buffer );
WGECamera::detach( buffer );
}
osg::ref_ptr< osg::Texture2D > WGEOffscreenRenderPass::createTexture( GLint internalFormat )
......
......@@ -32,7 +32,7 @@
#include "../WGEUtils.h"
#include "../WGETexture.h"
#include "../WGECamera.h"
class WGETextureHud;
......@@ -41,7 +41,7 @@ class WGETextureHud;
* which, by default, is the same as the camera in the this instance nesting graph. It allows simple attachment of textures to a offscreen
* rendering as well as easy texture creation.
*/
class WGEOffscreenRenderPass: public osg::Camera // NOLINT
class WGEOffscreenRenderPass: public WGECamera // NOLINT
{
public:
/**
......
......@@ -33,7 +33,7 @@
#include "WGEPostprocessingNode.h"
WGEPostprocessingNode::WGEPostprocessingNode( osg::ref_ptr< osg::Camera > reference, size_t width, size_t height, bool noHud ):
WGEPostprocessingNode::WGEPostprocessingNode( osg::ref_ptr< WGECamera > reference, size_t width, size_t height, bool noHud ):
osg::Switch(),
m_childs( new WGEGroupNode() ),
m_properties( boost::shared_ptr< WProperties >( new WProperties( "Post-processing", "Post-processing properties" ) ) )
......
......@@ -40,7 +40,7 @@
#include "../callbacks/WGESwitchCallback.h"
#include "../callbacks/WGENodeMaskCallback.h"
#include "../WGEGroupNode.h"
#include "../WGECamera.h"
#include "WGEPostprocessor.h"
......@@ -76,7 +76,7 @@ public:
* \param height the height of the textures used in this rendering. Must be in [8,4096] and a power of two.
* \param noHud If true, no hud gets displayed showing the created and used textures.
*/
WGEPostprocessingNode( osg::ref_ptr< osg::Camera > reference, size_t width = 2048, size_t height = 2048, bool noHud = false );
WGEPostprocessingNode( osg::ref_ptr< WGECamera > reference, size_t width = 2048, size_t height = 2048, bool noHud = false );
/**
* Destructor.
......
......@@ -127,11 +127,11 @@ WGEPostprocessor::PostprocessorInput::PostprocessorInput( osg::ref_ptr< osg::Tex
WGEPostprocessor::PostprocessorInput WGEPostprocessor::PostprocessorInput::attach( osg::ref_ptr< WGEOffscreenRenderPass > from )
{
PostprocessorInput buf;
buf.m_colorTexture = from->attach( osg::Camera::COLOR_BUFFER0 );
buf.m_normalTexture = from->attach( osg::Camera::COLOR_BUFFER1, GL_RGB );
buf.m_parameterTexture = from->attach( osg::Camera::COLOR_BUFFER2, GL_R32F );
buf.m_tangentTexture = from->attach( osg::Camera::COLOR_BUFFER3, GL_RGB );
buf.m_depthTexture = from->attach( osg::Camera::DEPTH_BUFFER );
buf.m_colorTexture = from->attach( WGECamera::COLOR_BUFFER0 );
buf.m_normalTexture = from->attach( WGECamera::COLOR_BUFFER1, GL_RGB );
buf.m_parameterTexture = from->attach( WGECamera::COLOR_BUFFER2, GL_R32F );
buf.m_tangentTexture = from->attach( WGECamera::COLOR_BUFFER3, GL_RGB );
buf.m_depthTexture = from->attach( WGECamera::DEPTH_BUFFER );
return buf;
}
......
......@@ -40,6 +40,7 @@
#include "../offscreen/WGEOffscreenFinalPass.h"
#include "../shaders/WGEShaderPropertyDefineOptions.h"
#include "../WGECamera.h"
#include "../../common/WProperties.h"
#include "../../common/WPrototyped.h"
......
......@@ -61,7 +61,7 @@ WGEPostprocessorCelShading::WGEPostprocessorCelShading( osg::ref_ptr< WGEOffscre
pass->getOrCreateStateSet()->addUniform( new WGEPropertyUniform< WPropInt >( "u_celShadingBins", bins ) );
// attach color0 output
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER0, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER0, GL_RGBA ) );
// provide the Gbuffer input
gbuffer.bind( pass );
......
......@@ -65,7 +65,7 @@ WGEPostprocessorEdgeEnhance::WGEPostprocessorEdgeEnhance( osg::ref_ptr< WGEOffsc
pass->getOrCreateStateSet()->addUniform( new WGEPropertyUniform< WPropDouble >( "u_edgeEdgeThresholdLower", edgeThresholdL ) );
// attach color0 output
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER0, GL_RGB ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER0, GL_RGB ) );
// provide the Gbuffer input
gbuffer.bind( pass );
......
......@@ -60,56 +60,56 @@ WGEPostprocessorGauss::WGEPostprocessorGauss( osg::ref_ptr< WGEOffscreenRenderNo
// for each of the textures do:
// attach color0 output and bind tex0
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER0, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER0, GL_RGBA ) );
pass->bind( tex0, 0 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT0" );
// attach color1 output and bind tex1
if( tex1 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER1, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER1, GL_RGBA ) );
pass->bind( tex1, 1 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT1" );
}
// attach color2 output and bind tex2
if( tex2 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER2, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER2, GL_RGBA ) );
pass->bind( tex2, 2 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT2" );
}
// attach color3 output and bind tex3
if( tex3 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER3, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER3, GL_RGBA ) );
pass->bind( tex3, 3 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT3" );
}
// attach color4 output and bind tex4
if( tex4 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER4, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER4, GL_RGBA ) );
pass->bind( tex4, 4 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT4" );
}
// attach color5 output and bind tex5
if( tex5 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER5, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER5, GL_RGBA ) );
pass->bind( tex5, 5 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT5" );
}
// attach color6 output and bind tex6
if( tex6 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER6, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER6, GL_RGBA ) );
pass->bind( tex6, 6 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT6" );
}
// attach color7 output and bind tex7
if( tex7 )
{
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER7, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER7, GL_RGBA ) );
pass->bind( tex7, 7 );
s->setDefine( "WGE_POSTPROCESSOR_GAUSS_UNIT7" );
}
......
......@@ -114,7 +114,7 @@ WGEPostprocessorLineAO::WGEPostprocessorLineAO( osg::ref_ptr< WGEOffscreenRender
lineAOPass->getOrCreateStateSet()->addUniform( new WGEPropertyUniform< WPropDouble >( "u_lineaoRadiusSS", lineaoRadiusSS ) );
// attach color0 output
m_resultTextures.push_back( lineAOPass->attach( osg::Camera::COLOR_BUFFER0, GL_RGB ) );
m_resultTextures.push_back( lineAOPass->attach( WGECamera::COLOR_BUFFER0, GL_RGB ) );
// provide the Gbuffer input, with several mipmap levels
gbuffer.m_depthTexture->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR );
......
......@@ -65,7 +65,7 @@ WGEPostprocessorMergeOp::WGEPostprocessorMergeOp( osg::ref_ptr< WGEOffscreenRend
// for each of the textures do:
// attach color0 output and bind tex0
m_resultTextures.push_back( pass->attach( osg::Camera::COLOR_BUFFER0, GL_RGBA ) );
m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER0, GL_RGBA ) );
pass->bind( tex0, 0 );
m_mergeOpShader->setDefine( "WGE_POSTPROCESSOR_MERGEOP_UNIT0" );
......
......@@ -83,7 +83,7 @@ WGEPostprocessorSSAO::WGEPostprocessorSSAO( osg::ref_ptr< WGEOffscreenRenderNode
pass->getOrCreateStateSet()->addUniform( new WGEPropertyUniform< WPropDouble >( "u_ssaoFalloff", ssaoFalloff ) );
// attach color0 output