SL-98 - Render a "ground plane" in the model upload preview, so users can see any added offset

meow-7.2.2
Howard Stearns 2022-02-04 09:55:05 -08:00
parent 1ec05e9369
commit 57a7f63dcc
5 changed files with 39 additions and 2 deletions

View File

@ -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)
{

View File

@ -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];

View File

@ -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();

View File

@ -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()
{

View File

@ -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();