diff options
Diffstat (limited to 'modules')
24 files changed, 81 insertions, 236 deletions
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index 919731b52b..063508a25f 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -42,12 +42,9 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, if (err == OK) { size_t index = 0; - size_t width = - static_cast<size_t>(p_header.bmp_info_header.bmp_width < 0 ? -p_header.bmp_info_header.bmp_width : p_header.bmp_info_header.bmp_width); - size_t height = - static_cast<size_t>(p_header.bmp_info_header.bmp_height < 0 ? -p_header.bmp_info_header.bmp_height : p_header.bmp_info_header.bmp_height); - size_t bits_per_pixel = - static_cast<size_t>(p_header.bmp_info_header.bmp_bit_count); + size_t width = (size_t)p_header.bmp_info_header.bmp_width; + size_t height = (size_t)p_header.bmp_info_header.bmp_height; + size_t bits_per_pixel = (size_t)p_header.bmp_info_header.bmp_bit_count; if (p_header.bmp_info_header.bmp_compression != 0) { err = FAILED; diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index 567485c2c7..f0103bb71d 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -750,7 +750,7 @@ void CSGBrushOperation::_add_poly_outline(const BuildPoly &p_poly, int p_from_po t2d.affine_invert(); - float max_angle; + float max_angle = 0; int next_point_angle = -1; for (int i = 0; i < vertex_process[to_point].size(); i++) { diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 07c33ed670..5864d02615 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -215,7 +215,7 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Box Shape Extents")); static const char *method[3] = { "set_width", "set_height", "set_depth" }; - float current; + float current = 0; switch (p_idx) { case 0: current = s->get_width(); break; case 1: current = s->get_height(); break; diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 714be16db7..d1ef08dc83 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -1573,7 +1573,7 @@ CSGBrush *CSGPolygon::_build_brush() { } CSGBrush *brush = memnew(CSGBrush); - int face_count; + int face_count = 0; switch (mode) { case MODE_DEPTH: face_count = triangles.size() * 2 / 3 + (final_polygon.size()) * 2; break; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index ff15aaa735..53e9773791 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -108,8 +108,8 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, uint32_t magic = f->get_32(); uint32_t hsize = f->get_32(); uint32_t flags = f->get_32(); - uint32_t width = f->get_32(); uint32_t height = f->get_32(); + uint32_t width = f->get_32(); uint32_t pitch = f->get_32(); /* uint32_t depth = */ f->get_32(); uint32_t mipmaps = f->get_32(); diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 616c305f25..796ced84f4 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -35,7 +35,7 @@ extern "C" { #endif -#ifdef _WIN32 +#if defined(_WIN32) || defined(__ANDROID__) #define GDCALLINGCONV #define GDAPI GDCALLINGCONV #elif defined(__APPLE__) @@ -47,7 +47,7 @@ extern "C" { #define GDCALLINGCONV __attribute__((sysv_abi)) #define GDAPI GDCALLINGCONV #endif -#else +#else // !_WIN32 && !__APPLE__ #define GDCALLINGCONV __attribute__((sysv_abi)) #define GDAPI GDCALLINGCONV #endif diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 0983c12619..8c6dace847 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -292,6 +292,7 @@ List<ClassAPI> generate_c_api_classes() { method_api.has_varargs = method_bind && method_bind->is_vararg(); // Method flags + method_api.is_virtual = false; if (method_info.flags) { const uint32_t flags = method_info.flags; method_api.is_editor = flags & METHOD_FLAG_EDITOR; diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 641e4021d8..37e72bf9f8 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1016,6 +1016,16 @@ NativeScriptLanguage::NativeScriptLanguage() { #ifdef DEBUG_ENABLED profiling = false; #endif + + _init_call_type = "nativescript_init"; + _init_call_name = "nativescript_init"; + _terminate_call_name = "nativescript_terminate"; + _noarg_call_type = "nativescript_no_arg"; + _frame_call_name = "nativescript_frame"; +#ifndef NO_THREADS + _thread_enter_call_name = "nativescript_thread_enter"; + _thread_exit_call_name = "nativescript_thread_exit"; +#endif } NativeScriptLanguage::~NativeScriptLanguage() { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index ade8ffd280..51370f5fbf 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -277,18 +277,14 @@ public: Map<String, Set<NativeScript *> > library_script_users; - const StringName _init_call_type = "nativescript_init"; - const StringName _init_call_name = "nativescript_init"; - - const StringName _terminate_call_name = "nativescript_terminate"; - - const StringName _noarg_call_type = "nativescript_no_arg"; - - const StringName _frame_call_name = "nativescript_frame"; - + StringName _init_call_type; + StringName _init_call_name; + StringName _terminate_call_name; + StringName _noarg_call_type; + StringName _frame_call_name; #ifndef NO_THREADS - const StringName _thread_enter_call_name = "nativescript_thread_enter"; - const StringName _thread_exit_call_name = "nativescript_thread_exit"; + StringName _thread_enter_call_name; + StringName _thread_exit_call_name; #endif NativeScriptLanguage(); @@ -372,11 +368,14 @@ inline NativeScriptDesc *NativeScript::get_script_desc() const { class NativeReloadNode : public Node { GDCLASS(NativeReloadNode, Node) - bool unloaded = false; + bool unloaded; public: static void _bind_methods(); void _notification(int p_what); + + NativeReloadNode() : + unloaded(false) {} }; class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index b935861652..8088dcf17d 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -155,6 +155,7 @@ String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const return err_text; } +#ifdef DEBUG_ENABLED static String _get_var_type(const Variant *p_type) { String basestr; @@ -164,7 +165,6 @@ static String _get_var_type(const Variant *p_type) { if (!bobj) { basestr = "null instance"; } else { -#ifdef DEBUG_ENABLED if (ObjectDB::instance_validate(bobj)) { if (bobj->get_script_instance()) basestr = bobj->get_class() + " (" + bobj->get_script_instance()->get_script()->get_path().get_file() + ")"; @@ -173,10 +173,6 @@ static String _get_var_type(const Variant *p_type) { } else { basestr = "previously freed instance"; } - -#else - basestr = "Object"; -#endif } } else { @@ -185,6 +181,7 @@ static String _get_var_type(const Variant *p_type) { return basestr; } +#endif #if defined(__GNUC__) #define OPCODES_TABLE \ @@ -676,6 +673,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE(OPCODE_SET_MEMBER) { CHECK_SPACE(3); +#ifdef DEBUG_ENABLED int indexname = _code_ptr[ip + 1]; GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count); const StringName *index = &_global_names_ptr[indexname]; @@ -683,7 +681,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a bool valid; bool ok = ClassDB::set_property(p_instance->owner, *index, *src, &valid); -#ifdef DEBUG_ENABLED if (!ok) { err_text = "Internal error setting property: " + String(*index); OPCODE_BREAK; @@ -699,13 +696,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE(OPCODE_GET_MEMBER) { CHECK_SPACE(3); +#ifdef DEBUG_ENABLED int indexname = _code_ptr[ip + 1]; GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count); const StringName *index = &_global_names_ptr[indexname]; GET_VARIANT_PTR(dst, 2); - bool ok = ClassDB::get_property(p_instance->owner, *index, *dst); -#ifdef DEBUG_ENABLED + bool ok = ClassDB::get_property(p_instance->owner, *index, *dst); if (!ok) { err_text = "Internal error getting property: " + String(*index); OPCODE_BREAK; @@ -752,13 +749,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE(OPCODE_ASSIGN_TYPED_BUILTIN) { CHECK_SPACE(4); - Variant::Type var_type = (Variant::Type)_code_ptr[ip + 1]; GET_VARIANT_PTR(dst, 2); GET_VARIANT_PTR(src, 3); +#ifdef DEBUG_ENABLED + Variant::Type var_type = (Variant::Type)_code_ptr[ip + 1]; GD_ERR_BREAK(var_type < 0 || var_type >= Variant::VARIANT_MAX); -#ifdef DEBUG_ENABLED if (src->get_type() != var_type) { if (Variant::can_convert_strict(src->get_type(), var_type)) { Variant::CallError ce; @@ -1282,10 +1279,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } #endif + Object *obj = argobj->operator Object *(); String signal = argname->operator String(); -#ifdef DEBUG_ENABLED +#ifdef DEBUG_ENABLED if (!obj) { err_text = "First argument of yield() is null."; OPCODE_BREAK; @@ -1302,13 +1300,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } -#endif Error err = obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); -#ifdef DEBUG_ENABLED if (err != OK) { err_text = "Error connecting to signal: " + signal + " during yield()."; OPCODE_BREAK; } +#else + obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); #endif } diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 2fa5084d84..a79fcccaeb 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -56,7 +56,9 @@ T *GDScriptParser::alloc_node() { return t; } +#ifdef DEBUG_ENABLED static String _find_function_name(const GDScriptParser::OperatorNode *p_call); +#endif // DEBUG_ENABLED bool GDScriptParser::_end_statement() { @@ -747,7 +749,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s while (!bfn && b) { if (b->variables.has(identifier)) { IdentifierNode *id = alloc_node<IdentifierNode>(); - LocalVarNode *lv = b->variables[identifier]; id->name = identifier; id->declared_block = b; id->line = id_line; @@ -755,6 +756,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s bfn = true; #ifdef DEBUG_ENABLED + LocalVarNode *lv = b->variables[identifier]; switch (tokenizer->get_token()) { case GDScriptTokenizer::TK_OP_ASSIGN_ADD: case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND: diff --git a/modules/mobile_vr/SCsub b/modules/mobile_vr/SCsub index e5725ceb6f..4bd184f025 100644 --- a/modules/mobile_vr/SCsub +++ b/modules/mobile_vr/SCsub @@ -6,5 +6,3 @@ Import('env_modules') env_mobile_vr = env_modules.Clone() env_mobile_vr.add_source_files(env.modules_sources, '*.cpp') - -SConscript("shaders/SCsub") diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index 2cabc7bd59..87e4ddd900 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -297,49 +297,6 @@ bool MobileVRInterface::initialize() { mag_current_min = Vector3(0, 0, 0); mag_current_max = Vector3(0, 0, 0); -#if !defined(SERVER_ENABLED) - // build our shader - if (lens_shader == NULL) { - ///@TODO need to switch between GLES2 and GLES3 version, Reduz suggested moving this into our drivers and making this a core shader - // create a shader - lens_shader = new LensDistortedShaderGLES3(); - - // create our shader stuff - lens_shader->init(); - - glGenBuffers(1, &half_screen_quad); - glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad); - { - /* clang-format off */ - const float qv[16] = { - 0, -1, - -1, -1, - 0, 1, - -1, 1, - 1, 1, - 1, 1, - 1, -1, - 1, -1, - }; - /* clang-format on */ - - glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW); - } - - glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind - - glGenVertexArrays(1, &half_screen_array); - glBindVertexArray(half_screen_array); - glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad); - glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0); - glEnableVertexAttribArray(0); - glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, ((uint8_t *)NULL) + 8); - glEnableVertexAttribArray(4); - glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind - } -#endif - // reset our orientation orientation = Basis(); @@ -362,17 +319,6 @@ void MobileVRInterface::uninitialize() { arvr_server->clear_primary_interface_if(this); } -#if !defined(SERVER_ENABLED) - // cleanup our shader and buffers - if (lens_shader != NULL) { - glDeleteVertexArrays(1, &half_screen_array); - glDeleteBuffers(1, &half_screen_quad); - - delete lens_shader; - lens_shader = NULL; - } -#endif - initialized = false; }; }; @@ -448,48 +394,29 @@ void MobileVRInterface::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_t // We must have a valid render target ERR_FAIL_COND(!p_render_target.is_valid()); - // We must have an initialised shader - ERR_FAIL_COND(lens_shader != NULL); - // Because we are rendering to our device we must use our main viewport! ERR_FAIL_COND(p_screen_rect == Rect2()); - float offset_x = 0.0; - float aspect_ratio = 0.5 * p_screen_rect.size.x / p_screen_rect.size.y; + Rect2 dest = p_screen_rect; Vector2 eye_center; + // we output half a screen + dest.size.x *= 0.5; + if (p_eye == ARVRInterface::EYE_LEFT) { - offset_x = -1.0; eye_center.x = ((-intraocular_dist / 2.0) + (display_width / 4.0)) / (display_width / 2.0); } else if (p_eye == ARVRInterface::EYE_RIGHT) { + dest.position.x = dest.size.x; eye_center.x = ((intraocular_dist / 2.0) - (display_width / 4.0)) / (display_width / 2.0); } + // we don't offset the eye center vertically (yet) + eye_center.y = 0.0; // unset our render target so we are outputting to our main screen by making RasterizerStorageGLES3::system_fbo our current FBO VSG::rasterizer->set_current_render_target(RID()); - // now output to screen - // VSG::rasterizer->blit_render_target_to_screen(p_render_target, screen_rect, 0); - - // get our render target - RID eye_texture = VSG::storage->render_target_get_texture(p_render_target); - uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture); -#if !defined(SERVER_ENABLED) - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texid); - - lens_shader->bind(); - lens_shader->set_uniform(LensDistortedShaderGLES3::OFFSET_X, offset_x); - lens_shader->set_uniform(LensDistortedShaderGLES3::K1, k1); - lens_shader->set_uniform(LensDistortedShaderGLES3::K2, k2); - lens_shader->set_uniform(LensDistortedShaderGLES3::EYE_CENTER, eye_center); - lens_shader->set_uniform(LensDistortedShaderGLES3::UPSCALE, oversample); - lens_shader->set_uniform(LensDistortedShaderGLES3::ASPECT_RATIO, aspect_ratio); - - glBindVertexArray(half_screen_array); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glBindVertexArray(0); -#endif + // and output + VSG::rasterizer->output_lens_distorted_to_screen(p_render_target, dest, k1, k2, eye_center, oversample); }; void MobileVRInterface::process() { @@ -512,8 +439,6 @@ MobileVRInterface::MobileVRInterface() { k1 = 0.215; k2 = 0.215; last_ticks = 0; - - lens_shader = NULL; }; MobileVRInterface::~MobileVRInterface() { diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h index 63cad4c738..05b6331f94 100644 --- a/modules/mobile_vr/mobile_vr_interface.h +++ b/modules/mobile_vr/mobile_vr_interface.h @@ -34,10 +34,6 @@ #include "servers/arvr/arvr_interface.h" #include "servers/arvr/arvr_positional_tracker.h" -#if !defined(SERVER_ENABLED) -#include "shaders/lens_distorted.glsl.gen.h" -#endif - /** @author Bastiaan Olij <mux213@gmail.com> @@ -60,14 +56,6 @@ private: float eye_height; uint64_t last_ticks; -#if !defined(SERVER_ENABLED) - LensDistortedShaderGLES3 *lens_shader; - GLuint half_screen_quad; - GLuint half_screen_array; -#else - void *lens_shader; -#endif - real_t intraocular_dist; real_t display_width; real_t display_to_lens; diff --git a/modules/mobile_vr/shaders/SCsub b/modules/mobile_vr/shaders/SCsub deleted file mode 100644 index 97a3598598..0000000000 --- a/modules/mobile_vr/shaders/SCsub +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -Import('env') - -if 'GLES3_GLSL' in env['BUILDERS']: - env.GLES3_GLSL('lens_distorted.glsl'); diff --git a/modules/mobile_vr/shaders/lens_distorted.glsl b/modules/mobile_vr/shaders/lens_distorted.glsl deleted file mode 100644 index 92604c891c..0000000000 --- a/modules/mobile_vr/shaders/lens_distorted.glsl +++ /dev/null @@ -1,62 +0,0 @@ -/* clang-format off */ -[vertex] - -layout(location = 0) in highp vec4 vertex_attrib; -/* clang-format on */ -layout(location = 4) in vec2 uv_in; - -uniform float offset_x; - -out vec2 uv_interp; - -void main() { - - uv_interp = uv_in; - gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0); -} - -/* clang-format off */ -[fragment] - -uniform sampler2D source; //texunit:0 -/* clang-format on */ - -uniform vec2 eye_center; -uniform float k1; -uniform float k2; -uniform float upscale; -uniform float aspect_ratio; - -in vec2 uv_interp; - -layout(location = 0) out vec4 frag_color; - -void main() { - vec2 coords = uv_interp; - vec2 offset = coords - eye_center; - - // take aspect ratio into account - offset.y /= aspect_ratio; - - // distort - vec2 offset_sq = offset * offset; - float radius_sq = offset_sq.x + offset_sq.y; - float radius_s4 = radius_sq * radius_sq; - float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4); - offset *= distortion_scale; - - // reapply aspect ratio - offset.y *= aspect_ratio; - - // add our eye center back in - coords = offset + eye_center; - coords /= upscale; - - // and check our color - if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) { - frag_color = vec4(0.0, 0.0, 0.0, 1.0); - } else { - coords = (coords + vec2(1.0)) / vec2(2.0); - frag_color = textureLod(source, coords, 0.0); - } -} diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 308c54ecb3..2c3435fc1c 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2244,8 +2244,8 @@ void BindingsGenerator::_populate_global_constants() { String constant_name = GlobalConstants::get_global_constant_name(i); const DocData::ConstantDoc *const_doc = NULL; - for (int i = 0; i < global_scope_doc.constants.size(); i++) { - const DocData::ConstantDoc &curr_const_doc = global_scope_doc.constants[i]; + for (int j = 0; j < global_scope_doc.constants.size(); j++) { + const DocData::ConstantDoc &curr_const_doc = global_scope_doc.constants[j]; if (curr_const_doc.name == constant_name) { const_doc = &curr_const_doc; diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp index ecc3e4c59e..8d9b345a92 100644 --- a/modules/mono/editor/mono_bottom_panel.cpp +++ b/modules/mono/editor/mono_bottom_panel.cpp @@ -475,14 +475,14 @@ void MonoBuildTab::_bind_methods() { } MonoBuildTab::MonoBuildTab(const MonoBuildInfo &p_build_info, const String &p_logs_dir) : - build_info(p_build_info), - logs_dir(p_logs_dir), build_exited(false), issues_list(memnew(ItemList)), error_count(0), warning_count(0), errors_visible(true), - warnings_visible(true) { + warnings_visible(true), + logs_dir(p_logs_dir), + build_info(p_build_info) { issues_list->set_v_size_flags(SIZE_EXPAND_FILL); issues_list->connect("item_activated", this, "_issue_activated"); add_child(issues_list); diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp index 8116df5f51..6bb6efa92a 100644 --- a/modules/mono/utils/mono_reg_utils.cpp +++ b/modules/mono/utils/mono_reg_utils.cpp @@ -228,4 +228,4 @@ cleanup: } } // namespace MonoRegUtils -#endif WINDOWS_ENABLED +#endif // WINDOWS_ENABLED diff --git a/modules/mono/utils/thread_local.h b/modules/mono/utils/thread_local.h index 84dae1d86b..d7d98c47e2 100644 --- a/modules/mono/utils/thread_local.h +++ b/modules/mono/utils/thread_local.h @@ -108,17 +108,23 @@ class ThreadLocal { return data; } + void _initialize(const T &p_init_val) { + init_val = p_init_val; + storage.alloc(&destr_callback); + } + public: - ThreadLocal() : - ThreadLocal(T()) {} + ThreadLocal() { + _initialize(T()); + } - ThreadLocal(const T &p_init_val) : - init_val(p_init_val) { - storage.alloc(&destr_callback); + ThreadLocal(const T &p_init_val) { + _initialize(p_init_val); } - ThreadLocal(const ThreadLocal &other) : - ThreadLocal(*other._tls_get_value()) {} + ThreadLocal(const ThreadLocal &other) { + _initialize(*other._tls_get_value()); + } ~ThreadLocal() { storage.free(); diff --git a/modules/opensimplex/config.py b/modules/opensimplex/config.py index c91c9e5c80..c1010ad433 100644 --- a/modules/opensimplex/config.py +++ b/modules/opensimplex/config.py @@ -7,7 +7,7 @@ def configure(env): def get_doc_classes(): return [ "NoiseTexture", - "SimplexNoise" + "OpenSimplexNoise" ] def get_doc_path(): diff --git a/modules/opensimplex/doc_classes/NoiseTexture.xml b/modules/opensimplex/doc_classes/NoiseTexture.xml index 6af58e7a6b..9642865c43 100644 --- a/modules/opensimplex/doc_classes/NoiseTexture.xml +++ b/modules/opensimplex/doc_classes/NoiseTexture.xml @@ -41,8 +41,11 @@ <member name="seamless" type="bool" setter="set_seamless" getter="get_seamless"> Whether the texture can be tiled without visible seams or not. Seamless textures take longer to generate. </member> - <member name="size" type="Vector2" setter="set_size" getter="get_size"> - Size of the generated texture. + <member name="width" type="int" setter="set_width" getter="get_width"> + Width of the generated texture. + </member> + <member name="height" type="int" setter="set_height" getter="get_height"> + Height of the generated texture. </member> </members> <constants> diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 6f2723e43b..be522a9ab1 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -58,7 +58,6 @@ void NoiseTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_width", "width"), &NoiseTexture::set_width); ClassDB::bind_method(D_METHOD("set_height", "height"), &NoiseTexture::set_height); - ClassDB::bind_method(D_METHOD("set_size", "size"), &NoiseTexture::set_size); ClassDB::bind_method(D_METHOD("set_noise", "noise"), &NoiseTexture::set_noise); ClassDB::bind_method(D_METHOD("get_noise"), &NoiseTexture::get_noise); @@ -73,7 +72,8 @@ void NoiseTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("_generate_texture"), &NoiseTexture::_generate_texture); ClassDB::bind_method(D_METHOD("_thread_done", "image"), &NoiseTexture::_thread_done); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_width", "get_width"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "height", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "seamless"), "set_seamless", "get_seamless"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise"); @@ -208,17 +208,6 @@ bool NoiseTexture::is_normalmap() { return as_normalmap; } -void NoiseTexture::set_size(Vector2 p_size) { - if (p_size == size) return; - size = p_size; - _queue_update(); -} - -Vector2 NoiseTexture::get_size() { - - return size; -} - int NoiseTexture::get_width() const { return size.x; diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h index 78a02cda9f..2a4c32d633 100644 --- a/modules/opensimplex/noise_texture.h +++ b/modules/opensimplex/noise_texture.h @@ -83,9 +83,6 @@ public: void set_as_normalmap(bool p_seamless); bool is_normalmap(); - void set_size(Vector2 p_size); - Vector2 get_size(); - int get_width() const; int get_height() const; |