Add new scaling modes for splash screen

Removes the `fullsize` option which is superseded by `stretch_mode`.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
Samuel Pedrajas 2021-10-25 19:27:12 +02:00 committed by Rémi Verschelde
parent 4979d9fc7b
commit fcc9f5ce39
No known key found for this signature in database
GPG key ID: C3336907360768E1
13 changed files with 167 additions and 60 deletions

View file

@ -196,9 +196,6 @@
<member name="application/boot_splash/bg_color" type="Color" setter="" getter="" default="Color(0.14, 0.14, 0.14, 1)"> <member name="application/boot_splash/bg_color" type="Color" setter="" getter="" default="Color(0.14, 0.14, 0.14, 1)">
Background color for the boot splash. Background color for the boot splash.
</member> </member>
<member name="application/boot_splash/fullsize" type="bool" setter="" getter="" default="true">
If [code]true[/code], scale the boot splash image to the full window size (preserving the aspect ratio) when the engine starts. If [code]false[/code], the engine will leave it at the default pixel size.
</member>
<member name="application/boot_splash/image" type="String" setter="" getter="" default="&quot;&quot;"> <member name="application/boot_splash/image" type="String" setter="" getter="" default="&quot;&quot;">
Path to an image used as the boot splash. If left empty, the default Godot Engine splash will be displayed instead. Path to an image used as the boot splash. If left empty, the default Godot Engine splash will be displayed instead.
[b]Note:[/b] Only effective if [member application/boot_splash/show_image] is [code]true[/code]. [b]Note:[/b] Only effective if [member application/boot_splash/show_image] is [code]true[/code].
@ -206,6 +203,9 @@
<member name="application/boot_splash/show_image" type="bool" setter="" getter="" default="true"> <member name="application/boot_splash/show_image" type="bool" setter="" getter="" default="true">
If [code]true[/code], displays the image specified in [member application/boot_splash/image] when the engine starts. If [code]false[/code], only displays the plain color specified in [member application/boot_splash/bg_color]. If [code]true[/code], displays the image specified in [member application/boot_splash/image] when the engine starts. If [code]false[/code], only displays the plain color specified in [member application/boot_splash/bg_color].
</member> </member>
<member name="application/boot_splash/stretch_mode" type="int" setter="" getter="" default="1">
Specifies how the splash image will be stretched. See [enum RenderingServer.SplashStretchMode] constants for more information.
</member>
<member name="application/boot_splash/use_filter" type="bool" setter="" getter="" default="true"> <member name="application/boot_splash/use_filter" type="bool" setter="" getter="" default="true">
If [code]true[/code], applies linear filtering when scaling the image (recommended for high-resolution artwork). If [code]false[/code], uses nearest-neighbor interpolation (recommended for pixel art). If [code]true[/code], applies linear filtering when scaling the image (recommended for high-resolution artwork). If [code]false[/code], uses nearest-neighbor interpolation (recommended for pixel art).
</member> </member>

View file

@ -2657,10 +2657,10 @@
<return type="void" /> <return type="void" />
<argument index="0" name="image" type="Image" /> <argument index="0" name="image" type="Image" />
<argument index="1" name="color" type="Color" /> <argument index="1" name="color" type="Color" />
<argument index="2" name="scale" type="bool" /> <argument index="2" name="stretch_mode" type="int" enum="RenderingServer.SplashStretchMode" />
<argument index="3" name="use_filter" type="bool" default="true" /> <argument index="3" name="use_filter" type="bool" default="true" />
<description> <description>
Sets a boot image. The color defines the background color. If [code]scale[/code] is [code]true[/code], the image will be scaled to fit the screen size. If [code]use_filter[/code] is [code]true[/code], the image will be scaled with linear interpolation. If [code]use_filter[/code] is [code]false[/code], the image will be scaled with nearest-neighbor interpolation. Sets a boot image. The color defines the background color. The value of [code]stretch_mode[/code] indicates how the image will be stretched (see [enum SplashStretchMode] for possible values). If [code]use_filter[/code] is [code]true[/code], the image will be scaled with linear interpolation. If [code]use_filter[/code] is [code]false[/code], the image will be scaled with nearest-neighbor interpolation.
</description> </description>
</method> </method>
<method name="set_debug_generate_wireframes"> <method name="set_debug_generate_wireframes">
@ -4504,6 +4504,24 @@
</constant> </constant>
<constant name="RENDERING_INFO_VIDEO_MEM_USED" value="5" enum="RenderingInfo"> <constant name="RENDERING_INFO_VIDEO_MEM_USED" value="5" enum="RenderingInfo">
</constant> </constant>
<constant name="SPLASH_STRETCH_MODE_DISABLED" value="0" enum="SplashStretchMode">
The splash image uses its default pixel size.
</constant>
<constant name="SPLASH_STRETCH_MODE_KEEP" value="1" enum="SplashStretchMode">
If the window width is greater than its height, the splash image will be stretched to have the same height as the window. Otherwise, the image will be stretched to have the same width as the window. Both cases keep the original image's aspect ratio.
</constant>
<constant name="SPLASH_STRETCH_MODE_KEEP_WIDTH" value="2" enum="SplashStretchMode">
The splash image is stretched to have the same width as the window. It keeps the image's aspect ratio.
</constant>
<constant name="SPLASH_STRETCH_MODE_KEEP_HEIGHT" value="3" enum="SplashStretchMode">
The splash image is stretched to have the same height as the window. It keeps the image's aspect ratio.
</constant>
<constant name="SPLASH_STRETCH_MODE_COVER" value="4" enum="SplashStretchMode">
The splash image covers the window while keeping the aspect ratio.
</constant>
<constant name="SPLASH_STRETCH_MODE_EXPAND" value="5" enum="SplashStretchMode">
The splash image covers the window without keeping the aspect ratio.
</constant>
<constant name="FEATURE_SHADERS" value="0" enum="Features"> <constant name="FEATURE_SHADERS" value="0" enum="Features">
Hardware supports shaders. This enum is currently unused in Godot 3.x. Hardware supports shaders. This enum is currently unused in Godot 3.x.
</constant> </constant>

