From 57a7f63dcce6eb20a05dbc42bfdc9ac51072cb7e Mon Sep 17 00:00:00 2001 From: Howard Stearns <howard.stearns@gmail.com> Date: Fri, 4 Feb 2022 09:55:05 -0800 Subject: SL-98 - Render a "ground plane" in the model upload preview, so users can see any added offset --- indra/newview/llfloatermodelpreview.cpp | 1 + indra/newview/llfloatermodelpreview.h | 1 + indra/newview/llmodelpreview.cpp | 6 +++++- indra/newview/llvoavatar.cpp | 32 +++++++++++++++++++++++++++++++- indra/newview/llvoavatar.h | 1 + 5 files changed, 39 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 64b24d54c3..165adf4644 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -270,6 +270,7 @@ BOOL LLFloaterModelPreview::postBuild() LLPanel *panel = mTabContainer->getPanelByName("rigging_panel"); mAvatarTabIndex = mTabContainer->getIndexForPanel(panel); panel->getChild<LLScrollListCtrl>("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this)); + mPhysicsTabIndex = mTabContainer->getIndexForPanel(mTabContainer->getPanelByName("physics_panel")); if (LLConvexDecomposition::getInstance() != NULL) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 8a01b0c307..bb2b00351f 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -231,6 +231,7 @@ private: LLTabContainer* mTabContainer; S32 mAvatarTabIndex; // just to avoid any issues in case of xml changes + S32 mPhysicsTabIndex; std::string mSelectedJointName; joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS]; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index a9e80ab5da..88ef88d297 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3404,7 +3404,10 @@ BOOL LLModelPreview::render() { gDebugProgram.bind(); } - getPreviewAvatar()->renderCollisionVolumes(); + if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mPhysicsTabIndex) + { // Physics collision volumes obscure a lot, so only show them when on the physics tab. + getPreviewAvatar()->renderCollisionVolumes(); + } if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mAvatarTabIndex) { getPreviewAvatar()->renderBones(fmp->mSelectedJointName); @@ -3413,6 +3416,7 @@ BOOL LLModelPreview::render() { getPreviewAvatar()->renderBones(); } + getPreviewAvatar()->renderGroundPlane(mPelvisZOffset); if (shader) { shader->bind(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5d994058c2..812a5c4fe6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1,4 +1,4 @@ -/** +/** * @File llvoavatar.cpp * @brief Implementation of LLVOAvatar class which is a derivation of LLViewerObject * @@ -1673,6 +1673,36 @@ void LLVOAvatar::renderBones(const std::string &selected_joint) } } +void LLVOAvatar::renderGroundPlane(float z_offset) +{ // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render + LLVector3 root_pos = mRoot->getPosition(); + const LLVector4a* ext = mDrawable->getSpatialExtents(); + auto min = ext[0], max = ext[1]; + auto center = (max - min) * 0.5f; + F32 ground = root_pos[2] - center[2] - z_offset; + + LLVector3 vA{min[0], min[1], ground}; + LLVector3 vB{max[0], min[1], ground}; + LLVector3 vC{max[0], max[1], ground}; + LLVector3 vD{min[0], max[1], ground}; + + gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f ); + + gGL.begin(LLRender::LINES); + gGL.vertex3fv(vA.mV); + gGL.vertex3fv(vB.mV); + + gGL.vertex3fv(vB.mV); + gGL.vertex3fv(vC.mV); + + gGL.vertex3fv(vC.mV); + gGL.vertex3fv(vD.mV); + + gGL.vertex3fv(vD.mV); + gGL.vertex3fv(vA.mV); + + gGL.end(); +} void LLVOAvatar::renderJoints() { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 74ef589ca4..b4d27baf20 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -486,6 +486,7 @@ public: void renderCollisionVolumes(); void renderBones(const std::string &selected_joint = std::string()); void renderJoints(); + void renderGroundPlane(float z_offset = 0.0f); static void deleteCachedImages(bool clearAll=true); static void destroyGL(); static void restoreGL(); -- cgit v1.2.3 From 3397ca14766855091b8fd9391527d381e94793b1 Mon Sep 17 00:00:00 2001 From: Howard Stearns <howard.stearns@gmail.com> Date: Fri, 4 Feb 2022 12:46:22 -0800 Subject: SL-98 - Guessing at what might make MS compiler happier. --- indra/newview/llvoavatar.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 812a5c4fe6..7123c0e3dd 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1675,16 +1675,16 @@ void LLVOAvatar::renderBones(const std::string &selected_joint) void LLVOAvatar::renderGroundPlane(float z_offset) { // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render - LLVector3 root_pos = mRoot->getPosition(); + const LLVector3 root_pos = mRoot->getPosition(); const LLVector4a* ext = mDrawable->getSpatialExtents(); - auto min = ext[0], max = ext[1]; - auto center = (max - min) * 0.5f; - F32 ground = root_pos[2] - center[2] - z_offset; - - LLVector3 vA{min[0], min[1], ground}; - LLVector3 vB{max[0], min[1], ground}; - LLVector3 vC{max[0], max[1], ground}; - LLVector3 vD{min[0], max[1], ground}; + const LLVector4a min = ext[0], max = ext[1]; + const F32 center = (max[2] - min[2]) * 0.5f; + const F32 ground = root_pos[2] - center - z_offset; + + const LLVector3 vA{min[0], min[1], ground}; + const LLVector3 vB{max[0], min[1], ground}; + const LLVector3 vC{max[0], max[1], ground}; + const LLVector3 vD{min[0], max[1], ground}; gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f ); -- cgit v1.2.3 From f1df486208f94c649f09dc2dc0cce393208d3771 Mon Sep 17 00:00:00 2001 From: Howard Stearns <howard.stearns@gmail.com> Date: Fri, 4 Feb 2022 13:55:08 -0800 Subject: SL-98 - move new renderGroundPlane from LLVOAvatar to LLModelPreview --- indra/newview/llmodelpreview.cpp | 35 ++++++++++++++++++++++++++++++++++- indra/newview/llmodelpreview.h | 1 + indra/newview/llvoavatar.cpp | 30 ------------------------------ indra/newview/llvoavatar.h | 1 - 4 files changed, 35 insertions(+), 32 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 88ef88d297..8e487484fd 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3416,7 +3416,7 @@ BOOL LLModelPreview::render() { getPreviewAvatar()->renderBones(); } - getPreviewAvatar()->renderGroundPlane(mPelvisZOffset); + renderGroundPlane(mPelvisZOffset); if (shader) { shader->bind(); @@ -3441,6 +3441,39 @@ BOOL LLModelPreview::render() return TRUE; } +void LLModelPreview::renderGroundPlane(float z_offset) +{ // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render + const LLVOAvatar* avatarp = getPreviewAvatar(); + const LLVector3 root_pos = avatarp->mRoot->getPosition(); + const LLVector4a* ext = avatarp->mDrawable->getSpatialExtents(); + const LLVector4a min = ext[0], max = ext[1]; + const F32 center = (max[2] - min[2]) * 0.5f; + const F32 ground = root_pos[2] - center - z_offset; + + const LLVector3 vA{min[0], min[1], ground}; + const LLVector3 vB{max[0], min[1], ground}; + const LLVector3 vC{max[0], max[1], ground}; + const LLVector3 vD{min[0], max[1], ground}; + + gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f ); + + gGL.begin(LLRender::LINES); + gGL.vertex3fv(vA.mV); + gGL.vertex3fv(vB.mV); + + gGL.vertex3fv(vB.mV); + gGL.vertex3fv(vC.mV); + + gGL.vertex3fv(vC.mV); + gGL.vertex3fv(vD.mV); + + gGL.vertex3fv(vD.mV); + gGL.vertex3fv(vA.mV); + + gGL.end(); +} + + //----------------------------------------------------------------------------- // refresh() //----------------------------------------------------------------------------- diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 3664a27a72..60b510e415 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -217,6 +217,7 @@ private: LLVOAvatar* getPreviewAvatar(void) { return mPreviewAvatar; } // Count amount of original models, excluding sub-models static U32 countRootModels(LLModelLoader::model_list models); + void renderGroundPlane(float z_offset = 0.0f); protected: friend class LLModelLoader; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7123c0e3dd..7746af5a58 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1673,36 +1673,6 @@ void LLVOAvatar::renderBones(const std::string &selected_joint) } } -void LLVOAvatar::renderGroundPlane(float z_offset) -{ // Not necesarilly general - beware - but it seems to meet the needs of LLModelPreview::render - const LLVector3 root_pos = mRoot->getPosition(); - const LLVector4a* ext = mDrawable->getSpatialExtents(); - const LLVector4a min = ext[0], max = ext[1]; - const F32 center = (max[2] - min[2]) * 0.5f; - const F32 ground = root_pos[2] - center - z_offset; - - const LLVector3 vA{min[0], min[1], ground}; - const LLVector3 vB{max[0], min[1], ground}; - const LLVector3 vC{max[0], max[1], ground}; - const LLVector3 vD{min[0], max[1], ground}; - - gGL.diffuseColor3f( 1.0f, 0.0f, 1.0f ); - - gGL.begin(LLRender::LINES); - gGL.vertex3fv(vA.mV); - gGL.vertex3fv(vB.mV); - - gGL.vertex3fv(vB.mV); - gGL.vertex3fv(vC.mV); - - gGL.vertex3fv(vC.mV); - gGL.vertex3fv(vD.mV); - - gGL.vertex3fv(vD.mV); - gGL.vertex3fv(vA.mV); - - gGL.end(); -} void LLVOAvatar::renderJoints() { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index b4d27baf20..74ef589ca4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -486,7 +486,6 @@ public: void renderCollisionVolumes(); void renderBones(const std::string &selected_joint = std::string()); void renderJoints(); - void renderGroundPlane(float z_offset = 0.0f); static void deleteCachedImages(bool clearAll=true); static void destroyGL(); static void restoreGL(); -- cgit v1.2.3 From ca43cc2305502ec4f6a8d75ea2e4303b655ff0ce Mon Sep 17 00:00:00 2001 From: Howard Stearns <howard.stearns@gmail.com> Date: Fri, 4 Feb 2022 14:13:19 -0800 Subject: SL-98 - Remove special new tab-specific display behavior --- indra/newview/llfloatermodelpreview.cpp | 1 - indra/newview/llfloatermodelpreview.h | 1 - indra/newview/llmodelpreview.cpp | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 165adf4644..64b24d54c3 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -270,7 +270,6 @@ BOOL LLFloaterModelPreview::postBuild() LLPanel *panel = mTabContainer->getPanelByName("rigging_panel"); mAvatarTabIndex = mTabContainer->getIndexForPanel(panel); panel->getChild<LLScrollListCtrl>("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this)); - mPhysicsTabIndex = mTabContainer->getIndexForPanel(mTabContainer->getPanelByName("physics_panel")); if (LLConvexDecomposition::getInstance() != NULL) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index bb2b00351f..8a01b0c307 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -231,7 +231,6 @@ private: LLTabContainer* mTabContainer; S32 mAvatarTabIndex; // just to avoid any issues in case of xml changes - S32 mPhysicsTabIndex; std::string mSelectedJointName; joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS]; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 8e487484fd..f12ddb1745 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3404,10 +3404,7 @@ BOOL LLModelPreview::render() { gDebugProgram.bind(); } - if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mPhysicsTabIndex) - { // Physics collision volumes obscure a lot, so only show them when on the physics tab. - getPreviewAvatar()->renderCollisionVolumes(); - } + getPreviewAvatar()->renderCollisionVolumes(); if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mAvatarTabIndex) { getPreviewAvatar()->renderBones(fmp->mSelectedJointName); -- cgit v1.2.3 From b146de38de69167354da08e37dfd8903f2466f9d Mon Sep 17 00:00:00 2001 From: Howard Stearns <howard.stearns@gmail.com> Date: Tue, 8 Feb 2022 14:59:31 -0800 Subject: SL-98 - Remove dead code --- indra/newview/llvoavatar.cpp | 39 --------------------------------------- indra/newview/llvoavatar.h | 1 - 2 files changed, 40 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7746af5a58..f4fa94eade 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -176,8 +176,6 @@ const F32 MAX_STANDOFF_DISTANCE_CHANGE = 32; // Should probably be 4 or 3, but didn't want to change it while change other logic - SJB const S32 SWITCH_TO_BAKED_DISCARD = 5; -const F32 FOOT_COLLIDE_FUDGE = 0.04f; - const F32 HOVER_EFFECT_MAX_SPEED = 3.f; const F32 HOVER_EFFECT_STRENGTH = 0.f; const F32 UNDERWATER_EFFECT_STRENGTH = 0.1f; @@ -600,7 +598,6 @@ S32 LLVOAvatar::sNumVisibleChatBubbles = 0; BOOL LLVOAvatar::sDebugInvisible = FALSE; BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; BOOL LLVOAvatar::sShowAnimationDebug = FALSE; -BOOL LLVOAvatar::sShowFootPlane = FALSE; BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; F32 LLVOAvatar::sLODFactor = 1.f; F32 LLVOAvatar::sPhysicsLODFactor = 1.f; @@ -5008,42 +5005,6 @@ U32 LLVOAvatar::renderSkinned() return num_indices; } - // render collision normal - // *NOTE: this is disabled (there is no UI for enabling sShowFootPlane) due - // to DEV-14477. the code is left here to aid in tracking down the cause - // of the crash in the future. -brad - if (sShowFootPlane && mDrawable.notNull()) - { - LLVector3 slaved_pos = mDrawable->getPositionAgent(); - LLVector3 foot_plane_normal(mFootPlane.mV[VX], mFootPlane.mV[VY], mFootPlane.mV[VZ]); - F32 dist_from_plane = (slaved_pos * foot_plane_normal) - mFootPlane.mV[VW]; - LLVector3 collide_point = slaved_pos; - collide_point.mV[VZ] -= foot_plane_normal.mV[VZ] * (dist_from_plane + COLLISION_TOLERANCE - FOOT_COLLIDE_FUDGE); - - gGL.begin(LLRender::LINES); - { - F32 SQUARE_SIZE = 0.2f; - gGL.color4f(1.f, 0.f, 0.f, 1.f); - - gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); - gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); - - gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); - gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); - - gGL.vertex3f(collide_point.mV[VX] + SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); - gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); - - gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] + SQUARE_SIZE, collide_point.mV[VZ]); - gGL.vertex3f(collide_point.mV[VX] - SQUARE_SIZE, collide_point.mV[VY] - SQUARE_SIZE, collide_point.mV[VZ]); - - gGL.vertex3f(collide_point.mV[VX], collide_point.mV[VY], collide_point.mV[VZ]); - gGL.vertex3f(collide_point.mV[VX] + mFootPlane.mV[VX], collide_point.mV[VY] + mFootPlane.mV[VY], collide_point.mV[VZ] + mFootPlane.mV[VZ]); - - } - gGL.end(); - gGL.flush(); - } //-------------------------------------------------------------------- // render all geometry attached to the skeleton //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 74ef589ca4..d6f9dfaad4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -328,7 +328,6 @@ public: static bool sLimitNonImpostors; // use impostors for far away avatars static F32 sRenderDistance; // distance at which avatars will render. static BOOL sShowAnimationDebug; // show animation debug info - static BOOL sShowFootPlane; // show foot collision plane reported by server static BOOL sShowCollisionVolumes; // show skeletal collision volumes static BOOL sVisibleInFirstPerson; static S32 sNumLODChangesThisFrame; -- cgit v1.2.3