diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 64b24d54c3d69d8c1141c908eb52d744c1cb3b75..165adf46440f912165a50ac309042724dfcc4dab 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 8a01b0c30773c2448e22554ae3c2fc3c3d1f98fa..bb2b00351f7717e8618ca287c411d783644d6ef7 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -231,6 +231,7 @@ class LLFloaterModelPreview : public LLFloaterModelUploadBase 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 a9e80ab5da107dcd7ea1ae10c3edaf030561c50a..88ef88d29760649bb2627e5b306835f3481cdc0d 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 5d994058c2e0ddf7cb253ffbc1e77dadd5ca644f..812a5c4fe6f4478787772fa5683c4222b82e0347 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 74ef589ca47a9532e7fc242c9d9e67fbf2acdf36..b4d27baf2076dbe744dadaca6e21c22842ebb504 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -486,6 +486,7 @@ class LLVOAvatar : 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();