View file

@ -298,54 +298,89 @@ void RasterizerGLES3::blit_render_targets_to_screen(DisplayServer::WindowID p_sc
} }
} }
void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) { void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter) {
if (p_image.is_null() || p_image->is_empty()) if (p_image.is_null() || p_image->is_empty()) {
return; return;
}
Size2i win_size = DisplayServer::get_singleton()->screen_get_size(); Size2 window_size = DisplayServer::get_singleton()->screen_get_size();
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, win_size.width, win_size.height); glViewport(0, 0, window_size.width, window_size.height);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
if (false) { glClearColor(p_color.r, p_color.g, p_color.b, 1.0);
// if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
glClearColor(0.0, 0.0, 0.0, 0.0);
} else {
glClearColor(p_color.r, p_color.g, p_color.b, 1.0);
}
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
canvas.canvas_begin(); canvas.canvas_begin();
RID texture = storage.texture_create(); RID texture = storage.texture_create();
// FIXME: Handle p_filter.
//storage.texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), VS::TEXTURE_TYPE_2D, p_use_filter ? VS::TEXTURE_FLAG_FILTER : 0); //storage.texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), VS::TEXTURE_TYPE_2D, p_use_filter ? VS::TEXTURE_FLAG_FILTER : 0);
storage._texture_allocate_internal(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), RenderingDevice::TEXTURE_TYPE_2D); storage._texture_allocate_internal(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), RenderingDevice::TEXTURE_TYPE_2D);
storage.texture_set_data(texture, p_image); storage.texture_set_data(texture, p_image);
// Stretch code synced with RendererCompositorRD.
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height()); Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
Rect2 screenrect; Rect2 screenrect;
if (p_scale) { switch (p_stretch_mode) {
if (win_size.width > win_size.height) { case RenderingServer::SPLASH_STRETCH_MODE_DISABLED: {
//scale horizontally screenrect = imgrect;
screenrect.size.y = win_size.height; screenrect.position += ((window_size - screenrect.size) / 2.0).floor();
screenrect.size.x = imgrect.size.x * win_size.height / imgrect.size.y; } break;
screenrect.position.x = (win_size.width - screenrect.size.x) / 2; case RenderingServer::SPLASH_STRETCH_MODE_KEEP: {
if (window_size.width > window_size.height) {
// Scale horizontally.
screenrect.size.y = window_size.height;
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
} else {
// Scale vertically.
screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
}
} break;
case RenderingServer::SPLASH_STRETCH_MODE_KEEP_WIDTH: {
// Scale vertically.
screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
} break;
case RenderingServer::SPLASH_STRETCH_MODE_KEEP_HEIGHT: {
// Scale horizontally.
screenrect.size.y = window_size.height;
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
} break;
case RenderingServer::SPLASH_STRETCH_MODE_COVER: {
double window_aspect = (double)window_size.width / window_size.height;
double img_aspect = imgrect.size.x / imgrect.size.y;
} else { if (window_aspect > img_aspect) {
//scale vertically // Scale vertically.
screenrect.size.x = win_size.width; screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * win_size.width / imgrect.size.x; screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (win_size.height - screenrect.size.y) / 2; screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
} } else {
} else { // Scale horizontally.
screenrect = imgrect; screenrect.size.y = window_size.height;
screenrect.position += ((Size2(win_size.width, win_size.height) - screenrect.size) / 2.0).floor(); screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
}
} break;
case RenderingServer::SPLASH_STRETCH_MODE_EXPAND: {
screenrect.size.x = window_size.width;
screenrect.size.y = window_size.height;
} break;
} }
// FIXME: Actually draw the image after binding it, using screenrect for scaling.
RasterizerStorageGLES3::Texture *t = storage.texture_owner.get_or_null(texture); RasterizerStorageGLES3::Texture *t = storage.texture_owner.get_or_null(texture);
glActiveTexture(GL_TEXTURE0 + storage.config.max_texture_image_units - 1); glActiveTexture(GL_TEXTURE0 + storage.config.max_texture_image_units - 1);
glBindTexture(GL_TEXTURE_2D, t->tex_id); glBindTexture(GL_TEXTURE_2D, t->tex_id);
//canvas->draw_generic_textured_rect(screenrect, Rect2(0, 0, 1, 1));
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
canvas.canvas_end(); canvas.canvas_end();

