diff options
author | Howard Stearns <howard.stearns@gmail.com> | 2022-02-04 13:55:08 -0800 |
---|---|---|
committer | Howard Stearns <howard.stearns@gmail.com> | 2022-02-04 13:55:08 -0800 |
commit | f1df486208f94c649f09dc2dc0cce393208d3771 (patch) | |
tree | d13099a332fab9a168bba306d709ec061f941013 /indra/newview/llmodelpreview.cpp | |
parent | 3397ca14766855091b8fd9391527d381e94793b1 (diff) |
SL-98 - move new renderGroundPlane from LLVOAvatar to LLModelPreview
Diffstat (limited to 'indra/newview/llmodelpreview.cpp')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
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() //----------------------------------------------------------------------------- |