MAINT-9026 hook up sun/moon scale to settingsvo and render code

master
Graham Linden 2018-08-22 23:02:16 +01:00
parent 3b9e6636e5
commit f45edabe47
5 changed files with 44 additions and 6 deletions

View File

@ -579,6 +579,9 @@ void LLSettingsVOSky::updateSettings()
gSky.setMoonTextures(getMoonTextureId(), getNextMoonTextureId());
gSky.setCloudNoiseTextures(getCloudNoiseTextureId(), getNextCloudNoiseTextureId());
gSky.setBloomTextures(getBloomTextureId(), getNextBloomTextureId());
gSky.setSunScale(getSunScale());
gSky.setMoonScale(getMoonScale());
}
void LLSettingsVOSky::applySpecial(void *ptarget)

View File

@ -129,6 +129,22 @@ void LLSky::resetVertexBuffers()
}
}
void LLSky::setSunScale(F32 sun_scale)
{
if(mVOSkyp.notNull())
{
mVOSkyp->setSunScale(sun_scale);
}
}
void LLSky::setMoonScale(F32 moon_scale)
{
if(mVOSkyp.notNull())
{
mVOSkyp->setMoonScale(moon_scale);
}
}
void LLSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next)
{
if(mVOSkyp.notNull()) {

View File

@ -61,6 +61,9 @@ public:
void setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next);
void setBloomTextures(const LLUUID& bloom_texture, const LLUUID& bloom_texture_next);
void setSunScale(F32 sun_scale);
void setMoonScale(F32 moon_scale);
LLColor4 getSkyFogColor() const;
void setCloudDensityAtAgent(F32 cloud_density);

View File

@ -775,6 +775,16 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline)
return mDrawable;
}
void LLVOSky::setSunScale(F32 sun_scale)
{
mSunScale = sun_scale;
}
void LLVOSky::setMoonScale(F32 moon_scale)
{
mMoonScale = moon_scale;
}
void LLVOSky::setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next)
{
// We test the UUIDs here because we explicitly do not want the default image returned by getFetchedTexture in that case...
@ -955,8 +965,8 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
right.normalize();
up.normalize();
bool draw_sun = updateHeavenlyBodyGeometry(drawable, FACE_SUN, mSun, up, right);
bool draw_moon = updateHeavenlyBodyGeometry(drawable, FACE_MOON, mMoon, up, right);
bool draw_sun = updateHeavenlyBodyGeometry(drawable, mSunScale, FACE_SUN, mSun, up, right);
bool draw_moon = updateHeavenlyBodyGeometry(drawable, mMoonScale, FACE_MOON, mMoon, up, right);
draw_sun &= LLEnvironment::getInstance()->getIsSunUp();
draw_moon &= LLEnvironment::getInstance()->getIsMoonUp();
@ -987,7 +997,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
return TRUE;
}
bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right)
bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 f, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right)
{
mHeavenlyBodyUpdated = TRUE ;
@ -1010,8 +1020,8 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, LLHe
F32 horiz_enlargement = 1 + enlargm_factor * 0.3f;
F32 vert_enlargement = 1 + enlargm_factor * 0.2f;
const LLVector3 scaled_right = horiz_enlargement * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_right;
const LLVector3 scaled_up = vert_enlargement * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_up;
const LLVector3 scaled_right = horiz_enlargement * scale * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_right;
const LLVector3 scaled_up = vert_enlargement * scale * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_up;
LLVector3 v_clipped[4];

View File

@ -236,7 +236,7 @@ public:
void setSunDirectionCFR(const LLVector3 &sun_direction);
void setMoonDirectionCFR(const LLVector3 &moon_direction);
bool updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right);
bool updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right);
void updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB);
F32 getWorldScale() const { return mWorldScale; }
@ -278,6 +278,9 @@ public:
void setCloudNoiseTextures(const LLUUID& cloud_noise_texture, const LLUUID& cloud_noise_texture_next);
void setBloomTextures(const LLUUID& bloom_texture, const LLUUID& bloom_texture_next);
void setSunScale(F32 sun_scale);
void setMoonScale(F32 sun_scale);
void forceSkyUpdate(void) { mForceUpdate = TRUE; }
public:
@ -297,6 +300,9 @@ protected:
LLPointer<LLViewerFetchedTexture> mCloudNoiseTexturep[2];
LLPointer<LLViewerFetchedTexture> mBloomTexturep[2];
F32 mSunScale = 1.0f;
F32 mMoonScale = 1.0f;
static S32 sResolution;
static S32 sTileResX;
static S32 sTileResY;