View file

@ -57,7 +57,7 @@ public:
RendererCanvasRender *get_canvas() { return &canvas; } RendererCanvasRender *get_canvas() { return &canvas; }
RendererSceneRender *get_scene() { return &scene; } RendererSceneRender *get_scene() { return &scene; }
void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true); void set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter = true);
void initialize(); void initialize();
void begin_frame(double frame_step); void begin_frame(double frame_step);

View file

@ -1728,11 +1728,15 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (show_logo) { //boot logo! if (show_logo) { //boot logo!
const bool boot_logo_image = GLOBAL_DEF("application/boot_splash/show_image", true); const bool boot_logo_image = GLOBAL_DEF("application/boot_splash/show_image", true);
const String boot_logo_path = String(GLOBAL_DEF("application/boot_splash/image", String())).strip_edges(); const String boot_logo_path = String(GLOBAL_DEF("application/boot_splash/image", String())).strip_edges();
const bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true); const RenderingServer::SplashStretchMode boot_stretch_mode =
(RenderingServer::SplashStretchMode)(int)GLOBAL_DEF("application/boot_splash/stretch_mode", RenderingServer::SPLASH_STRETCH_MODE_KEEP);
const bool boot_logo_filter = GLOBAL_DEF("application/boot_splash/use_filter", true); const bool boot_logo_filter = GLOBAL_DEF("application/boot_splash/use_filter", true);
ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/stretch_mode",
PropertyInfo(Variant::INT, "application/boot_splash/stretch_mode",
PROPERTY_HINT_ENUM, "Disabled,Keep,Keep Width,Keep Height,Cover,Expand")); // Sync with RenderingServer::SplashStretchMode.
ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image", ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image",
PropertyInfo(Variant::STRING, PropertyInfo(Variant::STRING, "application/boot_splash/image",
"application/boot_splash/image",
PROPERTY_HINT_FILE, "*.png")); PROPERTY_HINT_FILE, "*.png"));
Ref<Image> boot_logo; Ref<Image> boot_logo;
@ -1760,9 +1764,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
const Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color); const Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color);
#endif #endif
if (boot_logo.is_valid()) { if (boot_logo.is_valid()) {
RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale, RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color,
boot_logo_filter); boot_stretch_mode, boot_logo_filter);
} else { } else {
#ifndef NO_DEFAULT_BOOT_LOGO #ifndef NO_DEFAULT_BOOT_LOGO
MAIN_PRINT("Main: Create bootsplash"); MAIN_PRINT("Main: Create bootsplash");
@ -1775,7 +1778,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
MAIN_PRINT("Main: ClearColor"); MAIN_PRINT("Main: ClearColor");
RenderingServer::get_singleton()->set_default_clear_color(boot_bg_color); RenderingServer::get_singleton()->set_default_clear_color(boot_bg_color);
MAIN_PRINT("Main: Image"); MAIN_PRINT("Main: Image");
RenderingServer::get_singleton()->set_boot_image(splash, boot_bg_color, false); RenderingServer::get_singleton()->set_boot_image(splash, boot_bg_color, RenderingServer::SPLASH_STRETCH_MODE_DISABLED);
#endif #endif
} }

