diff options
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 67 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 108 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 39 |
3 files changed, 113 insertions, 101 deletions
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 7dc415e480..2c8bddee93 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -285,52 +285,51 @@ bool LLSettingsDay::initialize() //========================================================================= LLSD LLSettingsDay::defaults() { - LLSD dfltsetting; + static LLSD dfltsetting; - dfltsetting[SETTING_NAME] = "_default_"; - - LLSD frames(LLSD::emptyMap()); - LLSD waterTrack; - LLSD skyTrack; - - - const U32 FRAME_COUNT = 8; - const F32 FRAME_STEP = 1.0f / F32(FRAME_COUNT); - F32 time = 0.0f; - for (U32 i = 0; i < FRAME_COUNT; i++) + if (dfltsetting.size() == 0) { - std::string name("_default_"); - name += ('a' + i); - - std::string water_frame_name("water:"); - std::string sky_frame_name("sky:"); + dfltsetting[SETTING_NAME] = "_default_"; + dfltsetting[SETTING_TYPE] = "daycycle"; - water_frame_name += name; - sky_frame_name += name; + LLSD frames(LLSD::emptyMap()); + LLSD waterTrack; + LLSD skyTrack; - waterTrack[SETTING_KEYKFRAME] = time; - waterTrack[SETTING_KEYNAME] = water_frame_name; + + const U32 FRAME_COUNT = 8; + const F32 FRAME_STEP = 1.0f / F32(FRAME_COUNT); + F32 time = 0.0f; + for (U32 i = 0; i < FRAME_COUNT; i++) + { + std::string name("_default_"); + name += ('a' + i); - skyTrack[SETTING_KEYKFRAME] = time; - skyTrack[SETTING_KEYNAME] = sky_frame_name; + std::string water_frame_name("water:"); + std::string sky_frame_name("sky:"); - frames[water_frame_name] = LLSettingsWater::defaults(time); - frames[sky_frame_name] = LLSettingsSky::defaults(time); + water_frame_name += name; + sky_frame_name += name; - time += FRAME_STEP; - } + waterTrack[SETTING_KEYKFRAME] = time; + waterTrack[SETTING_KEYNAME] = water_frame_name; - LLSD tracks; - tracks.append(LLSDArray(waterTrack)); - tracks.append(LLSDArray(skyTrack)); + skyTrack[SETTING_KEYKFRAME] = time; + skyTrack[SETTING_KEYNAME] = sky_frame_name; - dfltsetting[SETTING_TRACKS] = tracks; + frames[water_frame_name] = LLSettingsWater::defaults(time); + frames[sky_frame_name] = LLSettingsSky::defaults(time); - + time += FRAME_STEP; + } - dfltsetting[SETTING_FRAMES] = frames; + LLSD tracks; + tracks.append(LLSDArray(waterTrack)); + tracks.append(LLSDArray(skyTrack)); - dfltsetting[SETTING_TYPE] = "daycycle"; + dfltsetting[SETTING_TRACKS] = tracks; + dfltsetting[SETTING_FRAMES] = frames; + } return dfltsetting; } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 6f1520bdfa..bf0115b80b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -40,7 +40,7 @@ static const LLVector3 DUE_EAST = LLVector3::x_axis; static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); + quat.setEulerAngles(0.0f, altitude, azimuth); return quat; } @@ -585,53 +585,57 @@ LLSD LLSettingsSky::mieConfigDefault() LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) { - LLSD dfltsetting; - LLQuaternion sunquat; - LLQuaternion moonquat; - - F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); - F32 altitude = (F_PI * position); - - // give the sun and moon slightly different tracks through the sky - // instead of positioning them at opposite poles from each other... - sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); - moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); - - // Magic constants copied form dfltsetting.xml - dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); - dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); + static LLSD dfltsetting; + + if (dfltsetting.size() == 0) + { + LLQuaternion sunquat; + LLQuaternion moonquat; + + F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); + F32 altitude = (F_PI * position); + + // give the sun and moon slightly different tracks through the sky + // instead of positioning them at opposite poles from each other... + sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); + moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); + + // Magic constants copied form dfltsetting.xml + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); - dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); - dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); - dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); + dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); + dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); + dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); - dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); - dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); - dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - - dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); - dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); - - dfltsetting[SETTING_TYPE] = "sky"; - - // defaults are for earth... - dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); - dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); - dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); + dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); + dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); + + dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; + dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); + dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + + dfltsetting[SETTING_TYPE] = "sky"; + + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + } return dfltsetting; } @@ -769,11 +773,17 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. - F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); - F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + F32 two_pi = F_PI * 2.0f; + + // get counter-clockwise radian angle from clockwise legacy WL east angle... + F32 azimuth = two_pi - legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude); + + // original WL moon dir was diametrically opposed to the sun dir + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); //LLVector3 sundir = DUE_EAST * sunquat; //LLVector3 moondir = DUE_EAST * moonquat; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 8eb65331ad..3e0c6dcb82 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -89,27 +89,30 @@ LLSettingsWater::LLSettingsWater() : //========================================================================= LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) { - LLSD dfltsetting; + static LLSD dfltsetting; - // give the normal scale offset some variability over track time... - F32 normal_scale_offset = (position * 0.5f) - 0.25f; + if (dfltsetting.size() == 0) + { + // give the normal scale offset some variability over track time... + F32 normal_scale_offset = (position * 0.5f) - 0.25f; - // Magic constants copied form defaults.xml - dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); - dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); - dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); - dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); - dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); - dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); - dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId(); - dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId(); - dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f + normal_scale_offset, 2.0f + normal_scale_offset, 2.0f + normal_scale_offset).getValue(); - dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); - dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); - dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); - dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); + // Magic constants copied form defaults.xml + dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); + dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); + dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); + dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); + dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); + dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); + dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId(); + dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId(); + dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f + normal_scale_offset, 2.0f + normal_scale_offset, 2.0f + normal_scale_offset).getValue(); + dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); + dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); + dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); + dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); - dfltsetting[SETTING_TYPE] = "water"; + dfltsetting[SETTING_TYPE] = "water"; + } return dfltsetting; } |