summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/image.cpp3
-rw-r--r--core/image.h6
-rw-r--r--doc/classes/Image.xml8
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp1
-rw-r--r--modules/svg/image_loader_svg.cpp5
-rw-r--r--servers/register_server_types.cpp5
6 files changed, 21 insertions, 7 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 4fc3b4becb..91c3d05a29 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -2632,6 +2632,9 @@ void Image::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "_set_data", "_get_data");
+ BIND_CONSTANT(MAX_WIDTH);
+ BIND_CONSTANT(MAX_HEIGHT);
+
BIND_ENUM_CONSTANT(FORMAT_L8); //luminance
BIND_ENUM_CONSTANT(FORMAT_LA8); //luminance-alpha
BIND_ENUM_CONSTANT(FORMAT_R8);
diff --git a/core/image.h b/core/image.h
index 3604580e98..b23f8cac46 100644
--- a/core/image.h
+++ b/core/image.h
@@ -52,14 +52,14 @@ typedef Ref<Image> (*ImageMemLoadFunc)(const uint8_t *p_png, int p_size);
class Image : public Resource {
GDCLASS(Image, Resource);
+public:
+ static SavePNGFunc save_png_func;
+
enum {
MAX_WIDTH = 16384, // force a limit somehow
MAX_HEIGHT = 16384 // force a limit somehow
};
-public:
- static SavePNGFunc save_png_func;
-
enum Format {
FORMAT_L8, //luminance
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index 56accdcd9e..8868dd778d 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -4,7 +4,7 @@
Image datatype.
</brief_description>
<description>
- Native image datatype. Contains image data, which can be converted to a [Texture], and several functions to interact with it. The maximum width and height for an [code]Image[/code] is 16384 pixels.
+ Native image datatype. Contains image data, which can be converted to a [Texture], and several functions to interact with it. The maximum width and height for an [code]Image[/code] are [constant MAX_WIDTH] and [constant MAX_HEIGHT].
</description>
<tutorials>
</tutorials>
@@ -476,6 +476,12 @@
</member>
</members>
<constants>
+ <constant name="MAX_WIDTH" value="16384">
+ The maximal width allowed for [code]Image[/code] resources.
+ </constant>
+ <constant name="MAX_HEIGHT" value="16384">
+ The maximal height allowed for [code]Image[/code] resources.
+ </constant>
<constant name="FORMAT_L8" value="0" enum="Format">
</constant>
<constant name="FORMAT_LA8" value="1" enum="Format">
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index bff031b93a..b2a7409d43 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -869,6 +869,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
//for light
actions[VS::SHADER_SPATIAL].renames["VIEW"] = "view";
actions[VS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
+ actions[VS::SHADER_SPATIAL].renames["LIGHT"] = "light";
actions[VS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
actions[VS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
actions[VS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index 404ca24482..e36844a1bc 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -109,7 +109,12 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t
float upscale = upsample ? 2.0 : 1.0;
int w = (int)(svg_image->width * p_scale * upscale);
+ ERR_EXPLAIN(vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max width.", rtos(p_scale)));
+ ERR_FAIL_COND_V(w > Image::MAX_WIDTH, ERR_PARAMETER_RANGE_ERROR);
+
int h = (int)(svg_image->height * p_scale * upscale);
+ ERR_EXPLAIN(vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max height.", rtos(p_scale)));
+ ERR_FAIL_COND_V(h > Image::MAX_HEIGHT, ERR_PARAMETER_RANGE_ERROR);
PoolVector<uint8_t> dst_image;
dst_image.resize(w * h * 4);
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 0c43000186..4e167be300 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -81,7 +81,6 @@ static void _debugger_get_resource_usage(List<ScriptDebuggerRemote::ResourceUsag
ShaderTypes *shader_types = NULL;
PhysicsServer *_createGodotPhysicsCallback() {
- WARN_PRINT("The GodotPhysics 3D physics engine is deprecated and will be removed in Godot 3.2. You should use the Bullet physics engine instead (configurable in your project settings).");
return memnew(PhysicsServerSW);
}
@@ -167,8 +166,8 @@ void register_server_types() {
GLOBAL_DEF(PhysicsServerManager::setting_property_name, "DEFAULT");
ProjectSettings::get_singleton()->set_custom_property_info(PhysicsServerManager::setting_property_name, PropertyInfo(Variant::STRING, PhysicsServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
- PhysicsServerManager::register_server("GodotPhysics - deprecated", &_createGodotPhysicsCallback);
- PhysicsServerManager::set_default_server("GodotPhysics - deprecated");
+ PhysicsServerManager::register_server("GodotPhysics", &_createGodotPhysicsCallback);
+ PhysicsServerManager::set_default_server("GodotPhysics");
}
void unregister_server_types() {