Merge branch 'DRTVWR-548-maint-N' of https://bitbucket.org/lindenlab/viewer

master
Ansariel 2022-07-22 12:19:11 +02:00
commit f9f81ebe20
12 changed files with 127 additions and 70 deletions

View File

@ -612,39 +612,49 @@ void LLAudioDecodeMgr::Impl::startMoreDecodes()
// Kick off a decode
mDecodes[decode_id] = LLPointer<LLVorbisDecodeState>(NULL);
main_queue->postTo(
general_queue,
[decode_id]() // Work done on general queue
{
LLPointer<LLVorbisDecodeState> decode_state = beginDecodingAndWritingAudio(decode_id);
if (!decode_state)
try
{
main_queue->postTo(
general_queue,
[decode_id]() // Work done on general queue
{
if (gAudiop)
gAudiop->markSoundCorrupt(decode_id);
LLPointer<LLVorbisDecodeState> decode_state = beginDecodingAndWritingAudio(decode_id);
// Audio decode has errored
if (!decode_state)
{
if (gAudiop)
gAudiop->markSoundCorrupt(decode_id);
// Audio decode has errored
return decode_state;
}
// Disk write of decoded audio is now in progress off-thread
return decode_state;
}
},
[decode_id, this](LLPointer<LLVorbisDecodeState> decode_state) // Callback to main thread
mutable {
if (!gAudiop)
{
// There is no LLAudioEngine anymore. This might happen if
// an audio decode is enqueued just before shutdown.
return;
}
// Disk write of decoded audio is now in progress off-thread
return decode_state;
},
[decode_id, this](LLPointer<LLVorbisDecodeState> decode_state) // Callback to main thread
mutable {
if (!gAudiop)
{
// There is no LLAudioEngine anymore. This might happen if
// an audio decode is enqueued just before shutdown.
return;
}
// At this point, we can be certain that the pointer to "this"
// is valid because the lifetime of "this" is dependent upon
// the lifetime of gAudiop.
// At this point, we can be certain that the pointer to "this"
// is valid because the lifetime of "this" is dependent upon
// the lifetime of gAudiop.
enqueueFinishAudio(decode_id, decode_state);
});
enqueueFinishAudio(decode_id, decode_state);
});
}
catch (const LLThreadSafeQueueInterrupt&)
{
// Shutdown
// Consider making processQueue() do a cleanup instead
// of starting more decodes
LL_WARNS() << "Tried to start decoding on shutdown" << LL_ENDL;
}
}
}

View File

