Skip to content

Commit

Permalink
[dataflow-rendering] allow using rendering node in any order
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasPaulin committed Mar 24, 2023
1 parent 974aec1 commit d27d5d7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/Dataflow/Rendering/Nodes/RenderNodes/ClearColorNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ bool ClearColorNode::execute() {
gl::glDepthMask( gl::GL_FALSE );
gl::glColorMask( gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE );
gl::glDisable( gl::GL_DEPTH_TEST );
envmap->render( m_portInCamera->getData() );
envmap->render( m_portInCamera->getData(), false );
gl::glDepthMask( gl::GL_TRUE );
gl::glEnable( gl::GL_DEPTH_TEST );
}
else {
clearColor[3] = 0_ra;
gl::glClearBufferfv( gl::GL_COLOR, 0, clearColor );
}

Expand All @@ -76,15 +77,15 @@ bool ClearColorNode::execute() {
}

void ClearColorNode::toJsonInternal( nlohmann::json& data ) const {
auto c = ColorType ::linearRGBTosRGB( m_editableClearColor );
auto c = ColorType::linearRGBTosRGB( m_editableClearColor );
std::array<Scalar, 3> color { { c.x(), c.y(), c.z() } };
data["clearColor"] = color;
}

bool ClearColorNode::fromJsonInternal( const nlohmann::json& data ) {
if ( data.contains( "clearColor" ) ) {
std::array<Scalar, 3> c = data["clearColor"];
m_editableClearColor = ColorType ::sRGBToLinearRGB( ColorType( c[0], c[1], c[2] ) );
m_editableClearColor = ColorType::sRGBToLinearRGB( ColorType( c[0], c[1], c[2] ) );
}
else {
m_editableClearColor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ void EmissivityNode::init() {
m_nodeState->depthFunc( gl::GL_LEQUAL );
m_nodeState->depthMask( gl::GL_FALSE );
m_nodeState->colorMask( gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE );
m_nodeState->disable( gl::GL_BLEND );
m_nodeState->blendFuncSeparate( gl::GL_ONE, gl::GL_DST_ALPHA, gl::GL_ONE, gl::GL_ZERO );
m_nodeState->enable( gl::GL_BLEND );
}

void EmissivityNode::destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ void EnvironmentLightingNode::init() {
m_nodeState->depthFunc( gl::GL_LEQUAL );
m_nodeState->depthMask( gl::GL_FALSE );
m_nodeState->colorMask( gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE );
m_nodeState->blendFunc( gl::GL_ONE, gl::GL_ONE );
// m_nodeState->blendFunc( gl::GL_ONE, gl::GL_DST_ALPHA );
m_nodeState->blendFuncSeparate( gl::GL_ONE, gl::GL_DST_ALPHA, gl::GL_ONE, gl::GL_ZERO );
m_nodeState->enable( gl::GL_BLEND );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ GeometryAovsNode::GeometryAovsNode( const std::string& name ) :
m_depthTexture = new Ra::Engine::Data::Texture( texParams );

addOutput( m_outDepthTex, m_depthTexture );
addOutput( m_outPosInWorldTex, m_posInWorldTexture );
addOutput( m_outNormalInWorldTex, m_normalInWorldTexture );
addOutput( m_outPosInWorldTex, m_posInWorldTexture );
}

void GeometryAovsNode::init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void LocalLightingNode::init() {
m_nodeState->depthFunc( gl::GL_LEQUAL );
m_nodeState->depthMask( gl::GL_FALSE );
m_nodeState->colorMask( gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE, gl::GL_TRUE );
m_nodeState->blendFunc( gl::GL_ONE, gl::GL_ONE );
m_nodeState->blendFuncSeparate( gl::GL_ONE, gl::GL_DST_ALPHA, gl::GL_ONE, gl::GL_ZERO );
m_nodeState->enable( gl::GL_BLEND );
}

Expand Down
5 changes: 2 additions & 3 deletions src/Dataflow/Rendering/Nodes/RenderNodes/SsaoRenderNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ namespace Nodes {
using namespace Ra::Engine::Data;

SsaoNode::SsaoNode( const std::string& name ) : RenderingNode( name, getTypename() ) {
addInput( m_inWorldPos );
m_inWorldPos->mustBeLinked();

addInput( m_inWorldNormal );
m_inWorldNormal->mustBeLinked();

addInput( m_inWorldPos );
m_inWorldPos->mustBeLinked();
addInput( m_inCamera );
m_inCamera->mustBeLinked();

Expand Down

0 comments on commit d27d5d7

Please sign in to comment.