Overrides - Defining more in the script

This commit is contained in:
Emmanuel BENOîT 2017-11-19 08:51:23 +01:00
parent 01326eda80
commit f16ff2ec2e
2 changed files with 25 additions and 14 deletions

View file

@ -69,12 +69,31 @@
(input raymarcher-correction 10) (input raymarcher-correction 10)
(input fog .00015) (input fog .00015)
(ui-overrides
(section "Scenes"
(section "Raymarcher"
(int "Iterations" raymarcher-iterations
(min 1) (max 2048) (step .05))
(float "Step size" raymarcher-step
(min 0) (max 2) (slider))
(float "Epsilon" raymarcher-epsilon
(min 1e-10) (max 1) (power 1)
(decimals 12) (step 1e-8))
(float "Maximal distance" raymarcher-max-dist
(min 1e-2) (max 1000000) (decimals 0)
(step .05))
(int "Correction steps" raymarcher-correction
(min 0) (max 100) (slider))
)
(float "Fog" fog
(min 0) (max 1) (step .000005) (decimals 5))
)
)
) )
(fn scene-render () (fn scene-render ()
(profiling "Scene render" (profiling "Scene render"
# FIXME temp - we'll need to do init right before this
# can be moved back to initialisation
(uniforms prg-scene-p1 1 $vp-width $vp-height) (uniforms prg-scene-p1 1 $vp-width $vp-height)
(uniforms prg-scene-p1 0 $time) (uniforms prg-scene-p1 0 $time)
@ -185,8 +204,6 @@
(profiling "Depth of Field" (profiling "Depth of Field"
(use-texture 1 in-depth smp-dof) (use-texture 1 in-depth smp-dof)
# FIXME temp - we'll need to do init right before this
# can be moved back to initialisation
(uniforms-i prg-dof-pass1 0 0) (uniforms-i prg-dof-pass1 0 0)
(uniforms-i prg-dof-pass1 1 1) (uniforms-i prg-dof-pass1 1 1)
(uniforms-i prg-dof-pass2 0 0) (uniforms-i prg-dof-pass2 0 0)
@ -297,8 +314,6 @@
(fn bloom-render (in-scene) (fn bloom-render (in-scene)
(profiling "BLOOOOM!" (profiling "BLOOOOM!"
# FIXME temp - we'll need to do init right before this
# can be moved back to initialisation
(uniforms-i prg-bloom-highpass 0 0) (uniforms-i prg-bloom-highpass 0 0)
(uniforms-i prg-bloom-highpass 1 0) (uniforms-i prg-bloom-highpass 1 0)
(uniforms prg-bloom-highpass 2 $vp-width $vp-height) (uniforms prg-bloom-highpass 2 $vp-width $vp-height)
@ -434,8 +449,6 @@
(fn combine-render (in-main in-bloom) (fn combine-render (in-main in-bloom)
(profiling "Combine" (profiling "Combine"
# FIXME temp - we'll need to do init right before this
# can be moved back to initialisation
(uniforms-i prg-combine 0 0) (uniforms-i prg-combine 0 0)
(uniforms-i prg-combine 1 1) (uniforms-i prg-combine 1 1)
(uniforms prg-combine 2 $vp-width $vp-height) (uniforms prg-combine 2 $vp-width $vp-height)
@ -505,8 +518,6 @@
(fn fxaa-render (in-image) (fn fxaa-render (in-image)
(profiling "FXAA" (profiling "FXAA"
# FIXME temp - we'll need to do init right before this
# can be moved back to initialisation
(uniforms-i prg-fxaa 0 0) (uniforms-i prg-fxaa 0 0)
(uniforms prg-fxaa 1 (uniforms prg-fxaa 1
$vp-x $vp-y $vp-width $vp-height) $vp-x $vp-y $vp-width $vp-height)

View file

@ -153,7 +153,7 @@ bool FloatSetPower_( T_SRDParserData const& data )
{ {
auto const& input( *( data.input ) ); auto const& input( *( data.input ) );
const auto v( input[ 1 ].floatValue( ) ); const auto v( input[ 1 ].floatValue( ) );
if ( v <= 0 ) { if ( v == 0 ) {
data.errors.add( "invalid power value" , (*data.input)[ 1 ] ); data.errors.add( "invalid power value" , (*data.input)[ 1 ] );
} else if ( !data.currentData->value< SP_Float >( )->setPower( v ) ) { } else if ( !data.currentData->value< SP_Float >( )->setPower( v ) ) {
data.errors.add( "duplicate power value" , (*data.input)[ 0 ] ); data.errors.add( "duplicate power value" , (*data.input)[ 0 ] );
@ -165,7 +165,7 @@ bool FloatSetDecimals_( T_SRDParserData const& data )
{ {
auto const& input( *( data.input ) ); auto const& input( *( data.input ) );
const auto v( input[ 1 ].longValue( ) ); const auto v( input[ 1 ].longValue( ) );
if ( v < 0 || v > 10 ) { if ( v < 0 || v > 20 ) {
data.errors.add( "invalid decimals value" , (*data.input)[ 1 ] ); data.errors.add( "invalid decimals value" , (*data.input)[ 1 ] );
} else if ( !data.currentData->value< SP_Float >( )->setDecimals( v ) ) { } else if ( !data.currentData->value< SP_Float >( )->setDecimals( v ) ) {
data.errors.add( "duplicate decimals value" , (*data.input)[ 0 ] ); data.errors.add( "duplicate decimals value" , (*data.input)[ 0 ] );
@ -393,7 +393,7 @@ bool A_Float::setStep(
bool A_Float::setDecimals( bool A_Float::setDecimals(
const uint32_t n ) noexcept const uint32_t n ) noexcept
{ {
assert( n <= 100 ); assert( n >= 0 && n <= 20 );
if ( decimals_ ) { if ( decimals_ ) {
return false; return false;
} }
@ -412,7 +412,7 @@ bool A_Float::setDecimals(
bool A_Float::setPower( bool A_Float::setPower(
const float v ) noexcept const float v ) noexcept
{ {
assert( v > 0 ); assert( v != 0 );
M_SETOPT_( power_ , v ); M_SETOPT_( power_ , v );
} }