Merge pull request #51672 from Calinou/shader-add-hint-transparent-texture
Add `hint_transparent` to use a transparent black placeholder texture
This commit is contained in:
commit
8cce479c01
11 changed files with 61 additions and 4 deletions
|
|
@ -1156,6 +1156,9 @@ void MaterialData::update_textures(const HashMap<StringName, Variant> &p_paramet
|
|||
case ShaderLanguage::ShaderNode::Uniform::HINT_DEFAULT_BLACK: {
|
||||
gl_texture = texture_storage->texture_gl_get_default(DEFAULT_GL_TEXTURE_BLACK);
|
||||
} break;
|
||||
case ShaderLanguage::ShaderNode::Uniform::HINT_DEFAULT_TRANSPARENT: {
|
||||
gl_texture = texture_storage->texture_gl_get_default(DEFAULT_GL_TEXTURE_TRANSPARENT);
|
||||
} break;
|
||||
case ShaderLanguage::ShaderNode::Uniform::HINT_ANISOTROPY: {
|
||||
gl_texture = texture_storage->texture_gl_get_default(DEFAULT_GL_TEXTURE_ANISO);
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,17 @@ TextureStorage::TextureStorage() {
|
|||
texture_2d_layered_initialize(default_gl_textures[DEFAULT_GL_TEXTURE_CUBEMAP_BLACK], images, RS::TEXTURE_LAYERED_CUBEMAP);
|
||||
}
|
||||
|
||||
{ // transparent black
|
||||
Ref<Image> image;
|
||||
image.instantiate();
|
||||
image->create(4, 4, true, Image::FORMAT_RGBA8);
|
||||
image->fill(Color(0, 0, 0, 0));
|
||||
image->generate_mipmaps();
|
||||
|
||||
default_gl_textures[DEFAULT_GL_TEXTURE_TRANSPARENT] = texture_allocate();
|
||||
texture_2d_initialize(default_gl_textures[DEFAULT_GL_TEXTURE_TRANSPARENT], image);
|
||||
}
|
||||
|
||||
{
|
||||
Ref<Image> image;
|
||||
image.instantiate();
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ namespace GLES3 {
|
|||
enum DefaultGLTexture {
|
||||
DEFAULT_GL_TEXTURE_WHITE,
|
||||
DEFAULT_GL_TEXTURE_BLACK,
|
||||
DEFAULT_GL_TEXTURE_TRANSPARENT,
|
||||
DEFAULT_GL_TEXTURE_NORMAL,
|
||||
DEFAULT_GL_TEXTURE_ANISO,
|
||||
DEFAULT_GL_TEXTURE_DEPTH,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue