Skip to content

Commit

Permalink
add updateEnvMap for native (#15889)
Browse files Browse the repository at this point in the history
  • Loading branch information
xubing0906 authored Aug 10, 2023
1 parent 6b80095 commit eded5a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions native/cocos/scene/Skybox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@ void SkyboxInfo::setMaterialProperty(const ccstd::string &name, const MaterialPr
}
}

void SkyboxInfo::updateEnvMap(TextureCube *val) {
if (!val) {
setApplyDiffuseMap(false);
setUseIBL(false);
setEnvLightingType(EnvironmentLightingType::HEMISPHERE_DIFFUSE);
}
if (_resource) {
_resource->setEnvMaps(_envmapHDR, _envmapLDR);
_resource->setDiffuseMaps(_diffuseMapHDR, _diffuseMapLDR);
_resource->setReflectionMaps(_reflectionHDR, _reflectionLDR);
_resource->setEnvmap(val);
}
}

void SkyboxInfo::activate(Skybox *resource) {
_resource = resource; // weak reference
Root::getInstance()->getPipeline()->getPipelineSceneData()->setHDR(_useHDR);
Expand Down
1 change: 1 addition & 0 deletions native/cocos/scene/Skybox.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class SkyboxInfo : public RefCounted {
inline Material *getSkyboxMaterial() const { return _editableMaterial; }

void setMaterialProperty(const ccstd::string &name, const MaterialPropertyVariant &val, index_t passIdx = CC_INVALID_INDEX) const;
void updateEnvMap(TextureCube *val);

void activate(Skybox *resource);

Expand Down

0 comments on commit eded5a9

Please sign in to comment.