View file

@ -763,7 +763,7 @@ public:
RendererCanvasRender *get_canvas() override { return &canvas; } RendererCanvasRender *get_canvas() override { return &canvas; }
RendererSceneRender *get_scene() override { return &scene; } RendererSceneRender *get_scene() override { return &scene; }
void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) override {} void set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter = true) override {}
void initialize() override {} void initialize() override {}
void begin_frame(double frame_step) override { void begin_frame(double frame_step) override {

View file

@ -76,7 +76,7 @@ public:
virtual RendererCanvasRender *get_canvas() = 0; virtual RendererCanvasRender *get_canvas() = 0;
virtual RendererSceneRender *get_scene() = 0; virtual RendererSceneRender *get_scene() = 0;
virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0; virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter = true) = 0;
virtual void initialize() = 0; virtual void initialize() = 0;
virtual void begin_frame(double frame_step) = 0; virtual void begin_frame(double frame_step) = 0;

View file

@ -159,7 +159,7 @@ void RendererCompositorRD::finalize() {
RD::get_singleton()->free(blit.sampler); RD::get_singleton()->free(blit.sampler);
} }
void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) { void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter) {
RD::get_singleton()->prepare_screen_for_drawing(); RD::get_singleton()->prepare_screen_for_drawing();
RID texture = storage->texture_allocate(); RID texture = storage->texture_allocate();
@ -182,22 +182,56 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height()); Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
Rect2 screenrect; Rect2 screenrect;
if (p_scale) { switch (p_stretch_mode) {
if (window_size.width > window_size.height) { case RenderingServer::SPLASH_STRETCH_MODE_DISABLED: {
//scale horizontally screenrect = imgrect;
screenrect.size.y = window_size.height; screenrect.position += ((window_size - screenrect.size) / 2.0).floor();
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y; } break;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2; case RenderingServer::SPLASH_STRETCH_MODE_KEEP: {
if (window_size.width > window_size.height) {
} else { // Scale horizontally.
//scale vertically screenrect.size.y = window_size.height;
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
} else {
// Scale vertically.
screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
}
} break;
case RenderingServer::SPLASH_STRETCH_MODE_KEEP_WIDTH: {
// Scale vertically.
screenrect.size.x = window_size.width; screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x; screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (window_size.height - screenrect.size.y) / 2; screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
} } break;
} else { case RenderingServer::SPLASH_STRETCH_MODE_KEEP_HEIGHT: {
screenrect = imgrect; // Scale horizontally.
screenrect.position += ((window_size - screenrect.size) / 2.0).floor(); screenrect.size.y = window_size.height;
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
} break;
case RenderingServer::SPLASH_STRETCH_MODE_COVER: {
double window_aspect = (double)window_size.width / window_size.height;
double img_aspect = imgrect.size.x / imgrect.size.y;
if (window_aspect > img_aspect) {
// Scale vertically.
screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
} else {
// Scale horizontally.
screenrect.size.y = window_size.height;
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
}
} break;
case RenderingServer::SPLASH_STRETCH_MODE_EXPAND: {
screenrect.size.x = window_size.width;
screenrect.size.y = window_size.height;
} break;
} }
screenrect.position /= window_size; screenrect.position /= window_size;

View file

@ -90,7 +90,7 @@ public:
RendererCanvasRender *get_canvas() { return canvas; } RendererCanvasRender *get_canvas() { return canvas; }
RendererSceneRender *get_scene() { return scene; } RendererSceneRender *get_scene() { return scene; }
void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter); void set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter);
void initialize(); void initialize();
void begin_frame(double frame_step); void begin_frame(double frame_step);

View file

@ -273,9 +273,9 @@ Vector<RenderingServer::FrameProfileArea> RenderingServerDefault::get_frame_prof
/* TESTING */ /* TESTING */
void RenderingServerDefault::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) { void RenderingServerDefault::set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter) {
redraw_request(); redraw_request();
RSG::rasterizer->set_boot_image(p_image, p_color, p_scale, p_use_filter); RSG::rasterizer->set_boot_image(p_image, p_color, p_stretch_mode, p_use_filter);
} }
void RenderingServerDefault::set_default_clear_color(const Color &p_color) { void RenderingServerDefault::set_default_clear_color(const Color &p_color) {

View file

@ -907,7 +907,7 @@ public:
virtual double get_frame_setup_time_cpu() const override; virtual double get_frame_setup_time_cpu() const override;
virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) override; virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter = true) override;
virtual void set_default_clear_color(const Color &p_color) override; virtual void set_default_clear_color(const Color &p_color) override;
virtual bool has_feature(Features p_feature) const override; virtual bool has_feature(Features p_feature) const override;

