Raymarcher - reverted(ish) use of program pipeline
This commit is contained in:
parent
df06cf16ad
commit
86ce40f772
2 changed files with 26 additions and 0 deletions
|
@ -23,7 +23,9 @@ T_Raymarcher::T_Raymarcher(
|
||||||
.add( txDepth_ )
|
.add( txDepth_ )
|
||||||
.create( ) )
|
.create( ) )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
glGenProgramPipelines( 1 , &pipeline_ );
|
glGenProgramPipelines( 1 , &pipeline_ );
|
||||||
|
#endif
|
||||||
|
|
||||||
program_.addFile( "raymarch-header.glsl" );
|
program_.addFile( "raymarch-header.glsl" );
|
||||||
program_.addFile( "pbr.glsl" );
|
program_.addFile( "pbr.glsl" );
|
||||||
|
@ -32,10 +34,12 @@ T_Raymarcher::T_Raymarcher(
|
||||||
program_.addFile( "raymarcher.glsl" );
|
program_.addFile( "raymarcher.glsl" );
|
||||||
program_.load( );
|
program_.load( );
|
||||||
|
|
||||||
|
#if 0
|
||||||
auto& fsq( T_ShaderProgram::FullscreenQuad( watcher ) );
|
auto& fsq( T_ShaderProgram::FullscreenQuad( watcher ) );
|
||||||
glUseProgramStages( pipeline_ , GL_VERTEX_SHADER_BIT , fsq.id( ) );
|
glUseProgramStages( pipeline_ , GL_VERTEX_SHADER_BIT , fsq.id( ) );
|
||||||
glUseProgramStages( pipeline_ , GL_FRAGMENT_SHADER_BIT , program_.id( ) );
|
glUseProgramStages( pipeline_ , GL_FRAGMENT_SHADER_BIT , program_.id( ) );
|
||||||
assert( glGetError( ) == GL_NO_ERROR );
|
assert( glGetError( ) == GL_NO_ERROR );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +51,11 @@ void T_Raymarcher::render( )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
glBindProgramPipeline( pipeline_ );
|
glBindProgramPipeline( pipeline_ );
|
||||||
|
#else
|
||||||
|
program_.activate( );
|
||||||
|
#endif
|
||||||
glClearColor( 0 , 0 , 0 , 1 );
|
glClearColor( 0 , 0 , 0 , 1 );
|
||||||
glClear( GL_COLOR_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT );
|
||||||
enum {
|
enum {
|
||||||
|
@ -61,6 +69,7 @@ void T_Raymarcher::render( )
|
||||||
U_RAYMARCHER = 7 ,
|
U_RAYMARCHER = 7 ,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
glProgramUniform1f( program_.id( ) , U_TIME , 0 );
|
glProgramUniform1f( program_.id( ) , U_TIME , 0 );
|
||||||
glProgramUniform2f( program_.id( ) , U_RESOLUTION , rtOutput_.width( ) , rtOutput_.height( ) );
|
glProgramUniform2f( program_.id( ) , U_RESOLUTION , rtOutput_.width( ) , rtOutput_.height( ) );
|
||||||
|
|
||||||
|
@ -76,6 +85,21 @@ void T_Raymarcher::render( )
|
||||||
|
|
||||||
glDrawArrays( GL_TRIANGLE_STRIP , 0 , 4 );
|
glDrawArrays( GL_TRIANGLE_STRIP , 0 , 4 );
|
||||||
glBindProgramPipeline( 0 );
|
glBindProgramPipeline( 0 );
|
||||||
|
#else
|
||||||
|
glUniform1f( U_TIME , 0 );
|
||||||
|
glUniform2f( U_RESOLUTION , rtOutput_.width( ) , rtOutput_.height( ) );
|
||||||
|
|
||||||
|
glUniform3fv( U_CAM_POS , 1 , &camera_.pos.x );
|
||||||
|
glUniform3fv( U_LOOK_AT , 1 , &camera_.lookAt.x );
|
||||||
|
glUniform3fv( U_CAM_UP , 1 , &camera_.up.x );
|
||||||
|
glUniform1f( U_NEAR_PLANE , camera_.np );
|
||||||
|
|
||||||
|
glUniform3f( U_LIGHT_DIR , 0 , 1 , -1 );
|
||||||
|
|
||||||
|
glUniform4f( U_RAYMARCHER , rmIterations , rmStep , rmEpsilon , rmMaxDist );
|
||||||
|
|
||||||
|
glRectf( -1 , -1 , 1 , 1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
PEND( );
|
PEND( );
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,9 @@ struct T_Raymarcher
|
||||||
private:
|
private:
|
||||||
T_Camera camera_;
|
T_Camera camera_;
|
||||||
|
|
||||||
|
#if 0
|
||||||
GLuint pipeline_;
|
GLuint pipeline_;
|
||||||
|
#endif
|
||||||
T_ShaderProgram program_;
|
T_ShaderProgram program_;
|
||||||
|
|
||||||
T_Texture txOutput_ , txDepth_;
|
T_Texture txOutput_ , txDepth_;
|
||||||
|
|
Loading…
Reference in a new issue