normalize rendered light color for display consistency (compiler normalizes it anyway)
lower 3d light sphere brightness to reduce occlusion #63
This commit is contained in:
@@ -162,11 +162,6 @@ inline bool VectorCompare( const Vector3& v1, const Vector3& v2 ){
|
||||
return vector3_equal_epsilon( v1, v2, EQUAL_EPSILON );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T VectorMax( const BasicVector3<T>& v ){
|
||||
return ( v[0] > v[1] ) ? ( ( v[0] > v[2] ) ? v[0] : v[2] ) : ( ( v[1] > v[2] ) ? v[1] : v[2] );
|
||||
}
|
||||
|
||||
inline bool VectorIsOnAxis( const Vector3& v ){
|
||||
int zeroComponentCount = 0;
|
||||
for ( int i = 0; i < 3; ++i )
|
||||
@@ -349,7 +344,7 @@ inline EPlaneType PlaneTypeForNormal( const Vector3& normal ) {
|
||||
|
||||
|
||||
inline void ColorNormalize( Vector3& color ) {
|
||||
const float max = VectorMax( color );
|
||||
const float max = vector3_max_component( color );
|
||||
|
||||
if ( max == 0 ) {
|
||||
color.set( 1 );
|
||||
|
||||
@@ -88,7 +88,7 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){
|
||||
|
||||
if ( lightmapExposure == 0 ) {
|
||||
/* clamp with color normalization */
|
||||
max = VectorMax( sample );
|
||||
max = vector3_max_component( sample );
|
||||
if ( max > maxLight ) {
|
||||
sample *= ( maxLight / max );
|
||||
}
|
||||
@@ -98,7 +98,7 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){
|
||||
inv = 1.f / lightmapExposure;
|
||||
//Exposure
|
||||
|
||||
max = VectorMax( sample );
|
||||
max = vector3_max_component( sample );
|
||||
|
||||
dif = ( 1 - exp( -max * inv ) ) * 255;
|
||||
|
||||
@@ -123,7 +123,7 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){
|
||||
sample[i] = std::max( 0.f, lightmapContrast * ( sample[i] - 128 ) + 128 );
|
||||
}
|
||||
/* clamp with color normalization */
|
||||
max = VectorMax( sample );
|
||||
max = vector3_max_component( sample );
|
||||
if ( max > 255.0f ) {
|
||||
sample *= ( 255.0f / max );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user