@ -2461,6 +2461,13 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
//copy out indices
S32 num_indices = idx.size() / 2;
const S32 indices_to_discard = num_indices % 3;
if (indices_to_discard > 0)
{
// Invalid number of triangle indices
LL_WARNS() << "Incomplete triangle discarded from face! Indices count " << num_indices << " was not divisible by 3. face index: " << i << " Total: " << face_count << LL_ENDL;
num_indices -= indices_to_discard;
}
face.resizeIndices(num_indices);
if (num_indices > 2 && !face.mIndices)
@ -2476,8 +2483,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
}
U16* indices = (U16*) &(idx[0]);
U32 count = idx.size()/2;
for (U32 j = 0; j < count; ++j)
for (U32 j = 0; j < num_indices; ++j)
{
face.mIndices[j] = indices[j];
}
@ -3898,8 +3904,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
#if DEBUG_SILHOUETTE_EDGE_MAP
//for each triangle
U32 count = face.mNumIndices;
for (U32 j = 0; j < count/3; j++) {
U32 tri_count = face.mNumIndices / 3;
for (U32 j = 0; j < tri_count; j++) {
//get vertices
S32 v1 = face.mIndices[j*3+0];
S32 v2 = face.mIndices[j*3+1];
@ -3917,7 +3923,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
continue;
}
if (nIndex >= (S32) count/3) {
if (nIndex >= (S32)tri_count) {
continue;
}
//get neighbor vertices
@ -5639,6 +5645,8 @@ void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVe
}
ND_OCTREE_LOG << "Creating octree with scale " << scaler << " mNumIndices " << mNumIndices << ND_OCTREE_LOG_END;
llassert(mNumIndices % 3 == 0);
mOctree = new LLOctreeRoot<LLVolumeTriangle, LLVolumeTriangle*>(center, size, NULL);
new LLVolumeOctreeListener(mOctree);
// Clear old triangles, but keep the underlying storage pointer
@ -5647,14 +5655,14 @@ void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVe
// Initialize all the triangles we need
mOctreeTriangles.resize(num_triangles);
for (U32 i = 0; i < mNumIndices; i+= 3)
for (U32 triangle_index = 0; triangle_index < num_triangles; ++triangle_index)
{ //for each triangle
const U32 triangle_index = i / 3;
const U32 index = triangle_index * 3;
LLVolumeTriangle* tri = &mOctreeTriangles[triangle_index];
const LLVector4a& v0 = mPositions[mIndices[i]];
const LLVector4a& v1 = mPositions[mIndices[i+1]];
const LLVector4a& v2 = mPositions[mIndices[i+2]];
const LLVector4a& v0 = mPositions[mIndices[index]];
const LLVector4a& v1 = mPositions[mIndices[index + 1]];
const LLVector4a& v2 = mPositions[mIndices[index + 2]];
//store pointers to vertex data
tri->mV[0] = &v0;
@ -5662,9 +5670,9 @@ void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVe
tri->mV[2] = &v2;
//store indices
tri->mIndex[0] = mIndices[i];
tri->mIndex[1] = mIndices[i+1];
tri->mIndex[2] = mIndices[i+2];
tri->mIndex[0] = mIndices[index];
tri->mIndex[1] = mIndices[index + 1];
tri->mIndex[2] = mIndices[index + 2];
//get minimum point
LLVector4a min = v0;
@ -6586,6 +6594,7 @@ void LLVolumeFace::allocateJointIndices(S32 num_verts)
void LLVolumeFace::resizeIndices(S32 num_indices)
{
ll_aligned_free_16(mIndices);
llassert(num_indices % 3 == 0);
if (num_indices)
{

View File

@ -383,6 +383,8 @@ void LLModel::setVolumeFaceData(
U32 num_verts,
U32 num_indices)
{
llassert(num_indices % 3 == 0);
LLVolumeFace& face = mVolumeFaces[f];
face.resizeVertices(num_verts);

View File

@ -290,9 +290,14 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
pickerp->getCurG (),
pickerp->getCurB (),
subject->mColor.mV[VALPHA] ); // keep current alpha
subject->mColor = updatedColor;
subject->setControlValue(updatedColor.getValue());
pickerp->setRevertOnCancel(TRUE);
bool color_changed = subject->mColor != updatedColor;
if (color_changed)
{
subject->mColor = updatedColor;
subject->setControlValue(updatedColor.getValue());
}
if (pick_op == COLOR_CANCEL && subject->mOnCancelCallback)
{
subject->mOnCancelCallback( subject, LLSD());
@ -306,6 +311,13 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
// just commit change
subject->onCommit ();
}
if (pick_op == COLOR_CANCEL || pick_op == COLOR_SELECT)
{
// both select and cancel close LLFloaterColorPicker
// but COLOR_CHANGE does not
subject->setFocus(TRUE);
}
}
}
}

View File

@ -176,7 +176,6 @@ void LLFloaterColorPicker::showUI ()
openFloater(getKey());
setVisible ( TRUE );
setFocus ( TRUE );
setRevertOnCancel(FALSE);
// HACK: if system color picker is required - close the SL one we made and use default system dialog
if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) )
@ -188,15 +187,23 @@ void LLFloaterColorPicker::showUI ()
// code that will get switched in for default system color picker
if ( swatch )
{
// Todo: this needs to be threaded for viewer not to timeout
LLColor4 curCol = swatch->get ();
send_agent_pause();
getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] );
bool commit = getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] );
send_agent_resume();
setOrigRgb ( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] );
setCurRgb( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] );
if (commit)
{
setOrigRgb(curCol[0], curCol[1], curCol[2]);
setCurRgb(curCol[0], curCol[1], curCol[2]);
LLColorSwatchCtrl::onColorChanged ( swatch, LLColorSwatchCtrl::COLOR_CHANGE );
LLColorSwatchCtrl::onColorChanged(swatch, LLColorSwatchCtrl::COLOR_SELECT);
}
else
{
LLColorSwatchCtrl::onColorChanged(swatch, LLColorSwatchCtrl::COLOR_CANCEL);
}
}
closeFloater();
@ -404,10 +411,7 @@ void LLFloaterColorPicker::onClickCancel ( void* data )
if ( self )
{
if(self->getRevertOnCancel())
{
self->cancelSelection ();
}
self->cancelSelection();
self->closeFloater();
}
}

