diff options
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/gltfscenemanager.cpp | 59 | ||||
| -rw-r--r-- | indra/newview/llface.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llfloaterimagepreview.cpp | 28 | ||||
| -rw-r--r-- | indra/newview/llglsandbox.cpp | 120 | ||||
| -rw-r--r-- | indra/newview/llimprocessing.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llphysicsshapebuilderutil.cpp | 53 | ||||
| -rw-r--r-- | indra/newview/llphysicsshapebuilderutil.h | 2 | 
7 files changed, 116 insertions, 156 deletions
| diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp index ce54fa4c12..ed66753267 100644 --- a/indra/newview/gltfscenemanager.cpp +++ b/indra/newview/gltfscenemanager.cpp @@ -371,43 +371,46 @@ void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)  //static  void GLTFSceneManager::onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status)  { -    LLViewerObject* obj = (LLViewerObject*)user_data; -    llassert(asset_type == LLAssetType::AT_GLTF_BIN); - -    if (status == LL_ERR_NOERR) -    { -        if (obj) +    LLAppViewer::instance()->postToMainCoro([=]()          { -            // find the Buffer with the given id in the asset -            if (obj->mGLTFAsset) -            { -                obj->mGLTFAsset->mPendingBuffers--; - +            LLViewerObject* obj = (LLViewerObject*)user_data; +            llassert(asset_type == LLAssetType::AT_GLTF_BIN); -                if (obj->mGLTFAsset->mPendingBuffers == 0) +            if (status == LL_ERR_NOERR) +            { +                if (obj)                  { -                    if (obj->mGLTFAsset->prep()) +                    // find the Buffer with the given id in the asset +                    if (obj->mGLTFAsset)                      { -                        GLTFSceneManager& mgr = GLTFSceneManager::instance(); -                        if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end()) +                        obj->mGLTFAsset->mPendingBuffers--; + + +                        if (obj->mGLTFAsset->mPendingBuffers == 0)                          { -                            GLTFSceneManager::instance().mObjects.push_back(obj); +                            if (obj->mGLTFAsset->prep()) +                            { +                                GLTFSceneManager& mgr = GLTFSceneManager::instance(); +                                if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end()) +                                { +                                    GLTFSceneManager::instance().mObjects.push_back(obj); +                                } +                            } +                            else +                            { +                                LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL; +                                obj->mGLTFAsset = nullptr; +                            }                          }                      } -                    else -                    { -                        LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL; -                        obj->mGLTFAsset = nullptr; -                    }                  }              } -        } -    } -    else -    { -        LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL; -        obj->unref(); -    } +            else +            { +                LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL; +                obj->unref(); +            } +        });  }  //static diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index ce68474211..297661effd 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2268,6 +2268,14 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)          center.mul(0.5f);          size.setSub(mRiggedExtents[1], mRiggedExtents[0]);      } +    else if (mDrawablep && mVObjp.notNull() && mVObjp->getPartitionType() == LLViewerRegion::PARTITION_PARTICLE && mDrawablep->getSpatialGroup()) +    { // use box of spatial group for particles (over approximates size, but we don't actually have a good size per particle) +        LLSpatialGroup* group = mDrawablep->getSpatialGroup(); +        const LLVector4a* extents = group->getExtents(); +        size.setSub(extents[1], extents[0]); +        center.setAdd(extents[1], extents[0]); +        center.mul(0.5f); +    }      else      {          center.load3(getPositionAgent().mV); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 236725bd45..989e1d8d04 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -288,18 +288,18 @@ void LLFloaterImagePreview::draw()              gGL.begin(LLRender::TRIANGLES);              {                  gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); -                gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop); +                gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);                  gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mBottom); -                gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom); +                gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);                  gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom); -                gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); +                gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); -                gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); -                gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop);                  gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom); -                gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); +                gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); +                gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); +                gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);                  gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop); -                gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mTop); +                gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);              }              gGL.end(); @@ -325,18 +325,18 @@ void LLFloaterImagePreview::draw()                  gGL.begin(LLRender::TRIANGLES);                  {                      gGL.texCoord2f(0.f, 1.f); -                    gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop); +                    gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);                      gGL.texCoord2f(0.f, 0.f); -                    gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom); +                    gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);                      gGL.texCoord2f(1.f, 0.f); -                    gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); +                    gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); -                    gGL.texCoord2f(0.f, 1.f); -                    gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop);                      gGL.texCoord2f(1.f, 0.f); -                    gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); +                    gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); +                    gGL.texCoord2f(0.f, 1.f); +                    gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);                      gGL.texCoord2f(1.f, 1.f); -                    gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mTop); +                    gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);                  }                  gGL.end(); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 731e711cd1..af025d5879 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -68,7 +68,7 @@  #include <vector>  // Height of the yellow selection highlight posts for land -const F32 PARCEL_POST_HEIGHT = 0.666f; +constexpr F32 PARCEL_POST_HEIGHT = 0.666f;  // Returns true if you got at least one object  void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) @@ -178,27 +178,27 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)      {          std::vector<LLDrawable*> potentials; -        for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); -            iter != LLWorld::getInstance()->getRegionList().end(); ++iter) +        for (LLViewerRegion* region : LLWorld::getInstance()->getRegionList())          { -            LLViewerRegion* region = *iter;              for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)              { -                LLSpatialPartition* part = region->getSpatialPartition(i); -                if (part) +                if (LLSpatialPartition* part = region->getSpatialPartition(i))                  {                      part->cull(*LLViewerCamera::getInstance(), &potentials, true);                  }              }          } -        for (std::vector<LLDrawable*>::iterator iter = potentials.begin(); -             iter != potentials.end(); iter++) +        for (LLDrawable* drawable : potentials)          { -            LLDrawable* drawable = *iter; +            if (!drawable) +            { +                continue; +            } +              LLViewerObject* vobjp = drawable->getVObj(); -            if (!drawable || !vobjp || +            if (!vobjp ||                  vobjp->getPCode() != LL_PCODE_VOLUME ||                  vobjp->isAttachment() ||                  (deselect && !vobjp->isSelected())) @@ -244,7 +244,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)      gViewerWindow->setup3DRender();  } -const F32 WIND_RELATIVE_ALTITUDE            = 25.f; +constexpr F32 WIND_RELATIVE_ALTITUDE = 25.f;  void LLWind::renderVectors()  { @@ -266,14 +266,14 @@ void LLWind::renderVectors()              x = mVelX[i + j*mSize] * WIND_SCALE_HACK;              y = mVelY[i + j*mSize] * WIND_SCALE_HACK;              gGL.pushMatrix(); -            gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0); -            gGL.color3f(0,1,0); +            gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.f); +            gGL.color3f(0.f, 1.f, 0.f);              gGL.begin(LLRender::POINTS); -                gGL.vertex3f(0,0,0); +                gGL.vertex3f(0.f, 0.f, 0.f);              gGL.end(); -            gGL.color3f(1,0,0); +            gGL.color3f(1.f, 0.f, 0.f);              gGL.begin(LLRender::LINES); -                gGL.vertex3f(x * 0.1f, y * 0.1f ,0.f); +                gGL.vertex3f(x * 0.1f, y * 0.1f, 0.f);                  gGL.vertex3f(x, y, 0.f);              gGL.end();              gGL.popMatrix(); @@ -287,7 +287,7 @@ void LLWind::renderVectors()  // Used by lltoolselectland  void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, -                                   const LLVector3d &east_north_top_global ) +                                   const LLVector3d &east_north_top_global)  {      LLGLSUIDefault gls_ui;      gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -356,92 +356,6 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global,      LLUI::setLineWidth(1.f);  } -/* -void LLViewerParcelMgr::renderParcel(LLParcel* parcel ) -{ -    S32 i; -    S32 count = parcel->getBoxCount(); -    for (i = 0; i < count; i++) -    { -        const LLParcelBox& box = parcel->getBox(i); - -        F32 west = box.mMin.mV[VX]; -        F32 south = box.mMin.mV[VY]; - -        F32 east = box.mMax.mV[VX]; -        F32 north = box.mMax.mV[VY]; - -        // HACK: At edge of last region of world, we need to make sure the region -        // resolves correctly so we can get a height value. -        const F32 FUDGE = 0.01f; - -        F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) ); -        F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) ); -        F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) ); -        F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) ); - -        // little hack to make nearby lines not Z-fight -        east -= 0.1f; -        north -= 0.1f; - -        F32 sw_top = sw_bottom + POST_HEIGHT; -        F32 se_top = se_bottom + POST_HEIGHT; -        F32 ne_top = ne_bottom + POST_HEIGHT; -        F32 nw_top = nw_bottom + POST_HEIGHT; - -        gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -        LLGLDepthTest gls_depth(GL_TRUE); - -        LLUI::setLineWidth(2.f); -        gGL.color4f(0.f, 1.f, 1.f, 1.f); - -        // Cheat and give this the same pick-name as land -        gGL.begin(LLRender::LINES); - -        gGL.vertex3f(west, north, nw_bottom); -        gGL.vertex3f(west, north, nw_top); - -        gGL.vertex3f(east, north, ne_bottom); -        gGL.vertex3f(east, north, ne_top); - -        gGL.vertex3f(east, south, se_bottom); -        gGL.vertex3f(east, south, se_top); - -        gGL.vertex3f(west, south, sw_bottom); -        gGL.vertex3f(west, south, sw_top); - -        gGL.end(); - -        gGL.color4f(0.f, 1.f, 1.f, 0.2f); -        gGL.begin(LLRender::QUADS); - -        gGL.vertex3f(west, north, nw_bottom); -        gGL.vertex3f(west, north, nw_top); -        gGL.vertex3f(east, north, ne_top); -        gGL.vertex3f(east, north, ne_bottom); - -        gGL.vertex3f(east, north, ne_bottom); -        gGL.vertex3f(east, north, ne_top); -        gGL.vertex3f(east, south, se_top); -        gGL.vertex3f(east, south, se_bottom); - -        gGL.vertex3f(east, south, se_bottom); -        gGL.vertex3f(east, south, se_top); -        gGL.vertex3f(west, south, sw_top); -        gGL.vertex3f(west, south, sw_bottom); - -        gGL.vertex3f(west, south, sw_bottom); -        gGL.vertex3f(west, south, sw_top); -        gGL.vertex3f(west, north, nw_top); -        gGL.vertex3f(west, north, nw_bottom); - -        gGL.end(); - -        LLUI::setLineWidth(1.f); -    } -} -*/ -  // north = a wall going north/south.  Need that info to set up texture  // coordinates correctly. diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index c1e68e0288..590cd09a31 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -488,7 +488,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,          case IM_NOTHING_SPECIAL:    // p2p IM              // Don't show dialog, just do IM              if (!gAgent.isGodlike() -                && gAgent.getRegion()->isPrelude() +                && gAgent.inPrelude()                  && to_id.isNull())              {                  // do nothing -- don't distract newbies in diff --git a/indra/newview/llphysicsshapebuilderutil.cpp b/indra/newview/llphysicsshapebuilderutil.cpp index 37534feadc..eb0df1194e 100644 --- a/indra/newview/llphysicsshapebuilderutil.cpp +++ b/indra/newview/llphysicsshapebuilderutil.cpp @@ -28,6 +28,26 @@  #include "llphysicsshapebuilderutil.h" +#include "llmeshrepository.h" + +bool LLPhysicsVolumeParams::hasDecomposition() const + { +    if (!isMeshSculpt()) +    { +        return false; +    } + +    LLUUID mesh_id = getSculptID(); +    if (mesh_id.isNull()) +    { +        return false; +    } + +    LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id); + +    return decomp != NULL; +} +  /* static */  void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut)  { @@ -200,19 +220,32 @@ void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumePara      {          specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;      } -    else if (volume_params.isMeshSculpt() && -             // Check overall dimensions, not individual triangles. -             (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE || -              scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE || -              scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE -              ) ) +    else if (volume_params.isMeshSculpt())      { -        // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't. -        specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX; +        // Check overall dimensions, not individual triangles. +        if (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE +            || scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE +            || scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE +            ) +        { +            if (volume_params.hasDecomposition()) +            { +                specOut.mType = PhysicsShapeSpecification::USER_MESH; +            } +            else +            { +                // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't. +                specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX; +            } +        } +        else +        { +            specOut.mType = PhysicsShapeSpecification::USER_MESH; +        }      } -    else if ( volume_params.isSculpt() ) // Is a sculpt of any kind (mesh or legacy) +    else if ( volume_params.isSculpt() )      { -        specOut.mType = volume_params.isMeshSculpt() ? PhysicsShapeSpecification::USER_MESH : PhysicsShapeSpecification::SCULPT; +        specOut.mType = PhysicsShapeSpecification::SCULPT;      }      else // Resort to mesh      { diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h index 33c2d0a8b6..01c173523b 100644 --- a/indra/newview/llphysicsshapebuilderutil.h +++ b/indra/newview/llphysicsshapebuilderutil.h @@ -79,6 +79,8 @@ public:      bool shouldForceConvex() const { return mForceConvex; } +    bool hasDecomposition() const; +  private:      bool mForceConvex;  }; | 
