summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/dds/texture_loader_dds.cpp2
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp11
-rw-r--r--modules/enet/networked_multiplayer_enet.h3
-rw-r--r--modules/etc/SCsub37
-rw-r--r--modules/etc/config.py (renamed from modules/etc1/config.py)0
-rw-r--r--modules/etc/image_etc.cpp199
-rw-r--r--modules/etc/image_etc.h (renamed from modules/etc1/image_etc.h)2
-rw-r--r--modules/etc/register_types.cpp (renamed from modules/etc1/register_types.cpp)6
-rw-r--r--modules/etc/register_types.h (renamed from modules/etc1/register_types.h)4
-rw-r--r--modules/etc/texture_loader_pkm.cpp (renamed from modules/etc1/texture_loader_pkm.cpp)0
-rw-r--r--modules/etc/texture_loader_pkm.h (renamed from modules/etc1/texture_loader_pkm.h)0
-rw-r--r--modules/etc1/SCsub20
-rw-r--r--modules/etc1/image_etc.cpp183
-rw-r--r--modules/gdnative/gdnative.cpp6
-rw-r--r--modules/gdnative/godot.h7
-rw-r--r--modules/gdnative/godot/godot_array.cpp256
-rw-r--r--modules/gdnative/godot/godot_array.h71
-rw-r--r--modules/gdnative/godot/godot_color.cpp57
-rw-r--r--modules/gdnative/godot/godot_color.h16
-rw-r--r--modules/gdnative/godot/godot_dictionary.cpp31
-rw-r--r--modules/gdnative/godot/godot_dictionary.h8
-rw-r--r--modules/gdnative/godot/godot_node_path.cpp6
-rw-r--r--modules/gdnative/godot/godot_node_path.h1
-rw-r--r--modules/gdnative/godot/godot_pool_arrays.cpp602
-rw-r--r--modules/gdnative/godot/godot_pool_arrays.h189
-rw-r--r--modules/gdnative/godot/godot_quat.cpp40
-rw-r--r--modules/gdnative/godot/godot_quat.h12
-rw-r--r--modules/gdnative/godot/godot_rect2.cpp16
-rw-r--r--modules/gdnative/godot/godot_rect2.h6
-rw-r--r--modules/gdnative/godot/godot_rect3.cpp28
-rw-r--r--modules/gdnative/godot/godot_rect3.h6
-rw-r--r--modules/gdnative/godot/godot_string.cpp98
-rw-r--r--modules/gdnative/godot/godot_string.h25
-rw-r--r--modules/gdnative/godot/godot_transform.cpp26
-rw-r--r--modules/gdnative/godot/godot_transform.h6
-rw-r--r--modules/gdnative/godot/godot_variant.cpp4
-rw-r--r--modules/gdnative/godot/godot_variant.h3
-rw-r--r--modules/gdscript/gd_compiler.cpp2
-rw-r--r--modules/gdscript/gd_editor.cpp13
-rw-r--r--modules/gdscript/gd_function.cpp6
-rw-r--r--modules/gdscript/gd_parser.cpp6
-rw-r--r--modules/gdscript/gd_parser.h2
-rw-r--r--modules/gdscript/gd_script.cpp6
-rw-r--r--modules/gdscript/gd_script.h2
-rw-r--r--modules/gdscript/gd_tokenizer.cpp2
-rw-r--r--modules/gdscript/gd_tokenizer.h1
-rw-r--r--modules/gridmap/grid_map.cpp16
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp8
-rw-r--r--modules/hdr/SCsub9
-rw-r--r--modules/hdr/config.py7
-rw-r--r--modules/hdr/image_loader_hdr.cpp161
-rw-r--r--modules/hdr/image_loader_hdr.h46
-rw-r--r--modules/hdr/register_types.cpp45
-rw-r--r--modules/hdr/register_types.h31
-rw-r--r--modules/jpg/image_loader_jpegd.cpp2
-rw-r--r--modules/jpg/image_loader_jpegd.h2
-rw-r--r--modules/squish/image_compress_squish.cpp154
-rw-r--r--modules/squish/image_compress_squish.h3
-rw-r--r--modules/squish/register_types.cpp1
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h2
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.cpp4
-rw-r--r--modules/tga/SCsub9
-rw-r--r--modules/tga/config.py7
-rw-r--r--modules/tga/image_loader_tga.cpp314
-rw-r--r--modules/tga/image_loader_tga.h83
-rw-r--r--modules/tga/register_types.cpp45
-rw-r--r--modules/tga/register_types.h31
-rw-r--r--modules/tinyexr/SCsub20
-rw-r--r--modules/tinyexr/config.py7
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp168
-rw-r--r--modules/tinyexr/image_loader_tinyexr.h46
-rw-r--r--modules/tinyexr/register_types.cpp45
-rw-r--r--modules/tinyexr/register_types.h31
-rw-r--r--modules/visual_script/visual_script.cpp11
-rw-r--r--modules/visual_script/visual_script.h2
-rw-r--r--modules/visual_script/visual_script_editor.cpp6
-rw-r--r--modules/visual_script/visual_script_editor.h1
-rw-r--r--modules/webp/image_loader_webp.cpp2
-rw-r--r--modules/webp/image_loader_webp.h2
79 files changed, 2445 insertions, 903 deletions
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 4448c80387..71593ebfa9 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -76,8 +76,6 @@ static const DDSFormatInfo dds_format_info[DDS_MAX] = {
{ "DXT1", true, false, 4, 8, Image::FORMAT_DXT1 },
{ "DXT3", true, false, 4, 16, Image::FORMAT_DXT3 },
{ "DXT5", true, false, 4, 16, Image::FORMAT_DXT5 },
- { "ATI1", true, false, 4, 8, Image::FORMAT_ATI1 },
- { "ATI2", true, false, 4, 16, Image::FORMAT_ATI2 },
{ "BGRA8", false, false, 1, 4, Image::FORMAT_RGBA8 },
{ "BGR8", false, false, 1, 3, Image::FORMAT_RGB8 },
{ "RGBA8", false, false, 1, 4, Image::FORMAT_RGBA8 },
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index c05c86d9ae..738bd27ed3 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -575,6 +575,9 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
case COMPRESS_ZLIB: {
mode = Compression::MODE_DEFLATE;
} break;
+ case COMPRESS_ZSTD: {
+ mode = Compression::MODE_ZSTD;
+ } break;
default: { ERR_FAIL_V(0); }
}
@@ -608,6 +611,10 @@ size_t NetworkedMultiplayerENet::enet_decompress(void *context, const enet_uint8
ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_DEFLATE);
} break;
+ case COMPRESS_ZSTD: {
+
+ ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_ZSTD);
+ } break;
default: {}
}
if (ret < 0) {
@@ -629,7 +636,8 @@ void NetworkedMultiplayerENet::_setup_compressor() {
enet_host_compress_with_range_coder(host);
} break;
case COMPRESS_FASTLZ:
- case COMPRESS_ZLIB: {
+ case COMPRESS_ZLIB:
+ case COMPRESS_ZSTD: {
enet_host_compress(host, &enet_compressor);
} break;
@@ -654,6 +662,7 @@ void NetworkedMultiplayerENet::_bind_methods() {
BIND_CONSTANT(COMPRESS_RANGE_CODER);
BIND_CONSTANT(COMPRESS_FASTLZ);
BIND_CONSTANT(COMPRESS_ZLIB);
+ BIND_CONSTANT(COMPRESS_ZSTD);
}
NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index c20c1af68e..8b971adf55 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -43,7 +43,8 @@ public:
COMPRESS_NONE,
COMPRESS_RANGE_CODER,
COMPRESS_FASTLZ,
- COMPRESS_ZLIB
+ COMPRESS_ZLIB,
+ COMPRESS_ZSTD
};
private:
diff --git a/modules/etc/SCsub b/modules/etc/SCsub
new file mode 100644
index 0000000000..8f5937017e
--- /dev/null
+++ b/modules/etc/SCsub
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_etc = env_modules.Clone()
+
+# Thirdparty source files
+# Not unbundled so far since not widespread as shared library
+thirdparty_dir = "#thirdparty/etc2comp/"
+thirdparty_sources = [
+ "EtcBlock4x4.cpp",
+ "EtcBlock4x4Encoding.cpp",
+ "EtcBlock4x4Encoding_ETC1.cpp",
+ "EtcBlock4x4Encoding_R11.cpp",
+ "EtcBlock4x4Encoding_RG11.cpp",
+ "EtcBlock4x4Encoding_RGB8A1.cpp",
+ "EtcBlock4x4Encoding_RGB8.cpp",
+ "EtcBlock4x4Encoding_RGBA8.cpp",
+ "Etc.cpp",
+ "EtcDifferentialTrys.cpp",
+ "EtcFilter.cpp",
+ "EtcImage.cpp",
+ "EtcIndividualTrys.cpp",
+ "EtcMath.cpp",
+ "EtcSortedBlockList.cpp",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env_etc.add_source_files(env.modules_sources, thirdparty_sources)
+env_etc.Append(CPPPATH=[thirdparty_dir])
+
+# Godot source files
+env_etc.add_source_files(env.modules_sources, "*.cpp")
+
+# upstream uses c++11
+env_etc.Append(CXXFLAGS="-std=gnu++11")
diff --git a/modules/etc1/config.py b/modules/etc/config.py
index fb920482f5..fb920482f5 100644
--- a/modules/etc1/config.py
+++ b/modules/etc/config.py
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
new file mode 100644
index 0000000000..d9daffc59e
--- /dev/null
+++ b/modules/etc/image_etc.cpp
@@ -0,0 +1,199 @@
+/*************************************************************************/
+/* image_etc.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "image_etc.h"
+#include "Etc.h"
+#include "EtcFilter.h"
+#include "image.h"
+#include "os/copymem.h"
+#include "os/os.h"
+#include "print_string.h"
+
+static Image::Format _get_etc2_mode(Image::DetectChannels format) {
+ switch (format) {
+ case Image::DETECTED_L:
+ case Image::DETECTED_R:
+ return Image::FORMAT_ETC2_R11;
+
+ case Image::DETECTED_RG:
+ return Image::FORMAT_ETC2_RG11;
+
+ case Image::DETECTED_RGB:
+ return Image::FORMAT_ETC2_RGB8;
+
+ case Image::DETECTED_RGBA:
+ return Image::FORMAT_ETC2_RGBA8;
+
+ // TODO: would be nice if we could use FORMAT_ETC2_RGB8A1 for FORMAT_RGBA5551
+ }
+
+ ERR_FAIL_COND_V(true, Image::FORMAT_MAX);
+}
+
+static Etc::Image::Format _image_format_to_etc2comp_format(Image::Format format) {
+ switch (format) {
+ case Image::FORMAT_ETC:
+ return Etc::Image::Format::ETC1;
+
+ case Image::FORMAT_ETC2_R11:
+ return Etc::Image::Format::R11;
+
+ case Image::FORMAT_ETC2_R11S:
+ return Etc::Image::Format::SIGNED_R11;
+
+ case Image::FORMAT_ETC2_RG11:
+ return Etc::Image::Format::RG11;
+
+ case Image::FORMAT_ETC2_RG11S:
+ return Etc::Image::Format::SIGNED_RG11;
+
+ case Image::FORMAT_ETC2_RGB8:
+ return Etc::Image::Format::RGB8;
+
+ case Image::FORMAT_ETC2_RGBA8:
+ return Etc::Image::Format::RGBA8;
+
+ case Image::FORMAT_ETC2_RGB8A1:
+ return Etc::Image::Format::RGB8A1;
+ }
+
+ ERR_FAIL_COND_V(true, Etc::Image::Format::UNKNOWN);
+}
+
+static void _decompress_etc1(Image *p_img) {
+ // not implemented, to be removed
+}
+
+static void _decompress_etc2(Image *p_img) {
+ // not implemented, to be removed
+}
+
+static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_format, Image::CompressSource p_source) {
+ Image::Format img_format = p_img->get_format();
+ Image::DetectChannels detected_channels = p_img->get_detected_channels();
+
+ if (p_source == Image::COMPRESS_SOURCE_SRGB && (detected_channels == Image::DETECTED_R || detected_channels == Image::DETECTED_RG)) {
+ //R and RG do not support SRGB
+ detected_channels = Image::DETECTED_RGB;
+ }
+
+ if (p_source == Image::COMPRESS_SOURCE_NORMAL) {
+ //use RG channels only for normal
+ detected_channels = Image::DETECTED_RG;
+ }
+
+ if (img_format >= Image::FORMAT_DXT1) {
+ return; //do not compress, already compressed
+ }
+
+ if (img_format > Image::FORMAT_RGBA8) {
+ // TODO: we should be able to handle FORMAT_RGBA4444 and FORMAT_RGBA5551 eventually
+ return;
+ }
+
+ int imgw = p_img->get_width(), imgh = p_img->get_height();
+ ERR_FAIL_COND(nearest_power_of_2(imgw) != imgw || nearest_power_of_2(imgh) != imgh);
+
+ Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels);
+
+ Ref<Image> img = p_img->duplicate();
+
+ if (img->get_format() != Image::FORMAT_RGBA8)
+ img->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert
+
+ PoolVector<uint8_t>::Read r = img->get_data().read();
+
+ int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps() ? -1 : 0);
+ int mmc = p_img->has_mipmaps() ? Image::get_image_required_mipmaps(imgw, imgh, etc_format) : 0;
+
+ PoolVector<uint8_t> dst_data;
+ dst_data.resize(target_size);
+
+ PoolVector<uint8_t>::Write w = dst_data.write();
+
+ // prepare parameters to be passed to etc2comp
+ int num_cpus = OS::get_singleton()->get_processor_count();
+ int encoding_time = 0;
+ float effort = 0.0; //default, reasonable time
+
+ if (p_lossy_quality > 0.75)
+ effort = 0.4;
+ else if (p_lossy_quality > 0.85)
+ effort = 0.6;
+ else if (p_lossy_quality > 0.95)
+ effort = 0.8;
+
+ Etc::ErrorMetric error_metric = Etc::ErrorMetric::RGBX; // NOTE: we can experiment with other error metrics
+ Etc::Image::Format etc2comp_etc_format = _image_format_to_etc2comp_format(etc_format);
+
+ int wofs = 0;
+ for (int i = 0; i < mmc + 1; i++) {
+ // convert source image to internal etc2comp format (which is equivalent to Image::FORMAT_RGBAF)
+ // NOTE: We can alternatively add a case to Image::convert to handle Image::FORMAT_RGBAF conversion.
+ int mipmap_ofs = 0, mipmap_size = 0, mipmap_w = 0, mipmap_h = 0;
+ img->get_mipmap_offset_size_and_dimensions(i, mipmap_ofs, mipmap_size, mipmap_w, mipmap_h);
+ const uint8_t *src = &r[mipmap_ofs];
+
+ Etc::ColorFloatRGBA *src_rgba_f = new Etc::ColorFloatRGBA[mipmap_w * mipmap_h];
+ for (int i = 0; i < mipmap_w * mipmap_h; i++) {
+ int si = i * 4; // RGBA8
+ src_rgba_f[i] = Etc::ColorFloatRGBA::ConvertFromRGBA8(src[si], src[si + 1], src[si + 2], src[si + 3]);
+ }
+
+ unsigned char *etc_data = NULL;
+ unsigned int etc_data_len = 0;
+ unsigned int extended_width = 0, extended_height = 0;
+ Etc::Encode((float *)src_rgba_f, mipmap_w, mipmap_h, etc2comp_etc_format, error_metric, effort, num_cpus, num_cpus, &etc_data, &etc_data_len, &extended_width, &extended_height, &encoding_time);
+
+ memcpy(&w[wofs], etc_data, etc_data_len);
+ wofs += etc_data_len;
+
+ delete[] etc_data;
+ delete[] src_rgba_f;
+ }
+
+ p_img->create(imgw, imgh, mmc > 1 ? true : false, etc_format, dst_data);
+}
+
+static void _compress_etc1(Image *p_img, float p_lossy_quality) {
+ _compress_etc(p_img, p_lossy_quality, true, Image::COMPRESS_SOURCE_GENERIC);
+}
+
+static void _compress_etc2(Image *p_img, float p_lossy_quality, Image::CompressSource p_source) {
+ _compress_etc(p_img, p_lossy_quality, false, p_source);
+}
+
+void _register_etc_compress_func() {
+
+ Image::_image_compress_etc1_func = _compress_etc1;
+ //Image::_image_decompress_etc1 = _decompress_etc1;
+
+ Image::_image_compress_etc2_func = _compress_etc2;
+ //Image::_image_decompress_etc2 = _decompress_etc2;
+}
diff --git a/modules/etc1/image_etc.h b/modules/etc/image_etc.h
index 69e082bb87..3cbadef6fa 100644
--- a/modules/etc1/image_etc.h
+++ b/modules/etc/image_etc.h
@@ -30,6 +30,6 @@
#ifndef IMAGE_ETC1_H
#define IMAGE_ETC1_H
-void _register_etc1_compress_func();
+void _register_etc_compress_func();
#endif // IMAGE_ETC_H
diff --git a/modules/etc1/register_types.cpp b/modules/etc/register_types.cpp
index 859486222f..e777859a8f 100644
--- a/modules/etc1/register_types.cpp
+++ b/modules/etc/register_types.cpp
@@ -34,15 +34,15 @@
static ResourceFormatPKM *resource_loader_pkm = NULL;
-void register_etc1_types() {
+void register_etc_types() {
resource_loader_pkm = memnew(ResourceFormatPKM);
ResourceLoader::add_resource_format_loader(resource_loader_pkm);
- _register_etc1_compress_func();
+ _register_etc_compress_func();
}
-void unregister_etc1_types() {
+void unregister_etc_types() {
memdelete(resource_loader_pkm);
}
diff --git a/modules/etc1/register_types.h b/modules/etc/register_types.h
index 0552b87d65..44399376f3 100644
--- a/modules/etc1/register_types.h
+++ b/modules/etc/register_types.h
@@ -27,5 +27,5 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-void register_etc1_types();
-void unregister_etc1_types();
+void register_etc_types();
+void unregister_etc_types();
diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp
index c04528d2a0..c04528d2a0 100644
--- a/modules/etc1/texture_loader_pkm.cpp
+++ b/modules/etc/texture_loader_pkm.cpp
diff --git a/modules/etc1/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h
index 8a0f06a51a..8a0f06a51a 100644
--- a/modules/etc1/texture_loader_pkm.h
+++ b/modules/etc/texture_loader_pkm.h
diff --git a/modules/etc1/SCsub b/modules/etc1/SCsub
deleted file mode 100644
index 0c5dc66d2e..0000000000
--- a/modules/etc1/SCsub
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-Import('env_modules')
-
-env_etc1 = env_modules.Clone()
-
-# Thirdparty source files
-# Not unbundled so far since not widespread as shared library
-thirdparty_dir = "#thirdparty/rg-etc1/"
-thirdparty_sources = [
- "rg_etc1.cpp",
-]
-thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-
-env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
-env_etc1.Append(CPPPATH=[thirdparty_dir])
-
-# Godot source files
-env_etc1.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp
deleted file mode 100644
index 121f50684d..0000000000
--- a/modules/etc1/image_etc.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*************************************************************************/
-/* image_etc.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "image_etc.h"
-#include "image.h"
-#include "os/copymem.h"
-#include "print_string.h"
-#include "rg_etc1.h"
-static void _decompress_etc(Image *p_img) {
-
- ERR_FAIL_COND(p_img->get_format() != Image::FORMAT_ETC);
-
- int imgw = p_img->get_width();
- int imgh = p_img->get_height();
- PoolVector<uint8_t> src = p_img->get_data();
- PoolVector<uint8_t> dst;
-
- PoolVector<uint8_t>::Read r = src.read();
-
- int mmc = p_img->get_mipmap_count();
-
- for (int i = 0; i <= mmc; i++) {
-
- dst.resize(dst.size() + imgw * imgh * 3);
- const uint8_t *srcbr = &r[p_img->get_mipmap_offset(i)];
- PoolVector<uint8_t>::Write w = dst.write();
-
- uint8_t *wptr = &w[dst.size() - imgw * imgh * 3];
-
- int bw = MAX(imgw / 4, 1);
- int bh = MAX(imgh / 4, 1);
-
- for (int y = 0; y < bh; y++) {
-
- for (int x = 0; x < bw; x++) {
-
- uint8_t block[4 * 4 * 4];
-
- rg_etc1::unpack_etc1_block(srcbr, (unsigned int *)block);
- srcbr += 8;
-
- int maxx = MIN(imgw, 4);
- int maxy = MIN(imgh, 4);
-
- for (int yy = 0; yy < maxy; yy++) {
-
- for (int xx = 0; xx < maxx; xx++) {
-
- uint32_t src_ofs = (yy * 4 + xx) * 4;
- uint32_t dst_ofs = ((y * 4 + yy) * imgw + x * 4 + xx) * 3;
- wptr[dst_ofs + 0] = block[src_ofs + 0];
- wptr[dst_ofs + 1] = block[src_ofs + 1];
- wptr[dst_ofs + 2] = block[src_ofs + 2];
- }
- }
- }
- }
-
- imgw = MAX(1, imgw / 2);
- imgh = MAX(1, imgh / 2);
- }
-
- r = PoolVector<uint8_t>::Read();
- //print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps()));
- bool needs_mipmaps = p_img->has_mipmaps();
- p_img->create(p_img->get_width(), p_img->get_height(), p_img->has_mipmaps(), Image::FORMAT_RGB8, dst);
- if (needs_mipmaps)
- p_img->generate_mipmaps();
-}
-
-static void _compress_etc(Image *p_img) {
-
- Ref<Image> img = p_img->duplicate();
-
- int imgw = img->get_width(), imgh = img->get_height();
-
- ERR_FAIL_COND(nearest_power_of_2(imgw) != imgw || nearest_power_of_2(imgh) != imgh);
-
- if (img->get_format() != Image::FORMAT_RGB8)
- img->convert(Image::FORMAT_RGB8);
-
- PoolVector<uint8_t> res_data;
- PoolVector<uint8_t> dst_data;
- PoolVector<uint8_t>::Read r = img->get_data().read();
-
- int target_size = Image::get_image_data_size(p_img->get_width(), p_img->get_height(), Image::FORMAT_ETC, p_img->has_mipmaps() ? -1 : 0);
- int mmc = p_img->has_mipmaps() ? Image::get_image_required_mipmaps(p_img->get_width(), p_img->get_height(), Image::FORMAT_ETC) : 0;
-
- dst_data.resize(target_size);
- int mc = 0;
- int ofs = 0;
- PoolVector<uint8_t>::Write w = dst_data.write();
-
- rg_etc1::etc1_pack_params pp;
- pp.m_quality = rg_etc1::cLowQuality;
- for (int i = 0; i <= mmc; i++) {
-
- int bw = MAX(imgw / 4, 1);
- int bh = MAX(imgh / 4, 1);
- const uint8_t *src = &r[img->get_mipmap_offset(i)];
- int mmsize = MAX(bw, 1) * MAX(bh, 1) * 8;
-
- uint8_t *dst = &w[ofs];
- ofs += mmsize;
-
- //print_line("bh: "+itos(bh)+" bw: "+itos(bw));
-
- for (int y = 0; y < bh; y++) {
-
- for (int x = 0; x < bw; x++) {
-
- //print_line("x: "+itos(x)+" y: "+itos(y));
-
- uint8_t block[4 * 4 * 4];
- zeromem(block, 4 * 4 * 4);
- uint8_t cblock[8];
-
- int maxy = MIN(imgh, 4);
- int maxx = MIN(imgw, 4);
-
- for (int yy = 0; yy < maxy; yy++) {
-
- for (int xx = 0; xx < maxx; xx++) {
-
- uint32_t dst_ofs = (yy * 4 + xx) * 4;
- uint32_t src_ofs = ((y * 4 + yy) * imgw + x * 4 + xx) * 3;
- block[dst_ofs + 0] = src[src_ofs + 0];
- block[dst_ofs + 1] = src[src_ofs + 1];
- block[dst_ofs + 2] = src[src_ofs + 2];
- block[dst_ofs + 3] = 255;
- }
- }
-
- rg_etc1::pack_etc1_block(cblock, (const unsigned int *)block, pp);
- for (int j = 0; j < 8; j++) {
-
- dst[j] = cblock[j];
- }
-
- dst += 8;
- }
- }
-
- imgw = MAX(1, imgw / 2);
- imgh = MAX(1, imgh / 2);
- mc++;
- }
-
- p_img->create(p_img->get_width(), p_img->get_height(), (mc - 1) ? true : false, Image::FORMAT_ETC, dst_data);
-}
-
-void _register_etc1_compress_func() {
-
- rg_etc1::pack_etc1_block_init();
- Image::_image_compress_etc_func = _compress_etc;
- Image::_image_decompress_etc = _decompress_etc;
-}
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 9c8625c1e0..706b81f7a3 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -516,9 +516,9 @@ static const char *_dl_platforms_info[] = {
"unix|server|so|Server",
"unix|android|so|Android",
"unix|haiku|so|Haiku", // Right?
- "|mac|dynlib|Mac",
- "mac|ios|dynlib|iOS",
- "mac|osx|dynlib|OSX",
+ "|mac|dylib|Mac",
+ "mac|ios|dylib|iOS",
+ "mac|osx|dylib|OSX",
"|html5|js|HTML5",
"|windows|dll|Windows",
"windows|uwp|dll|UWP",
diff --git a/modules/gdnative/godot.h b/modules/gdnative/godot.h
index 726bde0b65..1d86998291 100644
--- a/modules/gdnative/godot.h
+++ b/modules/gdnative/godot.h
@@ -60,6 +60,13 @@ extern "C" {
#define GDAPI GDCALLINGCONV
#endif
+// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
+#ifdef _WIN32
+#define GDN_EXPORT __declspec(dllexport)
+#else
+#define GDN_EXPORT
+#endif
+
#include <stdbool.h>
#include <stdint.h>
diff --git a/modules/gdnative/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp
index 65353c5b0f..5497dde520 100644
--- a/modules/gdnative/godot/godot_array.cpp
+++ b/modules/gdnative/godot/godot_array.cpp
@@ -44,254 +44,264 @@ extern "C" {
void _array_api_anchor() {
}
-void GDAPI godot_array_new(godot_array *p_arr) {
- Array *a = (Array *)p_arr;
- memnew_placement(a, Array);
+void GDAPI godot_array_new(godot_array *r_dest) {
+ Array *dest = (Array *)r_dest;
+ memnew_placement(dest, Array);
}
-void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) {
+ Array *dest = (Array *)r_dest;
+ const Array *src = (const Array *)p_src;
+ memnew_placement(dest, Array(*src));
+}
+
+void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca) {
+ Array *dest = (Array *)r_dest;
PoolVector<Color> *pca = (PoolVector<Color> *)p_pca;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a) {
+ Array *dest = (Array *)r_dest;
PoolVector<Vector3> *pca = (PoolVector<Vector3> *)p_pv3a;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a) {
+ Array *dest = (Array *)r_dest;
PoolVector<Vector2> *pca = (PoolVector<Vector2> *)p_pv2a;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa) {
+ Array *dest = (Array *)r_dest;
PoolVector<String> *pca = (PoolVector<String> *)p_psa;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra) {
+ Array *dest = (Array *)r_dest;
PoolVector<godot_real> *pca = (PoolVector<godot_real> *)p_pra;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia) {
+ Array *dest = (Array *)r_dest;
PoolVector<godot_int> *pca = (PoolVector<godot_int> *)p_pia;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba) {
+ Array *dest = (Array *)r_dest;
PoolVector<uint8_t> *pca = (PoolVector<uint8_t> *)p_pba;
- memnew_placement(a, Array);
- a->resize(pca->size());
+ memnew_placement(dest, Array);
+ dest->resize(pca->size());
- for (size_t i = 0; i < a->size(); i++) {
+ for (size_t i = 0; i < dest->size(); i++) {
Variant v = pca->operator[](i);
- a->operator[](i) = v;
+ dest->operator[](i) = v;
}
}
-void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value) {
+ Array *self = (Array *)p_self;
Variant *val = (Variant *)p_value;
- a->operator[](p_idx) = *val;
+ self->operator[](p_idx) = *val;
}
-godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx) {
+godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx) {
godot_variant raw_dest;
Variant *dest = (Variant *)&raw_dest;
- memnew_placement(dest, Variant);
- const Array *a = (const Array *)p_arr;
- *dest = a->operator[](p_idx);
+ const Array *self = (const Array *)p_self;
+ memnew_placement(dest, Variant(self->operator[](p_idx)));
return raw_dest;
}
-void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) {
- Array *a = (Array *)p_arr;
+godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx) {
+ Array *self = (Array *)p_self;
+ return (godot_variant *)&self->operator[](p_idx);
+}
+
+void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value) {
+ Array *self = (Array *)p_self;
Variant *val = (Variant *)p_value;
- a->append(*val);
+ self->append(*val);
}
-void GDAPI godot_array_clear(godot_array *p_arr) {
- Array *a = (Array *)p_arr;
- a->clear();
+void GDAPI godot_array_clear(godot_array *p_self) {
+ Array *self = (Array *)p_self;
+ self->clear();
}
-godot_int GDAPI godot_array_count(const godot_array *p_arr, const godot_variant *p_value) {
- const Array *a = (const Array *)p_arr;
+godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value) {
+ const Array *self = (const Array *)p_self;
const Variant *val = (const Variant *)p_value;
- return a->count(*val);
+ return self->count(*val);
}
-godot_bool GDAPI godot_array_empty(const godot_array *p_arr) {
- const Array *a = (const Array *)p_arr;
- return a->empty();
+godot_bool GDAPI godot_array_empty(const godot_array *p_self) {
+ const Array *self = (const Array *)p_self;
+ return self->empty();
}
-void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value) {
+ Array *self = (Array *)p_self;
const Variant *val = (const Variant *)p_value;
- a->erase(*val);
+ self->erase(*val);
}
-godot_variant GDAPI godot_array_front(const godot_array *p_arr) {
- const Array *a = (const Array *)p_arr;
+godot_variant GDAPI godot_array_front(const godot_array *p_self) {
+ const Array *self = (const Array *)p_self;
godot_variant v;
Variant *val = (Variant *)&v;
memnew_placement(val, Variant);
- *val = a->front();
+ *val = self->front();
return v;
}
-godot_variant GDAPI godot_array_back(const godot_array *p_arr) {
- const Array *a = (const Array *)p_arr;
+godot_variant GDAPI godot_array_back(const godot_array *p_self) {
+ const Array *self = (const Array *)p_self;
godot_variant v;
Variant *val = (Variant *)&v;
memnew_placement(val, Variant);
- *val = a->back();
+ *val = self->back();
return v;
}
-godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
- const Array *a = (const Array *)p_arr;
+godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) {
+ const Array *self = (const Array *)p_self;
const Variant *val = (const Variant *)p_what;
- return a->find(*val, p_from);
+ return self->find(*val, p_from);
}
-godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what) {
- const Array *a = (const Array *)p_arr;
+godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what) {
+ const Array *self = (const Array *)p_self;
const Variant *val = (const Variant *)p_what;
- return a->find_last(*val);
+ return self->find_last(*val);
}
-godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value) {
- const Array *a = (const Array *)p_arr;
+godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value) {
+ const Array *self = (const Array *)p_self;
const Variant *val = (const Variant *)p_value;
- return a->has(*val);
+ return self->has(*val);
}
-uint32_t GDAPI godot_array_hash(const godot_array *p_arr) {
- const Array *a = (const Array *)p_arr;
- return a->hash();
+godot_int GDAPI godot_array_hash(const godot_array *p_self) {
+ const Array *self = (const Array *)p_self;
+ return self->hash();
}
-void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value) {
+ Array *self = (Array *)p_self;
const Variant *val = (const Variant *)p_value;
- a->insert(p_pos, *val);
+ self->insert(p_pos, *val);
}
-void GDAPI godot_array_invert(godot_array *p_arr) {
- Array *a = (Array *)p_arr;
- a->invert();
+void GDAPI godot_array_invert(godot_array *p_self) {
+ Array *self = (Array *)p_self;
+ self->invert();
}
-godot_variant GDAPI godot_array_pop_back(godot_array *p_arr) {
- Array *a = (Array *)p_arr;
+godot_variant GDAPI godot_array_pop_back(godot_array *p_self) {
+ Array *self = (Array *)p_self;
godot_variant v;
Variant *val = (Variant *)&v;
memnew_placement(val, Variant);
- *val = a->pop_back();
+ *val = self->pop_back();
return v;
}
-godot_variant GDAPI godot_array_pop_front(godot_array *p_arr) {
- Array *a = (Array *)p_arr;
+godot_variant GDAPI godot_array_pop_front(godot_array *p_self) {
+ Array *self = (Array *)p_self;
godot_variant v;
Variant *val = (Variant *)&v;
memnew_placement(val, Variant);
- *val = a->pop_front();
+ *val = self->pop_front();
return v;
}
-void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value) {
+ Array *self = (Array *)p_self;
const Variant *val = (const Variant *)p_value;
- a->push_back(*val);
+ self->push_back(*val);
}
-void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value) {
+ Array *self = (Array *)p_self;
const Variant *val = (const Variant *)p_value;
- a->push_front(*val);
+ self->push_front(*val);
}
-void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx) {
- Array *a = (Array *)p_arr;
- a->remove(p_idx);
+void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx) {
+ Array *self = (Array *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size) {
- Array *a = (Array *)p_arr;
- a->resize(p_size);
+void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size) {
+ Array *self = (Array *)p_self;
+ self->resize(p_size);
}
-godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
- const Array *a = (const Array *)p_arr;
+godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) {
+ const Array *self = (const Array *)p_self;
const Variant *val = (const Variant *)p_what;
- return a->rfind(*val, p_from);
+ return self->rfind(*val, p_from);
}
-godot_int GDAPI godot_array_size(const godot_array *p_arr) {
- const Array *a = (const Array *)p_arr;
- return a->size();
+godot_int GDAPI godot_array_size(const godot_array *p_self) {
+ const Array *self = (const Array *)p_self;
+ return self->size();
}
-void GDAPI godot_array_sort(godot_array *p_arr) {
- Array *a = (Array *)p_arr;
- a->sort();
+void GDAPI godot_array_sort(godot_array *p_self) {
+ Array *self = (Array *)p_self;
+ self->sort();
}
-void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func) {
- Array *a = (Array *)p_arr;
+void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func) {
+ Array *self = (Array *)p_self;
const String *func = (const String *)p_func;
- a->sort_custom((Object *)p_obj, *func);
+ self->sort_custom((Object *)p_obj, *func);
}
-void GDAPI godot_array_destroy(godot_array *p_arr) {
- ((Array *)p_arr)->~Array();
+void GDAPI godot_array_destroy(godot_array *p_self) {
+ ((Array *)p_self)->~Array();
}
#ifdef __cplusplus
diff --git a/modules/gdnative/godot/godot_array.h b/modules/gdnative/godot/godot_array.h
index 29a76304d0..bf8bc61977 100644
--- a/modules/gdnative/godot/godot_array.h
+++ b/modules/gdnative/godot/godot_array.h
@@ -48,66 +48,69 @@ typedef struct godot_array {
#include "../godot.h"
-void GDAPI godot_array_new(godot_array *p_arr);
-void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca);
-void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a);
-void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a);
-void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa);
-void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra);
-void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia);
-void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba);
+void GDAPI godot_array_new(godot_array *r_dest);
+void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src);
+void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca);
+void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa);
+void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra);
+void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia);
+void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba);
-void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value);
+void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value);
-godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx);
+godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx);
-void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value);
+godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx);
-void GDAPI godot_array_clear(godot_array *p_arr);
+void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value);
-godot_int GDAPI godot_array_count(const godot_array *p_arr, const godot_variant *p_value);
+void GDAPI godot_array_clear(godot_array *p_self);
-godot_bool GDAPI godot_array_empty(const godot_array *p_arr);
+godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value);
-void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value);
+godot_bool GDAPI godot_array_empty(const godot_array *p_self);
-godot_variant GDAPI godot_array_front(const godot_array *p_arr);
+void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value);
-godot_variant GDAPI godot_array_back(const godot_array *p_arr);
+godot_variant GDAPI godot_array_front(const godot_array *p_self);
-godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from);
+godot_variant GDAPI godot_array_back(const godot_array *p_self);
-godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what);
+godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from);
-godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value);
+godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what);
-uint32_t GDAPI godot_array_hash(const godot_array *p_arr);
+godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value);
-void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value);
+godot_int GDAPI godot_array_hash(const godot_array *p_self);
-void GDAPI godot_array_invert(godot_array *p_arr);
+void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value);
-godot_variant GDAPI godot_array_pop_back(godot_array *p_arr);
+void GDAPI godot_array_invert(godot_array *p_self);
-godot_variant GDAPI godot_array_pop_front(godot_array *p_arr);
+godot_variant GDAPI godot_array_pop_back(godot_array *p_self);
-void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value);
+godot_variant GDAPI godot_array_pop_front(godot_array *p_self);
-void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value);
+void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value);
-void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx);
+void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value);
-void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size);
+void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from);
+void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size);
-godot_int GDAPI godot_array_size(const godot_array *p_arr);
+godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from);
-void GDAPI godot_array_sort(godot_array *p_arr);
+godot_int GDAPI godot_array_size(const godot_array *p_self);
-void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func);
+void GDAPI godot_array_sort(godot_array *p_self);
-void GDAPI godot_array_destroy(godot_array *p_arr);
+void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func);
+
+void GDAPI godot_array_destroy(godot_array *p_self);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/godot/godot_color.cpp b/modules/gdnative/godot/godot_color.cpp
index 0417a828ab..6dedf2ab10 100644
--- a/modules/gdnative/godot/godot_color.cpp
+++ b/modules/gdnative/godot/godot_color.cpp
@@ -50,6 +50,61 @@ void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const
*dest = Color(p_r, p_g, p_b);
}
+godot_real godot_color_get_r(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->r;
+}
+
+void godot_color_set_r(godot_color *p_self, const godot_real val) {
+ Color *self = (Color *)p_self;
+ self->r = val;
+}
+
+godot_real godot_color_get_g(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->g;
+}
+
+void godot_color_set_g(godot_color *p_self, const godot_real val) {
+ Color *self = (Color *)p_self;
+ self->g = val;
+}
+
+godot_real godot_color_get_b(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->b;
+}
+
+void godot_color_set_b(godot_color *p_self, const godot_real val) {
+ Color *self = (Color *)p_self;
+ self->b = val;
+}
+
+godot_real godot_color_get_a(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->a;
+}
+
+void godot_color_set_a(godot_color *p_self, const godot_real val) {
+ Color *self = (Color *)p_self;
+ self->a = val;
+}
+
+godot_real godot_color_get_h(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->get_h();
+}
+
+godot_real godot_color_get_s(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->get_s();
+}
+
+godot_real godot_color_get_v(const godot_color *p_self) {
+ const Color *self = (const Color *)p_self;
+ return self->get_v();
+}
+
godot_string GDAPI godot_color_as_string(const godot_color *p_self) {
godot_string ret;
const Color *self = (const Color *)p_self;
@@ -106,7 +161,7 @@ godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bo
godot_string dest;
const Color *self = (const Color *)p_self;
- *((String *)&dest) = self->to_html(p_with_alpha);
+ memnew_placement(&dest, String(self->to_html(p_with_alpha)));
return dest;
}
diff --git a/modules/gdnative/godot/godot_color.h b/modules/gdnative/godot/godot_color.h
index 8588c997ea..10dc228b1c 100644
--- a/modules/gdnative/godot/godot_color.h
+++ b/modules/gdnative/godot/godot_color.h
@@ -49,6 +49,22 @@ typedef struct godot_color {
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a);
void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b);
+godot_real godot_color_get_r(const godot_color *p_self);
+void godot_color_set_r(godot_color *p_self, const godot_real r);
+
+godot_real godot_color_get_g(const godot_color *p_self);
+void godot_color_set_g(godot_color *p_self, const godot_real g);
+
+godot_real godot_color_get_b(const godot_color *p_self);
+void godot_color_set_b(godot_color *p_self, const godot_real b);
+
+godot_real godot_color_get_a(const godot_color *p_self);
+void godot_color_set_a(godot_color *p_self, const godot_real a);
+
+godot_real godot_color_get_h(const godot_color *p_self);
+godot_real godot_color_get_s(const godot_color *p_self);
+godot_real godot_color_get_v(const godot_color *p_self);
+
godot_string GDAPI godot_color_as_string(const godot_color *p_self);
godot_int GDAPI godot_color_to_32(const godot_color *p_self);
diff --git a/modules/gdnative/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp
index dda245e59e..12c40f0564 100644
--- a/modules/gdnative/godot/godot_dictionary.cpp
+++ b/modules/gdnative/godot/godot_dictionary.cpp
@@ -44,6 +44,12 @@ void GDAPI godot_dictionary_new(godot_dictionary *r_dest) {
memnew_placement(dest, Dictionary);
}
+void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src) {
+ Dictionary *dest = (Dictionary *)r_dest;
+ const Dictionary *src = (const Dictionary *)p_src;
+ memnew_placement(dest, Dictionary(*src));
+}
+
void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) {
Dictionary *self = (Dictionary *)p_self;
self->~Dictionary();
@@ -101,26 +107,39 @@ godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) {
return dest;
}
-godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
+godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key) {
godot_variant raw_dest;
Variant *dest = (Variant *)&raw_dest;
- const Dictionary *dict = (const Dictionary *)p_dict;
+ const Dictionary *self = (const Dictionary *)p_self;
const Variant *key = (const Variant *)p_key;
- *dest = dict->operator[](*key);
+ memnew_placement(dest, Variant(self->operator[](*key)));
return raw_dest;
}
+void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value) {
+ Dictionary *self = (Dictionary *)p_self;
+ const Variant *key = (const Variant *)p_key;
+ const Variant *value = (const Variant *)p_value;
+ self->operator[](*key) = *value;
+}
+
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) {
+ Array *self = (Array *)p_self;
+ const Variant *key = (const Variant *)p_key;
+ return (godot_variant *)&self->operator[](*key);
+}
+
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) {
const Dictionary *self = (const Dictionary *)p_self;
const Dictionary *b = (const Dictionary *)p_b;
return *self == *b;
}
-godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict) {
+godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self) {
godot_string raw_dest;
String *dest = (String *)&raw_dest;
- const Dictionary *dict = (const Dictionary *)p_dict;
- memnew_placement(dest, String(JSON::print(Variant(*dict))));
+ const Dictionary *self = (const Dictionary *)p_self;
+ memnew_placement(dest, String(JSON::print(Variant(*self))));
return raw_dest;
}
diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h
index 9f6de77aac..0325670b15 100644
--- a/modules/gdnative/godot/godot_dictionary.h
+++ b/modules/gdnative/godot/godot_dictionary.h
@@ -48,6 +48,7 @@ typedef struct godot_dictionary {
#include "godot_variant.h"
void GDAPI godot_dictionary_new(godot_dictionary *r_dest);
+void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_self);
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self);
@@ -68,11 +69,14 @@ godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self);
-godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
+godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key);
+void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value);
+
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);
-godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
+godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/godot/godot_node_path.cpp b/modules/gdnative/godot/godot_node_path.cpp
index 165688a340..c8eacd05af 100644
--- a/modules/gdnative/godot/godot_node_path.cpp
+++ b/modules/gdnative/godot/godot_node_path.cpp
@@ -44,6 +44,12 @@ void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_fr
memnew_placement(dest, NodePath(*from));
}
+void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) {
+ NodePath *dest = (NodePath *)r_dest;
+ const NodePath *src = (const NodePath *)p_src;
+ memnew_placement(dest, NodePath(*src));
+}
+
void GDAPI godot_node_path_destroy(godot_node_path *p_self) {
NodePath *self = (NodePath *)p_self;
self->~NodePath();
diff --git a/modules/gdnative/godot/godot_node_path.h b/modules/gdnative/godot/godot_node_path.h
index fb94bd3822..b0c9d44859 100644
--- a/modules/gdnative/godot/godot_node_path.h
+++ b/modules/gdnative/godot/godot_node_path.h
@@ -47,6 +47,7 @@ typedef struct godot_node_path {
#include "godot_string.h"
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from);
+void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src);
void GDAPI godot_node_path_destroy(godot_node_path *p_self);
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self);
diff --git a/modules/gdnative/godot/godot_pool_arrays.cpp b/modules/gdnative/godot/godot_pool_arrays.cpp
index 10d5d6d939..ea9aceea81 100644
--- a/modules/gdnative/godot/godot_pool_arrays.cpp
+++ b/modules/gdnative/godot/godot_pool_arrays.cpp
@@ -44,542 +44,584 @@ void _pool_arrays_api_anchor() {
// byte
-void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- memnew_placement(pba, PoolVector<uint8_t>);
+void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest) {
+ PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest;
+ memnew_placement(dest, PoolVector<uint8_t>);
}
-void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src) {
+ PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest;
+ const PoolVector<uint8_t> *src = (const PoolVector<uint8_t> *)p_src;
+ memnew_placement(dest, PoolVector<uint8_t>(*src));
+}
+
+void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a) {
+ PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<uint8_t>);
+ memnew_placement(dest, PoolVector<uint8_t>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- pba->append(p_data);
+void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ self->append(p_data);
}
-void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
PoolVector<uint8_t> *array = (PoolVector<uint8_t> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- return pba->insert(p_idx, p_data);
+godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ return (godot_error)self->insert(p_idx, p_data);
}
-void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- pba->push_back(p_data);
+void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ self->push_back(p_data);
}
-void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- pba->set(p_idx, p_data);
+void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) {
+ PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
+ self->set(p_idx, p_data);
}
-uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_pba, const godot_int p_idx) {
- const PoolVector<uint8_t> *pba = (const PoolVector<uint8_t> *)p_pba;
- return pba->get(p_idx);
+uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx) {
+ const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self;
+ return self->get(p_idx);
}
-godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_pba) {
- const PoolVector<uint8_t> *pba = (const PoolVector<uint8_t> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self) {
+ const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba) {
- ((PoolVector<uint8_t> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self) {
+ ((PoolVector<uint8_t> *)p_self)->~PoolVector();
}
// int
-void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pba) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- memnew_placement(pba, PoolVector<uint8_t>);
+void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest) {
+ PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest;
+ memnew_placement(dest, PoolVector<godot_int>);
+}
+
+void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src) {
+ PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest;
+ const PoolVector<godot_int> *src = (const PoolVector<godot_int> *)p_src;
+ memnew_placement(dest, PoolVector<godot_int>(*src));
}
-void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pba, const godot_array *p_a) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a) {
+ PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<uint8_t>);
+ memnew_placement(dest, PoolVector<godot_int>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pba, const godot_int p_data) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->append(p_data);
+void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->append(p_data);
}
-void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pba, const godot_pool_int_array *p_array) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
PoolVector<godot_int> *array = (PoolVector<godot_int> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- return pba->insert(p_idx, p_data);
+godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ return (godot_error)self->insert(p_idx, p_data);
}
-void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pba) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pba, const godot_int p_data) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->push_back(p_data);
+void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->push_back(p_data);
}
-void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pba, const godot_int p_idx) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pba, const godot_int p_size) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->set(p_idx, p_data);
+void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->set(p_idx, p_data);
}
-godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_pba, const godot_int p_idx) {
- const PoolVector<godot_int> *pba = (const PoolVector<godot_int> *)p_pba;
- return pba->get(p_idx);
+godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx) {
+ const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self;
+ return self->get(p_idx);
}
-godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_pba) {
- const PoolVector<godot_int> *pba = (const PoolVector<godot_int> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self) {
+ const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pba) {
- ((PoolVector<godot_int> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self) {
+ ((PoolVector<godot_int> *)p_self)->~PoolVector();
}
// real
-void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pba) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
- memnew_placement(pba, PoolVector<uint8_t>);
+void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest) {
+ PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest;
+ memnew_placement(dest, PoolVector<godot_real>);
}
-void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pba, const godot_array *p_a) {
- PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src) {
+ PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest;
+ const PoolVector<godot_real> *src = (const PoolVector<godot_real> *)p_src;
+ memnew_placement(dest, PoolVector<godot_real>(*src));
+}
+
+void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a) {
+ PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<uint8_t>);
+ memnew_placement(dest, PoolVector<godot_real>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pba, const godot_real p_data) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
- pba->append(p_data);
+void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
+ self->append(p_data);
}
-void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pba, const godot_pool_real_array *p_array) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
PoolVector<godot_real> *array = (PoolVector<godot_real> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
- return pba->insert(p_idx, p_data);
+godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
+ return (godot_error)self->insert(p_idx, p_data);
}
-void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pba) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pba, const godot_real p_data) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
- pba->push_back(p_data);
+void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
+ self->push_back(p_data);
}
-void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pba, const godot_int p_idx) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pba, const godot_int p_size) {
- PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size) {
+ PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) {
- PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
- pba->set(p_idx, p_data);
+void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) {
+ PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
+ self->set(p_idx, p_data);
}
-godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_pba, const godot_int p_idx) {
- const PoolVector<godot_real> *pba = (const PoolVector<godot_real> *)p_pba;
- return pba->get(p_idx);
+godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx) {
+ const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self;
+ return self->get(p_idx);
}
-godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_pba) {
- const PoolVector<godot_real> *pba = (const PoolVector<godot_real> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self) {
+ const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pba) {
- ((PoolVector<godot_real> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self) {
+ ((PoolVector<godot_real> *)p_self)->~PoolVector();
}
// string
-void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_pba) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
- memnew_placement(pba, PoolVector<String>);
+void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest) {
+ PoolVector<String> *dest = (PoolVector<String> *)r_dest;
+ memnew_placement(dest, PoolVector<String>);
+}
+
+void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src) {
+ PoolVector<String> *dest = (PoolVector<String> *)r_dest;
+ const PoolVector<String> *src = (const PoolVector<String> *)p_src;
+ memnew_placement(dest, PoolVector<String>(*src));
}
-void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_pba, const godot_array *p_a) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a) {
+ PoolVector<String> *dest = (PoolVector<String> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<String>);
+ memnew_placement(dest, PoolVector<String>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_pba, const godot_string *p_data) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
String &s = *(String *)p_data;
- pba->append(s);
+ self->append(s);
}
-void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_pba, const godot_pool_string_array *p_array) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
PoolVector<String> *array = (PoolVector<String> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
String &s = *(String *)p_data;
- return pba->insert(p_idx, s);
+ return (godot_error)self->insert(p_idx, s);
}
-void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_pba) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_pba, const godot_string *p_data) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
String &s = *(String *)p_data;
- pba->push_back(s);
+ self->push_back(s);
}
-void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_pba, const godot_int p_idx) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_pba, const godot_int p_size) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) {
- PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) {
+ PoolVector<String> *self = (PoolVector<String> *)p_self;
String &s = *(String *)p_data;
- pba->set(p_idx, s);
+ self->set(p_idx, s);
}
-godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_pba, const godot_int p_idx) {
- const PoolVector<String> *pba = (const PoolVector<String> *)p_pba;
+godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx) {
+ const PoolVector<String> *self = (const PoolVector<String> *)p_self;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
- *s = pba->get(p_idx);
+ *s = self->get(p_idx);
return str;
}
-godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_pba) {
- const PoolVector<String> *pba = (const PoolVector<String> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self) {
+ const PoolVector<String> *self = (const PoolVector<String> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_pba) {
- ((PoolVector<String> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self) {
+ ((PoolVector<String> *)p_self)->~PoolVector();
}
// vector2
-void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pba) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
- memnew_placement(pba, PoolVector<Vector2>);
+void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest) {
+ PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest;
+ memnew_placement(dest, PoolVector<Vector2>);
+}
+
+void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src) {
+ PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest;
+ const PoolVector<Vector2> *src = (const PoolVector<Vector2> *)p_src;
+ memnew_placement(dest, PoolVector<Vector2>(*src));
}
-void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pba, const godot_array *p_a) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a) {
+ PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<Vector2>);
+ memnew_placement(dest, PoolVector<Vector2>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
Vector2 &s = *(Vector2 *)p_data;
- pba->append(s);
+ self->append(s);
}
-void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pba, const godot_pool_vector2_array *p_array) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
PoolVector<Vector2> *array = (PoolVector<Vector2> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
Vector2 &s = *(Vector2 *)p_data;
- return pba->insert(p_idx, s);
+ return (godot_error)self->insert(p_idx, s);
}
-void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pba) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
Vector2 &s = *(Vector2 *)p_data;
- pba->push_back(s);
+ self->push_back(s);
}
-void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pba, const godot_int p_idx) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pba, const godot_int p_size) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) {
- PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self;
Vector2 &s = *(Vector2 *)p_data;
- pba->set(p_idx, s);
+ self->set(p_idx, s);
}
-godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_pba, const godot_int p_idx) {
- const PoolVector<Vector2> *pba = (const PoolVector<Vector2> *)p_pba;
+godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx) {
+ const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self;
godot_vector2 v;
Vector2 *s = (Vector2 *)&v;
- *s = pba->get(p_idx);
+ *s = self->get(p_idx);
return v;
}
-godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_pba) {
- const PoolVector<Vector2> *pba = (const PoolVector<Vector2> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self) {
+ const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pba) {
- ((PoolVector<Vector2> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self) {
+ ((PoolVector<Vector2> *)p_self)->~PoolVector();
}
// vector3
-void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pba) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
- memnew_placement(pba, PoolVector<Vector3>);
+void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest) {
+ PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest;
+ memnew_placement(dest, PoolVector<Vector3>);
}
-void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pba, const godot_array *p_a) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src) {
+ PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest;
+ const PoolVector<Vector3> *src = (const PoolVector<Vector3> *)p_src;
+ memnew_placement(dest, PoolVector<Vector3>(*src));
+}
+
+void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a) {
+ PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<Vector3>);
+ memnew_placement(dest, PoolVector<Vector3>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
Vector3 &s = *(Vector3 *)p_data;
- pba->append(s);
+ self->append(s);
}
-void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pba, const godot_pool_vector3_array *p_array) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
PoolVector<Vector3> *array = (PoolVector<Vector3> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
Vector3 &s = *(Vector3 *)p_data;
- return pba->insert(p_idx, s);
+ return (godot_error)self->insert(p_idx, s);
}
-void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pba) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
Vector3 &s = *(Vector3 *)p_data;
- pba->push_back(s);
+ self->push_back(s);
}
-void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pba, const godot_int p_idx) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pba, const godot_int p_size) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) {
- PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
Vector3 &s = *(Vector3 *)p_data;
- pba->set(p_idx, s);
+ self->set(p_idx, s);
}
-godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_pba, const godot_int p_idx) {
- const PoolVector<Vector3> *pba = (const PoolVector<Vector3> *)p_pba;
+godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx) {
+ const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self;
godot_vector3 v;
Vector3 *s = (Vector3 *)&v;
- *s = pba->get(p_idx);
+ *s = self->get(p_idx);
return v;
}
-godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_pba) {
- const PoolVector<Vector3> *pba = (const PoolVector<Vector3> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self) {
+ const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pba) {
- ((PoolVector<Vector3> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self) {
+ ((PoolVector<Vector3> *)p_self)->~PoolVector();
}
// color
-void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pba) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
- memnew_placement(pba, PoolVector<Color>);
+void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest) {
+ PoolVector<Color> *dest = (PoolVector<Color> *)r_dest;
+ memnew_placement(dest, PoolVector<Color>);
+}
+
+void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src) {
+ PoolVector<Color> *dest = (PoolVector<Color> *)r_dest;
+ const PoolVector<Color> *src = (const PoolVector<Color> *)p_src;
+ memnew_placement(dest, PoolVector<Color>(*src));
}
-void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pba, const godot_array *p_a) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a) {
+ PoolVector<Color> *dest = (PoolVector<Color> *)r_dest;
Array *a = (Array *)p_a;
- memnew_placement(pba, PoolVector<Color>);
+ memnew_placement(dest, PoolVector<Color>);
- pba->resize(a->size());
+ dest->resize(a->size());
for (size_t i = 0; i < a->size(); i++) {
- pba->set(i, (*a)[i]);
+ dest->set(i, (*a)[i]);
}
}
-void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pba, const godot_color *p_data) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
Color &s = *(Color *)p_data;
- pba->append(s);
+ self->append(s);
}
-void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pba, const godot_pool_color_array *p_array) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
PoolVector<Color> *array = (PoolVector<Color> *)p_array;
- pba->append_array(*array);
+ self->append_array(*array);
}
-int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
Color &s = *(Color *)p_data;
- return pba->insert(p_idx, s);
+ return (godot_error)self->insert(p_idx, s);
}
-void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pba) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
- pba->invert();
+void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
+ self->invert();
}
-void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pba, const godot_color *p_data) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
Color &s = *(Color *)p_data;
- pba->push_back(s);
+ self->push_back(s);
}
-void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pba, const godot_int p_idx) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
- pba->remove(p_idx);
+void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
+ self->remove(p_idx);
}
-void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pba, const godot_int p_size) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
- pba->resize(p_size);
+void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
+ self->resize(p_size);
}
-void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) {
- PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) {
+ PoolVector<Color> *self = (PoolVector<Color> *)p_self;
Color &s = *(Color *)p_data;
- pba->set(p_idx, s);
+ self->set(p_idx, s);
}
-godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_pba, const godot_int p_idx) {
- const PoolVector<Color> *pba = (const PoolVector<Color> *)p_pba;
+godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx) {
+ const PoolVector<Color> *self = (const PoolVector<Color> *)p_self;
godot_color v;
Color *s = (Color *)&v;
- *s = pba->get(p_idx);
+ *s = self->get(p_idx);
return v;
}
-godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_pba) {
- const PoolVector<Color> *pba = (const PoolVector<Color> *)p_pba;
- return pba->size();
+godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self) {
+ const PoolVector<Color> *self = (const PoolVector<Color> *)p_self;
+ return self->size();
}
-void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pba) {
- ((PoolVector<Color> *)p_pba)->~PoolVector();
+void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) {
+ ((PoolVector<Color> *)p_self)->~PoolVector();
}
#ifdef __cplusplus
diff --git a/modules/gdnative/godot/godot_pool_arrays.h b/modules/gdnative/godot/godot_pool_arrays.h
index 015be65c3e..a794d03f01 100644
--- a/modules/gdnative/godot/godot_pool_arrays.h
+++ b/modules/gdnative/godot/godot_pool_arrays.h
@@ -101,185 +101,192 @@ typedef struct godot_pool_color_array {
// byte
-void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba);
-void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a);
+void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest);
+void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src);
+void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data);
+void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data);
-void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array);
+void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array);
-int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
+godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data);
-void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba);
+void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self);
-void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data);
+void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data);
-void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx);
+void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size);
+void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
-uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_pba, const godot_int p_idx);
+void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data);
+uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_pba);
+godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self);
-void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba);
+void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self);
// int
-void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pia);
-void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pia, const godot_array *p_a);
+void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest);
+void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src);
+void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pia, const godot_int p_data);
+void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data);
-void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pia, const godot_pool_int_array *p_array);
+void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array);
-int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
+godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data);
-void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pia);
+void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self);
-void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pia, const godot_int p_data);
+void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data);
-void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pia, const godot_int p_idx);
+void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pia, const godot_int p_size);
+void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
-godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_pia, const godot_int p_idx);
+void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data);
+godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_pia);
+godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self);
-void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pia);
+void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self);
// real
-void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pra);
-void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pra, const godot_array *p_a);
+void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest);
+void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src);
+void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pra, const godot_real p_data);
+void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data);
-void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pra, const godot_pool_real_array *p_array);
+void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array);
-int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
+godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data);
-void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pra);
+void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self);
-void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pra, const godot_real p_data);
+void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data);
-void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pra, const godot_int p_idx);
+void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pra, const godot_int p_size);
+void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
-godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_pra, const godot_int p_idx);
+void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data);
+godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_pra);
+godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self);
-void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pra);
+void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self);
// string
-void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_psa);
-void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_psa, const godot_array *p_a);
+void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest);
+void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src);
+void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_psa, const godot_string *p_data);
+void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data);
-void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_psa, const godot_pool_string_array *p_array);
+void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array);
-int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
+godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data);
-void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_psa);
+void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self);
-void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_psa, const godot_string *p_data);
+void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data);
-void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_psa, const godot_int p_idx);
+void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_psa, const godot_int p_size);
+void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
-godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_psa, const godot_int p_idx);
+void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data);
+godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_psa);
+godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self);
-void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_psa);
+void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self);
// vector2
-void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pv2a);
-void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pv2a, const godot_array *p_a);
+void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest);
+void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src);
+void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data);
+void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data);
-void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pv2a, const godot_pool_vector2_array *p_array);
+void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array);
-int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
+godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data);
-void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self);
-void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data);
+void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data);
-void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
+void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pv2a, const godot_int p_size);
+void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
-godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
+void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data);
+godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_pv2a);
+godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self);
-void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self);
// vector3
-void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pv3a);
-void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pv3a, const godot_array *p_a);
+void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest);
+void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src);
+void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data);
+void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data);
-void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pv3a, const godot_pool_vector3_array *p_array);
+void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array);
-int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
+godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data);
-void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self);
-void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data);
+void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data);
-void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
+void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pv3a, const godot_int p_size);
+void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
-godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
+void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data);
+godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_pv3a);
+godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self);
-void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self);
// color
-void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pca);
-void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pca, const godot_array *p_a);
+void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest);
+void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src);
+void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a);
-void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pca, const godot_color *p_data);
+void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data);
-void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pca, const godot_pool_color_array *p_array);
+void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array);
-int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
+godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data);
-void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pca);
+void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self);
-void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pca, const godot_color *p_data);
+void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data);
-void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pca, const godot_int p_idx);
+void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx);
-void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pca, const godot_int p_size);
+void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size);
-void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
-godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_pca, const godot_int p_idx);
+void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data);
+godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx);
-godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_pca);
+godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self);
-void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca);
+void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/godot/godot_quat.cpp b/modules/gdnative/godot/godot_quat.cpp
index 4d38c4987c..7235e4fcec 100644
--- a/modules/gdnative/godot/godot_quat.cpp
+++ b/modules/gdnative/godot/godot_quat.cpp
@@ -50,6 +50,46 @@ void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector
*dest = Quat(*axis, p_angle);
}
+godot_real GDAPI godot_quat_get_x(const godot_quat *p_self) {
+ const Quat *self = (const Quat *)p_self;
+ return self->x;
+}
+
+void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val) {
+ Quat *self = (Quat *)p_self;
+ self->x = val;
+}
+
+godot_real GDAPI godot_quat_get_y(const godot_quat *p_self) {
+ const Quat *self = (const Quat *)p_self;
+ return self->y;
+}
+
+void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val) {
+ Quat *self = (Quat *)p_self;
+ self->y = val;
+}
+
+godot_real GDAPI godot_quat_get_z(const godot_quat *p_self) {
+ const Quat *self = (const Quat *)p_self;
+ return self->z;
+}
+
+void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val) {
+ Quat *self = (Quat *)p_self;
+ self->z = val;
+}
+
+godot_real GDAPI godot_quat_get_w(const godot_quat *p_self) {
+ const Quat *self = (const Quat *)p_self;
+ return self->w;
+}
+
+void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val) {
+ Quat *self = (Quat *)p_self;
+ self->w = val;
+}
+
godot_string GDAPI godot_quat_as_string(const godot_quat *p_self) {
godot_string ret;
const Quat *self = (const Quat *)p_self;
diff --git a/modules/gdnative/godot/godot_quat.h b/modules/gdnative/godot/godot_quat.h
index 6bdc33accf..2289b6cbab 100644
--- a/modules/gdnative/godot/godot_quat.h
+++ b/modules/gdnative/godot/godot_quat.h
@@ -49,6 +49,18 @@ typedef struct godot_quat {
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w);
void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle);
+godot_real GDAPI godot_quat_get_x(const godot_quat *p_self);
+void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val);
+
+godot_real GDAPI godot_quat_get_y(const godot_quat *p_self);
+void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val);
+
+godot_real GDAPI godot_quat_get_z(const godot_quat *p_self);
+void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val);
+
+godot_real GDAPI godot_quat_get_w(const godot_quat *p_self);
+void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val);
+
godot_string GDAPI godot_quat_as_string(const godot_quat *p_self);
godot_real GDAPI godot_quat_length(const godot_quat *p_self);
diff --git a/modules/gdnative/godot/godot_rect2.cpp b/modules/gdnative/godot/godot_rect2.cpp
index eea95ca6fe..0e456ea3ba 100644
--- a/modules/gdnative/godot/godot_rect2.cpp
+++ b/modules/gdnative/godot/godot_rect2.cpp
@@ -38,11 +38,11 @@ extern "C" {
void _rect2_api_anchor() {}
-void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
- const Vector2 *pos = (const Vector2 *)p_pos;
+void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
+ const Vector2 *position = (const Vector2 *)p_pos;
const Vector2 *size = (const Vector2 *)p_size;
Rect2 *dest = (Rect2 *)r_dest;
- *dest = Rect2(*pos, *size);
+ *dest = Rect2(*position, *size);
}
void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height) {
@@ -124,11 +124,11 @@ godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const god
return *self == *b;
}
-godot_vector2 GDAPI godot_rect2_get_pos(const godot_rect2 *p_self) {
+godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Rect2 *self = (const Rect2 *)p_self;
- *d = self->get_pos();
+ *d = self->get_position();
return dest;
}
@@ -140,10 +140,10 @@ godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self) {
return dest;
}
-void GDAPI godot_rect2_set_pos(godot_rect2 *p_self, const godot_vector2 *p_pos) {
+void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos) {
Rect2 *self = (Rect2 *)p_self;
- const Vector2 *pos = (const Vector2 *)p_pos;
- self->set_pos(*pos);
+ const Vector2 *position = (const Vector2 *)p_pos;
+ self->set_position(*position);
}
void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size) {
diff --git a/modules/gdnative/godot/godot_rect2.h b/modules/gdnative/godot/godot_rect2.h
index 9743321a3b..488a1204f7 100644
--- a/modules/gdnative/godot/godot_rect2.h
+++ b/modules/gdnative/godot/godot_rect2.h
@@ -46,7 +46,7 @@ typedef struct godot_rect2 {
#include "../godot.h"
#include "godot_vector2.h"
-void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size);
+void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size);
void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height);
godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self);
@@ -71,11 +71,11 @@ godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vect
godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b);
-godot_vector2 GDAPI godot_rect2_get_pos(const godot_rect2 *p_self);
+godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self);
godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self);
-void GDAPI godot_rect2_set_pos(godot_rect2 *p_self, const godot_vector2 *p_pos);
+void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos);
void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size);
diff --git a/modules/gdnative/godot/godot_rect3.cpp b/modules/gdnative/godot/godot_rect3.cpp
index c4f8a853c2..e524fa8463 100644
--- a/modules/gdnative/godot/godot_rect3.cpp
+++ b/modules/gdnative/godot/godot_rect3.cpp
@@ -45,6 +45,34 @@ void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, cons
*dest = Rect3(*pos, *size);
}
+godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self) {
+ godot_vector3 raw_ret;
+ const Rect3 *self = (const Rect3 *)p_self;
+ Vector3 *ret = (Vector3 *)&raw_ret;
+ *ret = self->position;
+ return raw_ret;
+}
+
+void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v) {
+ Rect3 *self = (Rect3 *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->position = *v;
+}
+
+godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) {
+ godot_vector3 raw_ret;
+ const Rect3 *self = (const Rect3 *)p_self;
+ Vector3 *ret = (Vector3 *)&raw_ret;
+ *ret = self->size;
+ return raw_ret;
+}
+
+void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v) {
+ Rect3 *self = (Rect3 *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->size = *v;
+}
+
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) {
godot_string ret;
const Rect3 *self = (const Rect3 *)p_self;
diff --git a/modules/gdnative/godot/godot_rect3.h b/modules/gdnative/godot/godot_rect3.h
index 95969ab20e..9e9a49ac27 100644
--- a/modules/gdnative/godot/godot_rect3.h
+++ b/modules/gdnative/godot/godot_rect3.h
@@ -49,6 +49,12 @@ typedef struct godot_rect3 {
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
+godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self);
+void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v);
+
+godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self);
+void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v);
+
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self);
godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self);
diff --git a/modules/gdnative/godot/godot_string.cpp b/modules/gdnative/godot/godot_string.cpp
index 59d20c6d23..679011e715 100644
--- a/modules/gdnative/godot/godot_string.cpp
+++ b/modules/gdnative/godot/godot_string.cpp
@@ -41,81 +41,75 @@ extern "C" {
void _string_api_anchor() {
}
-void GDAPI godot_string_new(godot_string *p_str) {
- String *p = (String *)p_str;
- memnew_placement(p, String);
- // *p = String(); // useless here
+void GDAPI godot_string_new(godot_string *r_dest) {
+ String *dest = (String *)r_dest;
+ memnew_placement(dest, String);
}
-void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) {
- String *p = (String *)p_str;
- memnew_placement(p, String);
- *p = String::utf8(p_contents, p_size);
+void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src) {
+ String *dest = (String *)r_dest;
+ const String *src = (const String *)p_src;
+ memnew_placement(dest, String(*src));
}
-void GDAPI godot_string_new_unicode_data(godot_string *p_str, const wchar_t *p_contents, const int p_size) {
- String *p = (String *)p_str;
- memnew_placement(p, String);
- *p = String(p_contents, p_size);
+void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size) {
+ String *dest = (String *)r_dest;
+ memnew_placement(dest, String(String::utf8(p_contents, p_size)));
}
-void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size) {
- String *p = (String *)p_str;
+void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size) {
+ String *dest = (String *)r_dest;
+ memnew_placement(dest, String(p_contents, p_size));
+}
+
+void GDAPI godot_string_get_data(const godot_string *p_self, char *r_dest, int *p_size) {
+ String *self = (String *)p_self;
if (p_size != NULL) {
- *p_size = p->utf8().length();
+ *p_size = self->utf8().length();
}
- if (p_dest != NULL) {
- memcpy(p_dest, p->utf8().get_data(), *p_size);
+ if (r_dest != NULL) {
+ memcpy(r_dest, self->utf8().get_data(), *p_size);
}
}
-void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) {
- String *dest = (String *)p_dest;
- String *src = (String *)p_src;
-
- *dest = *src;
-}
-
-wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) {
- String *s = (String *)p_str;
- return &(s->operator[](p_idx));
+wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) {
+ String *self = (String *)p_self;
+ return &(self->operator[](p_idx));
}
-const char GDAPI *godot_string_c_str(const godot_string *p_str) {
- const String *s = (const String *)p_str;
- return s->utf8().get_data();
+const char GDAPI *godot_string_c_str(const godot_string *p_self) {
+ const String *self = (const String *)p_self;
+ return self->utf8().get_data();
}
-const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_str) {
- const String *s = (const String *)p_str;
- return s->c_str();
+const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self) {
+ const String *self = (const String *)p_self;
+ return self->c_str();
}
-godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) {
- String *a = (String *)p_a;
- String *b = (String *)p_b;
- return *a == *b;
+godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b) {
+ const String *self = (const String *)p_self;
+ const String *b = (const String *)p_b;
+ return *self == *b;
}
-godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) {
- String *a = (String *)p_a;
- String *b = (String *)p_b;
- return *a < *b;
+godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b) {
+ const String *self = (const String *)p_self;
+ const String *b = (const String *)p_b;
+ return *self < *b;
}
-void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) {
- String *dest = (String *)p_dest;
- const String *a = (String *)p_a;
- const String *b = (String *)p_b;
-
- String tmp = *a + *b;
- godot_string_new(p_dest);
- *dest = tmp;
+godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b) {
+ godot_string ret;
+ const String *self = (const String *)p_self;
+ const String *b = (const String *)p_b;
+ memnew_placement(&ret, String(*self + *b));
+ return ret;
}
-void GDAPI godot_string_destroy(godot_string *p_str) {
- String *p = (String *)p_str;
- p->~String();
+void GDAPI godot_string_destroy(godot_string *p_self) {
+ String *self = (String *)p_self;
+ self->~String();
}
#ifdef __cplusplus
diff --git a/modules/gdnative/godot/godot_string.h b/modules/gdnative/godot/godot_string.h
index e0ba298a9c..df848abb76 100644
--- a/modules/gdnative/godot/godot_string.h
+++ b/modules/gdnative/godot/godot_string.h
@@ -45,27 +45,26 @@ typedef struct godot_string {
#include "../godot.h"
-void GDAPI godot_string_new(godot_string *p_str);
-void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
-void GDAPI godot_string_new_unicode_data(godot_string *p_str, const wchar_t *p_contents, const int p_size);
+void GDAPI godot_string_new(godot_string *r_dest);
+void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src);
+void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size);
+void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size);
-void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size);
+void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size);
-void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src);
+wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
+const char GDAPI *godot_string_c_str(const godot_string *p_self);
+const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self);
-wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx);
-const char GDAPI *godot_string_c_str(const godot_string *p_str);
-const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_str);
-
-godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b);
-godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b);
-void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b);
+godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b);
+godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b);
+godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b);
// @Incomplete
// hmm, I guess exposing the whole API doesn't make much sense
// since the language used in the library has its own string funcs
-void GDAPI godot_string_destroy(godot_string *p_str);
+void GDAPI godot_string_destroy(godot_string *p_self);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/godot/godot_transform.cpp b/modules/gdnative/godot/godot_transform.cpp
index f5a012f59c..eb9e1e207b 100644
--- a/modules/gdnative/godot/godot_transform.cpp
+++ b/modules/gdnative/godot/godot_transform.cpp
@@ -57,6 +57,32 @@ void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_bas
*dest = Transform(*basis, *origin);
}
+godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self) {
+ godot_basis dest;
+ const Transform *self = (const Transform *)p_self;
+ *((Basis *)&dest) = self->basis;
+ return dest;
+}
+
+void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v) {
+ Transform *self = (Transform *)p_self;
+ const Basis *v = (const Basis *)p_v;
+ self->basis = *v;
+}
+
+godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self) {
+ godot_vector3 dest;
+ const Transform *self = (const Transform *)p_self;
+ *((Vector3 *)&dest) = self->origin;
+ return dest;
+}
+
+void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v) {
+ Transform *self = (Transform *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->origin = *v;
+}
+
godot_string GDAPI godot_transform_as_string(const godot_transform *p_self) {
godot_string ret;
const Transform *self = (const Transform *)p_self;
diff --git a/modules/gdnative/godot/godot_transform.h b/modules/gdnative/godot/godot_transform.h
index b15efc23b8..ee87e1d33f 100644
--- a/modules/gdnative/godot/godot_transform.h
+++ b/modules/gdnative/godot/godot_transform.h
@@ -51,6 +51,12 @@ typedef struct godot_transform {
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin);
void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin);
+godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self);
+void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v);
+
+godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self);
+void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v);
+
godot_string GDAPI godot_transform_as_string(const godot_transform *p_self);
godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self);
diff --git a/modules/gdnative/godot/godot_variant.cpp b/modules/gdnative/godot/godot_variant.cpp
index 9381fb86d3..c9607fb21a 100644
--- a/modules/gdnative/godot/godot_variant.cpp
+++ b/modules/gdnative/godot/godot_variant.cpp
@@ -45,10 +45,10 @@ godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) {
return (godot_variant_type)self->get_type();
}
-void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src) {
+void GDAPI godot_variant_new_copy(godot_variant *p_dest, const godot_variant *p_src) {
Variant *dest = (Variant *)p_dest;
Variant *src = (Variant *)p_src;
- *dest = *src;
+ memnew_placement(dest, Variant(*src));
}
void GDAPI godot_variant_new_nil(godot_variant *r_dest) {
diff --git a/modules/gdnative/godot/godot_variant.h b/modules/gdnative/godot/godot_variant.h
index d46b87c41b..9b6d287249 100644
--- a/modules/gdnative/godot/godot_variant.h
+++ b/modules/gdnative/godot/godot_variant.h
@@ -68,7 +68,6 @@ typedef enum godot_variant_type {
GODOT_VARIANT_TYPE_NODE_PATH, // 15
GODOT_VARIANT_TYPE_RID,
GODOT_VARIANT_TYPE_OBJECT,
- GODOT_VARIANT_TYPE_INPUT_EVENT, // TODO: remove me once input_event is removed from main Godot codebase
GODOT_VARIANT_TYPE_DICTIONARY,
GODOT_VARIANT_TYPE_ARRAY, // 20
@@ -119,7 +118,7 @@ typedef struct godot_variant_call_error {
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
-void GDAPI godot_variant_copy(godot_variant *r_dest, const godot_variant *p_src);
+void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src);
void GDAPI godot_variant_new_nil(godot_variant *r_dest);
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 12b43d6060..d4ede4cb17 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1014,7 +1014,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr
}
} break;
- case GDParser::OperatorNode::OP_EXTENDS: {
+ case GDParser::OperatorNode::OP_IS: {
ERR_FAIL_COND_V(on->arguments.size() != 2, false);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index eea5b15236..5e3ce31dd6 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -69,6 +69,19 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
return script;
}
+bool GDScriptLanguage::is_using_templates() {
+
+ return true;
+}
+
+void GDScriptLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {
+
+ String src = p_script->get_source_code();
+ src = src.replace("%BASE%", p_base_class_name);
+ src = src.replace("%TS%", _get_indentation());
+ p_script->set_source_code(src);
+}
+
bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
GDParser parser;
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index fb32d23ad5..e8a8e20927 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -358,12 +358,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (a->get_type() != Variant::OBJECT || a->operator Object *() == NULL) {
- err_text = "Left operand of 'extends' is not an instance of anything.";
+ err_text = "Left operand of 'is' is not an instance of anything.";
break;
}
if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) {
- err_text = "Right operand of 'extends' is not a class.";
+ err_text = "Right operand of 'is' is not a class.";
break;
}
#endif
@@ -401,7 +401,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!nc) {
- err_text = "Right operand of 'extends' is not a class (type: '" + obj_B->get_class() + "').";
+ err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "').";
break;
}
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 4ae62eb1d0..d64cd86de6 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1077,7 +1077,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool
case GDTokenizer::TK_OP_BIT_AND: op = OperatorNode::OP_BIT_AND; break;
case GDTokenizer::TK_OP_BIT_OR: op = OperatorNode::OP_BIT_OR; break;
case GDTokenizer::TK_OP_BIT_XOR: op = OperatorNode::OP_BIT_XOR; break;
- case GDTokenizer::TK_PR_EXTENDS: op = OperatorNode::OP_EXTENDS; break;
+ case GDTokenizer::TK_PR_IS: op = OperatorNode::OP_IS; break;
case GDTokenizer::TK_CF_IF: op = OperatorNode::OP_TERNARY_IF; break;
case GDTokenizer::TK_CF_ELSE: op = OperatorNode::OP_TERNARY_ELSE; break;
default: valid = false; break;
@@ -1117,7 +1117,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool
switch (expression[i].op) {
- case OperatorNode::OP_EXTENDS:
+ case OperatorNode::OP_IS:
priority = -1;
break; //before anything
@@ -1420,7 +1420,7 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) {
}
}
- if (op->op == OperatorNode::OP_EXTENDS) {
+ if (op->op == OperatorNode::OP_IS) {
//nothing much
return op;
}
diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h
index 7e7e19de1b..3ad3466624 100644
--- a/modules/gdscript/gd_parser.h
+++ b/modules/gdscript/gd_parser.h
@@ -216,7 +216,7 @@ public:
OP_CALL,
OP_PARENT_CALL,
OP_YIELD,
- OP_EXTENDS,
+ OP_IS,
//indexing operator
OP_INDEX,
OP_INDEX_NAMED,
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 173014b138..1dcc442234 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -615,6 +615,11 @@ Error GDScript::reload(bool p_keep_state) {
if (basedir != "")
basedir = basedir.get_base_dir();
+ if (basedir.find("res://") == -1 && basedir.find("user://") == -1) {
+ //loading a template, don't parse
+ return OK;
+ }
+
valid = false;
GDParser parser;
Error err = parser.parse(source, basedir, false, path);
@@ -1812,6 +1817,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"breakpoint",
"class",
"extends",
+ "is",
"func",
"preload",
"setget",
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 00ae136790..ebef4fed74 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -381,6 +381,8 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ virtual bool is_using_templates();
+ virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 5e1a48ae86..f4e0cc8e29 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -90,6 +90,7 @@ const char *GDTokenizer::token_names[TK_MAX] = {
"func",
"class",
"extends",
+ "is",
"onready",
"tool",
"static",
@@ -864,6 +865,7 @@ void GDTokenizerText::_advance() {
{ TK_PR_FUNCTION, "func" },
{ TK_PR_CLASS, "class" },
{ TK_PR_EXTENDS, "extends" },
+ { TK_PR_IS, "is" },
{ TK_PR_ONREADY, "onready" },
{ TK_PR_TOOL, "tool" },
{ TK_PR_STATIC, "static" },
diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h
index ea7629b661..c051176097 100644
--- a/modules/gdscript/gd_tokenizer.h
+++ b/modules/gdscript/gd_tokenizer.h
@@ -96,6 +96,7 @@ public:
TK_PR_FUNCTION,
TK_PR_CLASS,
TK_PR_EXTENDS,
+ TK_PR_IS,
TK_PR_ONREADY,
TK_PR_TOOL,
TK_PR_STATIC,
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index d1f54e021f..9d3da8227c 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -1057,12 +1057,12 @@ Error GridMap::create_area(int p_id, const Rect3 &p_bounds) {
// FIRST VALIDATE AREA
IndexKey from, to;
- from.x = p_bounds.pos.x;
- from.y = p_bounds.pos.y;
- from.z = p_bounds.pos.z;
- to.x = p_bounds.pos.x + p_bounds.size.x;
- to.y = p_bounds.pos.y + p_bounds.size.y;
- to.z = p_bounds.pos.z + p_bounds.size.z;
+ from.x = p_bounds.position.x;
+ from.y = p_bounds.position.y;
+ from.z = p_bounds.position.z;
+ to.x = p_bounds.position.x + p_bounds.size.x;
+ to.y = p_bounds.position.y + p_bounds.size.y;
+ to.z = p_bounds.position.z + p_bounds.size.z;
for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) {
//this should somehow be faster...
@@ -1101,8 +1101,8 @@ Rect3 GridMap::area_get_bounds(int p_area) const {
const Area *a = area_map[p_area];
Rect3 aabb;
- aabb.pos = Vector3(a->from.x, a->from.y, a->from.z);
- aabb.size = Vector3(a->to.x, a->to.y, a->to.z) - aabb.pos;
+ aabb.position = Vector3(a->from.x, a->from.y, a->from.z);
+ aabb.size = Vector3(a->to.x, a->to.y, a->to.z) - aabb.position;
return aabb;
}
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index e567e08c79..954e865bcd 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -560,7 +560,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
else
return false;
- return do_input_action(p_camera, Point2(mb->get_pos().x, mb->get_pos().y), true);
+ return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true);
} else {
if (
@@ -604,7 +604,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
if (mm.is_valid()) {
- return do_input_action(p_camera, mm->get_pos(), false);
+ return do_input_action(p_camera, mm->get_position(), false);
}
} else if (edit_mode->get_selected() == 1) {
@@ -616,7 +616,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
- Point2 point = mb->get_pos();
+ Point2 point = mb->get_position();
Camera *camera = p_camera;
Vector3 from = camera->project_ray_origin(point);
@@ -635,7 +635,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
int area = E->get();
Rect3 aabb = node->area_get_bounds(area);
- aabb.pos *= node->get_cell_size();
+ aabb.position *= node->get_cell_size();
aabb.size *= node->get_cell_size();
Vector3 rclip, rnormal;
diff --git a/modules/hdr/SCsub b/modules/hdr/SCsub
new file mode 100644
index 0000000000..c960e8126b
--- /dev/null
+++ b/modules/hdr/SCsub
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_hdr = env_modules.Clone()
+
+# Godot's own source files
+env_hdr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/hdr/config.py b/modules/hdr/config.py
new file mode 100644
index 0000000000..fb920482f5
--- /dev/null
+++ b/modules/hdr/config.py
@@ -0,0 +1,7 @@
+
+def can_build(platform):
+ return True
+
+
+def configure(env):
+ pass
diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp
new file mode 100644
index 0000000000..19df27b962
--- /dev/null
+++ b/modules/hdr/image_loader_hdr.cpp
@@ -0,0 +1,161 @@
+/*************************************************************************/
+/* image_loader_jpegd.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "image_loader_hdr.h"
+
+#include "os/os.h"
+#include "print_string.h"
+
+#include "thirdparty/tinyexr/tinyexr.h"
+
+Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) {
+
+ String header = f->get_token();
+
+ print_line("HEADER: " + header);
+ ERR_FAIL_COND_V(header != "#?RADIANCE" && header != "#?RGBE", ERR_FILE_UNRECOGNIZED);
+
+ while (true) {
+ String format = f->get_token();
+ ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_UNRECOGNIZED);
+ if (format.begins_with("FORMAT=") && format != "FORMAT=32-bit_rle_rgbe") {
+ ERR_EXPLAIN("Only 32-bit_rle_rgbe is supported for .hdr files.");
+ return ERR_FILE_UNRECOGNIZED;
+ }
+ if (format == "FORMAT=32-bit_rle_rgbe")
+ break;
+ }
+
+ String token = f->get_token();
+
+ ERR_FAIL_COND_V(token != "-Y", ERR_FILE_CORRUPT);
+
+ int height = f->get_token().to_int();
+
+ token = f->get_token();
+
+ ERR_FAIL_COND_V(token != "+X", ERR_FILE_CORRUPT);
+
+ int width = f->get_line().to_int();
+
+ print_line("HDR w: " + itos(width) + " h:" + itos(height));
+
+ PoolVector<uint8_t> imgdata;
+
+ imgdata.resize(height * width * sizeof(uint32_t));
+
+ {
+
+ PoolVector<uint8_t>::Write w = imgdata.write();
+
+ uint8_t *ptr = (uint8_t *)w.ptr();
+
+ if (width < 8 || width >= 32768) {
+ // Read flat data
+
+ f->get_buffer(ptr, width * height * 4);
+ } else {
+ // Read RLE-encoded data
+
+ for (int j = 0; j < height; ++j) {
+ int c1 = f->get_8();
+ int c2 = f->get_8();
+ int len = f->get_8();
+ if (c1 != 2 || c2 != 2 || (len & 0x80)) {
+ // not run-length encoded, so we have to actually use THIS data as a decoded
+ // pixel (note this can't be a valid pixel--one of RGB must be >= 128)
+
+ ptr[(j * width) * 4 + 0] = uint8_t(c1);
+ ptr[(j * width) * 4 + 1] = uint8_t(c2);
+ ptr[(j * width) * 4 + 2] = uint8_t(len);
+ ptr[(j * width) * 4 + 3] = f->get_8();
+
+ f->get_buffer(&ptr[(j * width + 1) * 4], (width - 1) * 4);
+ continue;
+ }
+ len <<= 8;
+ len |= f->get_8();
+
+ print_line("line: " + itos(len));
+ if (len != width) {
+ ERR_EXPLAIN("invalid decoded scanline length, corrupt HDR");
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+
+ for (int k = 0; k < 4; ++k) {
+ int i = 0;
+ while (i < width) {
+ int count = f->get_8();
+ if (count > 128) {
+ // Run
+ int value = f->get_8();
+ count -= 128;
+ for (int z = 0; z < count; ++z)
+ ptr[(j * width + i++) * 4 + k] = uint8_t(value);
+ } else {
+ // Dump
+ for (int z = 0; z < count; ++z)
+ ptr[(j * width + i++) * 4 + k] = f->get_8();
+ }
+ }
+ }
+ }
+ }
+
+ //convert
+ for (int i = 0; i < width * height; i++) {
+
+ float exp = pow(2.0f, ptr[3] - 128.0f);
+
+ Color c(
+ ptr[0] * exp / 255.0,
+ ptr[1] * exp / 255.0,
+ ptr[2] * exp / 255.0);
+
+ if (p_force_linear) {
+ c = c.to_linear();
+ }
+
+ *(uint32_t *)ptr = c.to_rgbe9995();
+ ptr += 4;
+ }
+ }
+
+ p_image->create(width, height, false, Image::FORMAT_RGBE9995, imgdata);
+
+ return OK;
+}
+
+void ImageLoaderHDR::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("hdr");
+}
+
+ImageLoaderHDR::ImageLoaderHDR() {
+}
diff --git a/modules/hdr/image_loader_hdr.h b/modules/hdr/image_loader_hdr.h
new file mode 100644
index 0000000000..127833ebd0
--- /dev/null
+++ b/modules/hdr/image_loader_hdr.h
@@ -0,0 +1,46 @@
+/*************************************************************************/
+/* image_loader_jpegd.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef IMAGE_LOADER_HDR_H
+#define IMAGE_LOADER_HDR_H
+
+#include "io/image_loader.h"
+
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+class ImageLoaderHDR : public ImageFormatLoader {
+
+public:
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ ImageLoaderHDR();
+};
+
+#endif
diff --git a/modules/hdr/register_types.cpp b/modules/hdr/register_types.cpp
new file mode 100644
index 0000000000..e4f7c14aa7
--- /dev/null
+++ b/modules/hdr/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "image_loader_hdr.h"
+
+static ImageLoaderHDR *image_loader_hdr = NULL;
+
+void register_hdr_types() {
+
+ image_loader_hdr = memnew(ImageLoaderHDR);
+ ImageLoader::add_image_format_loader(image_loader_hdr);
+}
+
+void unregister_hdr_types() {
+
+ memdelete(image_loader_hdr);
+}
diff --git a/modules/hdr/register_types.h b/modules/hdr/register_types.h
new file mode 100644
index 0000000000..3d901ea003
--- /dev/null
+++ b/modules/hdr/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_hdr_types();
+void unregister_hdr_types();
diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp
index 0741dd198a..8c73b69f1b 100644
--- a/modules/jpg/image_loader_jpegd.cpp
+++ b/modules/jpg/image_loader_jpegd.cpp
@@ -89,7 +89,7 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p
return OK;
}
-Error ImageLoaderJPG::load_image(Ref<Image> p_image, FileAccess *f) {
+Error ImageLoaderJPG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) {
PoolVector<uint8_t> src_image;
int src_image_len = f->get_len();
diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h
index 57d7a2bb1c..aa073b493d 100644
--- a/modules/jpg/image_loader_jpegd.h
+++ b/modules/jpg/image_loader_jpegd.h
@@ -38,7 +38,7 @@
class ImageLoaderJPG : public ImageFormatLoader {
public:
- virtual Error load_image(Ref<Image> p_image, FileAccess *f);
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
ImageLoaderJPG();
};
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 3f7ad8b2c2..efce76c805 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -39,63 +39,135 @@
#include <squish.h>
-void image_compress_squish(Image *p_image) {
-
+void image_decompress_squish(Image *p_image) {
int w = p_image->get_width();
int h = p_image->get_height();
- if (!p_image->has_mipmaps()) {
- ERR_FAIL_COND(!w || w % 4 != 0);
- ERR_FAIL_COND(!h || h % 4 != 0);
+ Image::Format target_format = Image::FORMAT_RGBA8;
+ PoolVector<uint8_t> data;
+ int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps() ? -1 : 0);
+ int mm_count = p_image->get_mipmap_count();
+ data.resize(target_size);
+
+ PoolVector<uint8_t>::Read rb = p_image->get_data().read();
+ PoolVector<uint8_t>::Write wb = data.write();
+
+ int squish_flags = Image::FORMAT_MAX;
+ if (p_image->get_format() == Image::FORMAT_DXT1) {
+ squish_flags = squish::kDxt1;
+ } else if (p_image->get_format() == Image::FORMAT_DXT3) {
+ squish_flags = squish::kDxt3;
+ } else if (p_image->get_format() == Image::FORMAT_DXT5) {
+ squish_flags = squish::kDxt5;
+ } else if (p_image->get_format() == Image::FORMAT_RGTC_R) {
+ squish_flags = squish::kBc4;
+ } else if (p_image->get_format() == Image::FORMAT_RGTC_RG) {
+ squish_flags = squish::kBc5;
} else {
- ERR_FAIL_COND(!w || w != nearest_power_of_2(w));
- ERR_FAIL_COND(!h || h != nearest_power_of_2(h));
- };
+ print_line("wtf askd to decompress.. " + itos(p_image->get_format()));
+ ERR_FAIL_COND(true);
+ return;
+ }
+
+ int dst_ofs = 0;
+
+ for (int i = 0; i <= mm_count; i++) {
+ int src_ofs = 0, mipmap_size = 0, mipmap_w = 0, mipmap_h = 0;
+ p_image->get_mipmap_offset_size_and_dimensions(i, src_ofs, mipmap_size, mipmap_w, mipmap_h);
+ squish::DecompressImage(&wb[dst_ofs], mipmap_w, mipmap_h, &rb[src_ofs], squish_flags);
+ }
+
+ p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
+}
+
+void image_compress_squish(Image *p_image, Image::CompressSource p_source) {
if (p_image->get_format() >= Image::FORMAT_DXT1)
return; //do not compress, already compressed
- int shift = 0;
- int squish_comp = squish::kColourRangeFit;
- Image::Format target_format;
+ int w = p_image->get_width();
+ int h = p_image->get_height();
- if (p_image->get_format() == Image::FORMAT_LA8) {
- //compressed normalmap
- target_format = Image::FORMAT_DXT5;
- squish_comp |= squish::kDxt5;
- } else if (p_image->detect_alpha() != Image::ALPHA_NONE) {
+ if (p_image->get_format() <= Image::FORMAT_RGBA8) {
- target_format = Image::FORMAT_DXT3;
- squish_comp |= squish::kDxt3;
- } else {
- target_format = Image::FORMAT_DXT1;
- shift = 1;
- squish_comp |= squish::kDxt1;
- }
+ int squish_comp = squish::kColourRangeFit;
+ Image::Format target_format;
- p_image->convert(Image::FORMAT_RGBA8); //always expects rgba
+ Image::DetectChannels dc = p_image->get_detected_channels();
- PoolVector<uint8_t> data;
- int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps() ? -1 : 0);
- int mm_count = p_image->has_mipmaps() ? Image::get_image_required_mipmaps(w, h, target_format) : 0;
- data.resize(target_size);
+ p_image->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert
- PoolVector<uint8_t>::Read rb = p_image->get_data().read();
- PoolVector<uint8_t>::Write wb = data.write();
+ if (p_source == Image::COMPRESS_SOURCE_SRGB && (dc == Image::DETECTED_R || dc == Image::DETECTED_RG)) {
+ //R and RG do not support SRGB
+ dc = Image::DETECTED_RGB;
+ }
- int dst_ofs = 0;
+ if (p_source == Image::COMPRESS_SOURCE_NORMAL) {
+ //R and RG do not support SRGB
+ dc = Image::DETECTED_RG;
+ }
- for (int i = 0; i <= mm_count; i++) {
+ switch (dc) {
+ case Image::DETECTED_L: {
- int src_ofs = p_image->get_mipmap_offset(i);
- squish::CompressImage(&rb[src_ofs], w, h, &wb[dst_ofs], squish_comp);
- dst_ofs += (MAX(4, w) * MAX(4, h)) >> shift;
- w >>= 1;
- h >>= 1;
- }
+ target_format = Image::FORMAT_DXT1;
+ squish_comp |= squish::kDxt1;
+ } break;
+ case Image::DETECTED_LA: {
- rb = PoolVector<uint8_t>::Read();
- wb = PoolVector<uint8_t>::Write();
+ target_format = Image::FORMAT_DXT5;
+ squish_comp |= squish::kDxt5;
+ } break;
+ case Image::DETECTED_R: {
- p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
+ target_format = Image::FORMAT_RGTC_R;
+ squish_comp |= squish::kBc4;
+ } break;
+ case Image::DETECTED_RG: {
+
+ target_format = Image::FORMAT_RGTC_RG;
+ squish_comp |= squish::kBc5;
+ } break;
+ case Image::DETECTED_RGB: {
+
+ target_format = Image::FORMAT_DXT1;
+ squish_comp |= squish::kDxt1;
+ } break;
+ case Image::DETECTED_RGBA: {
+
+ //TODO, should convert both, then measure which one does a better job
+ target_format = Image::FORMAT_DXT5;
+ squish_comp |= squish::kDxt5;
+
+ } break;
+ }
+
+ PoolVector<uint8_t> data;
+ int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps() ? -1 : 0);
+ int mm_count = p_image->has_mipmaps() ? Image::get_image_required_mipmaps(w, h, target_format) : 0;
+ data.resize(target_size);
+ int shift = Image::get_format_pixel_rshift(target_format);
+
+ PoolVector<uint8_t>::Read rb = p_image->get_data().read();
+ PoolVector<uint8_t>::Write wb = data.write();
+
+ int dst_ofs = 0;
+
+ for (int i = 0; i <= mm_count; i++) {
+
+ int bw = w % 4 != 0 ? w + (4 - w % 4) : w;
+ int bh = h % 4 != 0 ? h + (4 - h % 4) : h;
+
+ int src_ofs = p_image->get_mipmap_offset(i);
+ squish::CompressImage(&rb[src_ofs], w, h, &wb[dst_ofs], squish_comp);
+ dst_ofs += (MAX(4, bw) * MAX(4, bh)) >> shift;
+ w >>= 1;
+ h >>= 1;
+ }
+
+ rb = PoolVector<uint8_t>::Read();
+ wb = PoolVector<uint8_t>::Write();
+
+ p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
+ }
}
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 81f57c6822..68aaeefc30 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -32,6 +32,7 @@
#include "image.h"
-void image_compress_squish(Image *p_image);
+void image_compress_squish(Image *p_image, Image::CompressSource p_source);
+void image_decompress_squish(Image *p_image);
#endif // IMAGE_COMPRESS_SQUISH_H
diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp
index 41341db93b..2eeea59836 100644
--- a/modules/squish/register_types.cpp
+++ b/modules/squish/register_types.cpp
@@ -36,6 +36,7 @@
void register_squish_types() {
Image::set_compress_bc_func(image_compress_squish);
+ Image::_image_decompress_bc = image_decompress_squish;
}
void unregister_squish_types() {}
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index 287aa4ca47..46cdfd3f2d 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -77,7 +77,7 @@ class AudioStreamOGGVorbis : public AudioStream {
GDCLASS(AudioStreamOGGVorbis, AudioStream)
OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged
- RES_BASE_EXTENSION("asogg");
+ RES_BASE_EXTENSION("oggstr");
friend class AudioStreamPlaybackOGGVorbis;
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
index 9a3d5c2651..f0a7ee1ec6 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
@@ -48,7 +48,7 @@ void ResourceImporterOGGVorbis::get_recognized_extensions(List<String> *p_extens
}
String ResourceImporterOGGVorbis::get_save_extension() const {
- return "asogg";
+ return "oggstr";
}
String ResourceImporterOGGVorbis::get_resource_type() const {
@@ -99,7 +99,7 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
ogg_stream->set_data(data);
ogg_stream->set_loop(loop);
- return ResourceSaver::save(p_save_path + ".asogg", ogg_stream);
+ return ResourceSaver::save(p_save_path + ".oggstr", ogg_stream);
}
ResourceImporterOGGVorbis::ResourceImporterOGGVorbis() {
diff --git a/modules/tga/SCsub b/modules/tga/SCsub
new file mode 100644
index 0000000000..7e405f405c
--- /dev/null
+++ b/modules/tga/SCsub
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_tga = env_modules.Clone()
+
+# Godot's own source files
+env_tga.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/tga/config.py b/modules/tga/config.py
new file mode 100644
index 0000000000..fb920482f5
--- /dev/null
+++ b/modules/tga/config.py
@@ -0,0 +1,7 @@
+
+def can_build(platform):
+ return True
+
+
+def configure(env):
+ pass
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
new file mode 100644
index 0000000000..5b8610b975
--- /dev/null
+++ b/modules/tga/image_loader_tga.cpp
@@ -0,0 +1,314 @@
+/*************************************************************************/
+/* image_loader_jpegd.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "image_loader_tga.h"
+
+#include "os/os.h"
+#include "print_string.h"
+
+Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size) {
+ Error error;
+
+ PoolVector<uint8_t> pixels;
+ error = pixels.resize(p_pixel_size);
+ if (error != OK)
+ return error;
+
+ PoolVector<uint8_t>::Write pixels_w = pixels.write();
+
+ size_t compressed_pos = 0;
+ size_t output_pos = 0;
+ size_t c = 0;
+ size_t count = 0;
+
+ while (output_pos < p_output_size) {
+ c = p_compressed_buffer[compressed_pos];
+ compressed_pos += 1;
+ count = (c & 0x7f) + 1;
+
+ if (c & 0x80) {
+ for (int i = 0; i < p_pixel_size; i++) {
+ pixels_w.ptr()[i] = p_compressed_buffer[compressed_pos];
+ compressed_pos += 1;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < p_pixel_size; j++) {
+ p_uncompressed_buffer[output_pos + j] = pixels_w.ptr()[j];
+ }
+ output_pos += p_pixel_size;
+ }
+ } else {
+ count *= p_pixel_size;
+ for (int i = 0; i < count; i++) {
+ p_uncompressed_buffer[output_pos] = p_compressed_buffer[compressed_pos];
+ compressed_pos += 1;
+ output_pos += 1;
+ }
+ }
+ }
+ return OK;
+}
+
+Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome) {
+
+#define TGA_PUT_PIXEL(r, g, b, a) \
+ int image_data_ofs = ((y * width) + x); \
+ image_data_w[image_data_ofs * 4 + 0] = r; \
+ image_data_w[image_data_ofs * 4 + 1] = g; \
+ image_data_w[image_data_ofs * 4 + 2] = b; \
+ image_data_w[image_data_ofs * 4 + 3] = a;
+
+ uint32_t width = p_header.image_width;
+ uint32_t height = p_header.image_height;
+ tga_origin_e origin = static_cast<tga_origin_e>((p_header.image_descriptor & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT);
+
+ uint32_t x_start;
+ int32_t x_step;
+ uint32_t x_end;
+ uint32_t y_start;
+ int32_t y_step;
+ uint32_t y_end;
+
+ if (origin == TGA_ORIGIN_TOP_LEFT || origin == TGA_ORIGIN_TOP_RIGHT) {
+ y_start = 0;
+ y_step = 1;
+ y_end = height;
+ } else {
+ y_start = height - 1;
+ y_step = -1;
+ y_end = -1;
+ }
+
+ if (origin == TGA_ORIGIN_TOP_LEFT || origin == TGA_ORIGIN_BOTTOM_LEFT) {
+ x_start = 0;
+ x_step = 1;
+ x_end = width;
+ } else {
+ x_start = width - 1;
+ x_step = -1;
+ x_end = -1;
+ }
+
+ PoolVector<uint8_t> image_data;
+ image_data.resize(width * height * sizeof(uint32_t));
+ PoolVector<uint8_t>::Write image_data_w = image_data.write();
+
+ size_t i = 0;
+ uint32_t x = x_start;
+ uint32_t y = y_start;
+
+ if (p_header.pixel_depth == 8) {
+ if (p_is_monochrome) {
+ while (y != y_end) {
+ while (x != x_end) {
+ uint8_t shade = p_buffer[i];
+
+ TGA_PUT_PIXEL(shade, shade, shade, 0xff)
+
+ x += x_step;
+ i += 1;
+ }
+ x = x_start;
+ y += y_step;
+ }
+ } else {
+ while (y != y_end) {
+ while (x != x_end) {
+ uint8_t index = p_buffer[i];
+ uint8_t r = 0x00;
+ uint8_t g = 0x00;
+ uint8_t b = 0x00;
+ uint8_t a = 0xff;
+
+ if (p_header.color_map_depth == 24) {
+ r = (p_palette[(index * 3) + 0]);
+ g = (p_palette[(index * 3) + 1]);
+ b = (p_palette[(index * 3) + 2]);
+ } else {
+ return ERR_INVALID_DATA;
+ }
+
+ TGA_PUT_PIXEL(r, g, b, a)
+
+ x += x_step;
+ i += 1;
+ }
+ x = x_start;
+ y += y_step;
+ }
+ }
+ } else if (p_header.pixel_depth == 24) {
+ while (y != y_end) {
+ while (x != x_end) {
+ uint8_t r = p_buffer[i + 2];
+ uint8_t g = p_buffer[i + 1];
+ uint8_t b = p_buffer[i + 0];
+
+ TGA_PUT_PIXEL(r, g, b, 0xff)
+
+ x += x_step;
+ i += 3;
+ }
+ x = x_start;
+ y += y_step;
+ }
+ } else if (p_header.pixel_depth == 32) {
+ while (y != y_end) {
+ while (x != x_end) {
+ uint8_t a = p_buffer[i + 3];
+ uint8_t r = p_buffer[i + 2];
+ uint8_t g = p_buffer[i + 1];
+ uint8_t b = p_buffer[i + 0];
+
+ TGA_PUT_PIXEL(r, g, b, a)
+
+ x += x_step;
+ i += 4;
+ }
+ x = x_start;
+ y += y_step;
+ }
+ }
+
+ image_data_w = PoolVector<uint8_t>::Write();
+
+ p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data);
+
+ return OK;
+}
+
+Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) {
+
+ PoolVector<uint8_t> src_image;
+ int src_image_len = f->get_len();
+ ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(src_image_len < sizeof(tga_header_s), ERR_FILE_CORRUPT);
+ src_image.resize(src_image_len);
+
+ Error err = OK;
+
+ tga_header_s tga_header;
+ tga_header.id_length = f->get_8();
+ tga_header.color_map_type = f->get_8();
+ tga_header.image_type = static_cast<tga_type_e>(f->get_8());
+
+ tga_header.first_color_entry = f->get_16();
+ tga_header.color_map_length = f->get_16();
+ tga_header.color_map_depth = f->get_8();
+
+ tga_header.x_origin = f->get_16();
+ tga_header.y_origin = f->get_16();
+ tga_header.image_width = f->get_16();
+ tga_header.image_height = f->get_16();
+ tga_header.pixel_depth = f->get_8();
+ tga_header.image_descriptor = f->get_8();
+
+ bool is_encoded = (tga_header.image_type == TGA_TYPE_RLE_INDEXED || tga_header.image_type == TGA_TYPE_RLE_RGB || tga_header.image_type == TGA_TYPE_RLE_MONOCHROME);
+ bool has_color_map = (tga_header.image_type == TGA_TYPE_RLE_INDEXED || tga_header.image_type == TGA_TYPE_INDEXED);
+ bool is_monochrome = (tga_header.image_type == TGA_TYPE_RLE_MONOCHROME || tga_header.image_type == TGA_TYPE_MONOCHROME);
+
+ if (tga_header.image_type == TGA_TYPE_NO_DATA)
+ err = FAILED;
+
+ if (has_color_map) {
+ if (tga_header.color_map_length > 256 || (tga_header.color_map_depth != 24) || tga_header.color_map_type != 1) {
+ err = FAILED;
+ }
+ } else {
+ if (tga_header.color_map_type) {
+ err = FAILED;
+ }
+ }
+
+ if (tga_header.image_width <= 0 || tga_header.image_height <= 0)
+ err = FAILED;
+
+ if (tga_header.pixel_depth != 8 && tga_header.pixel_depth != 24 && tga_header.pixel_depth != 32)
+ err = FAILED;
+
+ if (err == OK) {
+ f->seek(f->get_pos() + tga_header.id_length);
+
+ PoolVector<uint8_t> palette;
+
+ if (has_color_map) {
+ size_t color_map_size = tga_header.color_map_length * (tga_header.color_map_depth >> 3);
+ err = palette.resize(color_map_size);
+ if (err == OK) {
+ PoolVector<uint8_t>::Write palette_w = palette.write();
+ f->get_buffer(&palette_w[0], color_map_size);
+ } else {
+ return OK;
+ }
+ }
+
+ PoolVector<uint8_t>::Write src_image_w = src_image.write();
+ f->get_buffer(&src_image_w[0], src_image_len - f->get_pos());
+
+ PoolVector<uint8_t>::Read src_image_r = src_image.read();
+
+ const size_t pixel_size = tga_header.pixel_depth >> 3;
+ const size_t buffer_size = (tga_header.image_width * tga_header.image_height) * pixel_size;
+
+ PoolVector<uint8_t> uncompressed_buffer;
+ uncompressed_buffer.resize(buffer_size);
+ PoolVector<uint8_t>::Write uncompressed_buffer_w = uncompressed_buffer.write();
+ PoolVector<uint8_t>::Read uncompressed_buffer_r;
+
+ const uint8_t *buffer = NULL;
+
+ if (is_encoded) {
+
+ err = decode_tga_rle(src_image_r.ptr(), pixel_size, uncompressed_buffer_w.ptr(), buffer_size);
+
+ if (err == OK) {
+ uncompressed_buffer_r = uncompressed_buffer.read();
+ buffer = uncompressed_buffer_r.ptr();
+ }
+ } else {
+ buffer = src_image_r.ptr();
+ };
+
+ if (err == OK) {
+ PoolVector<uint8_t>::Read palette_r = palette.read();
+ err = convert_to_image(p_image, buffer, tga_header, palette_r.ptr(), is_monochrome);
+ }
+ }
+
+ f->close();
+ return err;
+}
+
+void ImageLoaderTGA::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("tga");
+}
+
+ImageLoaderTGA::ImageLoaderTGA() {
+}
diff --git a/modules/tga/image_loader_tga.h b/modules/tga/image_loader_tga.h
new file mode 100644
index 0000000000..11329ec68a
--- /dev/null
+++ b/modules/tga/image_loader_tga.h
@@ -0,0 +1,83 @@
+/*************************************************************************/
+/* image_loader_jpegd.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef IMAGE_LOADER_TGA_H
+#define IMAGE_LOADER_TGA_H
+
+#include "io/image_loader.h"
+
+/**
+ @author SaracenOne
+*/
+class ImageLoaderTGA : public ImageFormatLoader {
+ enum tga_type_e {
+ TGA_TYPE_NO_DATA = 0,
+ TGA_TYPE_INDEXED = 1,
+ TGA_TYPE_RGB = 2,
+ TGA_TYPE_MONOCHROME = 3,
+ TGA_TYPE_RLE_INDEXED = 9,
+ TGA_TYPE_RLE_RGB = 10,
+ TGA_TYPE_RLE_MONOCHROME = 11
+ };
+
+ enum tga_origin_e {
+ TGA_ORIGIN_BOTTOM_LEFT = 0x00,
+ TGA_ORIGIN_BOTTOM_RIGHT = 0x01,
+ TGA_ORIGIN_TOP_LEFT = 0x02,
+ TGA_ORIGIN_TOP_RIGHT = 0x03,
+ TGA_ORIGIN_SHIFT = 0x04,
+ TGA_ORIGIN_MASK = 0x30
+ };
+
+ struct tga_header_s {
+ uint8_t id_length;
+ uint8_t color_map_type;
+ tga_type_e image_type;
+
+ uint16_t first_color_entry;
+ uint16_t color_map_length;
+ uint8_t color_map_depth;
+
+ uint16_t x_origin;
+ uint16_t y_origin;
+ uint16_t image_width;
+ uint16_t image_height;
+ uint8_t pixel_depth;
+ uint8_t image_descriptor;
+ };
+ static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size);
+ static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome);
+
+public:
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ ImageLoaderTGA();
+};
+
+#endif
diff --git a/modules/tga/register_types.cpp b/modules/tga/register_types.cpp
new file mode 100644
index 0000000000..6e120fa3bf
--- /dev/null
+++ b/modules/tga/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "image_loader_tga.h"
+
+static ImageLoaderTGA *image_loader_tga = NULL;
+
+void register_tga_types() {
+
+ image_loader_tga = memnew(ImageLoaderTGA);
+ ImageLoader::add_image_format_loader(image_loader_tga);
+}
+
+void unregister_tga_types() {
+
+ memdelete(image_loader_tga);
+}
diff --git a/modules/tga/register_types.h b/modules/tga/register_types.h
new file mode 100644
index 0000000000..079b7bf291
--- /dev/null
+++ b/modules/tga/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_tga_types();
+void unregister_tga_types();
diff --git a/modules/tinyexr/SCsub b/modules/tinyexr/SCsub
new file mode 100644
index 0000000000..38fd00cc65
--- /dev/null
+++ b/modules/tinyexr/SCsub
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_tinyexr = env_modules.Clone()
+
+# Thirdparty source files
+# Not unbundled for now as they are not commonly available as shared library
+thirdparty_dir = "#thirdparty/tinyexr/"
+thirdparty_sources = [
+ "tinyexr.cc",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env_tinyexr.add_source_files(env.modules_sources, thirdparty_sources)
+env_tinyexr.Append(CPPPATH=[thirdparty_dir])
+
+# Godot's own source files
+env_tinyexr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py
new file mode 100644
index 0000000000..fb920482f5
--- /dev/null
+++ b/modules/tinyexr/config.py
@@ -0,0 +1,7 @@
+
+def can_build(platform):
+ return True
+
+
+def configure(env):
+ pass
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
new file mode 100644
index 0000000000..4eb91da10b
--- /dev/null
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -0,0 +1,168 @@
+/*************************************************************************/
+/* image_loader_jpegd.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "image_loader_tinyexr.h"
+
+#include "os/os.h"
+#include "print_string.h"
+
+#include "thirdparty/tinyexr/tinyexr.h"
+
+Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) {
+
+ PoolVector<uint8_t> src_image;
+ int src_image_len = f->get_len();
+ ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT);
+ src_image.resize(src_image_len);
+
+ PoolVector<uint8_t>::Write w = src_image.write();
+
+ f->get_buffer(&w[0], src_image_len);
+
+ f->close();
+
+ EXRVersion exr_version;
+ EXRImage exr_image;
+ EXRHeader exr_header;
+ const char *err = NULL;
+
+ InitEXRHeader(&exr_header);
+
+ int ret = ParseEXRVersionFromMemory(&exr_version, w.ptr(), src_image_len);
+ if (ret != TINYEXR_SUCCESS) {
+
+ return ERR_FILE_CORRUPT;
+ }
+
+ ret = ParseEXRHeaderFromMemory(&exr_header, &exr_version, w.ptr(), src_image_len, &err);
+ if (ret != TINYEXR_SUCCESS) {
+ if (err) {
+ ERR_PRINTS(String(err));
+ }
+ return ERR_FILE_CORRUPT;
+ }
+
+ InitEXRImage(&exr_image);
+ ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w.ptr(), src_image_len, &err);
+ if (ret != TINYEXR_SUCCESS) {
+ if (err) {
+ ERR_PRINTS(String(err));
+ }
+ return ERR_FILE_CORRUPT;
+ }
+
+ // RGBA
+ int idxR = -1;
+ int idxG = -1;
+ int idxB = -1;
+ int idxA = -1;
+ for (int c = 0; c < exr_header.num_channels; c++) {
+ if (strcmp(exr_header.channels[c].name, "R") == 0) {
+ idxR = c;
+ } else if (strcmp(exr_header.channels[c].name, "G") == 0) {
+ idxG = c;
+ } else if (strcmp(exr_header.channels[c].name, "B") == 0) {
+ idxB = c;
+ } else if (strcmp(exr_header.channels[c].name, "A") == 0) {
+ idxA = c;
+ }
+ }
+
+ if (idxR == -1) {
+ ERR_PRINT("R channel not found");
+ // @todo { free exr_image }
+ return ERR_FILE_CORRUPT;
+ }
+
+ if (idxG == -1) {
+ ERR_PRINT("G channel not found\n")
+ // @todo { free exr_image }
+ return ERR_FILE_CORRUPT;
+ }
+
+ if (idxB == -1) {
+ ERR_PRINT("B channel not found\n")
+ // @todo { free exr_image }
+ return ERR_FILE_CORRUPT;
+ }
+
+ PoolVector<uint8_t> imgdata;
+ Image::Format format;
+
+ if (idxA > 0) {
+
+ imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16
+ format = Image::FORMAT_RGBAH;
+ } else {
+
+ imgdata.resize(exr_image.width * exr_image.height * 6); //RGB16
+ format = Image::FORMAT_RGBH;
+ }
+
+ {
+
+ PoolVector<uint8_t>::Write wd = imgdata.write();
+ uint16_t *iw = (uint16_t *)wd.ptr();
+
+ // Assume `out_rgba` have enough memory allocated.
+ for (int i = 0; i < exr_image.width * exr_image.height; i++) {
+
+ Color color(
+ reinterpret_cast<float **>(exr_image.images)[idxR][i],
+ reinterpret_cast<float **>(exr_image.images)[idxG][i],
+ reinterpret_cast<float **>(exr_image.images)[idxB][i]);
+
+ if (p_force_linear)
+ color = color.to_linear();
+
+ *iw++ = Math::make_half_float(color.r);
+ *iw++ = Math::make_half_float(color.g);
+ *iw++ = Math::make_half_float(color.b);
+
+ if (idxA > 0) {
+ *iw++ = Math::make_half_float(reinterpret_cast<float **>(exr_image.images)[idxA][i]);
+ }
+ }
+ }
+
+ print_line("EXR w: " + itos(exr_image.width) + " h:" + itos(exr_image.height) + " format " + Image::get_format_name(format));
+ p_image->create(exr_image.width, exr_image.height, false, format, imgdata);
+
+ w = PoolVector<uint8_t>::Write();
+
+ return OK;
+}
+
+void ImageLoaderTinyEXR::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("exr");
+}
+
+ImageLoaderTinyEXR::ImageLoaderTinyEXR() {
+}
diff --git a/modules/tinyexr/image_loader_tinyexr.h b/modules/tinyexr/image_loader_tinyexr.h
new file mode 100644
index 0000000000..a52894b12b
--- /dev/null
+++ b/modules/tinyexr/image_loader_tinyexr.h
@@ -0,0 +1,46 @@
+/*************************************************************************/
+/* image_loader_jpegd.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef IMAGE_LOADER_TINYEXR_H
+#define IMAGE_LOADER_TINYEXR_H
+
+#include "io/image_loader.h"
+
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+class ImageLoaderTinyEXR : public ImageFormatLoader {
+
+public:
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ ImageLoaderTinyEXR();
+};
+
+#endif
diff --git a/modules/tinyexr/register_types.cpp b/modules/tinyexr/register_types.cpp
new file mode 100644
index 0000000000..73f3131276
--- /dev/null
+++ b/modules/tinyexr/register_types.cpp
@@ -0,0 +1,45 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "image_loader_tinyexr.h"
+
+static ImageLoaderTinyEXR *image_loader_tinyexr = NULL;
+
+void register_tinyexr_types() {
+
+ image_loader_tinyexr = memnew(ImageLoaderTinyEXR);
+ ImageLoader::add_image_format_loader(image_loader_tinyexr);
+}
+
+void unregister_tinyexr_types() {
+
+ memdelete(image_loader_tinyexr);
+}
diff --git a/modules/tinyexr/register_types.h b/modules/tinyexr/register_types.h
new file mode 100644
index 0000000000..f3c7372359
--- /dev/null
+++ b/modules/tinyexr/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_tinyexr_types();
+void unregister_tinyexr_types();
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index aec60391d3..bb8111ce99 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -2369,6 +2369,17 @@ Ref<Script> VisualScriptLanguage::get_template(const String &p_class_name, const
script->set_instance_base_type(p_base_class_name);
return script;
}
+
+bool VisualScriptLanguage::is_using_templates() {
+
+ return true;
+}
+
+void VisualScriptLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {
+ Ref<VisualScript> script = p_script;
+ script->set_instance_base_type(p_base_class_name);
+}
+
bool VisualScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
return false;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 72843099c7..1ccc358342 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -564,6 +564,8 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ virtual bool is_using_templates();
+ virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 5839bc9243..941668d474 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -1011,7 +1011,7 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
}
Rect2 pos = members->get_item_rect(ti);
- new_function_menu->set_position(members->get_global_position() + pos.pos + Vector2(0, pos.size.y));
+ new_function_menu->set_position(members->get_global_position() + pos.position + Vector2(0, pos.size.y));
new_function_menu->popup();
return;
} else if (p_button == 0) {
@@ -2240,6 +2240,10 @@ void VisualScriptEditor::add_callback(const String &p_function, PoolStringArray
//undo_redo->clear_history();
}
+bool VisualScriptEditor::show_members_overview() {
+ return false;
+}
+
void VisualScriptEditor::update_settings() {
_update_graph();
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index bb832431a0..92f31f20da 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -248,6 +248,7 @@ public:
virtual void get_breakpoints(List<int> *p_breakpoints);
virtual void add_callback(const String &p_function, PoolStringArray p_args);
virtual void update_settings();
+ virtual bool show_members_overview();
virtual void set_debugger_active(bool p_active);
virtual void set_tooltip_request_func(String p_method, Object *p_obj);
virtual Control *get_edit_menu();
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 7313cb6c7c..87c2e811b3 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -115,7 +115,7 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) {
return img;
}
-Error ImageLoaderWEBP::load_image(Ref<Image> p_image, FileAccess *f) {
+Error ImageLoaderWEBP::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) {
uint32_t size = f->get_len();
PoolVector<uint8_t> src_image;
diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index ba817e0ecd..1ac2196a71 100644
--- a/modules/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
@@ -38,7 +38,7 @@
class ImageLoaderWEBP : public ImageFormatLoader {
public:
- virtual Error load_image(Ref<Image> p_image, FileAccess *f);
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
ImageLoaderWEBP();
};