1
0
Fork 0
This commit is contained in:
Yordan Dolchinkov 2025-02-28 01:36:23 +01:00 committed by GitHub
commit 0361162cfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View File

@ -146,6 +146,8 @@ Error CompressedTexture2D::load(const String &p_path) {
} else {
texture = RS::get_singleton()->texture_2d_create(image);
}
RS::get_singleton()->texture_set_path(texture, get_path());
if (lw || lh) {
RS::get_singleton()->texture_set_size_override(texture, lw, lh);
}

View File

@ -248,6 +248,12 @@ void LightStorage::light_set_projector(RID p_light, RID p_texture) {
if (light->type != RS::LIGHT_DIRECTIONAL) {
if (light->projector.is_valid()) {
#ifdef TOOLS_ENABLED
TextureStorage::Texture *tex = TextureStorage::get_singleton()->get_texture(p_texture);
if (tex->detect_3d_callback) {
tex->detect_3d_callback(tex->detect_3d_callback_ud);
}
#endif
texture_storage->texture_add_to_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI);
}
light->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_LIGHT_SOFT_SHADOW_AND_PROJECTOR);

View File

@ -2678,6 +2678,23 @@ void TextureStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID
decal->textures[p_type] = p_texture;
if (decal->textures[p_type].is_valid()) {
#ifdef TOOLS_ENABLED
Texture *tex = get_texture(p_texture);
if (tex->detect_3d_callback) {
tex->detect_3d_callback(tex->detect_3d_callback_ud);
}
if (p_type == RS::DecalTexture::DECAL_TEXTURE_NORMAL && tex->detect_normal_callback) {
tex->detect_normal_callback(tex->detect_normal_callback_ud);
}
if (p_type == RS::DecalTexture::DECAL_TEXTURE_NORMAL || p_type == RS::DecalTexture::DECAL_TEXTURE_ORM) {
Texture *normal_tex = get_texture(decal->textures[RS::DecalTexture::DECAL_TEXTURE_NORMAL]);
Texture *orm_tex = get_texture(decal->textures[RS::DecalTexture::DECAL_TEXTURE_ORM]);
if (orm_tex && normal_tex && !normal_tex->path.is_empty() && orm_tex->detect_roughness_callback) {
orm_tex->detect_roughness_callback(orm_tex->detect_roughness_callback_ud, normal_tex->path, RS::TEXTURE_DETECT_ROUGHNESS_G);
}
}
#endif
texture_add_to_decal_atlas(decal->textures[p_type]);
}