summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Stearns <howard.stearns@gmail.com>2022-02-04 09:55:05 -0800
committerHoward Stearns <howard.stearns@gmail.com>2022-02-04 09:55:05 -0800
commit57a7f63dcce6eb20a05dbc42bfdc9ac51072cb7e (patch)
tree40eccd1797d0ef7545bdaf0c1e1eb00a90c219fc
parent1ec05e93695a661f6b3b6e374bf60cb991bab954 (diff)
SL-98 - Render a "ground plane" in the model upload preview, so users can see any added offset
-rw-r--r--indra/newview/llfloatermodelpreview.cpp1
-rw-r--r--indra/newview/llfloatermodelpreview.h1
-rw-r--r--indra/newview/llmodelpreview.cpp6
-rw-r--r--indra/newview/llvoavatar.cpp32
-rw-r--r--indra/newview/llvoavatar.h1
5 files changed, 39 insertions, 2 deletions
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();