Merge
commit
090ee2682b
|
|
@ -118,8 +118,12 @@ const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0
|
|||
const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water
|
||||
const S32 LLSettingsDay::FRAME_MAX(56);
|
||||
|
||||
const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f);
|
||||
|
||||
const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("283a26a3-b147-47b7-8057-cfff0302ec0e");
|
||||
|
||||
// Minimum value to prevent multislider in edit floaters from eating up frames that 'encroach' on one another's space
|
||||
static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f);
|
||||
//=========================================================================
|
||||
LLSettingsDay::LLSettingsDay(const LLSD &data) :
|
||||
LLSettingsBase(data),
|
||||
|
|
@ -185,7 +189,7 @@ LLSD LLSettingsDay::getSettings() const
|
|||
return settings;
|
||||
}
|
||||
|
||||
bool LLSettingsDay::initialize()
|
||||
bool LLSettingsDay::initialize(bool validate_frames)
|
||||
{
|
||||
LLSD tracks = mSettings[SETTING_TRACKS];
|
||||
LLSD frames = mSettings[SETTING_FRAMES];
|
||||
|
|
@ -263,6 +267,106 @@ bool LLSettingsDay::initialize()
|
|||
else
|
||||
hassky |= true;
|
||||
|
||||
if (validate_frames && mDayTracks[i].size() > 0)
|
||||
{
|
||||
// check if we hit close to anything in the list
|
||||
LLSettingsDay::CycleTrack_t::value_type frame = getSettingsNearKeyframe(keyframe, i, DEFAULT_FRAME_SLOP_FACTOR);
|
||||
if (frame.second)
|
||||
{
|
||||
// figure out direction of search
|
||||
LLSettingsBase::TrackPosition found = frame.first;
|
||||
LLSettingsBase::TrackPosition new_frame = keyframe;
|
||||
F32 total_frame_shift = 0;
|
||||
// We consider frame DEFAULT_FRAME_SLOP_FACTOR away as still encroaching, so add minimum increment
|
||||
F32 move_factor = DEFAULT_FRAME_SLOP_FACTOR + DEFAULT_MULTISLIDER_INCREMENT;
|
||||
bool move_forward = true;
|
||||
if ((new_frame < found && (found - new_frame) <= DEFAULT_FRAME_SLOP_FACTOR)
|
||||
|| (new_frame > found && (new_frame - found) > DEFAULT_FRAME_SLOP_FACTOR))
|
||||
{
|
||||
move_forward = false;
|
||||
}
|
||||
|
||||
if (move_forward)
|
||||
{
|
||||
CycleTrack_t::iterator iter = mDayTracks[i].find(found);
|
||||
new_frame = found; // for total_frame_shift
|
||||
while (total_frame_shift < 1)
|
||||
{
|
||||
// calculate shifted position from previous found point
|
||||
total_frame_shift += move_factor + (found >= new_frame ? found : found + 1) - new_frame;
|
||||
new_frame = found + move_factor;
|
||||
if (new_frame > 1) new_frame--;
|
||||
|
||||
// we know that current point is too close, go for next one
|
||||
iter++;
|
||||
if (iter == mDayTracks[i].end())
|
||||
{
|
||||
iter = mDayTracks[i].begin();
|
||||
}
|
||||
|
||||
if (((iter->first >= (new_frame - DEFAULT_MULTISLIDER_INCREMENT)) && ((new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= iter->first))
|
||||
|| ((iter->first < new_frame) && ((new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= (iter->first + 1))))
|
||||
{
|
||||
// we are encroaching at new point as well
|
||||
found = iter->first;
|
||||
}
|
||||
else // (new_frame + DEFAULT_FRAME_SLOP_FACTOR < iter->first)
|
||||
{
|
||||
//we found clear spot
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CycleTrack_t::reverse_iterator iter = mDayTracks[i].rbegin();
|
||||
while (iter->first != found)
|
||||
{
|
||||
iter++;
|
||||
}
|
||||
new_frame = found; // for total_frame_shift
|
||||
while (total_frame_shift < 1)
|
||||
{
|
||||
// calculate shifted position from current found point
|
||||
total_frame_shift += move_factor + new_frame - (found <= new_frame ? found : found - 1);
|
||||
new_frame = found - move_factor;
|
||||
if (new_frame < 0) new_frame++;
|
||||
|
||||
// we know that current point is too close, go for next one
|
||||
iter++;
|
||||
if (iter == mDayTracks[i].rend())
|
||||
{
|
||||
iter = mDayTracks[i].rbegin();
|
||||
}
|
||||
|
||||
if ((iter->first <= (new_frame + DEFAULT_MULTISLIDER_INCREMENT) && (new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= iter->first)
|
||||
|| ((iter->first > new_frame) && ((new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= (iter->first - 1))))
|
||||
{
|
||||
// we are encroaching at new point as well
|
||||
found = iter->first;
|
||||
}
|
||||
else // (new_frame - DEFAULT_FRAME_SLOP_FACTOR > iter->first)
|
||||
{
|
||||
//we found clear spot
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (total_frame_shift >= 1)
|
||||
{
|
||||
LL_WARNS() << "Could not fix frame position, adding as is to position: " << keyframe << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mark as new position
|
||||
keyframe = new_frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build clone since:
|
||||
// - can use settings from "used" multiple times
|
||||
// - settings can reuse LLSDs they were initialized from
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ public:
|
|||
static const S32 TRACK_MAX;
|
||||
static const S32 FRAME_MAX;
|
||||
|
||||
static const F32 DEFAULT_FRAME_SLOP_FACTOR;
|
||||
|
||||
static const LLUUID DEFAULT_ASSET_ID;
|
||||
|
||||
typedef std::map<LLSettingsBase::TrackPosition, LLSettingsBase::ptr_t> CycleTrack_t;
|
||||
|
|
@ -76,7 +78,7 @@ public:
|
|||
LLSettingsDay(const LLSD &data);
|
||||
virtual ~LLSettingsDay() { };
|
||||
|
||||
bool initialize();
|
||||
bool initialize(bool validate_frames = false);
|
||||
|
||||
virtual ptr_t buildClone() = 0;
|
||||
virtual LLSD getSettings() const SETTINGS_OVERRIDE;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
static LLDefaultChildRegistry::Register<LLMultiSlider> r("multi_slider_bar");
|
||||
|
||||
const F32 FLOAT_THRESHOLD = 0.00001f;
|
||||
|
||||
S32 LLMultiSlider::mNameCounter = 0;
|
||||
|
||||
LLMultiSlider::SliderParams::SliderParams()
|
||||
|
|
@ -52,6 +54,7 @@ LLMultiSlider::SliderParams::SliderParams()
|
|||
LLMultiSlider::Params::Params()
|
||||
: max_sliders("max_sliders", 1),
|
||||
allow_overlap("allow_overlap", false),
|
||||
loop_overlap("loop_overlap", false),
|
||||
overlap_threshold("overlap_threshold", 0),
|
||||
draw_track("draw_track", true),
|
||||
use_triangle("use_triangle", false),
|
||||
|
|
@ -73,6 +76,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
|
|||
mDragStartThumbRect( 0, getRect().getHeight(), p.thumb_width, 0 ),
|
||||
mMaxNumSliders(p.max_sliders),
|
||||
mAllowOverlap(p.allow_overlap),
|
||||
mLoopOverlap(p.loop_overlap),
|
||||
mDrawTrack(p.draw_track),
|
||||
mUseTriangle(p.use_triangle),
|
||||
mTrackColor(p.track_color()),
|
||||
|
|
@ -151,7 +155,14 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from
|
|||
// look at the current spot
|
||||
// and see if anything is there
|
||||
LLSD::map_iterator mIt = mValue.beginMap();
|
||||
F32 threshold = mOverlapThreshold + (mIncrement / 4); // increment is our distance between points, use to eliminate round error
|
||||
|
||||
// increment is our distance between points, use to eliminate round error
|
||||
F32 threshold = mOverlapThreshold + (mIncrement / 4);
|
||||
// If loop overlap is enabled, check if we overlap with points 'after' max value (project to lower)
|
||||
F32 loop_up_check = (mLoopOverlap && (value + threshold) > mMaxValue) ? (value + threshold - mMaxValue + mMinValue) : 0.0f;
|
||||
// If loop overlap is enabled, check if we overlap with points 'before' min value (project to upper)
|
||||
F32 loop_down_check = (mLoopOverlap && (value - threshold) < mMinValue) ? (value - threshold - mMinValue + mMaxValue) : 0.0f;
|
||||
|
||||
for(;mIt != mValue.endMap(); mIt++) {
|
||||
|
||||
F32 testVal = (F32)mIt->second.asReal() - newValue;
|
||||
|
|
@ -162,6 +173,18 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from
|
|||
hit = true;
|
||||
break;
|
||||
}
|
||||
if (loop_up_check != 0
|
||||
&& testVal < loop_up_check)
|
||||
{
|
||||
hit = true;
|
||||
break;
|
||||
}
|
||||
if (loop_down_check != 0
|
||||
&& testVal > loop_down_check)
|
||||
{
|
||||
hit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if none found, stop
|
||||
|
|
@ -311,7 +334,7 @@ bool LLMultiSlider::findUnusedValue(F32& initVal)
|
|||
|
||||
// look at the current spot
|
||||
// and see if anything is there
|
||||
F32 threshold = mOverlapThreshold + (mIncrement / 4);
|
||||
F32 threshold = mAllowOverlap ? FLOAT_THRESHOLD : mOverlapThreshold + (mIncrement / 4);
|
||||
LLSD::map_iterator mIt = mValue.beginMap();
|
||||
for(;mIt != mValue.endMap(); mIt++) {
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public:
|
|||
Optional<S32> max_sliders;
|
||||
|
||||
Optional<bool> allow_overlap,
|
||||
loop_overlap,
|
||||
draw_track,
|
||||
use_triangle;
|
||||
|
||||
|
|
@ -109,6 +110,7 @@ protected:
|
|||
|
||||
S32 mMaxNumSliders;
|
||||
BOOL mAllowOverlap;
|
||||
BOOL mLoopOverlap;
|
||||
F32 mOverlapThreshold;
|
||||
BOOL mDrawTrack;
|
||||
BOOL mUseTriangle; /// hacked in toggle to use a triangle
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ LLMultiSliderCtrl::Params::Params()
|
|||
can_edit_text("can_edit_text", false),
|
||||
max_sliders("max_sliders", 1),
|
||||
allow_overlap("allow_overlap", false),
|
||||
loop_overlap("loop_overlap", false),
|
||||
overlap_threshold("overlap_threshold", 0),
|
||||
draw_track("draw_track", true),
|
||||
use_triangle("use_triangle", false),
|
||||
|
|
@ -168,6 +169,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p)
|
|||
params.increment(p.increment);
|
||||
params.max_sliders(p.max_sliders);
|
||||
params.allow_overlap(p.allow_overlap);
|
||||
params.loop_overlap(p.loop_overlap);
|
||||
if (p.overlap_threshold.isProvided())
|
||||
{
|
||||
params.overlap_threshold = p.overlap_threshold;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public:
|
|||
Optional<S32> decimal_digits;
|
||||
Optional<S32> max_sliders;
|
||||
Optional<bool> allow_overlap,
|
||||
loop_overlap,
|
||||
draw_track,
|
||||
use_triangle;
|
||||
|
||||
|
|
|
|||
|
|
@ -321,29 +321,66 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask)
|
|||
{
|
||||
if (hasMouseCapture())
|
||||
{
|
||||
LLQuaternion delta;
|
||||
if (mask == MASK_CONTROL)
|
||||
{ // trackball (move to roll) mode
|
||||
LLQuaternion delta;
|
||||
|
||||
F32 rotX = x - mPrevX;
|
||||
F32 rotY = y - mPrevY;
|
||||
F32 rotX = x - mPrevX;
|
||||
F32 rotY = y - mPrevY;
|
||||
|
||||
if (abs(rotX) > 1)
|
||||
{
|
||||
F32 direction = (rotX < 0) ? -1 : 1;
|
||||
delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis
|
||||
mValue *= delta;
|
||||
if (abs(rotX) > 1)
|
||||
{
|
||||
F32 direction = (rotX < 0) ? -1 : 1;
|
||||
delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis
|
||||
mValue *= delta;
|
||||
}
|
||||
|
||||
if (abs(rotY) > 1)
|
||||
{
|
||||
F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top)
|
||||
delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis
|
||||
mValue *= delta;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // set on click mode
|
||||
if (!pointInTouchCircle(x, y))
|
||||
{
|
||||
return TRUE; // don't drag outside the circle
|
||||
}
|
||||
|
||||
if (abs(rotY) > 1)
|
||||
{
|
||||
F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top)
|
||||
delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis
|
||||
mValue *= delta;
|
||||
F32 radius = mTouchArea->getRect().getWidth() / 2;
|
||||
F32 xx = x - mTouchArea->getRect().getCenterX();
|
||||
F32 yy = y - mTouchArea->getRect().getCenterY();
|
||||
F32 dist = sqrt(pow(xx, 2) + pow(yy, 2));
|
||||
|
||||
F32 azimuth = llclamp(acosf(xx / dist), 0.0f, F_PI);
|
||||
F32 altitude = llclamp(acosf(dist / radius), 0.0f, F_PI_BY_TWO);
|
||||
|
||||
if (yy < 0)
|
||||
{
|
||||
azimuth = F_TWO_PI - azimuth;
|
||||
}
|
||||
|
||||
LLVector3 draw_point = VectorZero * mValue;
|
||||
if (draw_point.mV[VZ] >= 0.f)
|
||||
{
|
||||
if (is_approx_zero(altitude)) // don't change the hemisphere
|
||||
{
|
||||
altitude = F_APPROXIMATELY_ZERO;
|
||||
}
|
||||
altitude *= -1;
|
||||
}
|
||||
|
||||
mValue.setAngleAxis(altitude, 0, 1, 0);
|
||||
LLQuaternion az_quat;
|
||||
az_quat.setAngleAxis(azimuth, 0, 0, 1);
|
||||
mValue *= az_quat;
|
||||
}
|
||||
|
||||
onCommit();
|
||||
|
||||
mPrevX = x;
|
||||
mPrevY = y;
|
||||
onCommit();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ uniform mat3 env_mat;
|
|||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
|
||||
#if HAS_SHADOW
|
||||
uniform sampler2DShadow shadowMap0;
|
||||
|
|
@ -286,12 +285,9 @@ void main()
|
|||
calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten);
|
||||
|
||||
vec2 abnormal = encode_normal(norm.xyz);
|
||||
norm.xyz = decode_normal(abnormal.xy);
|
||||
norm.xyz = decode_normal(abnormal.xy);
|
||||
|
||||
float da_sun = dot(norm.xyz, sun_dir.xyz);
|
||||
float da_moon = dot(norm.xyz, moon_dir.xyz);
|
||||
|
||||
float da = max(da_sun, da_moon);
|
||||
float da = dot(norm.xyz, sun_dir.xyz);
|
||||
|
||||
float final_da = da;
|
||||
final_da = min(final_da, shadow);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ uniform mat3 env_mat;
|
|||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
|
|
@ -389,9 +388,7 @@ void main()
|
|||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
|
||||
float da_sun =dot(norm.xyz, sun_dir.xyz);
|
||||
float da_moon =dot(norm.xyz, moon_dir.xyz);
|
||||
float da = max(da_sun, da_moon);
|
||||
float da =dot(norm.xyz, sun_dir.xyz);
|
||||
|
||||
float final_da = da;
|
||||
final_da = min(final_da, shadow);
|
||||
|
|
@ -421,9 +418,7 @@ void main()
|
|||
// the old infinite-sky shiny reflection
|
||||
//
|
||||
|
||||
float sa_sun = dot(refnormpersp, sun_dir.xyz);
|
||||
float sa_moon = dot(refnormpersp, moon_dir.xyz);
|
||||
float sa = max(sa_sun, sa_moon);
|
||||
float sa = dot(refnormpersp, sun_dir.xyz);
|
||||
|
||||
vec3 dumbshiny = sunlit*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ uniform mat3 env_mat;
|
|||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
|
@ -107,9 +106,7 @@ void main()
|
|||
float envIntensity = norm.z;
|
||||
norm.xyz = decode_normal(norm.xy); // unpack norm
|
||||
|
||||
float da_sun = dot(norm.xyz, sun_dir.xyz);
|
||||
float da_moon = dot(norm.xyz, moon_dir.xyz);
|
||||
float da = max(da_sun, da_moon);
|
||||
float da = dot(norm.xyz, sun_dir.xyz);
|
||||
|
||||
float final_da = max(0.0,da);
|
||||
final_da = min(final_da, 1.0f);
|
||||
|
|
@ -151,9 +148,7 @@ void main()
|
|||
// the old infinite-sky shiny reflection
|
||||
//
|
||||
|
||||
float sa_sun = dot(refnormpersp, sun_dir.xyz);
|
||||
float sa_moon = dot(refnormpersp, moon_dir.xyz);
|
||||
float sa = max(sa_sun, sa_moon);
|
||||
float sa = dot(refnormpersp, sun_dir.xyz);
|
||||
|
||||
vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ uniform vec4 shadow_clip;
|
|||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
|
@ -117,9 +116,7 @@ void main()
|
|||
float envIntensity = norm.z;
|
||||
norm.xyz = decode_normal(norm.xy); // unpack norm
|
||||
|
||||
float da_sun = max(dot(norm.xyz, sun_dir.xyz), 0.0);
|
||||
float da_moon = max(dot(norm.xyz, moon_dir.xyz), 0.0);
|
||||
float da = max(da_sun, da_moon);
|
||||
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
|
||||
|
||||
float light_gamma = 1.0/1.3;
|
||||
da = pow(da, light_gamma);
|
||||
|
|
@ -170,9 +167,7 @@ void main()
|
|||
// the old infinite-sky shiny reflection
|
||||
//
|
||||
|
||||
float sa_sun = dot(refnormpersp, sun_dir.xyz);
|
||||
float sa_moon = dot(refnormpersp, moon_dir.xyz);
|
||||
float sa = max(sa_sun, sa_moon);
|
||||
float sa = dot(refnormpersp, sun_dir.xyz);
|
||||
vec3 dumbshiny = sunlit*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r);
|
||||
|
||||
// add the two types of shiny together
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ uniform mat4 inv_proj;
|
|||
uniform vec2 screen_res;
|
||||
uniform vec2 proj_shadow_res;
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
|
||||
uniform vec2 shadow_res;
|
||||
uniform float shadow_bias;
|
||||
|
|
@ -140,14 +139,10 @@ void main()
|
|||
}*/
|
||||
|
||||
float shadow = 0.0;
|
||||
float da_sun = dot(norm, sun_dir.xyz);
|
||||
float da_moon = dot(norm, moon_dir.xyz);
|
||||
float da = max(da_sun, da_moon);
|
||||
|
||||
float dp_directional_light = max(0.0, da);
|
||||
float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
|
||||
|
||||
vec3 shadow_pos = pos.xyz;
|
||||
vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light);
|
||||
vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
|
||||
|
||||
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ uniform mat4 inv_proj;
|
|||
uniform vec2 screen_res;
|
||||
uniform vec2 proj_shadow_res;
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
|
||||
uniform vec2 shadow_res;
|
||||
|
||||
|
|
@ -201,13 +200,10 @@ void main()
|
|||
}*/
|
||||
|
||||
float shadow = 0.0;
|
||||
float da_sun = dot(norm, sun_dir.xyz);
|
||||
float da_moon = dot(norm, moon_dir.xyz);
|
||||
float da = max(da_sun, da_moon);
|
||||
float dp_directional_light = max(0.0, da);
|
||||
float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
|
||||
|
||||
vec3 shadow_pos = pos.xyz;
|
||||
vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light);
|
||||
vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
|
||||
|
||||
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ in vec3 view_dir;
|
|||
|
||||
uniform vec3 cameraPosLocal;
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
uniform float sun_size;
|
||||
|
||||
uniform sampler2D transmittance_texture;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ in vec3 view_dir;
|
|||
|
||||
uniform vec3 cameraPosLocal;
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
uniform float sun_size;
|
||||
|
||||
uniform sampler2D transmittance_texture;
|
||||
|
|
|
|||
|
|
@ -423,13 +423,17 @@ void LLEnvironment::onLegacyRegionSettings(LLSD data)
|
|||
LLUUID regionId = data[0]["regionID"].asUUID();
|
||||
|
||||
LLSettingsDay::ptr_t regionday;
|
||||
if (data[1].isUndefined())
|
||||
regionday = LLSettingsVODay::buildDefaultDayCycle();
|
||||
else
|
||||
if (!data[1].isUndefined())
|
||||
regionday = LLSettingsVODay::buildFromLegacyMessage(regionId, data[1], data[2], data[3]);
|
||||
|
||||
clearEnvironment(ENV_PARCEL);
|
||||
setEnvironment(ENV_REGION, regionday, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
|
||||
if (!regionday)
|
||||
{
|
||||
LL_WARNS("ENVIRONMENT") << "Unable to create day from legacy. Using default day cycle." << LL_ENDL;
|
||||
setEnvironment(LLEnvironment::ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
|
||||
}
|
||||
else
|
||||
setEnvironment(ENV_REGION, regionday, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
|
||||
|
||||
updateEnvironment();
|
||||
}
|
||||
|
|
@ -570,12 +574,17 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSe
|
|||
|
||||
void LLEnvironment::setEnvironment(EnvSelection_t env, const LLUUID &assetId)
|
||||
{
|
||||
LLSettingsVOBase::getSettingsAsset(assetId,
|
||||
[this, env](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onSetEnvAssetLoaded(env, asset_id, settings, status); });
|
||||
|
||||
setEnvironment(env, assetId, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
|
||||
}
|
||||
|
||||
void LLEnvironment::onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
|
||||
|
||||
void LLEnvironment::setEnvironment(EnvSelection_t env, const LLUUID &assetId, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset)
|
||||
{
|
||||
LLSettingsVOBase::getSettingsAsset(assetId,
|
||||
[this, env, daylength, dayoffset](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onSetEnvAssetLoaded(env, asset_id, settings, daylength, dayoffset, status); });
|
||||
}
|
||||
|
||||
void LLEnvironment::onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset, S32 status)
|
||||
{
|
||||
if (!settings || status)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ public:
|
|||
void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(fixed, LLSettingsWater::ptr_t())); }
|
||||
void setEnvironment(EnvSelection_t env, const LLSettingsWater::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(LLSettingsSky::ptr_t(), fixed)); }
|
||||
void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixeds, const LLSettingsWater::ptr_t & fixedw) { setEnvironment(env, fixedEnvironment_t(fixeds, fixedw)); }
|
||||
void setEnvironment(EnvSelection_t env, const LLUUID &assetId, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset);
|
||||
void setEnvironment(EnvSelection_t env, const LLUUID &assetId);
|
||||
|
||||
void clearEnvironment(EnvSelection_t env);
|
||||
|
|
@ -368,7 +369,7 @@ private:
|
|||
|
||||
void onAgentPositionHasChanged(const LLVector3 &localpos);
|
||||
|
||||
void onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status);
|
||||
void onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset, S32 status);
|
||||
void onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset);
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -107,8 +107,6 @@ namespace {
|
|||
const std::string ACTION_APPLY_REGION("apply_region");
|
||||
|
||||
const F32 DAY_CYCLE_PLAY_TIME_SECONDS = 60;
|
||||
|
||||
const F32 FRAME_SLOP_FACTOR = 0.0251f;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
|
@ -407,7 +405,7 @@ void LLFloaterEditExtDayCycle::onAddTrack()
|
|||
{
|
||||
LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue());
|
||||
LLSettingsBase::ptr_t setting;
|
||||
if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, FRAME_SLOP_FACTOR)).second)
|
||||
if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
|
||||
{
|
||||
LL_WARNS("ENVIRONMENT") << "Attempt to add new frame too close to existing frame." << LL_ENDL;
|
||||
return;
|
||||
|
|
@ -512,7 +510,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data)
|
|||
{
|
||||
// don't move the point/frame as long as shift is pressed and user is attempting to copy
|
||||
// handleKeyUp will do the move if user releases key too early.
|
||||
if (!(mEditDay->getSettingsNearKeyframe(sliderpos, mCurrentTrack, FRAME_SLOP_FACTOR)).second)
|
||||
if (!(mEditDay->getSettingsNearKeyframe(sliderpos, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
|
||||
{
|
||||
LL_DEBUGS() << "Copying frame from " << it->second.mFrame << " to " << sliderpos << LL_ENDL;
|
||||
LLSettingsBase::ptr_t new_settings;
|
||||
|
|
@ -584,7 +582,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask)
|
|||
|
||||
LL_WARNS("LAPRAS") << "Selected vs mouse delta = " << (sliderval - sliderpos) << LL_ENDL;
|
||||
|
||||
if (fabs(sliderval - sliderpos) > FRAME_SLOP_FACTOR)
|
||||
if (fabs(sliderval - sliderpos) > LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)
|
||||
{
|
||||
mFramesSlider->resetCurSlider();
|
||||
}
|
||||
|
|
@ -598,12 +596,12 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask)
|
|||
|
||||
LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL;
|
||||
mTimeSlider->setCurSliderValue(sliderpos);
|
||||
selectFrame(sliderpos, FRAME_SLOP_FACTOR);
|
||||
selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
|
||||
}
|
||||
|
||||
void LLFloaterEditExtDayCycle::onTimeSliderMoved()
|
||||
{
|
||||
selectFrame(mTimeSlider->getCurSliderValue(), FRAME_SLOP_FACTOR);
|
||||
selectFrame(mTimeSlider->getCurSliderValue(), LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
|
||||
}
|
||||
|
||||
void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force )
|
||||
|
|
@ -796,7 +794,7 @@ void LLFloaterEditExtDayCycle::updateSlider()
|
|||
mLastFrameSlider.clear();
|
||||
}
|
||||
|
||||
selectFrame(frame_position, FRAME_SLOP_FACTOR);
|
||||
selectFrame(frame_position, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
|
||||
}
|
||||
|
||||
void LLFloaterEditExtDayCycle::updateTimeAndLabel()
|
||||
|
|
@ -990,7 +988,7 @@ void LLFloaterEditExtDayCycle::synchronizeTabs()
|
|||
{
|
||||
canedit = !mIsPlaying;
|
||||
// either search mEditDay or retrieve from mSliderKeyMap
|
||||
LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyframe(frame, LLSettingsDay::TRACK_WATER, FRAME_SLOP_FACTOR);
|
||||
LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyframe(frame, LLSettingsDay::TRACK_WATER, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
|
||||
psettingW = std::static_pointer_cast<LLSettingsWater>(found.second);
|
||||
}
|
||||
mCurrentEdit = psettingW;
|
||||
|
|
@ -1018,7 +1016,7 @@ void LLFloaterEditExtDayCycle::synchronizeTabs()
|
|||
{
|
||||
canedit = !mIsPlaying;
|
||||
// either search mEditDay or retrieve from mSliderKeyMap
|
||||
LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, FRAME_SLOP_FACTOR);
|
||||
LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
|
||||
psettingS = std::static_pointer_cast<LLSettingsSky>(found.second);
|
||||
}
|
||||
mCurrentEdit = psettingS;
|
||||
|
|
@ -1229,7 +1227,7 @@ void LLFloaterEditExtDayCycle::stopPlay()
|
|||
gIdleCallbacks.deleteFunction(onIdlePlay, this);
|
||||
mPlayTimer.stop();
|
||||
F32 frame = mTimeSlider->getCurSliderValue();
|
||||
selectFrame(frame, FRAME_SLOP_FACTOR);
|
||||
selectFrame(frame, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
|
||||
|
||||
getChild<LLView>("play_layout", true)->setVisible(TRUE);
|
||||
getChild<LLView>("pause_layout", true)->setVisible(FALSE);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ private:
|
|||
void setWaterTabsEnabled(BOOL enable);
|
||||
void setSkyTabsEnabled(BOOL enable);
|
||||
void updateButtons();
|
||||
void updateSlider(); //track to slider
|
||||
void updateSlider(); //generate sliders from current track
|
||||
void updateTimeAndLabel();
|
||||
void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t &setting, bool update_ui = true);
|
||||
void removeCurrentSliderFrame();
|
||||
|
|
|
|||
|
|
@ -1025,7 +1025,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io
|
|||
|
||||
if (dayp)
|
||||
{
|
||||
dayp->initialize();
|
||||
// true for validation - either validate here, or when cloning for floater.
|
||||
dayp->initialize(true);
|
||||
}
|
||||
return dayp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1418,8 +1418,11 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
|
|||
void LLVOSky::updateFog(const F32 distance)
|
||||
{
|
||||
LLEnvironment& environment = LLEnvironment::instance();
|
||||
LLVector3 light_dir = LLVector3(environment.getClampedLightNorm());
|
||||
m_legacyAtmospherics.updateFog(distance, light_dir);
|
||||
if (environment.getCurrentSky() != nullptr)
|
||||
{
|
||||
LLVector3 light_dir = LLVector3(environment.getClampedLightNorm());
|
||||
m_legacyAtmospherics.updateFog(distance, light_dir);
|
||||
}
|
||||
}
|
||||
|
||||
void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLVector3 &moon_dir_cfr)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ bool LLEnvironmentRequest::doRequest()
|
|||
{
|
||||
LL_INFOS("WindlightCaps") << "Skipping windlight setting request - we don't have this capability" << LL_ENDL;
|
||||
// region is apparently not capable of this; don't respond at all
|
||||
// (there shouldn't be any regions where this is the case... but
|
||||
LL_INFOS("ENVIRONMENT") << "No legacy windlight caps... just set the region to be the default day." << LL_ENDL;
|
||||
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_REGION, LLSettingsDay::GetDefaultAssetId());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -117,8 +120,8 @@ void LLEnvironmentRequest::environmentRequestCoro(std::string url)
|
|||
if (!status)
|
||||
{
|
||||
LL_WARNS("WindlightCaps") << "Got an error, not using region windlight... " << LL_ENDL;
|
||||
LLEnvironment::instance().onLegacyRegionSettings(LLSD());
|
||||
|
||||
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_REGION, LLSettingsDay::GetDefaultAssetId());
|
||||
|
||||
return;
|
||||
}
|
||||
result = result["content"];
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@
|
|||
height="10"
|
||||
increment="0.005"
|
||||
overlap_threshold="0.026"
|
||||
loop_overlap="true"
|
||||
initial_value="0"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
width="150"
|
||||
height="150"
|
||||
user_resize="false"
|
||||
increment_angle_mouse="0.5f"
|
||||
increment_angle_mouse="1.5f"
|
||||
increment_angle_btn="3.0f"
|
||||
image_sphere="VirtualTrackball_Sphere"
|
||||
image_moon_back="VirtualTrackball_Moon_Back"
|
||||
|
|
|
|||
Loading…
Reference in New Issue