Update dependencies
This commit is contained in:
parent
b83dec57b5
commit
b126ec93ee
21 changed files with 35884 additions and 7790 deletions
446
raylib/external/cgltf.h
vendored
446
raylib/external/cgltf.h
vendored
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* cgltf - a single-file glTF 2.0 parser written in C99.
|
||||
*
|
||||
* Version: 1.11
|
||||
* Version: 1.12
|
||||
*
|
||||
* Website: https://github.com/jkuhlmann/cgltf
|
||||
*
|
||||
|
@ -63,7 +63,7 @@
|
|||
* By passing null for the output pointer, users can find out how many floats are required in the
|
||||
* output buffer.
|
||||
*
|
||||
* `cgltf_accessor_num_components` is a tiny utility that tells you the dimensionality of
|
||||
* `cgltf_num_components` is a tiny utility that tells you the dimensionality of
|
||||
* a certain accessor type. This can be used before `cgltf_accessor_unpack_floats` to help allocate
|
||||
* the necessary amount of memory.
|
||||
*
|
||||
|
@ -99,6 +99,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef size_t cgltf_size;
|
||||
typedef long long int cgltf_ssize;
|
||||
typedef float cgltf_float;
|
||||
typedef int cgltf_int;
|
||||
typedef unsigned int cgltf_uint;
|
||||
|
@ -109,6 +110,7 @@ typedef enum cgltf_file_type
|
|||
cgltf_file_type_invalid,
|
||||
cgltf_file_type_gltf,
|
||||
cgltf_file_type_glb,
|
||||
cgltf_file_type_max_enum
|
||||
} cgltf_file_type;
|
||||
|
||||
typedef enum cgltf_result
|
||||
|
@ -123,12 +125,13 @@ typedef enum cgltf_result
|
|||
cgltf_result_io_error,
|
||||
cgltf_result_out_of_memory,
|
||||
cgltf_result_legacy_gltf,
|
||||
cgltf_result_max_enum
|
||||
} cgltf_result;
|
||||
|
||||
typedef struct cgltf_memory_options
|
||||
{
|
||||
void* (*alloc)(void* user, cgltf_size size);
|
||||
void (*free) (void* user, void* ptr);
|
||||
void* (*alloc_func)(void* user, cgltf_size size);
|
||||
void (*free_func) (void* user, void* ptr);
|
||||
void* user_data;
|
||||
} cgltf_memory_options;
|
||||
|
||||
|
@ -152,6 +155,7 @@ typedef enum cgltf_buffer_view_type
|
|||
cgltf_buffer_view_type_invalid,
|
||||
cgltf_buffer_view_type_indices,
|
||||
cgltf_buffer_view_type_vertices,
|
||||
cgltf_buffer_view_type_max_enum
|
||||
} cgltf_buffer_view_type;
|
||||
|
||||
typedef enum cgltf_attribute_type
|
||||
|
@ -164,6 +168,8 @@ typedef enum cgltf_attribute_type
|
|||
cgltf_attribute_type_color,
|
||||
cgltf_attribute_type_joints,
|
||||
cgltf_attribute_type_weights,
|
||||
cgltf_attribute_type_custom,
|
||||
cgltf_attribute_type_max_enum
|
||||
} cgltf_attribute_type;
|
||||
|
||||
typedef enum cgltf_component_type
|
||||
|
@ -175,6 +181,7 @@ typedef enum cgltf_component_type
|
|||
cgltf_component_type_r_16u, /* UNSIGNED_SHORT */
|
||||
cgltf_component_type_r_32u, /* UNSIGNED_INT */
|
||||
cgltf_component_type_r_32f, /* FLOAT */
|
||||
cgltf_component_type_max_enum
|
||||
} cgltf_component_type;
|
||||
|
||||
typedef enum cgltf_type
|
||||
|
@ -187,6 +194,7 @@ typedef enum cgltf_type
|
|||
cgltf_type_mat2,
|
||||
cgltf_type_mat3,
|
||||
cgltf_type_mat4,
|
||||
cgltf_type_max_enum
|
||||
} cgltf_type;
|
||||
|
||||
typedef enum cgltf_primitive_type
|
||||
|
@ -198,6 +206,7 @@ typedef enum cgltf_primitive_type
|
|||
cgltf_primitive_type_triangles,
|
||||
cgltf_primitive_type_triangle_strip,
|
||||
cgltf_primitive_type_triangle_fan,
|
||||
cgltf_primitive_type_max_enum
|
||||
} cgltf_primitive_type;
|
||||
|
||||
typedef enum cgltf_alpha_mode
|
||||
|
@ -205,6 +214,7 @@ typedef enum cgltf_alpha_mode
|
|||
cgltf_alpha_mode_opaque,
|
||||
cgltf_alpha_mode_mask,
|
||||
cgltf_alpha_mode_blend,
|
||||
cgltf_alpha_mode_max_enum
|
||||
} cgltf_alpha_mode;
|
||||
|
||||
typedef enum cgltf_animation_path_type {
|
||||
|
@ -213,18 +223,21 @@ typedef enum cgltf_animation_path_type {
|
|||
cgltf_animation_path_type_rotation,
|
||||
cgltf_animation_path_type_scale,
|
||||
cgltf_animation_path_type_weights,
|
||||
cgltf_animation_path_type_max_enum
|
||||
} cgltf_animation_path_type;
|
||||
|
||||
typedef enum cgltf_interpolation_type {
|
||||
cgltf_interpolation_type_linear,
|
||||
cgltf_interpolation_type_step,
|
||||
cgltf_interpolation_type_cubic_spline,
|
||||
cgltf_interpolation_type_max_enum
|
||||
} cgltf_interpolation_type;
|
||||
|
||||
typedef enum cgltf_camera_type {
|
||||
cgltf_camera_type_invalid,
|
||||
cgltf_camera_type_perspective,
|
||||
cgltf_camera_type_orthographic,
|
||||
cgltf_camera_type_max_enum
|
||||
} cgltf_camera_type;
|
||||
|
||||
typedef enum cgltf_light_type {
|
||||
|
@ -232,12 +245,14 @@ typedef enum cgltf_light_type {
|
|||
cgltf_light_type_directional,
|
||||
cgltf_light_type_point,
|
||||
cgltf_light_type_spot,
|
||||
cgltf_light_type_max_enum
|
||||
} cgltf_light_type;
|
||||
|
||||
typedef enum cgltf_data_free_method {
|
||||
cgltf_data_free_method_none,
|
||||
cgltf_data_free_method_file_release,
|
||||
cgltf_data_free_method_memory_free,
|
||||
cgltf_data_free_method_max_enum
|
||||
} cgltf_data_free_method;
|
||||
|
||||
typedef struct cgltf_extras {
|
||||
|
@ -267,6 +282,7 @@ typedef enum cgltf_meshopt_compression_mode {
|
|||
cgltf_meshopt_compression_mode_attributes,
|
||||
cgltf_meshopt_compression_mode_triangles,
|
||||
cgltf_meshopt_compression_mode_indices,
|
||||
cgltf_meshopt_compression_mode_max_enum
|
||||
} cgltf_meshopt_compression_mode;
|
||||
|
||||
typedef enum cgltf_meshopt_compression_filter {
|
||||
|
@ -274,6 +290,7 @@ typedef enum cgltf_meshopt_compression_filter {
|
|||
cgltf_meshopt_compression_filter_octahedral,
|
||||
cgltf_meshopt_compression_filter_quaternion,
|
||||
cgltf_meshopt_compression_filter_exponential,
|
||||
cgltf_meshopt_compression_filter_max_enum
|
||||
} cgltf_meshopt_compression_filter;
|
||||
|
||||
typedef struct cgltf_meshopt_compression
|
||||
|
@ -474,6 +491,21 @@ typedef struct cgltf_sheen
|
|||
cgltf_float sheen_roughness_factor;
|
||||
} cgltf_sheen;
|
||||
|
||||
typedef struct cgltf_emissive_strength
|
||||
{
|
||||
cgltf_float emissive_strength;
|
||||
} cgltf_emissive_strength;
|
||||
|
||||
typedef struct cgltf_iridescence
|
||||
{
|
||||
cgltf_float iridescence_factor;
|
||||
cgltf_texture_view iridescence_texture;
|
||||
cgltf_float iridescence_ior;
|
||||
cgltf_float iridescence_thickness_min;
|
||||
cgltf_float iridescence_thickness_max;
|
||||
cgltf_texture_view iridescence_thickness_texture;
|
||||
} cgltf_iridescence;
|
||||
|
||||
typedef struct cgltf_material
|
||||
{
|
||||
char* name;
|
||||
|
@ -485,6 +517,8 @@ typedef struct cgltf_material
|
|||
cgltf_bool has_ior;
|
||||
cgltf_bool has_specular;
|
||||
cgltf_bool has_sheen;
|
||||
cgltf_bool has_emissive_strength;
|
||||
cgltf_bool has_iridescence;
|
||||
cgltf_pbr_metallic_roughness pbr_metallic_roughness;
|
||||
cgltf_pbr_specular_glossiness pbr_specular_glossiness;
|
||||
cgltf_clearcoat clearcoat;
|
||||
|
@ -493,6 +527,8 @@ typedef struct cgltf_material
|
|||
cgltf_sheen sheen;
|
||||
cgltf_transmission transmission;
|
||||
cgltf_volume volume;
|
||||
cgltf_emissive_strength emissive_strength;
|
||||
cgltf_iridescence iridescence;
|
||||
cgltf_texture_view normal_texture;
|
||||
cgltf_texture_view occlusion_texture;
|
||||
cgltf_texture_view emissive_texture;
|
||||
|
@ -524,6 +560,12 @@ typedef struct cgltf_draco_mesh_compression {
|
|||
cgltf_size attributes_count;
|
||||
} cgltf_draco_mesh_compression;
|
||||
|
||||
typedef struct cgltf_mesh_gpu_instancing {
|
||||
cgltf_buffer_view* buffer_view;
|
||||
cgltf_attribute* attributes;
|
||||
cgltf_size attributes_count;
|
||||
} cgltf_mesh_gpu_instancing;
|
||||
|
||||
typedef struct cgltf_primitive {
|
||||
cgltf_primitive_type type;
|
||||
cgltf_accessor* indices;
|
||||
|
@ -628,6 +670,8 @@ struct cgltf_node {
|
|||
cgltf_float scale[3];
|
||||
cgltf_float matrix[16];
|
||||
cgltf_extras extras;
|
||||
cgltf_bool has_mesh_gpu_instancing;
|
||||
cgltf_mesh_gpu_instancing mesh_gpu_instancing;
|
||||
cgltf_size extensions_count;
|
||||
cgltf_extension* extensions;
|
||||
};
|
||||
|
@ -779,8 +823,8 @@ cgltf_result cgltf_load_buffers(
|
|||
|
||||
cgltf_result cgltf_load_buffer_base64(const cgltf_options* options, cgltf_size size, const char* base64, void** out_data);
|
||||
|
||||
void cgltf_decode_string(char* string);
|
||||
void cgltf_decode_uri(char* uri);
|
||||
cgltf_size cgltf_decode_string(char* string);
|
||||
cgltf_size cgltf_decode_uri(char* uri);
|
||||
|
||||
cgltf_result cgltf_validate(cgltf_data* data);
|
||||
|
||||
|
@ -829,6 +873,10 @@ cgltf_result cgltf_copy_extras_json(const cgltf_data* data, const cgltf_extras*
|
|||
#include <stdlib.h> /* For malloc, free, atoi, atof */
|
||||
#endif
|
||||
|
||||
#if CGLTF_VALIDATE_ENABLE_ASSERTS
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
/* JSMN_PARENT_LINKS is necessary to make parsing large structures linear in input size */
|
||||
#define JSMN_PARENT_LINKS
|
||||
|
||||
|
@ -920,7 +968,7 @@ static void* cgltf_calloc(cgltf_options* options, size_t element_size, cgltf_siz
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
void* result = options->memory.alloc(options->memory.user_data, element_size * count);
|
||||
void* result = options->memory.alloc_func(options->memory.user_data, element_size * count);
|
||||
if (!result)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -932,8 +980,8 @@ static void* cgltf_calloc(cgltf_options* options, size_t element_size, cgltf_siz
|
|||
static cgltf_result cgltf_default_file_read(const struct cgltf_memory_options* memory_options, const struct cgltf_file_options* file_options, const char* path, cgltf_size* size, void** data)
|
||||
{
|
||||
(void)file_options;
|
||||
void* (*memory_alloc)(void*, cgltf_size) = memory_options->alloc ? memory_options->alloc : &cgltf_default_alloc;
|
||||
void (*memory_free)(void*, void*) = memory_options->free ? memory_options->free : &cgltf_default_free;
|
||||
void* (*memory_alloc)(void*, cgltf_size) = memory_options->alloc_func ? memory_options->alloc_func : &cgltf_default_alloc;
|
||||
void (*memory_free)(void*, void*) = memory_options->free_func ? memory_options->free_func : &cgltf_default_free;
|
||||
|
||||
FILE* file = fopen(path, "rb");
|
||||
if (!file)
|
||||
|
@ -995,7 +1043,7 @@ static cgltf_result cgltf_default_file_read(const struct cgltf_memory_options* m
|
|||
static void cgltf_default_file_release(const struct cgltf_memory_options* memory_options, const struct cgltf_file_options* file_options, void* data)
|
||||
{
|
||||
(void)file_options;
|
||||
void (*memfree)(void*, void*) = memory_options->free ? memory_options->free : &cgltf_default_free;
|
||||
void (*memfree)(void*, void*) = memory_options->free_func ? memory_options->free_func : &cgltf_default_free;
|
||||
memfree(memory_options->user_data, data);
|
||||
}
|
||||
|
||||
|
@ -1014,13 +1062,13 @@ cgltf_result cgltf_parse(const cgltf_options* options, const void* data, cgltf_s
|
|||
}
|
||||
|
||||
cgltf_options fixed_options = *options;
|
||||
if (fixed_options.memory.alloc == NULL)
|
||||
if (fixed_options.memory.alloc_func == NULL)
|
||||
{
|
||||
fixed_options.memory.alloc = &cgltf_default_alloc;
|
||||
fixed_options.memory.alloc_func = &cgltf_default_alloc;
|
||||
}
|
||||
if (fixed_options.memory.free == NULL)
|
||||
if (fixed_options.memory.free_func == NULL)
|
||||
{
|
||||
fixed_options.memory.free = &cgltf_default_free;
|
||||
fixed_options.memory.free_func = &cgltf_default_free;
|
||||
}
|
||||
|
||||
uint32_t tmp;
|
||||
|
@ -1185,8 +1233,8 @@ static void cgltf_combine_paths(char* path, const char* base, const char* uri)
|
|||
|
||||
static cgltf_result cgltf_load_buffer_file(const cgltf_options* options, cgltf_size size, const char* uri, const char* gltf_path, void** out_data)
|
||||
{
|
||||
void* (*memory_alloc)(void*, cgltf_size) = options->memory.alloc ? options->memory.alloc : &cgltf_default_alloc;
|
||||
void (*memory_free)(void*, void*) = options->memory.free ? options->memory.free : &cgltf_default_free;
|
||||
void* (*memory_alloc)(void*, cgltf_size) = options->memory.alloc_func ? options->memory.alloc_func : &cgltf_default_alloc;
|
||||
void (*memory_free)(void*, void*) = options->memory.free_func ? options->memory.free_func : &cgltf_default_free;
|
||||
cgltf_result (*file_read)(const struct cgltf_memory_options*, const struct cgltf_file_options*, const char*, cgltf_size*, void**) = options->file.read ? options->file.read : &cgltf_default_file_read;
|
||||
|
||||
char* path = (char*)memory_alloc(options->memory.user_data, strlen(uri) + strlen(gltf_path) + 1);
|
||||
|
@ -1212,8 +1260,8 @@ static cgltf_result cgltf_load_buffer_file(const cgltf_options* options, cgltf_s
|
|||
|
||||
cgltf_result cgltf_load_buffer_base64(const cgltf_options* options, cgltf_size size, const char* base64, void** out_data)
|
||||
{
|
||||
void* (*memory_alloc)(void*, cgltf_size) = options->memory.alloc ? options->memory.alloc : &cgltf_default_alloc;
|
||||
void (*memory_free)(void*, void*) = options->memory.free ? options->memory.free : &cgltf_default_free;
|
||||
void* (*memory_alloc)(void*, cgltf_size) = options->memory.alloc_func ? options->memory.alloc_func : &cgltf_default_alloc;
|
||||
void (*memory_free)(void*, void*) = options->memory.free_func ? options->memory.free_func : &cgltf_default_free;
|
||||
|
||||
unsigned char* data = (unsigned char*)memory_alloc(options->memory.user_data, size);
|
||||
if (!data)
|
||||
|
@ -1266,25 +1314,29 @@ static int cgltf_unhex(char ch)
|
|||
-1;
|
||||
}
|
||||
|
||||
void cgltf_decode_string(char* string)
|
||||
cgltf_size cgltf_decode_string(char* string)
|
||||
{
|
||||
char* read = strchr(string, '\\');
|
||||
if (read == NULL)
|
||||
char* read = string + strcspn(string, "\\");
|
||||
if (*read == 0)
|
||||
{
|
||||
return;
|
||||
return read - string;
|
||||
}
|
||||
char* write = string;
|
||||
char* last = string;
|
||||
|
||||
while (read)
|
||||
for (;;)
|
||||
{
|
||||
// Copy characters since last escaped sequence
|
||||
cgltf_size written = read - last;
|
||||
strncpy(write, last, written);
|
||||
memmove(write, last, written);
|
||||
write += written;
|
||||
|
||||
if (*read++ == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// jsmn already checked that all escape sequences are valid
|
||||
++read;
|
||||
switch (*read++)
|
||||
{
|
||||
case '\"': *write++ = '\"'; break;
|
||||
|
@ -1326,13 +1378,14 @@ void cgltf_decode_string(char* string)
|
|||
}
|
||||
|
||||
last = read;
|
||||
read = strchr(read, '\\');
|
||||
read += strcspn(read, "\\");
|
||||
}
|
||||
|
||||
strcpy(write, last);
|
||||
*write = 0;
|
||||
return write - string;
|
||||
}
|
||||
|
||||
void cgltf_decode_uri(char* uri)
|
||||
cgltf_size cgltf_decode_uri(char* uri)
|
||||
{
|
||||
char* write = uri;
|
||||
char* i = uri;
|
||||
|
@ -1360,6 +1413,7 @@ void cgltf_decode_uri(char* uri)
|
|||
}
|
||||
|
||||
*write = 0;
|
||||
return write - uri;
|
||||
}
|
||||
|
||||
cgltf_result cgltf_load_buffers(const cgltf_options* options, cgltf_data* data, const char* gltf_path)
|
||||
|
@ -1695,10 +1749,10 @@ void cgltf_free_extensions(cgltf_data* data, cgltf_extension* extensions, cgltf_
|
|||
{
|
||||
for (cgltf_size i = 0; i < extensions_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, extensions[i].name);
|
||||
data->memory.free(data->memory.user_data, extensions[i].data);
|
||||
data->memory.free_func(data->memory.user_data, extensions[i].name);
|
||||
data->memory.free_func(data->memory.user_data, extensions[i].data);
|
||||
}
|
||||
data->memory.free(data->memory.user_data, extensions);
|
||||
data->memory.free_func(data->memory.user_data, extensions);
|
||||
}
|
||||
|
||||
void cgltf_free(cgltf_data* data)
|
||||
|
@ -1710,16 +1764,16 @@ void cgltf_free(cgltf_data* data)
|
|||
|
||||
void (*file_release)(const struct cgltf_memory_options*, const struct cgltf_file_options*, void* data) = data->file.release ? data->file.release : cgltf_default_file_release;
|
||||
|
||||
data->memory.free(data->memory.user_data, data->asset.copyright);
|
||||
data->memory.free(data->memory.user_data, data->asset.generator);
|
||||
data->memory.free(data->memory.user_data, data->asset.version);
|
||||
data->memory.free(data->memory.user_data, data->asset.min_version);
|
||||
data->memory.free_func(data->memory.user_data, data->asset.copyright);
|
||||
data->memory.free_func(data->memory.user_data, data->asset.generator);
|
||||
data->memory.free_func(data->memory.user_data, data->asset.version);
|
||||
data->memory.free_func(data->memory.user_data, data->asset.min_version);
|
||||
|
||||
cgltf_free_extensions(data, data->asset.extensions, data->asset.extensions_count);
|
||||
|
||||
for (cgltf_size i = 0; i < data->accessors_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->accessors[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->accessors[i].name);
|
||||
|
||||
if(data->accessors[i].is_sparse)
|
||||
{
|
||||
|
@ -1729,20 +1783,20 @@ void cgltf_free(cgltf_data* data)
|
|||
}
|
||||
cgltf_free_extensions(data, data->accessors[i].extensions, data->accessors[i].extensions_count);
|
||||
}
|
||||
data->memory.free(data->memory.user_data, data->accessors);
|
||||
data->memory.free_func(data->memory.user_data, data->accessors);
|
||||
|
||||
for (cgltf_size i = 0; i < data->buffer_views_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->buffer_views[i].name);
|
||||
data->memory.free(data->memory.user_data, data->buffer_views[i].data);
|
||||
data->memory.free_func(data->memory.user_data, data->buffer_views[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->buffer_views[i].data);
|
||||
|
||||
cgltf_free_extensions(data, data->buffer_views[i].extensions, data->buffer_views[i].extensions_count);
|
||||
}
|
||||
data->memory.free(data->memory.user_data, data->buffer_views);
|
||||
data->memory.free_func(data->memory.user_data, data->buffer_views);
|
||||
|
||||
for (cgltf_size i = 0; i < data->buffers_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->buffers[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->buffers[i].name);
|
||||
|
||||
if (data->buffers[i].data_free_method == cgltf_data_free_method_file_release)
|
||||
{
|
||||
|
@ -1750,74 +1804,74 @@ void cgltf_free(cgltf_data* data)
|
|||
}
|
||||
else if (data->buffers[i].data_free_method == cgltf_data_free_method_memory_free)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->buffers[i].data);
|
||||
data->memory.free_func(data->memory.user_data, data->buffers[i].data);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->buffers[i].uri);
|
||||
data->memory.free_func(data->memory.user_data, data->buffers[i].uri);
|
||||
|
||||
cgltf_free_extensions(data, data->buffers[i].extensions, data->buffers[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->buffers);
|
||||
data->memory.free_func(data->memory.user_data, data->buffers);
|
||||
|
||||
for (cgltf_size i = 0; i < data->meshes_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].name);
|
||||
|
||||
for (cgltf_size j = 0; j < data->meshes[i].primitives_count; ++j)
|
||||
{
|
||||
for (cgltf_size k = 0; k < data->meshes[i].primitives[j].attributes_count; ++k)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].attributes[k].name);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].attributes[k].name);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].attributes);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].attributes);
|
||||
|
||||
for (cgltf_size k = 0; k < data->meshes[i].primitives[j].targets_count; ++k)
|
||||
{
|
||||
for (cgltf_size m = 0; m < data->meshes[i].primitives[j].targets[k].attributes_count; ++m)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].targets[k].attributes[m].name);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].targets[k].attributes[m].name);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].targets[k].attributes);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].targets[k].attributes);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].targets);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].targets);
|
||||
|
||||
if (data->meshes[i].primitives[j].has_draco_mesh_compression)
|
||||
{
|
||||
for (cgltf_size k = 0; k < data->meshes[i].primitives[j].draco_mesh_compression.attributes_count; ++k)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].draco_mesh_compression.attributes[k].name);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].draco_mesh_compression.attributes[k].name);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].draco_mesh_compression.attributes);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].draco_mesh_compression.attributes);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives[j].mappings);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives[j].mappings);
|
||||
|
||||
cgltf_free_extensions(data, data->meshes[i].primitives[j].extensions, data->meshes[i].primitives[j].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].primitives);
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].weights);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].primitives);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].weights);
|
||||
|
||||
for (cgltf_size j = 0; j < data->meshes[i].target_names_count; ++j)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].target_names[j]);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].target_names[j]);
|
||||
}
|
||||
|
||||
cgltf_free_extensions(data, data->meshes[i].extensions, data->meshes[i].extensions_count);
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes[i].target_names);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes[i].target_names);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->meshes);
|
||||
data->memory.free_func(data->memory.user_data, data->meshes);
|
||||
|
||||
for (cgltf_size i = 0; i < data->materials_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->materials[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->materials[i].name);
|
||||
|
||||
if(data->materials[i].has_pbr_metallic_roughness)
|
||||
{
|
||||
|
@ -1853,6 +1907,11 @@ void cgltf_free(cgltf_data* data)
|
|||
cgltf_free_extensions(data, data->materials[i].sheen.sheen_color_texture.extensions, data->materials[i].sheen.sheen_color_texture.extensions_count);
|
||||
cgltf_free_extensions(data, data->materials[i].sheen.sheen_roughness_texture.extensions, data->materials[i].sheen.sheen_roughness_texture.extensions_count);
|
||||
}
|
||||
if(data->materials[i].has_iridescence)
|
||||
{
|
||||
cgltf_free_extensions(data, data->materials[i].iridescence.iridescence_texture.extensions, data->materials[i].iridescence.iridescence_texture.extensions_count);
|
||||
cgltf_free_extensions(data, data->materials[i].iridescence.iridescence_thickness_texture.extensions, data->materials[i].iridescence.iridescence_thickness_texture.extensions_count);
|
||||
}
|
||||
|
||||
cgltf_free_extensions(data, data->materials[i].normal_texture.extensions, data->materials[i].normal_texture.extensions_count);
|
||||
cgltf_free_extensions(data, data->materials[i].occlusion_texture.extensions, data->materials[i].occlusion_texture.extensions_count);
|
||||
|
@ -1861,126 +1920,126 @@ void cgltf_free(cgltf_data* data)
|
|||
cgltf_free_extensions(data, data->materials[i].extensions, data->materials[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->materials);
|
||||
data->memory.free_func(data->memory.user_data, data->materials);
|
||||
|
||||
for (cgltf_size i = 0; i < data->images_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->images[i].name);
|
||||
data->memory.free(data->memory.user_data, data->images[i].uri);
|
||||
data->memory.free(data->memory.user_data, data->images[i].mime_type);
|
||||
data->memory.free_func(data->memory.user_data, data->images[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->images[i].uri);
|
||||
data->memory.free_func(data->memory.user_data, data->images[i].mime_type);
|
||||
|
||||
cgltf_free_extensions(data, data->images[i].extensions, data->images[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->images);
|
||||
data->memory.free_func(data->memory.user_data, data->images);
|
||||
|
||||
for (cgltf_size i = 0; i < data->textures_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->textures[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->textures[i].name);
|
||||
cgltf_free_extensions(data, data->textures[i].extensions, data->textures[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->textures);
|
||||
data->memory.free_func(data->memory.user_data, data->textures);
|
||||
|
||||
for (cgltf_size i = 0; i < data->samplers_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->samplers[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->samplers[i].name);
|
||||
cgltf_free_extensions(data, data->samplers[i].extensions, data->samplers[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->samplers);
|
||||
data->memory.free_func(data->memory.user_data, data->samplers);
|
||||
|
||||
for (cgltf_size i = 0; i < data->skins_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->skins[i].name);
|
||||
data->memory.free(data->memory.user_data, data->skins[i].joints);
|
||||
data->memory.free_func(data->memory.user_data, data->skins[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->skins[i].joints);
|
||||
|
||||
cgltf_free_extensions(data, data->skins[i].extensions, data->skins[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->skins);
|
||||
data->memory.free_func(data->memory.user_data, data->skins);
|
||||
|
||||
for (cgltf_size i = 0; i < data->cameras_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->cameras[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->cameras[i].name);
|
||||
cgltf_free_extensions(data, data->cameras[i].extensions, data->cameras[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->cameras);
|
||||
data->memory.free_func(data->memory.user_data, data->cameras);
|
||||
|
||||
for (cgltf_size i = 0; i < data->lights_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->lights[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->lights[i].name);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->lights);
|
||||
data->memory.free_func(data->memory.user_data, data->lights);
|
||||
|
||||
for (cgltf_size i = 0; i < data->nodes_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->nodes[i].name);
|
||||
data->memory.free(data->memory.user_data, data->nodes[i].children);
|
||||
data->memory.free(data->memory.user_data, data->nodes[i].weights);
|
||||
data->memory.free_func(data->memory.user_data, data->nodes[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->nodes[i].children);
|
||||
data->memory.free_func(data->memory.user_data, data->nodes[i].weights);
|
||||
cgltf_free_extensions(data, data->nodes[i].extensions, data->nodes[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->nodes);
|
||||
data->memory.free_func(data->memory.user_data, data->nodes);
|
||||
|
||||
for (cgltf_size i = 0; i < data->scenes_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->scenes[i].name);
|
||||
data->memory.free(data->memory.user_data, data->scenes[i].nodes);
|
||||
data->memory.free_func(data->memory.user_data, data->scenes[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->scenes[i].nodes);
|
||||
|
||||
cgltf_free_extensions(data, data->scenes[i].extensions, data->scenes[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->scenes);
|
||||
data->memory.free_func(data->memory.user_data, data->scenes);
|
||||
|
||||
for (cgltf_size i = 0; i < data->animations_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->animations[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->animations[i].name);
|
||||
for (cgltf_size j = 0; j < data->animations[i].samplers_count; ++j)
|
||||
{
|
||||
cgltf_free_extensions(data, data->animations[i].samplers[j].extensions, data->animations[i].samplers[j].extensions_count);
|
||||
}
|
||||
data->memory.free(data->memory.user_data, data->animations[i].samplers);
|
||||
data->memory.free_func(data->memory.user_data, data->animations[i].samplers);
|
||||
|
||||
for (cgltf_size j = 0; j < data->animations[i].channels_count; ++j)
|
||||
{
|
||||
cgltf_free_extensions(data, data->animations[i].channels[j].extensions, data->animations[i].channels[j].extensions_count);
|
||||
}
|
||||
data->memory.free(data->memory.user_data, data->animations[i].channels);
|
||||
data->memory.free_func(data->memory.user_data, data->animations[i].channels);
|
||||
|
||||
cgltf_free_extensions(data, data->animations[i].extensions, data->animations[i].extensions_count);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->animations);
|
||||
data->memory.free_func(data->memory.user_data, data->animations);
|
||||
|
||||
for (cgltf_size i = 0; i < data->variants_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->variants[i].name);
|
||||
data->memory.free_func(data->memory.user_data, data->variants[i].name);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->variants);
|
||||
data->memory.free_func(data->memory.user_data, data->variants);
|
||||
|
||||
cgltf_free_extensions(data, data->data_extensions, data->data_extensions_count);
|
||||
|
||||
for (cgltf_size i = 0; i < data->extensions_used_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->extensions_used[i]);
|
||||
data->memory.free_func(data->memory.user_data, data->extensions_used[i]);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->extensions_used);
|
||||
data->memory.free_func(data->memory.user_data, data->extensions_used);
|
||||
|
||||
for (cgltf_size i = 0; i < data->extensions_required_count; ++i)
|
||||
{
|
||||
data->memory.free(data->memory.user_data, data->extensions_required[i]);
|
||||
data->memory.free_func(data->memory.user_data, data->extensions_required[i]);
|
||||
}
|
||||
|
||||
data->memory.free(data->memory.user_data, data->extensions_required);
|
||||
data->memory.free_func(data->memory.user_data, data->extensions_required);
|
||||
|
||||
file_release(&data->memory, &data->file, data->file_data);
|
||||
|
||||
data->memory.free(data->memory.user_data, data);
|
||||
data->memory.free_func(data->memory.user_data, data);
|
||||
}
|
||||
|
||||
void cgltf_node_transform_local(const cgltf_node* node, cgltf_float* out_matrix)
|
||||
|
@ -2063,7 +2122,7 @@ void cgltf_node_transform_world(const cgltf_node* node, cgltf_float* out_matrix)
|
|||
}
|
||||
}
|
||||
|
||||
static cgltf_size cgltf_component_read_index(const void* in, cgltf_component_type component_type)
|
||||
static cgltf_ssize cgltf_component_read_integer(const void* in, cgltf_component_type component_type)
|
||||
{
|
||||
switch (component_type)
|
||||
{
|
||||
|
@ -2074,7 +2133,7 @@ static cgltf_size cgltf_component_read_index(const void* in, cgltf_component_typ
|
|||
case cgltf_component_type_r_32u:
|
||||
return *((const uint32_t*) in);
|
||||
case cgltf_component_type_r_32f:
|
||||
return (cgltf_size)*((const float*) in);
|
||||
return (cgltf_ssize)*((const float*) in);
|
||||
case cgltf_component_type_r_8:
|
||||
return *((const int8_t*) in);
|
||||
case cgltf_component_type_r_8u:
|
||||
|
@ -2084,6 +2143,23 @@ static cgltf_size cgltf_component_read_index(const void* in, cgltf_component_typ
|
|||
}
|
||||
}
|
||||
|
||||
static cgltf_size cgltf_component_read_index(const void* in, cgltf_component_type component_type)
|
||||
{
|
||||
switch (component_type)
|
||||
{
|
||||
case cgltf_component_type_r_16u:
|
||||
return *((const uint16_t*) in);
|
||||
case cgltf_component_type_r_32u:
|
||||
return *((const uint32_t*) in);
|
||||
case cgltf_component_type_r_32f:
|
||||
return (cgltf_size)*((const float*) in);
|
||||
case cgltf_component_type_r_8u:
|
||||
return *((const uint8_t*) in);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static cgltf_float cgltf_component_read_float(const void* in, cgltf_component_type component_type, cgltf_bool normalized)
|
||||
{
|
||||
if (component_type == cgltf_component_type_r_32f)
|
||||
|
@ -2109,7 +2185,7 @@ static cgltf_float cgltf_component_read_float(const void* in, cgltf_component_ty
|
|||
}
|
||||
}
|
||||
|
||||
return (cgltf_float)cgltf_component_read_index(in, component_type);
|
||||
return (cgltf_float)cgltf_component_read_integer(in, component_type);
|
||||
}
|
||||
|
||||
static cgltf_size cgltf_component_size(cgltf_component_type component_type);
|
||||
|
@ -2467,7 +2543,7 @@ static int cgltf_parse_json_string(cgltf_options* options, jsmntok_t const* toke
|
|||
return CGLTF_ERROR_JSON;
|
||||
}
|
||||
int size = tokens[i].end - tokens[i].start;
|
||||
char* result = (char*)options->memory.alloc(options->memory.user_data, size + 1);
|
||||
char* result = (char*)options->memory.alloc_func(options->memory.user_data, size + 1);
|
||||
if (!result)
|
||||
{
|
||||
return CGLTF_ERROR_NOMEM;
|
||||
|
@ -2522,6 +2598,12 @@ static int cgltf_parse_json_string_array(cgltf_options* options, jsmntok_t const
|
|||
|
||||
static void cgltf_parse_attribute_type(const char* name, cgltf_attribute_type* out_type, int* out_index)
|
||||
{
|
||||
if (*name == '_')
|
||||
{
|
||||
*out_type = cgltf_attribute_type_custom;
|
||||
return;
|
||||
}
|
||||
|
||||
const char* us = strchr(name, '_');
|
||||
size_t len = us ? (size_t)(us - name) : strlen(name);
|
||||
|
||||
|
@ -2620,7 +2702,7 @@ static int cgltf_parse_json_unprocessed_extension(cgltf_options* options, jsmnto
|
|||
}
|
||||
|
||||
cgltf_size name_length = tokens[i].end - tokens[i].start;
|
||||
out_extension->name = (char*)options->memory.alloc(options->memory.user_data, name_length + 1);
|
||||
out_extension->name = (char*)options->memory.alloc_func(options->memory.user_data, name_length + 1);
|
||||
if (!out_extension->name)
|
||||
{
|
||||
return CGLTF_ERROR_NOMEM;
|
||||
|
@ -2631,7 +2713,7 @@ static int cgltf_parse_json_unprocessed_extension(cgltf_options* options, jsmnto
|
|||
|
||||
size_t start = tokens[i].start;
|
||||
size_t size = tokens[i].end - start;
|
||||
out_extension->data = (char*)options->memory.alloc(options->memory.user_data, size + 1);
|
||||
out_extension->data = (char*)options->memory.alloc_func(options->memory.user_data, size + 1);
|
||||
if (!out_extension->data)
|
||||
{
|
||||
return CGLTF_ERROR_NOMEM;
|
||||
|
@ -2712,6 +2794,37 @@ static int cgltf_parse_json_draco_mesh_compression(cgltf_options* options, jsmnt
|
|||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_mesh_gpu_instancing(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_mesh_gpu_instancing* out_mesh_gpu_instancing)
|
||||
{
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
|
||||
int size = tokens[i].size;
|
||||
++i;
|
||||
|
||||
for (int j = 0; j < size; ++j)
|
||||
{
|
||||
CGLTF_CHECK_KEY(tokens[i]);
|
||||
|
||||
if (cgltf_json_strcmp(tokens + i, json_chunk, "attributes") == 0)
|
||||
{
|
||||
i = cgltf_parse_json_attribute_list(options, tokens, i + 1, json_chunk, &out_mesh_gpu_instancing->attributes, &out_mesh_gpu_instancing->attributes_count);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "bufferView") == 0)
|
||||
{
|
||||
++i;
|
||||
out_mesh_gpu_instancing->buffer_view = CGLTF_PTRINDEX(cgltf_buffer_view, cgltf_json_to_int(tokens + i, json_chunk));
|
||||
++i;
|
||||
}
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_material_mapping_data(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_material_mapping* out_mappings, cgltf_size* offset)
|
||||
{
|
||||
(void)options;
|
||||
|
@ -3838,6 +3951,100 @@ static int cgltf_parse_json_sheen(cgltf_options* options, jsmntok_t const* token
|
|||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_emissive_strength(jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_emissive_strength* out_emissive_strength)
|
||||
{
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
int size = tokens[i].size;
|
||||
++i;
|
||||
|
||||
// Default
|
||||
out_emissive_strength->emissive_strength = 1.f;
|
||||
|
||||
for (int j = 0; j < size; ++j)
|
||||
{
|
||||
CGLTF_CHECK_KEY(tokens[i]);
|
||||
|
||||
if (cgltf_json_strcmp(tokens + i, json_chunk, "emissiveStrength") == 0)
|
||||
{
|
||||
++i;
|
||||
out_emissive_strength->emissive_strength = cgltf_json_to_float(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_skip_json(tokens, i + 1);
|
||||
}
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_iridescence(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_iridescence* out_iridescence)
|
||||
{
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
int size = tokens[i].size;
|
||||
++i;
|
||||
|
||||
// Default
|
||||
out_iridescence->iridescence_ior = 1.3f;
|
||||
out_iridescence->iridescence_thickness_min = 100.f;
|
||||
out_iridescence->iridescence_thickness_max = 400.f;
|
||||
|
||||
for (int j = 0; j < size; ++j)
|
||||
{
|
||||
CGLTF_CHECK_KEY(tokens[i]);
|
||||
|
||||
if (cgltf_json_strcmp(tokens + i, json_chunk, "iridescenceFactor") == 0)
|
||||
{
|
||||
++i;
|
||||
out_iridescence->iridescence_factor = cgltf_json_to_float(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "iridescenceTexture") == 0)
|
||||
{
|
||||
i = cgltf_parse_json_texture_view(options, tokens, i + 1, json_chunk, &out_iridescence->iridescence_texture);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "iridescenceIor") == 0)
|
||||
{
|
||||
++i;
|
||||
out_iridescence->iridescence_ior = cgltf_json_to_float(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "iridescenceThicknessMinimum") == 0)
|
||||
{
|
||||
++i;
|
||||
out_iridescence->iridescence_thickness_min = cgltf_json_to_float(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "iridescenceThicknessMaximum") == 0)
|
||||
{
|
||||
++i;
|
||||
out_iridescence->iridescence_thickness_max = cgltf_json_to_float(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "iridescenceThicknessTexture") == 0)
|
||||
{
|
||||
i = cgltf_parse_json_texture_view(options, tokens, i + 1, json_chunk, &out_iridescence->iridescence_thickness_texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_skip_json(tokens, i + 1);
|
||||
}
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_image(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_image* out_image)
|
||||
{
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
|
@ -4035,6 +4242,10 @@ static int cgltf_parse_json_texture(cgltf_options* options, jsmntok_t const* tok
|
|||
{
|
||||
i = cgltf_skip_json(tokens, i + 1);
|
||||
}
|
||||
if (i < 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4212,6 +4423,16 @@ static int cgltf_parse_json_material(cgltf_options* options, jsmntok_t const* to
|
|||
out_material->has_sheen = 1;
|
||||
i = cgltf_parse_json_sheen(options, tokens, i + 1, json_chunk, &out_material->sheen);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "KHR_materials_emissive_strength") == 0)
|
||||
{
|
||||
out_material->has_emissive_strength = 1;
|
||||
i = cgltf_parse_json_emissive_strength(tokens, i + 1, json_chunk, &out_material->emissive_strength);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "KHR_materials_iridescence") == 0)
|
||||
{
|
||||
out_material->has_iridescence = 1;
|
||||
i = cgltf_parse_json_iridescence(options, tokens, i + 1, json_chunk, &out_material->iridescence);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_parse_json_unprocessed_extension(options, tokens, i, json_chunk, &(out_material->extensions[out_material->extensions_count++]));
|
||||
|
@ -5172,6 +5393,11 @@ static int cgltf_parse_json_node(cgltf_options* options, jsmntok_t const* tokens
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "EXT_mesh_gpu_instancing") == 0)
|
||||
{
|
||||
out_node->has_mesh_gpu_instancing = 1;
|
||||
i = cgltf_parse_json_mesh_gpu_instancing(options, tokens, i + 1, json_chunk, &out_node->mesh_gpu_instancing);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_parse_json_unprocessed_extension(options, tokens, i, json_chunk, &(out_node->extensions[out_node->extensions_count++]));
|
||||
|
@ -5899,7 +6125,7 @@ cgltf_result cgltf_parse_json(cgltf_options* options, const uint8_t* json_chunk,
|
|||
options->json_token_count = token_count;
|
||||
}
|
||||
|
||||
jsmntok_t* tokens = (jsmntok_t*)options->memory.alloc(options->memory.user_data, sizeof(jsmntok_t) * (options->json_token_count + 1));
|
||||
jsmntok_t* tokens = (jsmntok_t*)options->memory.alloc_func(options->memory.user_data, sizeof(jsmntok_t) * (options->json_token_count + 1));
|
||||
|
||||
if (!tokens)
|
||||
{
|
||||
|
@ -5912,7 +6138,7 @@ cgltf_result cgltf_parse_json(cgltf_options* options, const uint8_t* json_chunk,
|
|||
|
||||
if (token_count <= 0)
|
||||
{
|
||||
options->memory.free(options->memory.user_data, tokens);
|
||||
options->memory.free_func(options->memory.user_data, tokens);
|
||||
return cgltf_result_invalid_json;
|
||||
}
|
||||
|
||||
|
@ -5920,11 +6146,11 @@ cgltf_result cgltf_parse_json(cgltf_options* options, const uint8_t* json_chunk,
|
|||
// for invalid JSON inputs this makes sure we don't perform out of bound reads of token data
|
||||
tokens[token_count].type = JSMN_UNDEFINED;
|
||||
|
||||
cgltf_data* data = (cgltf_data*)options->memory.alloc(options->memory.user_data, sizeof(cgltf_data));
|
||||
cgltf_data* data = (cgltf_data*)options->memory.alloc_func(options->memory.user_data, sizeof(cgltf_data));
|
||||
|
||||
if (!data)
|
||||
{
|
||||
options->memory.free(options->memory.user_data, tokens);
|
||||
options->memory.free_func(options->memory.user_data, tokens);
|
||||
return cgltf_result_out_of_memory;
|
||||
}
|
||||
|
||||
|
@ -5934,7 +6160,7 @@ cgltf_result cgltf_parse_json(cgltf_options* options, const uint8_t* json_chunk,
|
|||
|
||||
int i = cgltf_parse_json_root(options, tokens, 0, json_chunk, data);
|
||||
|
||||
options->memory.free(options->memory.user_data, tokens);
|
||||
options->memory.free_func(options->memory.user_data, tokens);
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
|
@ -6058,6 +6284,9 @@ static int cgltf_fixup_pointers(cgltf_data* data)
|
|||
|
||||
CGLTF_PTRFIXUP(data->materials[i].sheen.sheen_color_texture.texture, data->textures, data->textures_count);
|
||||
CGLTF_PTRFIXUP(data->materials[i].sheen.sheen_roughness_texture.texture, data->textures, data->textures_count);
|
||||
|
||||
CGLTF_PTRFIXUP(data->materials[i].iridescence.iridescence_texture.texture, data->textures, data->textures_count);
|
||||
CGLTF_PTRFIXUP(data->materials[i].iridescence.iridescence_thickness_texture.texture, data->textures, data->textures_count);
|
||||
}
|
||||
|
||||
for (cgltf_size i = 0; i < data->buffer_views_count; ++i)
|
||||
|
@ -6099,6 +6328,15 @@ static int cgltf_fixup_pointers(cgltf_data* data)
|
|||
CGLTF_PTRFIXUP(data->nodes[i].skin, data->skins, data->skins_count);
|
||||
CGLTF_PTRFIXUP(data->nodes[i].camera, data->cameras, data->cameras_count);
|
||||
CGLTF_PTRFIXUP(data->nodes[i].light, data->lights, data->lights_count);
|
||||
|
||||
if (data->nodes[i].has_mesh_gpu_instancing)
|
||||
{
|
||||
CGLTF_PTRFIXUP_REQ(data->nodes[i].mesh_gpu_instancing.buffer_view, data->buffer_views, data->buffer_views_count);
|
||||
for (cgltf_size m = 0; m < data->nodes[i].mesh_gpu_instancing.attributes_count; ++m)
|
||||
{
|
||||
CGLTF_PTRFIXUP_REQ(data->nodes[i].mesh_gpu_instancing.attributes[m].data, data->accessors, data->accessors_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (cgltf_size i = 0; i < data->scenes_count; ++i)
|
||||
|
|
704
raylib/external/dr_wav.h
vendored
704
raylib/external/dr_wav.h
vendored
File diff suppressed because it is too large
Load diff
|
@ -92,9 +92,6 @@ extern "C" {
|
|||
// @raysan5: Actually, only HWND handler needs to be defined
|
||||
// Including windows.h could suppose symbols re-definition issues (i.e Rectangle type)
|
||||
//#include <windows.h>
|
||||
typedef void *PVOID;
|
||||
typedef PVOID HANDLE;
|
||||
typedef HANDLE HWND;
|
||||
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
#if defined(__OBJC__)
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2015 Samsung Electronics Co., Ltd
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
#ifndef IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
@ -165,10 +165,8 @@ zwp_idle_inhibit_manager_v1_get_version(struct zwp_idle_inhibit_manager_v1 *zwp_
|
|||
static inline void
|
||||
zwp_idle_inhibit_manager_v1_destroy(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
|
||||
ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_idle_inhibit_manager_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
|
||||
ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,8 +179,8 @@ zwp_idle_inhibit_manager_v1_create_inhibitor(struct zwp_idle_inhibit_manager_v1
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
|
||||
ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR, &zwp_idle_inhibitor_v1_interface, NULL, surface);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_idle_inhibit_manager_v1,
|
||||
ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR, &zwp_idle_inhibitor_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibit_manager_v1), 0, NULL, surface);
|
||||
|
||||
return (struct zwp_idle_inhibitor_v1 *) id;
|
||||
}
|
||||
|
@ -223,10 +221,8 @@ zwp_idle_inhibitor_v1_get_version(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibit
|
|||
static inline void
|
||||
zwp_idle_inhibitor_v1_destroy(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_idle_inhibitor_v1,
|
||||
ZWP_IDLE_INHIBITOR_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_idle_inhibitor_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_idle_inhibitor_v1,
|
||||
ZWP_IDLE_INHIBITOR_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_idle_inhibitor_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2014 Jonas Ådahl
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
#ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
@ -244,15 +244,30 @@ enum zwp_pointer_constraints_v1_error {
|
|||
#define ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM
|
||||
/**
|
||||
* @ingroup iface_zwp_pointer_constraints_v1
|
||||
* the pointer constraint may reactivate
|
||||
* constraint lifetime
|
||||
*
|
||||
* A persistent pointer constraint may again reactivate once it has
|
||||
* been deactivated. See the corresponding deactivation event
|
||||
* (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||
* details.
|
||||
* These values represent different lifetime semantics. They are passed
|
||||
* as arguments to the factory requests to specify how the constraint
|
||||
* lifetimes should be managed.
|
||||
*/
|
||||
enum zwp_pointer_constraints_v1_lifetime {
|
||||
/**
|
||||
* the pointer constraint is defunct once deactivated
|
||||
*
|
||||
* A oneshot pointer constraint will never reactivate once it has
|
||||
* been deactivated. See the corresponding deactivation event
|
||||
* (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined)
|
||||
* for details.
|
||||
*/
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1,
|
||||
/**
|
||||
* the pointer constraint may reactivate
|
||||
*
|
||||
* A persistent pointer constraint may again reactivate once it
|
||||
* has been deactivated. See the corresponding deactivation event
|
||||
* (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined)
|
||||
* for details.
|
||||
*/
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2,
|
||||
};
|
||||
#endif /* ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM */
|
||||
|
@ -304,10 +319,8 @@ zwp_pointer_constraints_v1_get_version(struct zwp_pointer_constraints_v1 *zwp_po
|
|||
static inline void
|
||||
zwp_pointer_constraints_v1_destroy(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_pointer_constraints_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,8 +366,8 @@ zwp_pointer_constraints_v1_lock_pointer(struct zwp_pointer_constraints_v1 *zwp_p
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface, NULL, surface, pointer, region, lifetime);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), 0, NULL, surface, pointer, region, lifetime);
|
||||
|
||||
return (struct zwp_locked_pointer_v1 *) id;
|
||||
}
|
||||
|
@ -385,8 +398,8 @@ zwp_pointer_constraints_v1_confine_pointer(struct zwp_pointer_constraints_v1 *zw
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER, &zwp_confined_pointer_v1_interface, NULL, surface, pointer, region, lifetime);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
|
||||
ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER, &zwp_confined_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), 0, NULL, surface, pointer, region, lifetime);
|
||||
|
||||
return (struct zwp_confined_pointer_v1 *) id;
|
||||
}
|
||||
|
@ -484,10 +497,8 @@ zwp_locked_pointer_v1_get_version(struct zwp_locked_pointer_v1 *zwp_locked_point
|
|||
static inline void
|
||||
zwp_locked_pointer_v1_destroy(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_locked_pointer_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_locked_pointer_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,8 +519,8 @@ zwp_locked_pointer_v1_destroy(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v
|
|||
static inline void
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, wl_fixed_t surface_x, wl_fixed_t surface_y)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT, surface_x, surface_y);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_locked_pointer_v1), 0, surface_x, surface_y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -526,8 +537,8 @@ zwp_locked_pointer_v1_set_cursor_position_hint(struct zwp_locked_pointer_v1 *zwp
|
|||
static inline void
|
||||
zwp_locked_pointer_v1_set_region(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, struct wl_region *region)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_SET_REGION, region);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_locked_pointer_v1,
|
||||
ZWP_LOCKED_POINTER_V1_SET_REGION, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_locked_pointer_v1), 0, region);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -618,10 +629,8 @@ zwp_confined_pointer_v1_get_version(struct zwp_confined_pointer_v1 *zwp_confined
|
|||
static inline void
|
||||
zwp_confined_pointer_v1_destroy(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
ZWP_CONFINED_POINTER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_confined_pointer_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
ZWP_CONFINED_POINTER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_confined_pointer_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -647,8 +656,8 @@ zwp_confined_pointer_v1_destroy(struct zwp_confined_pointer_v1 *zwp_confined_poi
|
|||
static inline void
|
||||
zwp_confined_pointer_v1_set_region(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1, struct wl_region *region)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
ZWP_CONFINED_POINTER_V1_SET_REGION, region);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_confined_pointer_v1,
|
||||
ZWP_CONFINED_POINTER_V1_SET_REGION, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_confined_pointer_v1), 0, region);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2014 Jonas Ådahl
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
#ifndef RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
@ -158,10 +158,8 @@ zwp_relative_pointer_manager_v1_get_version(struct zwp_relative_pointer_manager_
|
|||
static inline void
|
||||
zwp_relative_pointer_manager_v1_destroy(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_relative_pointer_manager_v1,
|
||||
ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_relative_pointer_manager_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_relative_pointer_manager_v1,
|
||||
ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_manager_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,8 +173,8 @@ zwp_relative_pointer_manager_v1_get_relative_pointer(struct zwp_relative_pointer
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_relative_pointer_manager_v1,
|
||||
ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER, &zwp_relative_pointer_v1_interface, NULL, pointer);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_relative_pointer_manager_v1,
|
||||
ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER, &zwp_relative_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_manager_v1), 0, NULL, pointer);
|
||||
|
||||
return (struct zwp_relative_pointer_v1 *) id;
|
||||
}
|
||||
|
@ -288,10 +286,8 @@ zwp_relative_pointer_v1_get_version(struct zwp_relative_pointer_v1 *zwp_relative
|
|||
static inline void
|
||||
zwp_relative_pointer_v1_destroy(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_relative_pointer_v1,
|
||||
ZWP_RELATIVE_POINTER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_relative_pointer_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zwp_relative_pointer_v1,
|
||||
ZWP_RELATIVE_POINTER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_relative_pointer_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2013-2016 Collabora, Ltd.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
#ifndef VIEWPORTER_CLIENT_PROTOCOL_H
|
||||
#define VIEWPORTER_CLIENT_PROTOCOL_H
|
||||
|
@ -126,12 +126,6 @@ extern const struct wl_interface wp_viewporter_interface;
|
|||
* when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
* out_of_buffer error.
|
||||
*
|
||||
* The x, y arguments of wl_surface.attach are applied as normal to
|
||||
* the surface. They indicate how many pixels to remove from the
|
||||
* surface size from the left and the top. In other words, they are
|
||||
* still in the surface-local coordinate system, just like dst_width
|
||||
* and dst_height are.
|
||||
*
|
||||
* If the wl_surface associated with the wp_viewport is destroyed,
|
||||
* all wp_viewport requests except 'destroy' raise the protocol error
|
||||
* no_surface.
|
||||
|
@ -193,12 +187,6 @@ extern const struct wl_interface wp_viewporter_interface;
|
|||
* when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
* out_of_buffer error.
|
||||
*
|
||||
* The x, y arguments of wl_surface.attach are applied as normal to
|
||||
* the surface. They indicate how many pixels to remove from the
|
||||
* surface size from the left and the top. In other words, they are
|
||||
* still in the surface-local coordinate system, just like dst_width
|
||||
* and dst_height are.
|
||||
*
|
||||
* If the wl_surface associated with the wp_viewport is destroyed,
|
||||
* all wp_viewport requests except 'destroy' raise the protocol error
|
||||
* no_surface.
|
||||
|
@ -263,10 +251,8 @@ wp_viewporter_get_version(struct wp_viewporter *wp_viewporter)
|
|||
static inline void
|
||||
wp_viewporter_destroy(struct wp_viewporter *wp_viewporter)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewporter,
|
||||
WP_VIEWPORTER_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) wp_viewporter);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
|
||||
WP_VIEWPORTER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,8 +268,8 @@ wp_viewporter_get_viewport(struct wp_viewporter *wp_viewporter, struct wl_surfac
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) wp_viewporter,
|
||||
WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, NULL, surface);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
|
||||
WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), 0, NULL, surface);
|
||||
|
||||
return (struct wp_viewport *) id;
|
||||
}
|
||||
|
@ -357,10 +343,8 @@ wp_viewport_get_version(struct wp_viewport *wp_viewport)
|
|||
static inline void
|
||||
wp_viewport_destroy(struct wp_viewport *wp_viewport)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) wp_viewport);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -381,8 +365,8 @@ wp_viewport_destroy(struct wp_viewport *wp_viewport)
|
|||
static inline void
|
||||
wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_SET_SOURCE, x, y, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_SET_SOURCE, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -403,8 +387,8 @@ wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t
|
|||
static inline void
|
||||
wp_viewport_set_destination(struct wp_viewport *wp_viewport, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_SET_DESTINATION, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
|
||||
WP_VIEWPORT_SET_DESTINATION, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, width, height);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2018 Simon Ser
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
#ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
@ -174,10 +174,8 @@ zxdg_decoration_manager_v1_get_version(struct zxdg_decoration_manager_v1 *zxdg_d
|
|||
static inline void
|
||||
zxdg_decoration_manager_v1_destroy(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_decoration_manager_v1,
|
||||
ZXDG_DECORATION_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zxdg_decoration_manager_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_decoration_manager_v1,
|
||||
ZXDG_DECORATION_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,8 +194,8 @@ zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manage
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zxdg_decoration_manager_v1,
|
||||
ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, NULL, toplevel);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_decoration_manager_v1,
|
||||
ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1), 0, NULL, toplevel);
|
||||
|
||||
return (struct zxdg_toplevel_decoration_v1 *) id;
|
||||
}
|
||||
|
@ -325,10 +323,8 @@ zxdg_toplevel_decoration_v1_get_version(struct zxdg_toplevel_decoration_v1 *zxdg
|
|||
static inline void
|
||||
zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zxdg_toplevel_decoration_v1);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -356,8 +352,8 @@ zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_top
|
|||
static inline void
|
||||
zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, mode);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1), 0, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -371,8 +367,8 @@ zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_to
|
|||
static inline void
|
||||
zxdg_toplevel_decoration_v1_unset_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_decoration_v1,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1), 0);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2008-2013 Kristian Høgsberg
|
||||
|
@ -81,7 +81,7 @@ static const struct wl_message xdg_wm_base_events[] = {
|
|||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_wm_base_interface = {
|
||||
"xdg_wm_base", 3,
|
||||
"xdg_wm_base", 5,
|
||||
4, xdg_wm_base_requests,
|
||||
1, xdg_wm_base_events,
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ static const struct wl_message xdg_positioner_requests[] = {
|
|||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_positioner_interface = {
|
||||
"xdg_positioner", 3,
|
||||
"xdg_positioner", 5,
|
||||
10, xdg_positioner_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
@ -118,7 +118,7 @@ static const struct wl_message xdg_surface_events[] = {
|
|||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_surface_interface = {
|
||||
"xdg_surface", 3,
|
||||
"xdg_surface", 5,
|
||||
5, xdg_surface_requests,
|
||||
1, xdg_surface_events,
|
||||
};
|
||||
|
@ -143,12 +143,14 @@ static const struct wl_message xdg_toplevel_requests[] = {
|
|||
static const struct wl_message xdg_toplevel_events[] = {
|
||||
{ "configure", "iia", xdg_shell_wl_xs_types + 0 },
|
||||
{ "close", "", xdg_shell_wl_xs_types + 0 },
|
||||
{ "configure_bounds", "4ii", xdg_shell_wl_xs_types + 0 },
|
||||
{ "wm_capabilities", "5a", xdg_shell_wl_xs_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_toplevel_interface = {
|
||||
"xdg_toplevel", 3,
|
||||
"xdg_toplevel", 5,
|
||||
14, xdg_toplevel_requests,
|
||||
2, xdg_toplevel_events,
|
||||
4, xdg_toplevel_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_requests[] = {
|
||||
|
@ -164,7 +166,7 @@ static const struct wl_message xdg_popup_events[] = {
|
|||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_popup_interface = {
|
||||
"xdg_popup", 3,
|
||||
"xdg_popup", 5,
|
||||
3, xdg_popup_requests,
|
||||
3, xdg_popup_events,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.19.0 */
|
||||
/* Generated by wayland-scanner 1.21.0 */
|
||||
|
||||
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
|
||||
#define XDG_SHELL_CLIENT_PROTOCOL_H
|
||||
|
@ -185,7 +185,8 @@ extern const struct wl_interface xdg_positioner_interface;
|
|||
*
|
||||
* A newly-unmapped surface is considered to have met condition (1) out
|
||||
* of the 3 required conditions for mapping a surface if its role surface
|
||||
* has not been destroyed.
|
||||
* has not been destroyed, i.e. the client must perform the initial commit
|
||||
* again before attaching a buffer.
|
||||
* @section page_iface_xdg_surface_api API
|
||||
* See @ref iface_xdg_surface.
|
||||
*/
|
||||
|
@ -235,7 +236,8 @@ extern const struct wl_interface xdg_positioner_interface;
|
|||
*
|
||||
* A newly-unmapped surface is considered to have met condition (1) out
|
||||
* of the 3 required conditions for mapping a surface if its role surface
|
||||
* has not been destroyed.
|
||||
* has not been destroyed, i.e. the client must perform the initial commit
|
||||
* again before attaching a buffer.
|
||||
*/
|
||||
extern const struct wl_interface xdg_surface_interface;
|
||||
#endif
|
||||
|
@ -479,10 +481,8 @@ xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base)
|
|||
static inline void
|
||||
xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_wm_base);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -497,8 +497,8 @@ xdg_wm_base_create_positioner(struct xdg_wm_base *xdg_wm_base)
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, NULL);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL);
|
||||
|
||||
return (struct xdg_positioner *) id;
|
||||
}
|
||||
|
@ -525,8 +525,8 @@ xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL, surface);
|
||||
|
||||
return (struct xdg_surface *) id;
|
||||
}
|
||||
|
@ -540,8 +540,8 @@ xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *
|
|||
static inline void
|
||||
xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_PONG, serial);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
|
||||
XDG_WM_BASE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, serial);
|
||||
}
|
||||
|
||||
#ifndef XDG_POSITIONER_ERROR_ENUM
|
||||
|
@ -588,17 +588,106 @@ enum xdg_positioner_gravity {
|
|||
#define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
* vertically resize the surface
|
||||
* constraint adjustments
|
||||
*
|
||||
* Resize the surface vertically so that it is completely unconstrained.
|
||||
* The constraint adjustment value define ways the compositor will adjust
|
||||
* the position of the surface, if the unadjusted position would result
|
||||
* in the surface being partly constrained.
|
||||
*
|
||||
* Whether a surface is considered 'constrained' is left to the compositor
|
||||
* to determine. For example, the surface may be partly outside the
|
||||
* compositor's defined 'work area', thus necessitating the child surface's
|
||||
* position be adjusted until it is entirely inside the work area.
|
||||
*
|
||||
* The adjustments can be combined, according to a defined precedence: 1)
|
||||
* Flip, 2) Slide, 3) Resize.
|
||||
*/
|
||||
enum xdg_positioner_constraint_adjustment {
|
||||
/**
|
||||
* don't move the child surface when constrained
|
||||
*
|
||||
* Don't alter the surface position even if it is constrained on
|
||||
* some axis, for example partially outside the edge of an output.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0,
|
||||
/**
|
||||
* move along the x axis until unconstrained
|
||||
*
|
||||
* Slide the surface along the x axis until it is no longer
|
||||
* constrained.
|
||||
*
|
||||
* First try to slide towards the direction of the gravity on the x
|
||||
* axis until either the edge in the opposite direction of the
|
||||
* gravity is unconstrained or the edge in the direction of the
|
||||
* gravity is constrained.
|
||||
*
|
||||
* Then try to slide towards the opposite direction of the gravity
|
||||
* on the x axis until either the edge in the direction of the
|
||||
* gravity is unconstrained or the edge in the opposite direction
|
||||
* of the gravity is constrained.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
|
||||
/**
|
||||
* move along the y axis until unconstrained
|
||||
*
|
||||
* Slide the surface along the y axis until it is no longer
|
||||
* constrained.
|
||||
*
|
||||
* First try to slide towards the direction of the gravity on the y
|
||||
* axis until either the edge in the opposite direction of the
|
||||
* gravity is unconstrained or the edge in the direction of the
|
||||
* gravity is constrained.
|
||||
*
|
||||
* Then try to slide towards the opposite direction of the gravity
|
||||
* on the y axis until either the edge in the direction of the
|
||||
* gravity is unconstrained or the edge in the opposite direction
|
||||
* of the gravity is constrained.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
|
||||
/**
|
||||
* invert the anchor and gravity on the x axis
|
||||
*
|
||||
* Invert the anchor and gravity on the x axis if the surface is
|
||||
* constrained on the x axis. For example, if the left edge of the
|
||||
* surface is constrained, the gravity is 'left' and the anchor is
|
||||
* 'left', change the gravity to 'right' and the anchor to 'right'.
|
||||
*
|
||||
* If the adjusted position also ends up being constrained, the
|
||||
* resulting position of the flip_x adjustment will be the one
|
||||
* before the adjustment.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
|
||||
/**
|
||||
* invert the anchor and gravity on the y axis
|
||||
*
|
||||
* Invert the anchor and gravity on the y axis if the surface is
|
||||
* constrained on the y axis. For example, if the bottom edge of
|
||||
* the surface is constrained, the gravity is 'bottom' and the
|
||||
* anchor is 'bottom', change the gravity to 'top' and the anchor
|
||||
* to 'top'.
|
||||
*
|
||||
* The adjusted position is calculated given the original anchor
|
||||
* rectangle and offset, but with the new flipped anchor and
|
||||
* gravity values.
|
||||
*
|
||||
* If the adjusted position also ends up being constrained, the
|
||||
* resulting position of the flip_y adjustment will be the one
|
||||
* before the adjustment.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
|
||||
/**
|
||||
* horizontally resize the surface
|
||||
*
|
||||
* Resize the surface horizontally so that it is completely
|
||||
* unconstrained.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
|
||||
/**
|
||||
* vertically resize the surface
|
||||
*
|
||||
* Resize the surface vertically so that it is completely
|
||||
* unconstrained.
|
||||
*/
|
||||
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,
|
||||
};
|
||||
#endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */
|
||||
|
@ -684,10 +773,8 @@ xdg_positioner_get_version(struct xdg_positioner *xdg_positioner)
|
|||
static inline void
|
||||
xdg_positioner_destroy(struct xdg_positioner *xdg_positioner)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_positioner);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -702,8 +789,8 @@ xdg_positioner_destroy(struct xdg_positioner *xdg_positioner)
|
|||
static inline void
|
||||
xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_SIZE, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -723,8 +810,8 @@ xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, in
|
|||
static inline void
|
||||
xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_ANCHOR_RECT, x, y, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -740,8 +827,8 @@ xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x,
|
|||
static inline void
|
||||
xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_ANCHOR, anchor);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, anchor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -757,8 +844,8 @@ xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor
|
|||
static inline void
|
||||
xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravity)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_GRAVITY, gravity);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, gravity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -781,8 +868,8 @@ xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravi
|
|||
static inline void
|
||||
xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner, uint32_t constraint_adjustment)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, constraint_adjustment);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, constraint_adjustment);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -803,8 +890,8 @@ xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner,
|
|||
static inline void
|
||||
xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_OFFSET, x, y);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -820,8 +907,8 @@ xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int3
|
|||
static inline void
|
||||
xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_REACTIVE);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_REACTIVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -838,8 +925,8 @@ xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
|
|||
static inline void
|
||||
xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_PARENT_SIZE, parent_width, parent_height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_PARENT_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, parent_width, parent_height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -853,8 +940,8 @@ xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t pa
|
|||
static inline void
|
||||
xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_PARENT_CONFIGURE, serial);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_PARENT_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, serial);
|
||||
}
|
||||
|
||||
#ifndef XDG_SURFACE_ERROR_ENUM
|
||||
|
@ -972,10 +1059,8 @@ xdg_surface_get_version(struct xdg_surface *xdg_surface)
|
|||
static inline void
|
||||
xdg_surface_destroy(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_surface);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -992,8 +1077,8 @@ xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_GET_TOPLEVEL, &xdg_toplevel_interface, NULL);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_GET_TOPLEVEL, &xdg_toplevel_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL);
|
||||
|
||||
return (struct xdg_toplevel *) id;
|
||||
}
|
||||
|
@ -1015,8 +1100,8 @@ xdg_surface_get_popup(struct xdg_surface *xdg_surface, struct xdg_surface *paren
|
|||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_GET_POPUP, &xdg_popup_interface, NULL, parent, positioner);
|
||||
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_GET_POPUP, &xdg_popup_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL, parent, positioner);
|
||||
|
||||
return (struct xdg_popup *) id;
|
||||
}
|
||||
|
@ -1057,8 +1142,8 @@ xdg_surface_get_popup(struct xdg_surface *xdg_surface, struct xdg_surface *paren
|
|||
static inline void
|
||||
xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_WINDOW_GEOMETRY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1087,10 +1172,20 @@ xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int3
|
|||
static inline void
|
||||
xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_ACK_CONFIGURE, serial);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_ACK_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, serial);
|
||||
}
|
||||
|
||||
#ifndef XDG_TOPLEVEL_ERROR_ENUM
|
||||
#define XDG_TOPLEVEL_ERROR_ENUM
|
||||
enum xdg_toplevel_error {
|
||||
/**
|
||||
* provided value is not a valid variant of the resize_edge enum
|
||||
*/
|
||||
XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE = 0,
|
||||
};
|
||||
#endif /* XDG_TOPLEVEL_ERROR_ENUM */
|
||||
|
||||
#ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM
|
||||
#define XDG_TOPLEVEL_RESIZE_EDGE_ENUM
|
||||
/**
|
||||
|
@ -1117,41 +1212,87 @@ enum xdg_toplevel_resize_edge {
|
|||
#define XDG_TOPLEVEL_STATE_ENUM
|
||||
/**
|
||||
* @ingroup iface_xdg_toplevel
|
||||
* the surface is tiled
|
||||
* types of state on the surface
|
||||
*
|
||||
* The window is currently in a tiled layout and the bottom edge is
|
||||
* considered to be adjacent to another part of the tiling grid.
|
||||
* The different state values used on the surface. This is designed for
|
||||
* state values like maximized, fullscreen. It is paired with the
|
||||
* configure event to ensure that both the client and the compositor
|
||||
* setting the state can be synchronized.
|
||||
*
|
||||
* States set in this way are double-buffered. They will get applied on
|
||||
* the next commit.
|
||||
*/
|
||||
enum xdg_toplevel_state {
|
||||
/**
|
||||
* the surface is maximized
|
||||
* the surface is maximized
|
||||
*
|
||||
* The surface is maximized. The window geometry specified in the
|
||||
* configure event must be obeyed by the client.
|
||||
*
|
||||
* The client should draw without shadow or other decoration
|
||||
* outside of the window geometry.
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_MAXIMIZED = 1,
|
||||
/**
|
||||
* the surface is fullscreen
|
||||
* the surface is fullscreen
|
||||
*
|
||||
* The surface is fullscreen. The window geometry specified in
|
||||
* the configure event is a maximum; the client cannot resize
|
||||
* beyond it. For a surface to cover the whole fullscreened area,
|
||||
* the geometry dimensions must be obeyed by the client. For more
|
||||
* details, see xdg_toplevel.set_fullscreen.
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_FULLSCREEN = 2,
|
||||
/**
|
||||
* the surface is being resized
|
||||
* the surface is being resized
|
||||
*
|
||||
* The surface is being resized. The window geometry specified in
|
||||
* the configure event is a maximum; the client cannot resize
|
||||
* beyond it. Clients that have aspect ratio or cell sizing
|
||||
* configuration can use a smaller size, however.
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_RESIZING = 3,
|
||||
/**
|
||||
* the surface is now activated
|
||||
* the surface is now activated
|
||||
*
|
||||
* Client window decorations should be painted as if the window
|
||||
* is active. Do not assume this means that the window actually has
|
||||
* keyboard or pointer focus.
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_ACTIVATED = 4,
|
||||
/**
|
||||
* the surface’s left edge is tiled
|
||||
*
|
||||
* The window is currently in a tiled layout and the left edge is
|
||||
* considered to be adjacent to another part of the tiling grid.
|
||||
* @since 2
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_TILED_LEFT = 5,
|
||||
/**
|
||||
* the surface’s right edge is tiled
|
||||
*
|
||||
* The window is currently in a tiled layout and the right edge
|
||||
* is considered to be adjacent to another part of the tiling grid.
|
||||
* @since 2
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_TILED_RIGHT = 6,
|
||||
/**
|
||||
* the surface’s top edge is tiled
|
||||
*
|
||||
* The window is currently in a tiled layout and the top edge is
|
||||
* considered to be adjacent to another part of the tiling grid.
|
||||
* @since 2
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_TILED_TOP = 7,
|
||||
/**
|
||||
* the surface’s bottom edge is tiled
|
||||
*
|
||||
* The window is currently in a tiled layout and the bottom edge
|
||||
* is considered to be adjacent to another part of the tiling grid.
|
||||
* @since 2
|
||||
*/
|
||||
XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8,
|
||||
|
@ -1174,6 +1315,28 @@ enum xdg_toplevel_state {
|
|||
#define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 2
|
||||
#endif /* XDG_TOPLEVEL_STATE_ENUM */
|
||||
|
||||
#ifndef XDG_TOPLEVEL_WM_CAPABILITIES_ENUM
|
||||
#define XDG_TOPLEVEL_WM_CAPABILITIES_ENUM
|
||||
enum xdg_toplevel_wm_capabilities {
|
||||
/**
|
||||
* show_window_menu is available
|
||||
*/
|
||||
XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1,
|
||||
/**
|
||||
* set_maximized and unset_maximized are available
|
||||
*/
|
||||
XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 2,
|
||||
/**
|
||||
* set_fullscreen and unset_fullscreen are available
|
||||
*/
|
||||
XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3,
|
||||
/**
|
||||
* set_minimized is available
|
||||
*/
|
||||
XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 4,
|
||||
};
|
||||
#endif /* XDG_TOPLEVEL_WM_CAPABILITIES_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_toplevel
|
||||
* @struct xdg_toplevel_listener
|
||||
|
@ -1223,6 +1386,61 @@ struct xdg_toplevel_listener {
|
|||
*/
|
||||
void (*close)(void *data,
|
||||
struct xdg_toplevel *xdg_toplevel);
|
||||
/**
|
||||
* recommended window geometry bounds
|
||||
*
|
||||
* The configure_bounds event may be sent prior to a
|
||||
* xdg_toplevel.configure event to communicate the bounds a window
|
||||
* geometry size is recommended to constrain to.
|
||||
*
|
||||
* The passed width and height are in surface coordinate space. If
|
||||
* width and height are 0, it means bounds is unknown and
|
||||
* equivalent to as if no configure_bounds event was ever sent for
|
||||
* this surface.
|
||||
*
|
||||
* The bounds can for example correspond to the size of a monitor
|
||||
* excluding any panels or other shell components, so that a
|
||||
* surface isn't created in a way that it cannot fit.
|
||||
*
|
||||
* The bounds may change at any point, and in such a case, a new
|
||||
* xdg_toplevel.configure_bounds will be sent, followed by
|
||||
* xdg_toplevel.configure and xdg_surface.configure.
|
||||
* @since 4
|
||||
*/
|
||||
void (*configure_bounds)(void *data,
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
int32_t width,
|
||||
int32_t height);
|
||||
/**
|
||||
* compositor capabilities
|
||||
*
|
||||
* This event advertises the capabilities supported by the
|
||||
* compositor. If a capability isn't supported, clients should hide
|
||||
* or disable the UI elements that expose this functionality. For
|
||||
* instance, if the compositor doesn't advertise support for
|
||||
* minimized toplevels, a button triggering the set_minimized
|
||||
* request should not be displayed.
|
||||
*
|
||||
* The compositor will ignore requests it doesn't support. For
|
||||
* instance, a compositor which doesn't advertise support for
|
||||
* minimized will ignore set_minimized requests.
|
||||
*
|
||||
* Compositors must send this event once before the first
|
||||
* xdg_surface.configure event. When the capabilities change,
|
||||
* compositors must send this event again and then send an
|
||||
* xdg_surface.configure event.
|
||||
*
|
||||
* The configured state should not be applied immediately. See
|
||||
* xdg_surface.configure for details.
|
||||
*
|
||||
* The capabilities are sent as an array of 32-bit unsigned
|
||||
* integers in native endianness.
|
||||
* @param capabilities array of 32-bit capabilities
|
||||
* @since 5
|
||||
*/
|
||||
void (*wm_capabilities)(void *data,
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
struct wl_array *capabilities);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1259,6 +1477,14 @@ xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel,
|
|||
* @ingroup iface_xdg_toplevel
|
||||
*/
|
||||
#define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_toplevel
|
||||
*/
|
||||
#define XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION 4
|
||||
/**
|
||||
* @ingroup iface_xdg_toplevel
|
||||
*/
|
||||
#define XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION 5
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_toplevel
|
||||
|
@ -1346,10 +1572,8 @@ xdg_toplevel_get_version(struct xdg_toplevel *xdg_toplevel)
|
|||
static inline void
|
||||
xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_toplevel);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1358,25 +1582,25 @@ xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
|
|||
* Set the "parent" of this surface. This surface should be stacked
|
||||
* above the parent surface and all other ancestor surfaces.
|
||||
*
|
||||
* Parent windows should be set on dialogs, toolboxes, or other
|
||||
* Parent surfaces should be set on dialogs, toolboxes, or other
|
||||
* "auxiliary" surfaces, so that the parent is raised when the dialog
|
||||
* is raised.
|
||||
*
|
||||
* Setting a null parent for a child window removes any parent-child
|
||||
* relationship for the child. Setting a null parent for a window which
|
||||
* currently has no parent is a no-op.
|
||||
* Setting a null parent for a child surface unsets its parent. Setting
|
||||
* a null parent for a surface which currently has no parent is a no-op.
|
||||
*
|
||||
* If the parent is unmapped then its children are managed as
|
||||
* though the parent of the now-unmapped parent has become the
|
||||
* parent of this surface. If no parent exists for the now-unmapped
|
||||
* parent then the children are managed as though they have no
|
||||
* parent surface.
|
||||
* Only mapped surfaces can have child surfaces. Setting a parent which
|
||||
* is not mapped is equivalent to setting a null parent. If a surface
|
||||
* becomes unmapped, its children's parent is set to the parent of
|
||||
* the now-unmapped surface. If the now-unmapped surface has no parent,
|
||||
* its children's parent is unset. If the now-unmapped surface becomes
|
||||
* mapped again, its parent-child relationship is not restored.
|
||||
*/
|
||||
static inline void
|
||||
xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *parent)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_PARENT, parent);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_PARENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1393,8 +1617,8 @@ xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *
|
|||
static inline void
|
||||
xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_TITLE, title);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1427,8 +1651,8 @@ xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
|
|||
static inline void
|
||||
xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_APP_ID, app_id);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, app_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1449,8 +1673,8 @@ xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
|
|||
static inline void
|
||||
xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SHOW_WINDOW_MENU, seat, serial, x, y);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SHOW_WINDOW_MENU, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1476,8 +1700,8 @@ xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat
|
|||
static inline void
|
||||
xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_MOVE, seat, serial);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1507,18 +1731,19 @@ xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint3
|
|||
* guarantee that the device focus will return when the resize is
|
||||
* completed.
|
||||
*
|
||||
* The edges parameter specifies how the surface should be resized,
|
||||
* and is one of the values of the resize_edge enum. The compositor
|
||||
* may use this information to update the surface position for
|
||||
* example when dragging the top left corner. The compositor may also
|
||||
* use this information to adapt its behavior, e.g. choose an
|
||||
* appropriate cursor image.
|
||||
* The edges parameter specifies how the surface should be resized, and
|
||||
* is one of the values of the resize_edge enum. Values not matching
|
||||
* a variant of the enum will cause a protocol error. The compositor
|
||||
* may use this information to update the surface position for example
|
||||
* when dragging the top left corner. The compositor may also use
|
||||
* this information to adapt its behavior, e.g. choose an appropriate
|
||||
* cursor image.
|
||||
*/
|
||||
static inline void
|
||||
xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, uint32_t edges)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_RESIZE, seat, serial, edges);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, edges);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1562,8 +1787,8 @@ xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uin
|
|||
static inline void
|
||||
xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MAX_SIZE, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MAX_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1607,8 +1832,8 @@ xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int3
|
|||
static inline void
|
||||
xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MIN_SIZE, width, height);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MIN_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1637,8 +1862,8 @@ xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int3
|
|||
static inline void
|
||||
xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MAXIMIZED);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1669,8 +1894,8 @@ xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
|
|||
static inline void
|
||||
xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_UNSET_MAXIMIZED);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_UNSET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1703,8 +1928,8 @@ xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel)
|
|||
static inline void
|
||||
xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_FULLSCREEN, output);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1731,8 +1956,8 @@ xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output
|
|||
static inline void
|
||||
xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_UNSET_FULLSCREEN);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_UNSET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1750,8 +1975,8 @@ xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
|
|||
static inline void
|
||||
xdg_toplevel_set_minimized(struct xdg_toplevel *xdg_toplevel)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MINIMIZED);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
|
||||
XDG_TOPLEVEL_SET_MINIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
|
||||
}
|
||||
|
||||
#ifndef XDG_POPUP_ERROR_ENUM
|
||||
|
@ -1906,10 +2131,8 @@ xdg_popup_get_version(struct xdg_popup *xdg_popup)
|
|||
static inline void
|
||||
xdg_popup_destroy(struct xdg_popup *xdg_popup)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_popup);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), WL_MARSHAL_FLAG_DESTROY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1941,10 +2164,6 @@ xdg_popup_destroy(struct xdg_popup *xdg_popup)
|
|||
* nested grabbing popup as well. When a compositor dismisses popups, it
|
||||
* will follow the same dismissing order as required from the client.
|
||||
*
|
||||
* The parent of a grabbing popup must either be another xdg_popup with an
|
||||
* active explicit grab, or an xdg_popup or xdg_toplevel, if there are no
|
||||
* explicit grabs already taken.
|
||||
*
|
||||
* If the topmost grabbing popup is destroyed, the grab will be returned to
|
||||
* the parent of the popup, if that parent previously had an explicit grab.
|
||||
*
|
||||
|
@ -1960,8 +2179,8 @@ xdg_popup_destroy(struct xdg_popup *xdg_popup)
|
|||
static inline void
|
||||
xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_GRAB, seat, serial);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_GRAB, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, seat, serial);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1994,8 +2213,8 @@ xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t seria
|
|||
static inline void
|
||||
xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_REPOSITION, positioner, token);
|
||||
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_REPOSITION, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, positioner, token);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
2
raylib/external/glfw/src/wl_init.c
vendored
2
raylib/external/glfw/src/wl_init.c
vendored
|
@ -26,7 +26,7 @@
|
|||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
//#define _POSIX_C_SOURCE 199309L
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
6529
raylib/external/m3d.h
vendored
Normal file
6529
raylib/external/m3d.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
34602
raylib/external/miniaudio.h
vendored
34602
raylib/external/miniaudio.h
vendored
File diff suppressed because it is too large
Load diff
671
raylib/external/qoi.h
vendored
Normal file
671
raylib/external/qoi.h
vendored
Normal file
|
@ -0,0 +1,671 @@
|
|||
/*
|
||||
|
||||
QOI - The "Quite OK Image" format for fast, lossless image compression
|
||||
|
||||
Dominic Szablewski - https://phoboslab.org
|
||||
|
||||
|
||||
-- LICENSE: The MIT License(MIT)
|
||||
|
||||
Copyright(c) 2021 Dominic Szablewski
|
||||
|
||||
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.
|
||||
|
||||
|
||||
-- About
|
||||
|
||||
QOI encodes and decodes images in a lossless format. Compared to stb_image and
|
||||
stb_image_write QOI offers 20x-50x faster encoding, 3x-4x faster decoding and
|
||||
20% better compression.
|
||||
|
||||
|
||||
-- Synopsis
|
||||
|
||||
// Define `QOI_IMPLEMENTATION` in *one* C/C++ file before including this
|
||||
// library to create the implementation.
|
||||
|
||||
#define QOI_IMPLEMENTATION
|
||||
#include "qoi.h"
|
||||
|
||||
// Encode and store an RGBA buffer to the file system. The qoi_desc describes
|
||||
// the input pixel data.
|
||||
qoi_write("image_new.qoi", rgba_pixels, &(qoi_desc){
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.channels = 4,
|
||||
.colorspace = QOI_SRGB
|
||||
});
|
||||
|
||||
// Load and decode a QOI image from the file system into a 32bbp RGBA buffer.
|
||||
// The qoi_desc struct will be filled with the width, height, number of channels
|
||||
// and colorspace read from the file header.
|
||||
qoi_desc desc;
|
||||
void *rgba_pixels = qoi_read("image.qoi", &desc, 4);
|
||||
|
||||
|
||||
|
||||
-- Documentation
|
||||
|
||||
This library provides the following functions;
|
||||
- qoi_read -- read and decode a QOI file
|
||||
- qoi_decode -- decode the raw bytes of a QOI image from memory
|
||||
- qoi_write -- encode and write a QOI file
|
||||
- qoi_encode -- encode an rgba buffer into a QOI image in memory
|
||||
|
||||
See the function declaration below for the signature and more information.
|
||||
|
||||
If you don't want/need the qoi_read and qoi_write functions, you can define
|
||||
QOI_NO_STDIO before including this library.
|
||||
|
||||
This library uses malloc() and free(). To supply your own malloc implementation
|
||||
you can define QOI_MALLOC and QOI_FREE before including this library.
|
||||
|
||||
This library uses memset() to zero-initialize the index. To supply your own
|
||||
implementation you can define QOI_ZEROARR before including this library.
|
||||
|
||||
|
||||
-- Data Format
|
||||
|
||||
A QOI file has a 14 byte header, followed by any number of data "chunks" and an
|
||||
8-byte end marker.
|
||||
|
||||
struct qoi_header_t {
|
||||
char magic[4]; // magic bytes "qoif"
|
||||
uint32_t width; // image width in pixels (BE)
|
||||
uint32_t height; // image height in pixels (BE)
|
||||
uint8_t channels; // 3 = RGB, 4 = RGBA
|
||||
uint8_t colorspace; // 0 = sRGB with linear alpha, 1 = all channels linear
|
||||
};
|
||||
|
||||
Images are encoded row by row, left to right, top to bottom. The decoder and
|
||||
encoder start with {r: 0, g: 0, b: 0, a: 255} as the previous pixel value. An
|
||||
image is complete when all pixels specified by width * height have been covered.
|
||||
|
||||
Pixels are encoded as
|
||||
- a run of the previous pixel
|
||||
- an index into an array of previously seen pixels
|
||||
- a difference to the previous pixel value in r,g,b
|
||||
- full r,g,b or r,g,b,a values
|
||||
|
||||
The color channels are assumed to not be premultiplied with the alpha channel
|
||||
("un-premultiplied alpha").
|
||||
|
||||
A running array[64] (zero-initialized) of previously seen pixel values is
|
||||
maintained by the encoder and decoder. Each pixel that is seen by the encoder
|
||||
and decoder is put into this array at the position formed by a hash function of
|
||||
the color value. In the encoder, if the pixel value at the index matches the
|
||||
current pixel, this index position is written to the stream as QOI_OP_INDEX.
|
||||
The hash function for the index is:
|
||||
|
||||
index_position = (r * 3 + g * 5 + b * 7 + a * 11) % 64
|
||||
|
||||
Each chunk starts with a 2- or 8-bit tag, followed by a number of data bits. The
|
||||
bit length of chunks is divisible by 8 - i.e. all chunks are byte aligned. All
|
||||
values encoded in these data bits have the most significant bit on the left.
|
||||
|
||||
The 8-bit tags have precedence over the 2-bit tags. A decoder must check for the
|
||||
presence of an 8-bit tag first.
|
||||
|
||||
The byte stream's end is marked with 7 0x00 bytes followed a single 0x01 byte.
|
||||
|
||||
|
||||
The possible chunks are:
|
||||
|
||||
|
||||
.- QOI_OP_INDEX ----------.
|
||||
| Byte[0] |
|
||||
| 7 6 5 4 3 2 1 0 |
|
||||
|-------+-----------------|
|
||||
| 0 0 | index |
|
||||
`-------------------------`
|
||||
2-bit tag b00
|
||||
6-bit index into the color index array: 0..63
|
||||
|
||||
A valid encoder must not issue 2 or more consecutive QOI_OP_INDEX chunks to the
|
||||
same index. QOI_OP_RUN should be used instead.
|
||||
|
||||
|
||||
.- QOI_OP_DIFF -----------.
|
||||
| Byte[0] |
|
||||
| 7 6 5 4 3 2 1 0 |
|
||||
|-------+-----+-----+-----|
|
||||
| 0 1 | dr | dg | db |
|
||||
`-------------------------`
|
||||
2-bit tag b01
|
||||
2-bit red channel difference from the previous pixel between -2..1
|
||||
2-bit green channel difference from the previous pixel between -2..1
|
||||
2-bit blue channel difference from the previous pixel between -2..1
|
||||
|
||||
The difference to the current channel values are using a wraparound operation,
|
||||
so "1 - 2" will result in 255, while "255 + 1" will result in 0.
|
||||
|
||||
Values are stored as unsigned integers with a bias of 2. E.g. -2 is stored as
|
||||
0 (b00). 1 is stored as 3 (b11).
|
||||
|
||||
The alpha value remains unchanged from the previous pixel.
|
||||
|
||||
|
||||
.- QOI_OP_LUMA -------------------------------------.
|
||||
| Byte[0] | Byte[1] |
|
||||
| 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 |
|
||||
|-------+-----------------+-------------+-----------|
|
||||
| 1 0 | green diff | dr - dg | db - dg |
|
||||
`---------------------------------------------------`
|
||||
2-bit tag b10
|
||||
6-bit green channel difference from the previous pixel -32..31
|
||||
4-bit red channel difference minus green channel difference -8..7
|
||||
4-bit blue channel difference minus green channel difference -8..7
|
||||
|
||||
The green channel is used to indicate the general direction of change and is
|
||||
encoded in 6 bits. The red and blue channels (dr and db) base their diffs off
|
||||
of the green channel difference and are encoded in 4 bits. I.e.:
|
||||
dr_dg = (cur_px.r - prev_px.r) - (cur_px.g - prev_px.g)
|
||||
db_dg = (cur_px.b - prev_px.b) - (cur_px.g - prev_px.g)
|
||||
|
||||
The difference to the current channel values are using a wraparound operation,
|
||||
so "10 - 13" will result in 253, while "250 + 7" will result in 1.
|
||||
|
||||
Values are stored as unsigned integers with a bias of 32 for the green channel
|
||||
and a bias of 8 for the red and blue channel.
|
||||
|
||||
The alpha value remains unchanged from the previous pixel.
|
||||
|
||||
|
||||
.- QOI_OP_RUN ------------.
|
||||
| Byte[0] |
|
||||
| 7 6 5 4 3 2 1 0 |
|
||||
|-------+-----------------|
|
||||
| 1 1 | run |
|
||||
`-------------------------`
|
||||
2-bit tag b11
|
||||
6-bit run-length repeating the previous pixel: 1..62
|
||||
|
||||
The run-length is stored with a bias of -1. Note that the run-lengths 63 and 64
|
||||
(b111110 and b111111) are illegal as they are occupied by the QOI_OP_RGB and
|
||||
QOI_OP_RGBA tags.
|
||||
|
||||
|
||||
.- QOI_OP_RGB ------------------------------------------.
|
||||
| Byte[0] | Byte[1] | Byte[2] | Byte[3] |
|
||||
| 7 6 5 4 3 2 1 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 |
|
||||
|-------------------------+---------+---------+---------|
|
||||
| 1 1 1 1 1 1 1 0 | red | green | blue |
|
||||
`-------------------------------------------------------`
|
||||
8-bit tag b11111110
|
||||
8-bit red channel value
|
||||
8-bit green channel value
|
||||
8-bit blue channel value
|
||||
|
||||
The alpha value remains unchanged from the previous pixel.
|
||||
|
||||
|
||||
.- QOI_OP_RGBA ---------------------------------------------------.
|
||||
| Byte[0] | Byte[1] | Byte[2] | Byte[3] | Byte[4] |
|
||||
| 7 6 5 4 3 2 1 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 |
|
||||
|-------------------------+---------+---------+---------+---------|
|
||||
| 1 1 1 1 1 1 1 1 | red | green | blue | alpha |
|
||||
`-----------------------------------------------------------------`
|
||||
8-bit tag b11111111
|
||||
8-bit red channel value
|
||||
8-bit green channel value
|
||||
8-bit blue channel value
|
||||
8-bit alpha channel value
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Header - Public functions */
|
||||
|
||||
#ifndef QOI_H
|
||||
#define QOI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* A pointer to a qoi_desc struct has to be supplied to all of qoi's functions.
|
||||
It describes either the input format (for qoi_write and qoi_encode), or is
|
||||
filled with the description read from the file header (for qoi_read and
|
||||
qoi_decode).
|
||||
|
||||
The colorspace in this qoi_desc is an enum where
|
||||
0 = sRGB, i.e. gamma scaled RGB channels and a linear alpha channel
|
||||
1 = all channels are linear
|
||||
You may use the constants QOI_SRGB or QOI_LINEAR. The colorspace is purely
|
||||
informative. It will be saved to the file header, but does not affect
|
||||
how chunks are en-/decoded. */
|
||||
|
||||
#define QOI_SRGB 0
|
||||
#define QOI_LINEAR 1
|
||||
|
||||
typedef struct {
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned char channels;
|
||||
unsigned char colorspace;
|
||||
} qoi_desc;
|
||||
|
||||
#ifndef QOI_NO_STDIO
|
||||
|
||||
/* Encode raw RGB or RGBA pixels into a QOI image and write it to the file
|
||||
system. The qoi_desc struct must be filled with the image width, height,
|
||||
number of channels (3 = RGB, 4 = RGBA) and the colorspace.
|
||||
|
||||
The function returns 0 on failure (invalid parameters, or fopen or malloc
|
||||
failed) or the number of bytes written on success. */
|
||||
|
||||
int qoi_write(const char *filename, const void *data, const qoi_desc *desc);
|
||||
|
||||
|
||||
/* Read and decode a QOI image from the file system. If channels is 0, the
|
||||
number of channels from the file header is used. If channels is 3 or 4 the
|
||||
output format will be forced into this number of channels.
|
||||
|
||||
The function either returns NULL on failure (invalid data, or malloc or fopen
|
||||
failed) or a pointer to the decoded pixels. On success, the qoi_desc struct
|
||||
will be filled with the description from the file header.
|
||||
|
||||
The returned pixel data should be free()d after use. */
|
||||
|
||||
void *qoi_read(const char *filename, qoi_desc *desc, int channels);
|
||||
|
||||
#endif /* QOI_NO_STDIO */
|
||||
|
||||
|
||||
/* Encode raw RGB or RGBA pixels into a QOI image in memory.
|
||||
|
||||
The function either returns NULL on failure (invalid parameters or malloc
|
||||
failed) or a pointer to the encoded data on success. On success the out_len
|
||||
is set to the size in bytes of the encoded data.
|
||||
|
||||
The returned qoi data should be free()d after use. */
|
||||
|
||||
void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len);
|
||||
|
||||
|
||||
/* Decode a QOI image from memory.
|
||||
|
||||
The function either returns NULL on failure (invalid parameters or malloc
|
||||
failed) or a pointer to the decoded pixels. On success, the qoi_desc struct
|
||||
is filled with the description from the file header.
|
||||
|
||||
The returned pixel data should be free()d after use. */
|
||||
|
||||
void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* QOI_H */
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Implementation */
|
||||
|
||||
#ifdef QOI_IMPLEMENTATION
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef QOI_MALLOC
|
||||
#define QOI_MALLOC(sz) malloc(sz)
|
||||
#define QOI_FREE(p) free(p)
|
||||
#endif
|
||||
#ifndef QOI_ZEROARR
|
||||
#define QOI_ZEROARR(a) memset((a),0,sizeof(a))
|
||||
#endif
|
||||
|
||||
#define QOI_OP_INDEX 0x00 /* 00xxxxxx */
|
||||
#define QOI_OP_DIFF 0x40 /* 01xxxxxx */
|
||||
#define QOI_OP_LUMA 0x80 /* 10xxxxxx */
|
||||
#define QOI_OP_RUN 0xc0 /* 11xxxxxx */
|
||||
#define QOI_OP_RGB 0xfe /* 11111110 */
|
||||
#define QOI_OP_RGBA 0xff /* 11111111 */
|
||||
|
||||
#define QOI_MASK_2 0xc0 /* 11000000 */
|
||||
|
||||
#define QOI_COLOR_HASH(C) (C.rgba.r*3 + C.rgba.g*5 + C.rgba.b*7 + C.rgba.a*11)
|
||||
#define QOI_MAGIC \
|
||||
(((unsigned int)'q') << 24 | ((unsigned int)'o') << 16 | \
|
||||
((unsigned int)'i') << 8 | ((unsigned int)'f'))
|
||||
#define QOI_HEADER_SIZE 14
|
||||
|
||||
/* 2GB is the max file size that this implementation can safely handle. We guard
|
||||
against anything larger than that, assuming the worst case with 5 bytes per
|
||||
pixel, rounded down to a nice clean value. 400 million pixels ought to be
|
||||
enough for anybody. */
|
||||
#define QOI_PIXELS_MAX ((unsigned int)400000000)
|
||||
|
||||
typedef union {
|
||||
struct { unsigned char r, g, b, a; } rgba;
|
||||
unsigned int v;
|
||||
} qoi_rgba_t;
|
||||
|
||||
static const unsigned char qoi_padding[8] = {0,0,0,0,0,0,0,1};
|
||||
|
||||
static void qoi_write_32(unsigned char *bytes, int *p, unsigned int v) {
|
||||
bytes[(*p)++] = (0xff000000 & v) >> 24;
|
||||
bytes[(*p)++] = (0x00ff0000 & v) >> 16;
|
||||
bytes[(*p)++] = (0x0000ff00 & v) >> 8;
|
||||
bytes[(*p)++] = (0x000000ff & v);
|
||||
}
|
||||
|
||||
static unsigned int qoi_read_32(const unsigned char *bytes, int *p) {
|
||||
unsigned int a = bytes[(*p)++];
|
||||
unsigned int b = bytes[(*p)++];
|
||||
unsigned int c = bytes[(*p)++];
|
||||
unsigned int d = bytes[(*p)++];
|
||||
return a << 24 | b << 16 | c << 8 | d;
|
||||
}
|
||||
|
||||
void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
|
||||
int i, max_size, p, run;
|
||||
int px_len, px_end, px_pos, channels;
|
||||
unsigned char *bytes;
|
||||
const unsigned char *pixels;
|
||||
qoi_rgba_t index[64];
|
||||
qoi_rgba_t px, px_prev;
|
||||
|
||||
if (
|
||||
data == NULL || out_len == NULL || desc == NULL ||
|
||||
desc->width == 0 || desc->height == 0 ||
|
||||
desc->channels < 3 || desc->channels > 4 ||
|
||||
desc->colorspace > 1 ||
|
||||
desc->height >= QOI_PIXELS_MAX / desc->width
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
max_size =
|
||||
desc->width * desc->height * (desc->channels + 1) +
|
||||
QOI_HEADER_SIZE + sizeof(qoi_padding);
|
||||
|
||||
p = 0;
|
||||
bytes = (unsigned char *) QOI_MALLOC(max_size);
|
||||
if (!bytes) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qoi_write_32(bytes, &p, QOI_MAGIC);
|
||||
qoi_write_32(bytes, &p, desc->width);
|
||||
qoi_write_32(bytes, &p, desc->height);
|
||||
bytes[p++] = desc->channels;
|
||||
bytes[p++] = desc->colorspace;
|
||||
|
||||
|
||||
pixels = (const unsigned char *)data;
|
||||
|
||||
QOI_ZEROARR(index);
|
||||
|
||||
run = 0;
|
||||
px_prev.rgba.r = 0;
|
||||
px_prev.rgba.g = 0;
|
||||
px_prev.rgba.b = 0;
|
||||
px_prev.rgba.a = 255;
|
||||
px = px_prev;
|
||||
|
||||
px_len = desc->width * desc->height * desc->channels;
|
||||
px_end = px_len - desc->channels;
|
||||
channels = desc->channels;
|
||||
|
||||
for (px_pos = 0; px_pos < px_len; px_pos += channels) {
|
||||
if (channels == 4) {
|
||||
px = *(qoi_rgba_t *)(pixels + px_pos);
|
||||
}
|
||||
else {
|
||||
px.rgba.r = pixels[px_pos + 0];
|
||||
px.rgba.g = pixels[px_pos + 1];
|
||||
px.rgba.b = pixels[px_pos + 2];
|
||||
}
|
||||
|
||||
if (px.v == px_prev.v) {
|
||||
run++;
|
||||
if (run == 62 || px_pos == px_end) {
|
||||
bytes[p++] = QOI_OP_RUN | (run - 1);
|
||||
run = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int index_pos;
|
||||
|
||||
if (run > 0) {
|
||||
bytes[p++] = QOI_OP_RUN | (run - 1);
|
||||
run = 0;
|
||||
}
|
||||
|
||||
index_pos = QOI_COLOR_HASH(px) % 64;
|
||||
|
||||
if (index[index_pos].v == px.v) {
|
||||
bytes[p++] = QOI_OP_INDEX | index_pos;
|
||||
}
|
||||
else {
|
||||
index[index_pos] = px;
|
||||
|
||||
if (px.rgba.a == px_prev.rgba.a) {
|
||||
signed char vr = px.rgba.r - px_prev.rgba.r;
|
||||
signed char vg = px.rgba.g - px_prev.rgba.g;
|
||||
signed char vb = px.rgba.b - px_prev.rgba.b;
|
||||
|
||||
signed char vg_r = vr - vg;
|
||||
signed char vg_b = vb - vg;
|
||||
|
||||
if (
|
||||
vr > -3 && vr < 2 &&
|
||||
vg > -3 && vg < 2 &&
|
||||
vb > -3 && vb < 2
|
||||
) {
|
||||
bytes[p++] = QOI_OP_DIFF | (vr + 2) << 4 | (vg + 2) << 2 | (vb + 2);
|
||||
}
|
||||
else if (
|
||||
vg_r > -9 && vg_r < 8 &&
|
||||
vg > -33 && vg < 32 &&
|
||||
vg_b > -9 && vg_b < 8
|
||||
) {
|
||||
bytes[p++] = QOI_OP_LUMA | (vg + 32);
|
||||
bytes[p++] = (vg_r + 8) << 4 | (vg_b + 8);
|
||||
}
|
||||
else {
|
||||
bytes[p++] = QOI_OP_RGB;
|
||||
bytes[p++] = px.rgba.r;
|
||||
bytes[p++] = px.rgba.g;
|
||||
bytes[p++] = px.rgba.b;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bytes[p++] = QOI_OP_RGBA;
|
||||
bytes[p++] = px.rgba.r;
|
||||
bytes[p++] = px.rgba.g;
|
||||
bytes[p++] = px.rgba.b;
|
||||
bytes[p++] = px.rgba.a;
|
||||
}
|
||||
}
|
||||
}
|
||||
px_prev = px;
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)sizeof(qoi_padding); i++) {
|
||||
bytes[p++] = qoi_padding[i];
|
||||
}
|
||||
|
||||
*out_len = p;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) {
|
||||
const unsigned char *bytes;
|
||||
unsigned int header_magic;
|
||||
unsigned char *pixels;
|
||||
qoi_rgba_t index[64];
|
||||
qoi_rgba_t px;
|
||||
int px_len, chunks_len, px_pos;
|
||||
int p = 0, run = 0;
|
||||
|
||||
if (
|
||||
data == NULL || desc == NULL ||
|
||||
(channels != 0 && channels != 3 && channels != 4) ||
|
||||
size < QOI_HEADER_SIZE + (int)sizeof(qoi_padding)
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bytes = (const unsigned char *)data;
|
||||
|
||||
header_magic = qoi_read_32(bytes, &p);
|
||||
desc->width = qoi_read_32(bytes, &p);
|
||||
desc->height = qoi_read_32(bytes, &p);
|
||||
desc->channels = bytes[p++];
|
||||
desc->colorspace = bytes[p++];
|
||||
|
||||
if (
|
||||
desc->width == 0 || desc->height == 0 ||
|
||||
desc->channels < 3 || desc->channels > 4 ||
|
||||
desc->colorspace > 1 ||
|
||||
header_magic != QOI_MAGIC ||
|
||||
desc->height >= QOI_PIXELS_MAX / desc->width
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (channels == 0) {
|
||||
channels = desc->channels;
|
||||
}
|
||||
|
||||
px_len = desc->width * desc->height * channels;
|
||||
pixels = (unsigned char *) QOI_MALLOC(px_len);
|
||||
if (!pixels) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QOI_ZEROARR(index);
|
||||
px.rgba.r = 0;
|
||||
px.rgba.g = 0;
|
||||
px.rgba.b = 0;
|
||||
px.rgba.a = 255;
|
||||
|
||||
chunks_len = size - (int)sizeof(qoi_padding);
|
||||
for (px_pos = 0; px_pos < px_len; px_pos += channels) {
|
||||
if (run > 0) {
|
||||
run--;
|
||||
}
|
||||
else if (p < chunks_len) {
|
||||
int b1 = bytes[p++];
|
||||
|
||||
if (b1 == QOI_OP_RGB) {
|
||||
px.rgba.r = bytes[p++];
|
||||
px.rgba.g = bytes[p++];
|
||||
px.rgba.b = bytes[p++];
|
||||
}
|
||||
else if (b1 == QOI_OP_RGBA) {
|
||||
px.rgba.r = bytes[p++];
|
||||
px.rgba.g = bytes[p++];
|
||||
px.rgba.b = bytes[p++];
|
||||
px.rgba.a = bytes[p++];
|
||||
}
|
||||
else if ((b1 & QOI_MASK_2) == QOI_OP_INDEX) {
|
||||
px = index[b1];
|
||||
}
|
||||
else if ((b1 & QOI_MASK_2) == QOI_OP_DIFF) {
|
||||
px.rgba.r += ((b1 >> 4) & 0x03) - 2;
|
||||
px.rgba.g += ((b1 >> 2) & 0x03) - 2;
|
||||
px.rgba.b += ( b1 & 0x03) - 2;
|
||||
}
|
||||
else if ((b1 & QOI_MASK_2) == QOI_OP_LUMA) {
|
||||
int b2 = bytes[p++];
|
||||
int vg = (b1 & 0x3f) - 32;
|
||||
px.rgba.r += vg - 8 + ((b2 >> 4) & 0x0f);
|
||||
px.rgba.g += vg;
|
||||
px.rgba.b += vg - 8 + (b2 & 0x0f);
|
||||
}
|
||||
else if ((b1 & QOI_MASK_2) == QOI_OP_RUN) {
|
||||
run = (b1 & 0x3f);
|
||||
}
|
||||
|
||||
index[QOI_COLOR_HASH(px) % 64] = px;
|
||||
}
|
||||
|
||||
if (channels == 4) {
|
||||
*(qoi_rgba_t*)(pixels + px_pos) = px;
|
||||
}
|
||||
else {
|
||||
pixels[px_pos + 0] = px.rgba.r;
|
||||
pixels[px_pos + 1] = px.rgba.g;
|
||||
pixels[px_pos + 2] = px.rgba.b;
|
||||
}
|
||||
}
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
#ifndef QOI_NO_STDIO
|
||||
#include <stdio.h>
|
||||
|
||||
int qoi_write(const char *filename, const void *data, const qoi_desc *desc) {
|
||||
FILE *f = fopen(filename, "wb");
|
||||
int size;
|
||||
void *encoded;
|
||||
|
||||
if (!f) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
encoded = qoi_encode(data, desc, &size);
|
||||
if (!encoded) {
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fwrite(encoded, 1, size, f);
|
||||
fclose(f);
|
||||
|
||||
QOI_FREE(encoded);
|
||||
return size;
|
||||
}
|
||||
|
||||
void *qoi_read(const char *filename, qoi_desc *desc, int channels) {
|
||||
FILE *f = fopen(filename, "rb");
|
||||
int size, bytes_read;
|
||||
void *pixels, *data;
|
||||
|
||||
if (!f) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
if (size <= 0) {
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
data = QOI_MALLOC(size);
|
||||
if (!data) {
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bytes_read = fread(data, 1, size, f);
|
||||
fclose(f);
|
||||
|
||||
pixels = qoi_decode(data, bytes_read, desc, channels);
|
||||
QOI_FREE(data);
|
||||
return pixels;
|
||||
}
|
||||
|
||||
#endif /* QOI_NO_STDIO */
|
||||
#endif /* QOI_IMPLEMENTATION */
|
2
raylib/external/stb_vorbis.h
vendored
2
raylib/external/stb_vorbis.h
vendored
|
@ -570,7 +570,7 @@ enum STBVorbisError
|
|||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) || defined(__APPLE__) || defined(__CYGWIN__)
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#else // STB_VORBIS_NO_CRT
|
||||
|
|
55
raylib/external/vox_loader.h
vendored
55
raylib/external/vox_loader.h
vendored
|
@ -531,29 +531,34 @@ static void Vox_Build_Voxel(VoxArray3D* pvoxArray, int x, int y, int z, int matI
|
|||
int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArray3D* pvoxarray)
|
||||
{
|
||||
//////////////////////////////////////////////////
|
||||
//Read VOX file
|
||||
//4 bytes: magic number ('V' 'O' 'X' 'space' )
|
||||
//4 bytes: version number (current version is 150 )
|
||||
// Read VOX file
|
||||
// 4 bytes: magic number ('V' 'O' 'X' 'space')
|
||||
// 4 bytes: version number (current version is 150)
|
||||
|
||||
unsigned long signature;
|
||||
// @raysan5: Reviewed (unsigned long) -> (unsigned int), possible issue with Ubuntu 18.04 64bit
|
||||
|
||||
// @raysan5: reviewed signature loading
|
||||
unsigned char signature[4] = { 0 };
|
||||
|
||||
unsigned char* fileData = pvoxData;
|
||||
|
||||
unsigned char* fileDataPtr = fileData;
|
||||
unsigned char* endfileDataPtr = fileData + voxDataSize;
|
||||
|
||||
signature = *((unsigned long *)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
signature[0] = fileDataPtr[0];
|
||||
signature[1] = fileDataPtr[1];
|
||||
signature[2] = fileDataPtr[2];
|
||||
signature[3] = fileDataPtr[3];
|
||||
fileDataPtr += 4;
|
||||
|
||||
if (signature != 0x20584F56) //56 4F 58 20
|
||||
if ((signature[0] != 'V') && (signature[0] != 'O') && (signature[0] != 'X') && (signature[0] != ' '))
|
||||
{
|
||||
return VOX_ERROR_INVALID_FORMAT; //"Not an MagicaVoxel File format"
|
||||
}
|
||||
|
||||
unsigned long version;
|
||||
|
||||
version = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
// @raysan5: reviewed version loading
|
||||
unsigned int version = 0;
|
||||
version = ((unsigned int*)fileDataPtr)[0];
|
||||
fileDataPtr += 4;
|
||||
|
||||
if (version < 150)
|
||||
{
|
||||
|
@ -572,9 +577,9 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr
|
|||
//// children chunks : m bytes
|
||||
//{ child chunk 0 }
|
||||
//{ child chunk 1 }
|
||||
unsigned long sizeX, sizeY, sizeZ;
|
||||
unsigned int sizeX, sizeY, sizeZ;
|
||||
sizeX = sizeY = sizeZ = 0;
|
||||
unsigned long numVoxels = 0;
|
||||
unsigned int numVoxels = 0;
|
||||
|
||||
while (fileDataPtr < endfileDataPtr)
|
||||
{
|
||||
|
@ -583,23 +588,23 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr
|
|||
szChunkName[4] = 0;
|
||||
fileDataPtr += 4;
|
||||
|
||||
unsigned long chunkSize = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
unsigned int chunkSize = *((unsigned int*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned int);
|
||||
|
||||
//unsigned long chunkTotalChildSize = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
fileDataPtr += sizeof(unsigned int);
|
||||
|
||||
if (strcmp(szChunkName, "SIZE") == 0)
|
||||
{
|
||||
//(4 bytes x 3 : x, y, z )
|
||||
sizeX = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
sizeX = *((unsigned int*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned int);
|
||||
|
||||
sizeY = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
sizeY = *((unsigned int*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned int);
|
||||
|
||||
sizeZ = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
sizeZ = *((unsigned int*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned int);
|
||||
|
||||
//Alloc vox array
|
||||
Vox_AllocArray(pvoxarray, sizeX, sizeZ, sizeY); //Reverse Y<>Z for left to right handed system
|
||||
|
@ -610,8 +615,8 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr
|
|||
|
||||
//(numVoxels : 4 bytes )
|
||||
//(each voxel: 1 byte x 4 : x, y, z, colorIndex ) x numVoxels
|
||||
numVoxels = *((unsigned long*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned long);
|
||||
numVoxels = *((unsigned int*)fileDataPtr);
|
||||
fileDataPtr += sizeof(unsigned int);
|
||||
|
||||
while (numVoxels > 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue