* light radiuses: don't render biggest radius, make them less occluding in 3D

closes #63
This commit is contained in:
Garux 2024-01-19 12:26:40 +06:00
parent 9b9e1df066
commit ecdad801b9
2 changed files with 16 additions and 10 deletions

View File

@ -78,7 +78,7 @@ public:
Colour( const Callback& colourChanged ) Colour( const Callback& colourChanged )
: m_colourChanged( colourChanged ){ : m_colourChanged( colourChanged ){
default_colour( m_colour ); default_colour( m_colour );
m_colour_add = m_colour / 4; m_colour_add = m_colour / 8;
capture_state(); capture_state();
} }
~Colour(){ ~Colour(){
@ -88,7 +88,7 @@ public:
void colourChanged( const char* value ){ void colourChanged( const char* value ){
release_state(); release_state();
read_colour_normalized( m_colour, value ); read_colour_normalized( m_colour, value );
m_colour_add = m_colour / 4; m_colour_add = m_colour / 8;
capture_state(); capture_state();
m_colourChanged(); m_colourChanged();

View File

@ -321,9 +321,11 @@ void sphere_draw_fill( const Vector3& origin, float radius, const Vector3 radiiP
#endif #endif
void light_draw_radius_fill( const Vector3& origin, const std::array<float, 3>& envelope, const Vector3 radiiPoints[SPHERE_FILL_POINTS] ){ void light_draw_radius_fill( const Vector3& origin, const std::array<float, 3>& envelope, const Vector3 radiiPoints[SPHERE_FILL_POINTS] ){
#ifdef RADII_RENDER_BIG_RADIUS
if ( envelope[0] > 0 ) { if ( envelope[0] > 0 ) {
sphere_draw_fill( origin, envelope[0], radiiPoints ); sphere_draw_fill( origin, envelope[0], radiiPoints );
} }
#endif
if ( envelope[1] > 0 ) { if ( envelope[1] > 0 ) {
sphere_draw_fill( origin, envelope[1], radiiPoints ); sphere_draw_fill( origin, envelope[1], radiiPoints );
} }
@ -468,9 +470,11 @@ void sphere_draw_wire( const Vector3& origin, float radius, const Vector3 radiiP
} }
void light_draw_radius_wire( const Vector3& origin, const std::array<float, 3>& envelope, const Vector3 radiiPoints[SPHERE_WIRE_POINTS] ){ void light_draw_radius_wire( const Vector3& origin, const std::array<float, 3>& envelope, const Vector3 radiiPoints[SPHERE_WIRE_POINTS] ){
#ifdef RADII_RENDER_BIG_RADIUS
if ( envelope[0] > 0 ) { if ( envelope[0] > 0 ) {
sphere_draw_wire( origin, envelope[0], radiiPoints ); sphere_draw_wire( origin, envelope[0], radiiPoints );
} }
#endif
if ( envelope[1] > 0 ) { if ( envelope[1] > 0 ) {
sphere_draw_wire( origin, envelope[1], radiiPoints ); sphere_draw_wire( origin, envelope[1], radiiPoints );
} }
@ -821,24 +825,26 @@ public:
if ( spawnflags_linear( m_flags ) ) { if ( spawnflags_linear( m_flags ) ) {
r[0] = radius + 47.0f / m_fade; r[0] = radius + 47.0f / m_fade;
if( r[0] <= 1.f ){ // prevent transform to negative if( r[0] < 1.f ){ // prevent transform to <=0, as we use r[0] to calculate intensity
r[0] = 1.f; r[0] = 1.f;
r[1] = r[2] = 1.f - 47.0f / m_fade; // this is called once again after minimizing already minimal radii, so calculate correct r[1] r[1] = r[2] = 1.f - 47.0f / m_fade; // this is called once again after minimizing already minimal radii, so calculate correct r[1]
return;
} }
r[1] = radius; else{
r[2] = radius - 207.0f / m_fade;; r[1] = radius;
r[2] = radius - 207.0f / m_fade;;
}
} }
else else
{ {
r[0] = radius * sqrt( 48.f ); r[0] = radius * sqrt( 48.f );
if( r[0] <= 1.f ){ if( r[0] < 1.f ){
r[0] = 1.f; r[0] = 1.f;
r[1] = r[2] = 0; r[1] = r[2] = 0;
return;
} }
r[1] = radius; else{
r[2] = r[0] / sqrt( 255.f ); r[1] = radius;
r[2] = r[0] / sqrt( 255.f );
}
} }
// globalOutputStream() << r[0] << " " << r[1] << " " << r[2] << " m_radii_transformed\n"; // globalOutputStream() << r[0] << " " << r[1] << " " << r[2] << " m_radii_transformed\n";
} }