Fixed sometimes black SkyDome with dynamic time enabled + make dynamic time work correctly when accelerated simulation time
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3675 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 1532ae1e783a5774ffd3308283fb9cf991fa8c03 Former-commit-id: 05d1e5dd00c06fb1f4611045f21cef368fb63ad0
This commit is contained in:
parent
4c65c21361
commit
2128882965
4 changed files with 86 additions and 101 deletions
|
@ -65,10 +65,10 @@
|
|||
#define GR_ATT_FOVFACT "fov factor"
|
||||
#define GR_ATT_LODFACTOR "LOD Factor"
|
||||
#define GR_ATT_SKYDOMEDISTANCE "sky dome distance"
|
||||
#define GR_ATT_DYNAMICSKYDOME "dynamic sky dome"
|
||||
#define GR_ATT_DYNAMICSKYDOME_ENABLED "enabled"
|
||||
#define GR_ATT_DYNAMICSKYDOME_DISABLED "disabled"
|
||||
#define GR_ATT_PRECIPDENSITY "precipitation density"
|
||||
#define GR_ATT_DYNAMICTIME "dynamic time"
|
||||
#define GR_ATT_DYNAMICTIME_ENABLED "enabled"
|
||||
#define GR_ATT_DYNAMICTIME_DISABLED "disabled"
|
||||
//#define GR_ATT_DYNAMICWEATHER "dynamic weather"
|
||||
|
||||
#define GR_ATT_NB_SCREENS "number of screens"
|
||||
|
|
|
@ -70,7 +70,7 @@ unsigned grSkyDomeDistance = 0;
|
|||
|
||||
// Some private global variables.
|
||||
//static int grDynamicWeather = 0;
|
||||
static bool grDynamicTime = false;
|
||||
static bool grDynamicSkyDome = false;
|
||||
static int grBackgroundType = 0;
|
||||
static float grSunDeclination = 0.0f;
|
||||
static float grMoonDeclination = 0.0f;
|
||||
|
@ -106,11 +106,11 @@ grInitBackground(void)
|
|||
void *hndl = grTrackHandle;
|
||||
ssgLight *light = ssgGetLight(0);
|
||||
|
||||
/* If no dynamic sky is set, or the track skyversion doesn't support dynamic sky,
|
||||
we set up a static one */
|
||||
// If no realistic sky dome requested, or if the track skyversion doesn't support it,
|
||||
// we set up a static - texture-based - background
|
||||
if (!grSkyDomeDistance || grTrack->skyversion < 1)
|
||||
{
|
||||
GfLogInfo("Setting up static sky\n");
|
||||
GfLogInfo("Setting up static background (mono-texture sky and landscape)\n");
|
||||
|
||||
GLfloat matSpecular[] = {0.3, 0.3, 0.3, 1.0};
|
||||
GLfloat matShininess[] = {50.0};
|
||||
|
@ -167,32 +167,25 @@ grInitBackground(void)
|
|||
}*/
|
||||
}
|
||||
|
||||
/** If dynamic sky is needed, we create the Sun, the Moon, some stars and the clouds */
|
||||
// If realistic sky dome is requested,
|
||||
// we create the Sun, the Moon, some stars and the clouds
|
||||
else
|
||||
{
|
||||
GfLogInfo("Setting up dynamic sky :\n");
|
||||
|
||||
static const int CloudsTextureIndices[TR_CLOUDS_FULL+1] = { 1, 3, 5, 7, 8 };
|
||||
static const int NCloudsTextureIndices = sizeof(CloudsTextureIndices) / sizeof(int);
|
||||
|
||||
GfLogInfo("Setting up realistic %s sky dome :\n", grDynamicSkyDome ? "dynamic" : "static");
|
||||
|
||||
int div = 80000 / grSkyDomeDistance; //grSkyDomeDistance > 0 so cannot div0
|
||||
ssgSetNearFar(1, grSkyDomeDistance);
|
||||
|
||||
// Determine time of day (seconds since 00:00).
|
||||
const int timeOfDay = (int)grTrack->local.timeofday;
|
||||
|
||||
// Add random stars when relevant.
|
||||
/*if (timeOfDay < 7 * 3600 || timeOfDay > 17 * 3600)
|
||||
{
|
||||
if (timeOfDay < 5 * 3600 || timeOfDay > 19 * 3600)
|
||||
NStars = NMaxStars;
|
||||
else
|
||||
NStars = NMaxStars / 2;
|
||||
}
|
||||
else
|
||||
NStars = 0;*/
|
||||
NStars = NMaxStars; // Stars must be initialized same in day not only in the night
|
||||
|
||||
// Add random stars (can't optimize from real time of day,
|
||||
// in case grDynamicSkyDome - that is dynamic time of day -
|
||||
// and also simply because it'd be complicated to take care of actual lattitude).
|
||||
NStars = NMaxStars;
|
||||
if (AStarsData)
|
||||
delete [] AStarsData;
|
||||
AStarsData = new sgdVec3[NStars];
|
||||
|
@ -216,7 +209,7 @@ grInitBackground(void)
|
|||
TheSky->build(grSkyDomeDistance, grSkyDomeDistance, NPlanets, APlanetsData, NStars, AStarsData);
|
||||
|
||||
//Add the Sun itself
|
||||
TheCelestBodies[eCBSun] = TheSky->addBody(NULL, "data/textures/halo.rgba", (2500 / div), grSkyDomeDistance, true);
|
||||
TheCelestBodies[eCBSun] = TheSky->addBody(NULL, "data/textures/halo.rgba", (2500 / div), grSkyDomeDistance, /*isSun=*/true);
|
||||
GLfloat sunAscension = grTrack->local.sunascension;
|
||||
grSunDeclination = (float)(15 * (double)timeOfDay / 3600 - 90.0);
|
||||
|
||||
|
@ -260,14 +253,15 @@ grInitBackground(void)
|
|||
cloudLayers[0]->setDirection(45);
|
||||
GfLogInfo(" Cloud cover : 1 layer, texture=%s, speed=60, direction=45\n", buf);
|
||||
|
||||
// Set up the light source to the Sun position?
|
||||
sgVec3 solposn;
|
||||
sgSetVec3(solposn, 0, 0, 0);
|
||||
|
||||
light->setPosition(solposn);
|
||||
static ulClock ck;
|
||||
double dt = ck.getDeltaTime();
|
||||
TheSky->repositionFlat(solposn, 0, dt);
|
||||
// Set up the light source to the Sun position.
|
||||
sgCoord sunPosition;
|
||||
TheCelestBodies[eCBSun]->getPosition(&sunPosition);
|
||||
light->setPosition(sunPosition.xyz);
|
||||
|
||||
// Initialize the whole sky dome.
|
||||
sgVec3 viewPos;
|
||||
sgSetVec3(viewPos, 0, 0, 0);
|
||||
TheSky->repositionFlat(viewPos, 0, 0);
|
||||
|
||||
//Setup visibility according to rain if any
|
||||
// TODO: Does visibility really decrease when rain gets heavier ????
|
||||
|
@ -293,11 +287,11 @@ grInitBackground(void)
|
|||
break;
|
||||
}//switch Rain
|
||||
|
||||
TheSky->modifyVisibility( visibility, (float)dt);
|
||||
TheSky->modifyVisibility( visibility, 0);
|
||||
|
||||
//Setup overall light level according to rain if any
|
||||
double sol_angle = TheCelestBodies[eCBSun]->getAngle();
|
||||
double sky_brightness = (1.0 + cos(sol_angle)) / 2.0;
|
||||
const double sol_angle = TheCelestBodies[eCBSun]->getAngle();
|
||||
const double sky_brightness = (1.0 + cos(sol_angle)) / 2.0;
|
||||
double scene_brightness = pow(sky_brightness, 0.5);
|
||||
|
||||
if (grTrack->local.rain > 0) // TODO: Different values for each rain strength value ?
|
||||
|
@ -327,7 +321,8 @@ grInitBackground(void)
|
|||
CloudsColor[2] = FogColor[2] = BaseFogColor[2] * (float)sky_brightness;
|
||||
CloudsColor[3] = FogColor[3] = BaseFogColor[3];
|
||||
|
||||
TheSky->repaint(SkyColor, FogColor, CloudsColor, sol_angle, NPlanets, APlanetsData, NStars, AStarsData);
|
||||
TheSky->repaint(SkyColor, FogColor, CloudsColor, sol_angle,
|
||||
NPlanets, APlanetsData, NStars, AStarsData);
|
||||
|
||||
sgCoord solpos;
|
||||
TheCelestBodies[eCBSun]->getPosition(&solpos);
|
||||
|
@ -389,19 +384,17 @@ grLoadBackground(void)
|
|||
ssgNormalArray *bg_nrm;
|
||||
ssgSimpleState *bg_st;
|
||||
|
||||
// Load graphic options for the background.
|
||||
// Load graphic options for the sky dome / background.
|
||||
grSkyDomeDistance =
|
||||
(unsigned)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SKYDOMEDISTANCE, (char*)NULL, grSkyDomeDistance);
|
||||
if (grSkyDomeDistance > 0 && grSkyDomeDistance < grSkyDomeDistThresh)
|
||||
grSkyDomeDistance = grSkyDomeDistThresh; // If user enabled it (>0), must be at least the threshold.
|
||||
|
||||
grDynamicTime = grSkyDomeDistance > 0 && strcmp(GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_DYNAMICTIME, GR_ATT_DYNAMICTIME_DISABLED), GR_ATT_DYNAMICTIME_ENABLED) == 0;
|
||||
grDynamicSkyDome = grSkyDomeDistance > 0 && strcmp(GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_DYNAMICSKYDOME, GR_ATT_DYNAMICSKYDOME_DISABLED), GR_ATT_DYNAMICSKYDOME_ENABLED) == 0;
|
||||
|
||||
//grDynamicWeather = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_grDynamicWeather, (char*)NULL, grDynamicWeather);
|
||||
|
||||
GfLogInfo("Graphic options : Sky dome distance = %d m, dynamic time = %s\n",
|
||||
grSkyDomeDistance, grDynamicTime ? "true" : "false");
|
||||
|
||||
GfLogInfo("Graphic options : Sky dome : distance = %d m, dynamic = %s\n",
|
||||
grSkyDomeDistance, grDynamicSkyDome ? "true" : "false");
|
||||
|
||||
snprintf(buf, sizeof(buf), "tracks/%s/%s;data/img;data/textures;.",
|
||||
grTrack->category, grTrack->internalname);
|
||||
|
@ -744,10 +737,6 @@ grPreDrawSky(tSituation* s, float fogStart, float fogEnd)
|
|||
|
||||
if (grSkyDomeDistance && grTrack->skyversion > 0)
|
||||
{
|
||||
// Commenting these 2 lines fixes #266 (Splitscreen completely white with Skydome enabled)
|
||||
//glClearColor(FogColor[0], FogColor[1], FogColor[2], FogColor[3]);
|
||||
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
const GLfloat fog_exp2_density = (float)sqrt_m_log01 / TheSky->getVisibility();
|
||||
glEnable(GL_FOG);
|
||||
//glFogf(GL_FOG_START, fogStart);
|
||||
|
@ -788,63 +777,59 @@ grDrawStaticBackground(cGrCamera *cam, cGrBackgroundCam *bgCam)
|
|||
void
|
||||
grPostDrawSky(void)
|
||||
{
|
||||
if (grSkyDomeDistance && grTrack->skyversion > 0)
|
||||
{
|
||||
if (grSkyDomeDistance && grTrack->skyversion > 0)
|
||||
TheSky->postDraw(grSkyDomeDistance);
|
||||
}
|
||||
}//grPostDrawSky
|
||||
|
||||
// Update the sky when time changes
|
||||
void
|
||||
grUpdateSky(double currentTime)
|
||||
{
|
||||
if (!grDynamicTime)
|
||||
// Nothing to do if static sky dome.
|
||||
if (!grDynamicSkyDome)
|
||||
return;
|
||||
|
||||
// Update last update time.
|
||||
static int lastchecked = -100;
|
||||
static double lastTime = -10.0f;
|
||||
static ulClock ck ;
|
||||
ck.update () ;
|
||||
double dt1 = ck.getDeltaTime();
|
||||
if( currentTime < lastTime )
|
||||
|
||||
// ???????
|
||||
if( currentTime < lastTime )
|
||||
{
|
||||
lastchecked = -100;
|
||||
lastTime = currentTime;
|
||||
return;
|
||||
}
|
||||
|
||||
// Update sun position (?)
|
||||
// At each call, update possibly high speed objects of the sky dome : the clouds.
|
||||
sgVec3 viewPos;
|
||||
sgSetVec3(viewPos, 0, 0, 0); // Shouldn't this be the actual screen camera position ?
|
||||
TheSky->repositionFlat(viewPos, 0, currentTime - lastTime);
|
||||
|
||||
// Check if time to update low speed objects : sun and moon.
|
||||
int current = (int)floor( ( currentTime + 10.0f ) / 60.0f );
|
||||
|
||||
sgVec3 solposn;
|
||||
//sgSetVec3(solposn, 0, 0, 0);
|
||||
//ssgGetLight(0)->setPosition(solposn);
|
||||
//TheSky->repositionFlat(solposn, 0, dt1 );
|
||||
TheSky->repositionFlat(solposn , 0, dt1);
|
||||
//TheSky->modifyVisibility(solposn, (float)dt1);
|
||||
lastTime = currentTime;
|
||||
if( current == lastchecked )
|
||||
return;
|
||||
lastchecked = current;
|
||||
|
||||
GfLogDebug("Updating sky (dynamic time)\n");
|
||||
// Update sun and moon, and thus global lightning / coloring parameters of the scene.
|
||||
//GfLogDebug("Updating slow objects of the dynamic sky dome (sun and moon)\n");
|
||||
|
||||
// Update sun position
|
||||
// 1) Update sun position
|
||||
grSunDeclination += 0.25f; // TODO: Is this delta value realistic ?
|
||||
if (grSunDeclination >= 360.0f)
|
||||
grSunDeclination = 0.0f;
|
||||
|
||||
TheCelestBodies[eCBSun]->setDeclination ( DEG2RAD(grSunDeclination) );
|
||||
|
||||
// Update moon position
|
||||
// 2) Update moon position
|
||||
grMoonDeclination += 0.25f; // TODO: Is this delta value realistic ?
|
||||
if (grMoonDeclination >= 360.0f)
|
||||
grMoonDeclination = 0.0f;
|
||||
|
||||
TheCelestBodies[eCBMoon]->setDeclination ( DEG2RAD(grMoonDeclination) );
|
||||
|
||||
// Update scene color and light
|
||||
// 3) Update scene color and light
|
||||
double sol_angle = TheCelestBodies[eCBSun]->getAngle();
|
||||
double sky_brightness = (1.0 + cos(sol_angle)) / 2.0;
|
||||
double scene_brightness = pow(sky_brightness, 0.5);
|
||||
|
@ -854,33 +839,33 @@ grUpdateSky(double currentTime)
|
|||
SkyColor[2] = BaseSkyColor[2] * (float)sky_brightness;
|
||||
SkyColor[3] = BaseSkyColor[3];
|
||||
|
||||
/* set cloud and fog color */
|
||||
// 3a)cloud and fog color
|
||||
CloudsColor[0] = FogColor[0] = BaseFogColor[0] * (float)sky_brightness;
|
||||
CloudsColor[1] = FogColor[1] = BaseFogColor[1] * (float)sky_brightness;
|
||||
CloudsColor[2] = FogColor[2] = BaseFogColor[2] * (float)sky_brightness;
|
||||
CloudsColor[3] = FogColor[3] = BaseFogColor[3];
|
||||
|
||||
/* repaint the sky (simply update geometrical, color, ... state, no actual redraw) */
|
||||
TheSky->repaint(SkyColor, FogColor, CloudsColor, sol_angle, NPlanets, APlanetsData, NStars, AStarsData);
|
||||
// 3b) repaint the sky (simply update geometrical, color, ... state, no actual redraw)
|
||||
TheSky->repaint(SkyColor, FogColor, CloudsColor, sol_angle,
|
||||
NPlanets, APlanetsData, NStars, AStarsData);
|
||||
|
||||
// 3c) update the main light position (it's at the sun position !)
|
||||
sgCoord solpos;
|
||||
TheCelestBodies[eCBSun]-> getPosition(&solpos);
|
||||
ssgGetLight(0)-> setPosition(solpos.xyz);
|
||||
|
||||
// 3c) update scene colors.
|
||||
SceneAmbiant[0] = BaseAmbiant[0] * (float)scene_brightness;
|
||||
SceneAmbiant[1] = BaseAmbiant[1] * (float)scene_brightness;
|
||||
SceneAmbiant[2] = BaseAmbiant[2] * (float)scene_brightness;
|
||||
SceneAmbiant[3] = 1.0;
|
||||
|
||||
SceneDiffuse[0] = BaseDiffuse[0] * (float)scene_brightness;
|
||||
SceneDiffuse[1] = BaseDiffuse[1] * (float)scene_brightness;
|
||||
SceneDiffuse[2] = BaseDiffuse[2] * (float)scene_brightness;
|
||||
SceneDiffuse[3] = 1.0;
|
||||
|
||||
SceneSpecular[0] = BaseSpecular[0] * (float)scene_brightness;
|
||||
SceneSpecular[1] = BaseSpecular[1] * (float)scene_brightness;
|
||||
SceneSpecular[2] = BaseSpecular[2] * (float)scene_brightness;
|
||||
SceneSpecular[3] = 1.0;
|
||||
}//grUpdateSky
|
||||
|
||||
void
|
||||
|
|
|
@ -42,7 +42,7 @@ class cGrCamera
|
|||
int drawCurrent; /* flag to draw the current car */
|
||||
int drawDriver; /* flag to draw the driver */
|
||||
int drawBackground; /* flag to draw the background */
|
||||
int mirrorAllowed; /* flag to allox the display of mirror */
|
||||
int mirrorAllowed; /* flag to allow the display of mirror */
|
||||
|
||||
protected:
|
||||
sgVec3 speed;
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
static const int SkyDomeDistValues[] = {0, 12000, 20000, 40000, 80000};
|
||||
static const int NbSkyDomeDistValues = sizeof(SkyDomeDistValues) / sizeof(SkyDomeDistValues[0]);
|
||||
|
||||
static const char* DynamicTimeValues[] =
|
||||
{ GR_ATT_DYNAMICTIME_DISABLED, GR_ATT_DYNAMICTIME_ENABLED };
|
||||
static const int NbDynamicTimeValues = sizeof(DynamicTimeValues) / sizeof(DynamicTimeValues[0]);
|
||||
static const char* DynamicSkyDomeValues[] =
|
||||
{ GR_ATT_DYNAMICSKYDOME_DISABLED, GR_ATT_DYNAMICSKYDOME_ENABLED };
|
||||
static const int NbDynamicSkyDomeValues = sizeof(DynamicSkyDomeValues) / sizeof(DynamicSkyDomeValues[0]);
|
||||
static const int PrecipDensityValues[] = {0, 20, 40, 60, 80, 100};
|
||||
static const int NbPrecipDensityValues = sizeof(PrecipDensityValues) / sizeof(PrecipDensityValues[0]);
|
||||
|
||||
|
@ -49,7 +49,7 @@ static int SmokeEditId;
|
|||
static int SkidEditId;
|
||||
static int LodFactorEditId;
|
||||
static int SkyDomeDistLabelId;
|
||||
static int DynamicTimeLabelId, DynamicTimeLeftButtonId, DynamicTimeRightButtonId;
|
||||
static int DynamicSkyDomeLabelId, DynamicSkyDomeLeftButtonId, DynamicSkyDomeRightButtonId;
|
||||
static int PrecipDensityLabelId;
|
||||
|
||||
static int FovFactorValue = 100;
|
||||
|
@ -57,7 +57,7 @@ static int SmokeValue = 300;
|
|||
static int SkidValue = 20;
|
||||
static tdble LodFactorValue = 1.0;
|
||||
static int SkyDomeDistIndex = 0;
|
||||
static int DynamicTimeIndex = 0;
|
||||
static int DynamicSkyDomeIndex = 0;
|
||||
static int PrecipDensityIndex = NbPrecipDensityValues - 1;
|
||||
|
||||
static char buf[512];
|
||||
|
@ -83,7 +83,7 @@ SaveGraphicOptions(void *prevMenu)
|
|||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, SkidValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, LodFactorValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SKYDOMEDISTANCE, NULL, SkyDomeDistValues[SkyDomeDistIndex]);
|
||||
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_DYNAMICTIME, DynamicTimeValues[DynamicTimeIndex]);
|
||||
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_DYNAMICSKYDOME, DynamicSkyDomeValues[DynamicSkyDomeIndex]);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_PRECIPDENSITY, "%", PrecipDensityValues[PrecipDensityIndex]);
|
||||
|
||||
GfParmWriteFile(NULL, grHandle, "graph");
|
||||
|
@ -134,18 +134,18 @@ LoadGraphicOptions()
|
|||
|
||||
if (nSkyDomeDist > 0)
|
||||
{
|
||||
DynamicTimeIndex = 0; // Default value index, in case file value not found in list.
|
||||
const char* pszDynamicTime =
|
||||
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_DYNAMICTIME, GR_ATT_DYNAMICTIME_DISABLED);
|
||||
for (int i = 0; i < NbDynamicTimeValues; i++)
|
||||
DynamicSkyDomeIndex = 0; // Default value index, in case file value not found in list.
|
||||
const char* pszDynamicSkyDome =
|
||||
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_DYNAMICSKYDOME, GR_ATT_DYNAMICSKYDOME_DISABLED);
|
||||
for (int i = 0; i < NbDynamicSkyDomeValues; i++)
|
||||
{
|
||||
if (!strcmp(pszDynamicTime, DynamicTimeValues[i]))
|
||||
if (!strcmp(pszDynamicSkyDome, DynamicSkyDomeValues[i]))
|
||||
{
|
||||
DynamicTimeIndex = i;
|
||||
DynamicSkyDomeIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
GfuiLabelSetText(ScrHandle, DynamicTimeLabelId, DynamicTimeValues[DynamicTimeIndex]);
|
||||
GfuiLabelSetText(ScrHandle, DynamicSkyDomeLabelId, DynamicSkyDomeValues[DynamicSkyDomeIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -214,11 +214,11 @@ ChangeSkid(void* /* dummy */)
|
|||
}
|
||||
|
||||
static void
|
||||
ChangeDynamicTime(void* vp)
|
||||
ChangeDynamicSkyDome(void* vp)
|
||||
{
|
||||
const long delta = (long)vp;
|
||||
DynamicTimeIndex = (DynamicTimeIndex + NbDynamicTimeValues + delta) % NbDynamicTimeValues;
|
||||
GfuiLabelSetText(ScrHandle, DynamicTimeLabelId, DynamicTimeValues[DynamicTimeIndex]);
|
||||
DynamicSkyDomeIndex = (DynamicSkyDomeIndex + NbDynamicSkyDomeValues + delta) % NbDynamicSkyDomeValues;
|
||||
GfuiLabelSetText(ScrHandle, DynamicSkyDomeLabelId, DynamicSkyDomeValues[DynamicSkyDomeIndex]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -229,15 +229,15 @@ ChangeSkyDomeDist(void* vp)
|
|||
snprintf(buf, sizeof(buf), "%d", SkyDomeDistValues[SkyDomeDistIndex]);
|
||||
GfuiLabelSetText(ScrHandle, SkyDomeDistLabelId, buf);
|
||||
|
||||
const bool bLockDynamicTime = SkyDomeDistValues[SkyDomeDistIndex] == 0;
|
||||
if (bLockDynamicTime)
|
||||
const bool bLockDynamicSkyDome = SkyDomeDistValues[SkyDomeDistIndex] == 0;
|
||||
if (bLockDynamicSkyDome)
|
||||
{
|
||||
DynamicTimeIndex = 0;
|
||||
ChangeDynamicTime(0);
|
||||
DynamicSkyDomeIndex = 0;
|
||||
ChangeDynamicSkyDome(0);
|
||||
}
|
||||
const int nArrowsVisibility = bLockDynamicTime ? GFUI_INVISIBLE : GFUI_VISIBLE;
|
||||
GfuiVisibilitySet(ScrHandle, DynamicTimeLeftButtonId, nArrowsVisibility);
|
||||
GfuiVisibilitySet(ScrHandle, DynamicTimeRightButtonId, nArrowsVisibility);
|
||||
const int nArrowsVisibility = bLockDynamicSkyDome ? GFUI_INVISIBLE : GFUI_VISIBLE;
|
||||
GfuiVisibilitySet(ScrHandle, DynamicSkyDomeLeftButtonId, nArrowsVisibility);
|
||||
GfuiVisibilitySet(ScrHandle, DynamicSkyDomeRightButtonId, nArrowsVisibility);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -277,11 +277,11 @@ GraphMenuInit(void* prevMenu)
|
|||
GfuiMenuCreateButtonControl(ScrHandle, param, "skydomedistrightarrow", (void*)1, ChangeSkyDomeDist);
|
||||
SkyDomeDistLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "skydomedistlabel");
|
||||
|
||||
DynamicTimeLeftButtonId =
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "dynamictimeleftarrow", (void*)-1, ChangeDynamicTime);
|
||||
DynamicTimeRightButtonId =
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "dynamictimerightarrow", (void*)1, ChangeDynamicTime);
|
||||
DynamicTimeLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "dynamictimelabel");
|
||||
DynamicSkyDomeLeftButtonId =
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "dynamicskydomeleftarrow", (void*)-1, ChangeDynamicSkyDome);
|
||||
DynamicSkyDomeRightButtonId =
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "dynamicskydomerightarrow", (void*)1, ChangeDynamicSkyDome);
|
||||
DynamicSkyDomeLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "dynamicskydomelabel");
|
||||
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "precipdensityleftarrow", (void*)-1, ChangePrecipDensity);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "precipdensityrightarrow", (void*)1, ChangePrecipDensity);
|
||||
|
|
Loading…
Reference in a new issue