mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Lots of work on Audio & Physics engine:
-Added new 3D stream player node -Added ability for Area to capture sound from streams -Added small features in physics to be able to properly guess distance to areas for sound -Fixed 3D CollisionObject so shapes are added the same as in 2D, directly from children -Fixed KinematicBody API to make it the same as 2D.
This commit is contained in:
parent
e64b82ebfc
commit
2e73be99d8
64 changed files with 3834 additions and 2497 deletions
|
|
@ -29,6 +29,7 @@
|
|||
/*************************************************************************/
|
||||
#include "resource_format_binary.h"
|
||||
#include "global_config.h"
|
||||
#include "image.h"
|
||||
#include "io/file_access_compressed.h"
|
||||
#include "io/marshalls.h"
|
||||
#include "os/dir_access.h"
|
||||
|
|
@ -54,7 +55,6 @@ enum {
|
|||
VARIANT_TRANSFORM = 17,
|
||||
VARIANT_MATRIX32 = 18,
|
||||
VARIANT_COLOR = 20,
|
||||
//VARIANT_IMAGE = 21, - no longer variant type
|
||||
VARIANT_NODE_PATH = 22,
|
||||
VARIANT_RID = 23,
|
||||
VARIANT_OBJECT = 24,
|
||||
|
|
@ -70,7 +70,13 @@ enum {
|
|||
VARIANT_VECTOR2_ARRAY = 37,
|
||||
VARIANT_INT64 = 40,
|
||||
VARIANT_DOUBLE = 41,
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
VARIANT_IMAGE = 21, // - no longer variant type
|
||||
IMAGE_ENCODING_EMPTY = 0,
|
||||
IMAGE_ENCODING_RAW = 1,
|
||||
IMAGE_ENCODING_LOSSLESS = 2,
|
||||
IMAGE_ENCODING_LOSSY = 3,
|
||||
#endif
|
||||
OBJECT_EMPTY = 0,
|
||||
OBJECT_EXTERNAL_RESOURCE = 1,
|
||||
OBJECT_INTERNAL_RESOURCE = 2,
|
||||
|
|
@ -541,7 +547,69 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
|
|||
w = PoolVector<Color>::Write();
|
||||
r_v = array;
|
||||
} break;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
case VARIANT_IMAGE: {
|
||||
uint32_t encoding = f->get_32();
|
||||
if (encoding == IMAGE_ENCODING_EMPTY) {
|
||||
r_v = Ref<Image>();
|
||||
break;
|
||||
} else if (encoding == IMAGE_ENCODING_RAW) {
|
||||
uint32_t width = f->get_32();
|
||||
uint32_t height = f->get_32();
|
||||
uint32_t mipmaps = f->get_32();
|
||||
uint32_t format = f->get_32();
|
||||
const uint32_t format_version_shift = 24;
|
||||
const uint32_t format_version_mask = format_version_shift - 1;
|
||||
|
||||
uint32_t format_version = format >> format_version_shift;
|
||||
|
||||
const uint32_t current_version = 0;
|
||||
if (format_version > current_version) {
|
||||
|
||||
ERR_PRINT("Format version for encoded binary image is too new");
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
Image::Format fmt = Image::Format(format & format_version_mask); //if format changes, we can add a compatibility bit on top
|
||||
|
||||
uint32_t datalen = f->get_32();
|
||||
|
||||
PoolVector<uint8_t> imgdata;
|
||||
imgdata.resize(datalen);
|
||||
PoolVector<uint8_t>::Write w = imgdata.write();
|
||||
f->get_buffer(w.ptr(), datalen);
|
||||
_advance_padding(datalen);
|
||||
w = PoolVector<uint8_t>::Write();
|
||||
|
||||
Ref<Image> image;
|
||||
image.instance();
|
||||
image->create(width, height, mipmaps, fmt, imgdata);
|
||||
r_v = image;
|
||||
|
||||
} else {
|
||||
//compressed
|
||||
PoolVector<uint8_t> data;
|
||||
data.resize(f->get_32());
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
f->get_buffer(w.ptr(), data.size());
|
||||
w = PoolVector<uint8_t>::Write();
|
||||
|
||||
Ref<Image> image;
|
||||
|
||||
if (encoding == IMAGE_ENCODING_LOSSY && Image::lossy_unpacker) {
|
||||
|
||||
image = Image::lossy_unpacker(data);
|
||||
} else if (encoding == IMAGE_ENCODING_LOSSLESS && Image::lossless_unpacker) {
|
||||
|
||||
image = Image::lossless_unpacker(data);
|
||||
}
|
||||
_advance_padding(data.size());
|
||||
|
||||
r_v = image;
|
||||
}
|
||||
|
||||
} break;
|
||||
#endif
|
||||
default: {
|
||||
ERR_FAIL_V(ERR_FILE_CORRUPT);
|
||||
} break;
|
||||
|
|
@ -1644,7 +1712,6 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
|
|||
get_string_index(np.get_property());
|
||||
|
||||
} break;
|
||||
|
||||
default: {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue