Fix for particles not loading textures (#2598)

Also fix assert while prepping GLTF assets
master
Dave Parks 2024-09-18 15:23:20 -05:00 committed by GitHub
parent 4640f3204d
commit b31fd167c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 28 deletions

View File

@ -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)
LLViewerObject* obj = (LLViewerObject*)user_data;
llassert(asset_type == LLAssetType::AT_GLTF_BIN);
if (status == LL_ERR_NOERR)
{
obj->mGLTFAsset->mPendingBuffers--;
if (obj->mGLTFAsset->mPendingBuffers == 0)
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

View File

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