@@ -102,14 +102,6 @@ namespace
102
102
}
103
103
};
104
104
105
- LLTerrainMaterials::LLTerrainMaterials ()
106
- {
107
- for (S32 i = 0 ; i < ASSET_COUNT; ++i)
108
- {
109
- mMaterialTexturesSet [i] = false ;
110
- }
111
- }
112
-
113
105
LLTerrainMaterials::~LLTerrainMaterials ()
114
106
{
115
107
unboost ();
@@ -199,7 +191,6 @@ void LLTerrainMaterials::setDetailAssetID(S32 asset, const LLUUID& id)
199
191
LLPointer<LLFetchedGLTFMaterial>& mat = mDetailMaterials [asset];
200
192
mat = id.isNull () ? nullptr : gGLTFMaterialList .getMaterial (id);
201
193
mDetailRenderMaterials [asset] = nullptr ;
202
- mMaterialTexturesSet [asset] = false ;
203
194
}
204
195
205
196
const LLGLTFMaterial* LLTerrainMaterials::getMaterialOverride (S32 asset) const
@@ -262,11 +253,17 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict)
262
253
if (!material_asset_ready (mat)) { continue ; }
263
254
264
255
LLPointer<LLFetchedGLTFMaterial>& render_mat = mDetailRenderMaterials [i];
256
+ // This will be mutated by materialTexturesReady, due to the way that
257
+ // function is implemented.
258
+ bool render_material_textures_set = bool (render_mat);
265
259
if (!render_mat)
266
260
{
267
261
render_mat = new LLFetchedGLTFMaterial ();
268
262
*render_mat = *mat;
269
263
// This render_mat is effectively already loaded, because it gets its data from mat.
264
+ // However, its textures may not be loaded yet.
265
+ render_mat->materialBegin ();
266
+ render_mat->materialComplete (true );
270
267
271
268
LLPointer<LLGLTFMaterial>& override_mat = mDetailMaterialOverrides [i];
272
269
if (override_mat)
@@ -275,7 +272,8 @@ bool LLTerrainMaterials::makeMaterialsReady(bool boost, bool strict)
275
272
}
276
273
}
277
274
278
- ready[i] = materialTexturesReady (render_mat, mMaterialTexturesSet [i], boost, strict);
275
+ ready[i] = materialTexturesReady (render_mat, render_material_textures_set, boost, strict);
276
+ llassert (render_material_textures_set);
279
277
}
280
278
281
279
#if 1
@@ -414,16 +412,6 @@ bool LLTerrainMaterials::materialTexturesReady(LLPointer<LLFetchedGLTFMaterial>&
414
412
return true ;
415
413
}
416
414
417
- // Boost the loading priority of every known texture in the material
418
- // Return true when ready to use
419
- // static
420
- bool LLTerrainMaterials::makeMaterialReady (LLPointer<LLFetchedGLTFMaterial> &mat, bool &textures_set, bool boost, bool strict)
421
- {
422
- if (!material_asset_ready (mat)) { return false ; }
423
-
424
- return materialTexturesReady (mat, textures_set, boost, strict);
425
- }
426
-
427
415
// static
428
416
const LLUUID (&LLVLComposition::getDefaultTextures ())[ASSET_COUNT]
429
417
{
0 commit comments