Implement default_canvas_cull_mask

This commit is contained in:
Summersay415 2024-11-09 17:50:00 +07:00
parent e65a23762b
commit 151cbd347c
3 changed files with 9 additions and 0 deletions

View File

@ -1570,6 +1570,8 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/viewport/default_canvas_cull_mask", PROPERTY_HINT_LAYERS_2D_RENDER), 0xFFFFFFFF);
GLOBAL_DEF("collada/use_ambient", false);
// Input settings

View File

@ -2944,6 +2944,10 @@
<member name="rendering/textures/webp_compression/lossless_compression_factor" type="float" setter="" getter="" default="25">
The default compression factor for lossless WebP. Decompression speed is mostly unaffected by the compression factor. Supported values are 0 to 100.
</member>
<member name="rendering/viewport/default_canvas_cull_mask" type="int" setter="" getter="" default="4294967295">
Sets the [member Viewport.canvas_cull_mask] on the root viewport. Use with [member CanvasItem.visibility_layer].
[b]Note:[/b] This property is only read when the project starts. To change canvas cull mask at runtime, use [member Viewport.canvas_cull_mask] on the root [Viewport].
</member>
<member name="rendering/viewport/hdr_2d" type="bool" setter="" getter="" default="false">
If [code]true[/code], enables [member Viewport.use_hdr_2d] on the root viewport. 2D rendering will use an high dynamic range (HDR) format framebuffer matching the bit depth of the 3D framebuffer. When using the Forward+ renderer this will be an [code]RGBA16[/code] framebuffer, while when using the Mobile renderer it will be an [code]RGB10_A2[/code] framebuffer. Additionally, 2D rendering will take place in linear color space and will be converted to sRGB space immediately before blitting to the screen. Practically speaking, this means that the end result of the Viewport will not be clamped into the [code]0-1[/code] range and can be used in 3D rendering without color space adjustments. This allows 2D rendering to take advantage of effects requiring high dynamic range (e.g. 2D glow) as well as substantially improves the appearance of effects requiring highly detailed gradients.
[b]Note:[/b] This setting will have no effect when using the GL Compatibility renderer as the GL Compatibility renderer always renders in low dynamic range for performance reasons.

View File

@ -4116,6 +4116,9 @@ int Main::start() {
Viewport::DefaultCanvasItemTextureFilter(texture_filter));
sml->get_root()->set_default_canvas_item_texture_repeat(
Viewport::DefaultCanvasItemTextureRepeat(texture_repeat));
int default_canvas_cull_mask = GLOBAL_GET("rendering/viewport/default_canvas_cull_mask");
sml->get_root()->set_canvas_cull_mask(default_canvas_cull_mask);
}
#ifdef TOOLS_ENABLED