View file

@ -2730,7 +2730,7 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_test_texture"), &RenderingServer::get_test_texture); ClassDB::bind_method(D_METHOD("get_test_texture"), &RenderingServer::get_test_texture);
ClassDB::bind_method(D_METHOD("get_white_texture"), &RenderingServer::get_white_texture); ClassDB::bind_method(D_METHOD("get_white_texture"), &RenderingServer::get_white_texture);
ClassDB::bind_method(D_METHOD("set_boot_image", "image", "color", "scale", "use_filter"), &RenderingServer::set_boot_image, DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_boot_image", "image", "color", "stretch_mode", "use_filter"), &RenderingServer::set_boot_image, DEFVAL(true));
ClassDB::bind_method(D_METHOD("set_default_clear_color", "color"), &RenderingServer::set_default_clear_color); ClassDB::bind_method(D_METHOD("set_default_clear_color", "color"), &RenderingServer::set_default_clear_color);
ClassDB::bind_method(D_METHOD("has_feature", "feature"), &RenderingServer::has_feature); ClassDB::bind_method(D_METHOD("has_feature", "feature"), &RenderingServer::has_feature);
@ -2751,6 +2751,13 @@ void RenderingServer::_bind_methods() {
BIND_ENUM_CONSTANT(RENDERING_INFO_BUFFER_MEM_USED); BIND_ENUM_CONSTANT(RENDERING_INFO_BUFFER_MEM_USED);
BIND_ENUM_CONSTANT(RENDERING_INFO_VIDEO_MEM_USED); BIND_ENUM_CONSTANT(RENDERING_INFO_VIDEO_MEM_USED);
BIND_ENUM_CONSTANT(SPLASH_STRETCH_MODE_DISABLED);
BIND_ENUM_CONSTANT(SPLASH_STRETCH_MODE_KEEP);
BIND_ENUM_CONSTANT(SPLASH_STRETCH_MODE_KEEP_WIDTH);
BIND_ENUM_CONSTANT(SPLASH_STRETCH_MODE_KEEP_HEIGHT);
BIND_ENUM_CONSTANT(SPLASH_STRETCH_MODE_COVER);
BIND_ENUM_CONSTANT(SPLASH_STRETCH_MODE_EXPAND);
BIND_ENUM_CONSTANT(FEATURE_SHADERS); BIND_ENUM_CONSTANT(FEATURE_SHADERS);
BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED); BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED);

View file

@ -1510,7 +1510,16 @@ public:
virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data); virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data);
virtual void mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes); virtual void mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes);
virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0; enum SplashStretchMode {
SPLASH_STRETCH_MODE_DISABLED,
SPLASH_STRETCH_MODE_KEEP,
SPLASH_STRETCH_MODE_KEEP_WIDTH,
SPLASH_STRETCH_MODE_KEEP_HEIGHT,
SPLASH_STRETCH_MODE_COVER,
SPLASH_STRETCH_MODE_EXPAND,
};
virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, RenderingServer::SplashStretchMode p_stretch_mode, bool p_use_filter = true) = 0;
virtual void set_default_clear_color(const Color &p_color) = 0; virtual void set_default_clear_color(const Color &p_color) = 0;
enum Features { enum Features {
@ -1624,6 +1633,7 @@ VARIANT_ENUM_CAST(RenderingServer::CanvasLightShadowFilter);
VARIANT_ENUM_CAST(RenderingServer::CanvasOccluderPolygonCullMode); VARIANT_ENUM_CAST(RenderingServer::CanvasOccluderPolygonCullMode);
VARIANT_ENUM_CAST(RenderingServer::GlobalVariableType); VARIANT_ENUM_CAST(RenderingServer::GlobalVariableType);
VARIANT_ENUM_CAST(RenderingServer::RenderingInfo); VARIANT_ENUM_CAST(RenderingServer::RenderingInfo);
VARIANT_ENUM_CAST(RenderingServer::SplashStretchMode);
VARIANT_ENUM_CAST(RenderingServer::Features); VARIANT_ENUM_CAST(RenderingServer::Features);
VARIANT_ENUM_CAST(RenderingServer::CanvasTextureChannel); VARIANT_ENUM_CAST(RenderingServer::CanvasTextureChannel);
VARIANT_ENUM_CAST(RenderingServer::BakeChannels); VARIANT_ENUM_CAST(RenderingServer::BakeChannels);