View File

@ -104,9 +104,6 @@ class LLFloaterColorPicker
void setMouseDownInSwatch (BOOL mouse_down_in_swatch);
BOOL getMouseDownInSwatch () { return mMouseDownInSwatch; }
void setRevertOnCancel (BOOL revertOnCancel) { mRevertOnCancel = revertOnCancel; };
BOOL getRevertOnCancel () { return mRevertOnCancel; }
BOOL isColorChanged ();
// called when text entries (RGB/HSL etc.) are changed by user
@ -149,8 +146,6 @@ class LLFloaterColorPicker
BOOL mMouseDownInHueRegion;
BOOL mMouseDownInSwatch;
BOOL mRevertOnCancel;
const S32 mRGBViewerImageLeft;
const S32 mRGBViewerImageTop;
const S32 mRGBViewerImageWidth;

View File

@ -258,6 +258,10 @@ void LLFloaterCreateLandmark::populateFoldersList(const LLUUID &folder_id)
void LLFloaterCreateLandmark::onCommitTextChanges()
{
if (mItem.isNull())
{
return;
}
std::string current_title_value = mLandmarkTitleEditor->getText();
std::string item_title_value = mItem->getName();
std::string current_notes_value = mNotesEditor->getText();

View File

@ -1692,9 +1692,9 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
}
F64 map_scale = (F64)mMapView->getScale();
mMapView->setPan(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)),
mMapView->setPanWithInterpTime(-llfloor((F32)(pos_global.mdV[VX] * map_scale / REGION_WIDTH_METERS)),
-llfloor((F32)(pos_global.mdV[VY] * map_scale / REGION_WIDTH_METERS)),
!animate);
!animate, 0.1f);
mWaitingForTracker = FALSE;
}

View File

