diff options
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llmodelpreview.h | 1 |
2 files changed, 23 insertions, 19 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index b78bec5c04..39bfcbc9b7 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2533,6 +2533,20 @@ void LLModelPreview::loadedCallback( { pPreview->lookupLODModelFiles(lod); } + + const LLVOAvatar* avatarp = pPreview->getPreviewAvatar(); + if (avatarp) { // set up ground plane for possible rendering + 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; + auto plane = pPreview->mGroundPlane; + plane[0] = {min[0], min[1], ground}; + plane[1] = {max[0], min[1], ground}; + plane[2] = {max[0], max[1], ground}; + plane[3] = {min[0], max[1], ground}; + } } } @@ -3375,32 +3389,21 @@ BOOL LLModelPreview::render() 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(mGroundPlane[0].mV); + gGL.vertex3fv(mGroundPlane[1].mV); - gGL.vertex3fv(vB.mV); - gGL.vertex3fv(vC.mV); + gGL.vertex3fv(mGroundPlane[1].mV); + gGL.vertex3fv(mGroundPlane[2].mV); - gGL.vertex3fv(vC.mV); - gGL.vertex3fv(vD.mV); + gGL.vertex3fv(mGroundPlane[2].mV); + gGL.vertex3fv(mGroundPlane[3].mV); - gGL.vertex3fv(vD.mV); - gGL.vertex3fv(vA.mV); + gGL.vertex3fv(mGroundPlane[3].mV); + gGL.vertex3fv(mGroundPlane[0].mV); gGL.end(); } diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 293af4e83e..d3780e1a7e 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); + LLVector3 mGroundPlane[4]; void renderGroundPlane(float z_offset = 0.0f); protected: |