Skip to content

Commit

Permalink
build 171222. support for separate submodel activation thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
tmj-fstate committed Dec 23, 2017
1 parent 61a2511 commit 1b5e6aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
19 changes: 11 additions & 8 deletions AnimModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,17 @@ void TAnimModel::RaPrepare()
bool state; // stan światła
for (int i = 0; i < iNumLights; ++i)
{
switch (lsLights[i])
auto const lightmode { static_cast<int>( lsLights[ i ] ) };
switch (lightmode)
{
case ls_Blink: // migotanie
state = fBlinkTimer < fOnTime;
break;
case ls_Dark: // zapalone, gdy ciemno
state = Global::fLuminance <= fDark;
state = Global::fLuminance <= ( lsLights[i] - 3.0 );
break;
default: // zapalony albo zgaszony
state = (lsLights[i] == ls_On);
state = (lightmode == ls_On);
}
if (LightsOn[i])
LightsOn[i]->iVisible = state;
Expand Down Expand Up @@ -755,12 +756,12 @@ void TAnimModel::AnimationVND(void *pData, double a, double b, double c, double
};

//---------------------------------------------------------------------------
void TAnimModel::LightSet(int n, float v)
void TAnimModel::LightSet(int const n, float const v)
{ // ustawienie światła (n) na wartość (v)
if (n >= iMaxNumLights)
return; // przekroczony zakres
lsLights[ n ] = TLightState( static_cast<int>( v ) );
switch( lsLights[ n ] ) {
lsLights[ n ] = v;
switch( static_cast<int>( lsLights[ n ] ) ) {
// interpretacja ułamka zależnie od typu
case ls_Off: {
// ustalenie czasu migotania, t<1s (f>1Hz), np. 0.1 => t=0.1 (f=10Hz)
Expand All @@ -776,8 +777,10 @@ void TAnimModel::LightSet(int n, float v)
}
case ls_Dark: {
// zapalenie świateł zależne od oświetlenia scenerii
if( v > 3.0 ) { fDark = v - 3.0; } // ustawienie indywidualnego progu zapalania
else { fDark = DefaultDarkThresholdLevel; } // standardowy próg zaplania
if( v == 3.0 ) {
// standardowy próg zaplania
lsLights[ n ] = 3.0 + DefaultDarkThresholdLevel;
}
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions AnimModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class TAnimModel : public editor::basic_node {
vAngle.x = Angles.x;
vAngle.y = Angles.y;
vAngle.z = Angles.z; };
void LightSet( int n, float v );
void LightSet( int const n, float const v );
void AnimationVND( void *pData, double a, double b, double c, double d );
bool TerrainLoaded();
int TerrainCount();
Expand Down Expand Up @@ -178,8 +178,8 @@ class TAnimModel : public editor::basic_node {

std::string asText; // tekst dla wyświetlacza znakowego
TAnimAdvanced *pAdvanced { nullptr };
TLightState lsLights[ iMaxNumLights ];
float fDark { DefaultDarkThresholdLevel }; // poziom zapalanie światła (powinno być chyba powiązane z danym światłem?)
float lsLights[ iMaxNumLights ];
// float fDark { DefaultDarkThresholdLevel }; // poziom zapalanie światła (powinno być chyba powiązane z danym światłem?)
float fOnTime { 0.66f };
float fOffTime { 0.66f + 0.66f }; // były stałymi, teraz mogą być zmienne dla każdego egzemplarza
unsigned int m_framestamp { 0 }; // id of last rendered gfx frame
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once

#define VERSION_MAJOR 17
#define VERSION_MINOR 1214
#define VERSION_MINOR 1222
#define VERSION_REVISION 0

0 comments on commit 1b5e6aa

Please sign in to comment.