mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
[fix] skybox crash with auto releasing assets (#12348)
This commit is contained in:
@@ -376,15 +376,14 @@ export class Skybox {
|
||||
skybox_material.setProperty('environmentMap', envmap);
|
||||
skybox_material.recompileShaders({ USE_RGBE_CUBEMAP: this.isRGBE });
|
||||
}
|
||||
}
|
||||
|
||||
if (this._model) {
|
||||
if (this._editableMaterial) {
|
||||
this._model.setSubModelMaterial(0, this._editableMaterial);
|
||||
} else {
|
||||
this._model.setSubModelMaterial(0, skybox_material!);
|
||||
if (this._model) {
|
||||
if (this._editableMaterial) {
|
||||
this._model.setSubModelMaterial(0, this._editableMaterial);
|
||||
} else {
|
||||
this._model.setSubModelMaterial(0, skybox_material!);
|
||||
}
|
||||
this._updateSubModes();
|
||||
}
|
||||
this._updateSubModes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -355,11 +355,11 @@ void Skybox::updatePipeline() const {
|
||||
}
|
||||
_material->setProperty("environmentMap", envmap);
|
||||
_material->recompileShaders({{"USE_RGBE_CUBEMAP", isRGBE()}});
|
||||
}
|
||||
|
||||
if (_model != nullptr && _material != nullptr) {
|
||||
_model->setSubModelMaterial(0, _material);
|
||||
updateSubModes();
|
||||
if (_model != nullptr) {
|
||||
_model->setSubModelMaterial(0, _material);
|
||||
updateSubModes();
|
||||
}
|
||||
}
|
||||
|
||||
Root *root = Root::getInstance();
|
||||
@@ -424,11 +424,6 @@ void Skybox::updatePipeline() const {
|
||||
valueChanged = true;
|
||||
}
|
||||
|
||||
//set the macro value first before update the material
|
||||
if (isEnabled() && _material != nullptr) {
|
||||
_material->recompileShaders({ {"USE_RGBE_CUBEMAP", isRGBE()} });
|
||||
}
|
||||
|
||||
if (_model != nullptr && _material != nullptr) {
|
||||
_model->setSubModelMaterial(0, _material);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user