@ -271,7 +271,7 @@ BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const
{
S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
return PARCEL_SOUND_LOCAL & mOwnership[row * mParcelGridsPerEdge + column];
return parcelFlags(row, column, PARCEL_SOUND_LOCAL);
}
U8 LLViewerParcelOverlay::ownership( const LLVector3& pos) const
@ -285,12 +285,19 @@ U8 LLViewerParcelOverlay::parcelLineFlags(const LLVector3& pos) const
{
S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
return parcelLineFlags(row, column);
return parcelFlags(row, column, PARCEL_WEST_LINE | PARCEL_SOUTH_LINE);
}
U8 LLViewerParcelOverlay::parcelLineFlags(S32 row, S32 col) const
{
U8 flags = PARCEL_WEST_LINE | PARCEL_SOUTH_LINE;
if (row > mParcelGridsPerEdge || col > mParcelGridsPerEdge)
return parcelFlags(row, col, PARCEL_WEST_LINE | PARCEL_SOUTH_LINE);
}
U8 LLViewerParcelOverlay::parcelFlags(S32 row, S32 col, U8 flags) const
{
if (row >= mParcelGridsPerEdge
|| col >= mParcelGridsPerEdge
|| row < 0
|| col < 0)
{
LL_WARNS() << "Attempted to get ownership out of region's overlay, row: " << row << " col: " << col << LL_ENDL;
return flags;

View File

@ -96,7 +96,9 @@ private:
// This is in parcel rows and columns, not grid rows and columns
// Stored in bottom three bits.
U8 ownership(S32 row, S32 col) const
{ return 0x7 & mOwnership[row * mParcelGridsPerEdge + col]; }
{ return parcelFlags(row, col, (U8)0x7); }
U8 parcelFlags(S32 row, S32 col, U8 flags) const;
void addPropertyLine(std::vector<LLVector3>& vertex_array,
std::vector<LLColor4U>& color_array,

View File

@ -200,7 +200,8 @@ LLWorldMapView::LLWorldMapView() :
mMouseDownY(0),
mSelectIDStart(0),
mMapScale(0.f),
mTargetMapScale(0.f)
mTargetMapScale(0.f),
mMapIterpTime(MAP_ITERP_TIME_CONSTANT)
{
// LL_INFOS("WorldMap") << "Creating the Map -> LLWorldMapView::LLWorldMapView()" << LL_ENDL;
@ -298,7 +299,7 @@ void LLWorldMapView::setScale(F32 scale, bool snap)
{
mMapScale = 0.1f;
}
mMapIterpTime = MAP_ITERP_TIME_CONSTANT;
F32 ratio = (scale / old_scale);
mPanX *= ratio;
mPanY *= ratio;
@ -340,6 +341,7 @@ void LLWorldMapView::translatePan(S32 delta_x, S32 delta_y)
// static
void LLWorldMapView::setPan(S32 x, S32 y, BOOL snap)
{
mMapIterpTime = MAP_ITERP_TIME_CONSTANT;
mTargetPanX = (F32) x;
mTargetPanY = (F32) y;
if (snap)
@ -350,6 +352,13 @@ void LLWorldMapView::setPan(S32 x, S32 y, BOOL snap)
sVisibleTilesLoaded = false;
}
// static
void LLWorldMapView::setPanWithInterpTime(S32 x, S32 y, BOOL snap, F32 interp_time)
{
setPan(x, y, snap);
mMapIterpTime = interp_time;
}
bool LLWorldMapView::showRegionInfo() { return (LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD ? true : false); }
///////////////////////////////////////////////////////////////////////////////////
@ -383,9 +392,9 @@ void LLWorldMapView::draw()
mVisibleRegions.clear();
// animate pan if necessary
mPanX = lerp(mPanX, mTargetPanX, LLSmoothInterpolation::getInterpolant(MAP_ITERP_TIME_CONSTANT));
mPanY = lerp(mPanY, mTargetPanY, LLSmoothInterpolation::getInterpolant(MAP_ITERP_TIME_CONSTANT));
// animate pan if necessary
mPanX = lerp(mPanX, mTargetPanX, LLSmoothInterpolation::getInterpolant(mMapIterpTime));
mPanY = lerp(mPanY, mTargetPanY, LLSmoothInterpolation::getInterpolant(mMapIterpTime));
//RN: snaps to zoom value because interpolation caused jitter in the text rendering
if (!sZoomTimer.getStarted() && mMapScale != mTargetMapScale)

View File

@ -80,6 +80,7 @@ public:
// Pan is in pixels relative to the center of the map.
void translatePan( S32 delta_x, S32 delta_y );
void setPan( S32 x, S32 y, BOOL snap = TRUE );
void setPanWithInterpTime(S32 x, S32 y, BOOL snap, F32 interp_time);
// Return true if the current scale level is above the threshold for accessing region info
bool showRegionInfo();
@ -212,6 +213,8 @@ private:
static F32 sMapScaleSetting;
static LLVector2 sZoomPivot;
static LLFrameTimer sZoomTimer;
F32 mMapIterpTime;
};
#endif