Fix compile for 4.0.

This commit is contained in:
Relintai 2021-02-06 11:52:33 +01:00
parent f98b7410cd
commit c712c4b308
8 changed files with 65 additions and 12 deletions

View File

@ -8,7 +8,7 @@ It uses the legacy version of [rectpack2D](https://github.com/TeamHypersomnia/re
It should work on all platforms.
It supports both godot 3.2 and 4.0 (master). Note that since 4.0 is still in very early stages I only
It supports both godot 3.2 and 4.0 (master [last tested commit](https://github.com/godotengine/godot/commit/b7e10141197fdd9b0dbc4cfa7890329510d36540)). Note that since 4.0 is still in very early stages I only
check whether it works from time to time.
# Pre-built binaries

View File

@ -23,11 +23,19 @@ SOFTWARE.
#ifndef TEXTURE_LAYER_MERGER_H
#define TEXTURE_LAYER_MERGER_H
#include "core/reference.h"
#include "core/version.h"
#include "core/image.h"
#include "core/math/rect2.h"
#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#include "core/templates/vector.h"
#include "core/io/image.h"
#else
#include "core/reference.h"
#include "core/vector.h"
#include "core/image.h"
#endif
#include "core/math/rect2.h"
#include "scene/resources/texture.h"
#include "core/version.h"

View File

@ -23,10 +23,17 @@ SOFTWARE.
#ifndef TEXTURE_MERGER_H
#define TEXTURE_MERGER_H
#include "scene/main/node.h"
#include "core/version.h"
#include "core/engine.h"
#if VERSION_MAJOR > 3
#include "core/templates/vector.h"
#include "core/config/engine.h"
#else
#include "core/vector.h"
#include "core/engine.h"
#endif
#include "scene/main/node.h"
#include "texture_packer.h"

View File

@ -447,10 +447,17 @@ int TexturePacker::get_offset_for_format(Image::Format format) {
case Image::FORMAT_BPTC_RGBA:
case Image::FORMAT_BPTC_RGBF:
case Image::FORMAT_BPTC_RGBFU:
#if VERSION_MAJOR <= 3
case Image::FORMAT_PVRTC2:
case Image::FORMAT_PVRTC2A:
case Image::FORMAT_PVRTC4:
case Image::FORMAT_PVRTC4A:
#else
case Image::FORMAT_PVRTC1_2:
case Image::FORMAT_PVRTC1_2A:
case Image::FORMAT_PVRTC1_4:
case Image::FORMAT_PVRTC1_4A:
#endif
case Image::FORMAT_ETC:
case Image::FORMAT_ETC2_R11:
case Image::FORMAT_ETC2_R11S:

View File

@ -23,18 +23,27 @@ SOFTWARE.
#ifndef TEXTURE_PACKER_H
#define TEXTURE_PACKER_H
#include "core/color.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/io/image.h"
#include "core/object/reference.h"
#include "core/templates/vector.h"
#include "core/string/ustring.h"
#include "core/math/color.h"
#else
#include "core/image.h"
#include "core/reference.h"
#include "core/ustring.h"
#include "core/vector.h"
#include "core/ustring.h"
#include "core/color.h"
#endif
#include "scene/resources/texture.h"
#include <vector>
#include "rectpack2D/pack.h"
#include "core/version.h"
#if VERSION_MAJOR >= 4
#define PoolVector Vector
#define Texture Texture2D

View File

@ -23,7 +23,14 @@ SOFTWARE.
#ifndef EDITOR_PLUGIN_PACKER_IMAGE_RESOURCE_H
#define EDITOR_PLUGIN_PACKER_IMAGE_RESOURCE_H
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#else
#include "core/ustring.h"
#endif
#include "editor/editor_plugin.h"
#include "packer_image_resource_importer.h"

View File

@ -23,7 +23,14 @@ SOFTWARE.
#ifndef PACKER_IMAGE_REOURCE_H
#define PACKER_IMAGE_REOURCE_H
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/io/image.h"
#else
#include "core/image.h"
#endif
#include "scene/resources/texture.h"
class PackerImageResource : public Texture {

View File

@ -23,11 +23,19 @@ SOFTWARE.
#ifndef PACKER_IMAGE_RESOURCE_H
#define PACKER_IMAGE_RESOURCE_H
#include "core/io/resource_saver.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#include "core/io/image.h"
#else
#include "core/ustring.h"
#include "core/image.h"
#endif
#include "core/io/resource_saver.h"
#include "editor/import/editor_import_plugin.h"
#include "core/image.h"
#include "core/io/image_loader.h"
#include "packer_image_resource.h"