Updated rigged mesh selection/cursor hover handling.
This commit is contained in:
@@ -180,6 +180,7 @@
|
||||
#include "llviewernetwork.h"
|
||||
#include "llpostprocess.h"
|
||||
#include "llwearablelist.h"
|
||||
#include "llfloaterinspect.h"
|
||||
|
||||
#include "llnotifications.h"
|
||||
#include "llnotificationsutil.h"
|
||||
@@ -220,7 +221,9 @@ BOOL gShowOverlayTitle = FALSE;
|
||||
BOOL gPickTransparent = TRUE;
|
||||
|
||||
LLViewerObject* gDebugRaycastObject = NULL;
|
||||
LLVOPartGroup* gDebugRaycastParticle = NULL;
|
||||
LLVector4a gDebugRaycastIntersection;
|
||||
LLVector4a gDebugRaycastParticleIntersection;
|
||||
LLVector2 gDebugRaycastTexCoord;
|
||||
LLVector4a gDebugRaycastNormal;
|
||||
LLVector4a gDebugRaycastTangent;
|
||||
@@ -683,7 +686,7 @@ public:
|
||||
LLMeshRepository::sHTTPRetryCount));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat("%d/%d Mesh LOD Pending/Processing", LLMeshRepository::sLODPending, LLMeshRepository::sLODProcessing));
|
||||
addText(xpos, ypos, llformat("%d/%d Mesh LOD Pending/Processing", LLMeshRepository::sLODPending, (U32)LLMeshRepository::sLODProcessing));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat("%.3f/%.3f MB Mesh Cache Read/Write ", LLMeshRepository::sCacheBytesRead/(1024.f*1024.f), LLMeshRepository::sCacheBytesWritten/(1024.f*1024.f)));
|
||||
@@ -1103,7 +1106,9 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
|
||||
|
||||
if (prim_media_dnd_enabled)
|
||||
{
|
||||
LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY, TRUE /*BOOL pick_transparent*/ );
|
||||
LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY,
|
||||
TRUE /* pick_transparent */,
|
||||
FALSE /* pick_rigged */);
|
||||
|
||||
LLUUID object_id = pick_info.getObjectID();
|
||||
S32 object_face = pick_info.mObjectFace;
|
||||
@@ -3094,7 +3099,7 @@ void LLViewerWindow::updateUI()
|
||||
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
|
||||
{
|
||||
gDebugRaycastFaceHit = -1;
|
||||
gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE,
|
||||
gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE,
|
||||
&gDebugRaycastFaceHit,
|
||||
&gDebugRaycastIntersection,
|
||||
&gDebugRaycastTexCoord,
|
||||
@@ -3102,6 +3107,7 @@ void LLViewerWindow::updateUI()
|
||||
&gDebugRaycastTangent,
|
||||
&gDebugRaycastStart,
|
||||
&gDebugRaycastEnd);
|
||||
gDebugRaycastParticle = gPipeline.lineSegmentIntersectParticle(gDebugRaycastStart, gDebugRaycastEnd, &gDebugRaycastParticleIntersection, NULL);
|
||||
}
|
||||
|
||||
updateMouseDelta();
|
||||
@@ -3244,6 +3250,7 @@ void LLViewerWindow::updateUI()
|
||||
|
||||
// only handle hover events when UI is enabled
|
||||
// if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
|
||||
if (mMouseInWindow)
|
||||
{
|
||||
|
||||
if( mouse_captor )
|
||||
@@ -3946,7 +3953,14 @@ BOOL LLViewerWindow::clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewe
|
||||
return intersect;
|
||||
}
|
||||
|
||||
void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& info), BOOL pick_transparent, BOOL get_surface_info)
|
||||
void LLViewerWindow::pickAsync( S32 x,
|
||||
S32 y_from_bot,
|
||||
MASK mask,
|
||||
void (*callback)(const LLPickInfo& info),
|
||||
BOOL pick_transparent,
|
||||
BOOL pick_rigged,
|
||||
BOOL pick_unselectable,
|
||||
BOOL get_surface_info)
|
||||
{
|
||||
if (gNoRender)
|
||||
{
|
||||
@@ -3961,8 +3975,7 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback
|
||||
// "Show Debug Alpha" means no object actually transparent
|
||||
pick_transparent = TRUE;
|
||||
}
|
||||
|
||||
LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, get_surface_info, callback);
|
||||
LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, FALSE, get_surface_info, pick_unselectable, callback);
|
||||
schedulePick(pick_info);
|
||||
}
|
||||
|
||||
@@ -3994,6 +4007,11 @@ void LLViewerWindow::performPick()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gFocusMgr.getAppHasFocus())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mPicks.empty())
|
||||
{
|
||||
std::vector<LLPickInfo>::iterator pick_it;
|
||||
@@ -4023,13 +4041,18 @@ void LLViewerWindow::returnEmptyPicks()
|
||||
}
|
||||
|
||||
// Performs the GL object/land pick.
|
||||
LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_transparent)
|
||||
LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_transparent, BOOL pick_rigged, BOOL pick_particle)
|
||||
{
|
||||
if (gNoRender)
|
||||
{
|
||||
return LLPickInfo();
|
||||
}
|
||||
|
||||
if (!gFocusMgr.getAppHasFocus())
|
||||
{
|
||||
return LLPickInfo();
|
||||
}
|
||||
|
||||
// push back pick info object
|
||||
BOOL in_build_mode = gFloaterTools && gFloaterTools->getVisible();
|
||||
if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha)
|
||||
@@ -4038,10 +4061,9 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans
|
||||
// "Show Debug Alpha" means no object actually transparent
|
||||
pick_transparent = TRUE;
|
||||
}
|
||||
|
||||
// shortcut queueing in mPicks and just update mLastPick in place
|
||||
MASK key_mask = gKeyboard->currentMask(TRUE);
|
||||
mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, TRUE, NULL);
|
||||
mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, pick_rigged, pick_particle, TRUE, FALSE, NULL);
|
||||
mLastPick.fetchResults();
|
||||
|
||||
return mLastPick;
|
||||
@@ -4077,6 +4099,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
|
||||
LLViewerObject *this_object,
|
||||
S32 this_face,
|
||||
BOOL pick_transparent,
|
||||
BOOL pick_rigged,
|
||||
S32* face_hit,
|
||||
LLVector4a *intersection,
|
||||
LLVector2 *uv,
|
||||
@@ -4147,7 +4170,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
|
||||
{
|
||||
if (this_object->isHUDAttachment()) // is a HUD object?
|
||||
{
|
||||
if (this_object->lineSegmentIntersect(mh_start, mh_end, this_face, pick_transparent,
|
||||
if (this_object->lineSegmentIntersect(mh_start, mh_end, this_face, pick_transparent, pick_rigged,
|
||||
face_hit, intersection, uv, normal, tangent))
|
||||
{
|
||||
found = this_object;
|
||||
@@ -4155,7 +4178,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
|
||||
}
|
||||
else // is a world object
|
||||
{
|
||||
if (this_object->lineSegmentIntersect(mw_start, mw_end, this_face, pick_transparent,
|
||||
if (this_object->lineSegmentIntersect(mw_start, mw_end, this_face, pick_transparent, pick_rigged,
|
||||
face_hit, intersection, uv, normal, tangent))
|
||||
{
|
||||
found = this_object;
|
||||
@@ -4176,7 +4199,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
|
||||
|
||||
if (!found) // if not found in HUD, look in world:
|
||||
{
|
||||
found = gPipeline.lineSegmentIntersectInWorld(mw_start, mw_end, pick_transparent,
|
||||
found = gPipeline.lineSegmentIntersectInWorld(mw_start, mw_end, pick_transparent, pick_rigged,
|
||||
face_hit, intersection, uv, normal, tangent);
|
||||
|
||||
if (found && !pick_transparent)
|
||||
@@ -4321,7 +4344,7 @@ BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, con
|
||||
|
||||
|
||||
// Returns global position
|
||||
BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_position_global)
|
||||
BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_position_global, BOOL ignore_distance)
|
||||
{
|
||||
LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
|
||||
F32 mouse_dir_scale;
|
||||
@@ -4330,6 +4353,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d
|
||||
F32 land_z;
|
||||
const F32 FIRST_PASS_STEP = 1.0f; // meters
|
||||
const F32 SECOND_PASS_STEP = 0.1f; // meters
|
||||
const F32 draw_distance = ignore_distance ? MAX_FAR_CLIP : (gAgentCamera.mDrawDistance * 4);
|
||||
LLVector3d camera_pos_global;
|
||||
|
||||
camera_pos_global = gAgentCamera.getCameraPositionGlobal();
|
||||
@@ -4337,7 +4361,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d
|
||||
LLVector3 probe_point_region;
|
||||
|
||||
// walk forwards to find the point
|
||||
for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < gAgentCamera.mDrawDistance * 4; mouse_dir_scale += FIRST_PASS_STEP)
|
||||
for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < draw_distance; mouse_dir_scale += FIRST_PASS_STEP)
|
||||
{
|
||||
LLVector3d mouse_direction_global_d;
|
||||
mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale);
|
||||
@@ -5965,15 +5989,20 @@ LLPickInfo::LLPickInfo()
|
||||
mTangent(),
|
||||
mBinormal(),
|
||||
mHUDIcon(NULL),
|
||||
mPickTransparent(FALSE)
|
||||
mPickTransparent(FALSE),
|
||||
mPickRigged(FALSE),
|
||||
mPickParticle(FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos,
|
||||
MASK keyboard_mask,
|
||||
BOOL pick_transparent,
|
||||
BOOL pick_uv_coords,
|
||||
void (*pick_callback)(const LLPickInfo& pick_info))
|
||||
BOOL pick_transparent,
|
||||
BOOL pick_rigged,
|
||||
BOOL pick_particle,
|
||||
BOOL pick_uv_coords,
|
||||
BOOL pick_unselectable,
|
||||
void (*pick_callback)(const LLPickInfo& pick_info))
|
||||
: mMousePt(mouse_pos),
|
||||
mKeyMask(keyboard_mask),
|
||||
mPickCallback(pick_callback),
|
||||
@@ -5987,7 +6016,10 @@ LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos,
|
||||
mTangent(),
|
||||
mBinormal(),
|
||||
mHUDIcon(NULL),
|
||||
mPickTransparent(pick_transparent)
|
||||
mPickTransparent(pick_transparent),
|
||||
mPickRigged(pick_rigged),
|
||||
mPickParticle(pick_particle),
|
||||
mPickUnselectable(pick_unselectable)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6005,6 +6037,9 @@ void LLPickInfo::fetchResults()
|
||||
LLVector4a origin;
|
||||
origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
|
||||
F32 icon_dist = 0.f;
|
||||
LLVector4a start;
|
||||
LLVector4a end;
|
||||
LLVector4a particle_end;
|
||||
if (hit_icon)
|
||||
{
|
||||
LLVector4a delta;
|
||||
@@ -6013,15 +6048,25 @@ void LLPickInfo::fetchResults()
|
||||
}
|
||||
|
||||
LLViewerObject* hit_object = gViewerWindow->cursorIntersect(mMousePt.mX, mMousePt.mY, 512.f,
|
||||
NULL, -1, mPickTransparent, &face_hit,
|
||||
&intersection, &uv, &normal, &tangent);
|
||||
NULL, -1, mPickTransparent, mPickRigged, &face_hit,
|
||||
&intersection, &uv, &normal, &tangent, &start, &end);
|
||||
|
||||
mPickPt = mMousePt;
|
||||
|
||||
U32 te_offset = face_hit > -1 ? face_hit : 0;
|
||||
|
||||
//unproject relative clicked coordinate from window coordinate using GL
|
||||
|
||||
if (mPickParticle)
|
||||
{ //get the end point of line segement to use for particle raycast
|
||||
if (hit_object)
|
||||
{
|
||||
particle_end = intersection;
|
||||
}
|
||||
else
|
||||
{
|
||||
particle_end = end;
|
||||
}
|
||||
}
|
||||
|
||||
LLViewerObject* objectp = hit_object;
|
||||
|
||||
|
||||
@@ -6047,7 +6092,7 @@ void LLPickInfo::fetchResults()
|
||||
|
||||
// put global position into land_pos
|
||||
LLVector3d land_pos;
|
||||
if (!gViewerWindow->mousePointOnLandGlobal(mPickPt.mX, mPickPt.mY, &land_pos))
|
||||
if (!gViewerWindow->mousePointOnLandGlobal(mPickPt.mX, mPickPt.mY, &land_pos, mPickUnselectable))
|
||||
{
|
||||
// The selected point is beyond the draw distance or is otherwise
|
||||
// not selectable. Return before calling mPickCallback().
|
||||
@@ -6085,6 +6130,18 @@ void LLPickInfo::fetchResults()
|
||||
}
|
||||
}
|
||||
|
||||
if (mPickParticle)
|
||||
{ //search for closest particle to click origin out to intersection point
|
||||
S32 part_face = -1;
|
||||
|
||||
LLVOPartGroup* group = gPipeline.lineSegmentIntersectParticle(start, particle_end, NULL, &part_face);
|
||||
if (group)
|
||||
{
|
||||
mParticleOwnerID = group->getPartOwner(part_face);
|
||||
mParticleSourceID = group->getPartSource(part_face);
|
||||
}
|
||||
}
|
||||
|
||||
if (mPickCallback)
|
||||
{
|
||||
mPickCallback(*this);
|
||||
@@ -6135,7 +6192,7 @@ void LLPickInfo::getSurfaceInfo()
|
||||
if (objectp)
|
||||
{
|
||||
if (gViewerWindow->cursorIntersect(ll_round((F32)mMousePt.mX), ll_round((F32)mMousePt.mY), 1024.f,
|
||||
objectp, -1, mPickTransparent,
|
||||
objectp, -1, mPickTransparent, mPickRigged,
|
||||
&mObjectFace,
|
||||
&intersection,
|
||||
&mSTCoords,
|
||||
|
||||
Reference in New Issue
Block a user