updated cgltf to 1.15 and broke out commands from README into utility script. (#9369)
This commit is contained in:
2
third_party/cgltf/README.md
vendored
2
third_party/cgltf/README.md
vendored
@@ -101,10 +101,12 @@ cgltf supports core glTF 2.0:
|
||||
cgltf also supports some glTF extensions:
|
||||
- EXT_mesh_gpu_instancing
|
||||
- EXT_meshopt_compression
|
||||
- EXT_texture_webp
|
||||
- KHR_draco_mesh_compression (requires a library like [Google's Draco](https://github.com/google/draco) for decompression though)
|
||||
- KHR_lights_punctual
|
||||
- KHR_materials_anisotropy
|
||||
- KHR_materials_clearcoat
|
||||
- KHR_materials_diffuse_transmission
|
||||
- KHR_materials_dispersion
|
||||
- KHR_materials_emissive_strength
|
||||
- KHR_materials_ior
|
||||
|
||||
162
third_party/cgltf/cgltf.h
vendored
162
third_party/cgltf/cgltf.h
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* cgltf - a single-file glTF 2.0 parser written in C99.
|
||||
*
|
||||
* Version: 1.14
|
||||
* Version: 1.15
|
||||
*
|
||||
* Website: https://github.com/jkuhlmann/cgltf
|
||||
*
|
||||
@@ -376,13 +376,29 @@ typedef struct cgltf_image
|
||||
cgltf_extension* extensions;
|
||||
} cgltf_image;
|
||||
|
||||
typedef enum cgltf_filter_type {
|
||||
cgltf_filter_type_undefined = 0,
|
||||
cgltf_filter_type_nearest = 9728,
|
||||
cgltf_filter_type_linear = 9729,
|
||||
cgltf_filter_type_nearest_mipmap_nearest = 9984,
|
||||
cgltf_filter_type_linear_mipmap_nearest = 9985,
|
||||
cgltf_filter_type_nearest_mipmap_linear = 9986,
|
||||
cgltf_filter_type_linear_mipmap_linear = 9987
|
||||
} cgltf_filter_type;
|
||||
|
||||
typedef enum cgltf_wrap_mode {
|
||||
cgltf_wrap_mode_clamp_to_edge = 33071,
|
||||
cgltf_wrap_mode_mirrored_repeat = 33648,
|
||||
cgltf_wrap_mode_repeat = 10497
|
||||
} cgltf_wrap_mode;
|
||||
|
||||
typedef struct cgltf_sampler
|
||||
{
|
||||
char* name;
|
||||
cgltf_int mag_filter;
|
||||
cgltf_int min_filter;
|
||||
cgltf_int wrap_s;
|
||||
cgltf_int wrap_t;
|
||||
cgltf_filter_type mag_filter;
|
||||
cgltf_filter_type min_filter;
|
||||
cgltf_wrap_mode wrap_s;
|
||||
cgltf_wrap_mode wrap_t;
|
||||
cgltf_extras extras;
|
||||
cgltf_size extensions_count;
|
||||
cgltf_extension* extensions;
|
||||
@@ -395,6 +411,8 @@ typedef struct cgltf_texture
|
||||
cgltf_sampler* sampler;
|
||||
cgltf_bool has_basisu;
|
||||
cgltf_image* basisu_image;
|
||||
cgltf_bool has_webp;
|
||||
cgltf_image* webp_image;
|
||||
cgltf_extras extras;
|
||||
cgltf_size extensions_count;
|
||||
cgltf_extension* extensions;
|
||||
@@ -498,6 +516,14 @@ typedef struct cgltf_iridescence
|
||||
cgltf_texture_view iridescence_thickness_texture;
|
||||
} cgltf_iridescence;
|
||||
|
||||
typedef struct cgltf_diffuse_transmission
|
||||
{
|
||||
cgltf_texture_view diffuse_transmission_texture;
|
||||
cgltf_float diffuse_transmission_factor;
|
||||
cgltf_float diffuse_transmission_color_factor[3];
|
||||
cgltf_texture_view diffuse_transmission_color_texture;
|
||||
} cgltf_diffuse_transmission;
|
||||
|
||||
typedef struct cgltf_anisotropy
|
||||
{
|
||||
cgltf_float anisotropy_strength;
|
||||
@@ -523,6 +549,7 @@ typedef struct cgltf_material
|
||||
cgltf_bool has_sheen;
|
||||
cgltf_bool has_emissive_strength;
|
||||
cgltf_bool has_iridescence;
|
||||
cgltf_bool has_diffuse_transmission;
|
||||
cgltf_bool has_anisotropy;
|
||||
cgltf_bool has_dispersion;
|
||||
cgltf_pbr_metallic_roughness pbr_metallic_roughness;
|
||||
@@ -535,6 +562,7 @@ typedef struct cgltf_material
|
||||
cgltf_volume volume;
|
||||
cgltf_emissive_strength emissive_strength;
|
||||
cgltf_iridescence iridescence;
|
||||
cgltf_diffuse_transmission diffuse_transmission;
|
||||
cgltf_anisotropy anisotropy;
|
||||
cgltf_dispersion dispersion;
|
||||
cgltf_texture_view normal_texture;
|
||||
@@ -842,6 +870,8 @@ void cgltf_node_transform_world(const cgltf_node* node, cgltf_float* out_matrix)
|
||||
|
||||
const uint8_t* cgltf_buffer_view_data(const cgltf_buffer_view* view);
|
||||
|
||||
const cgltf_accessor* cgltf_find_accessor(const cgltf_primitive* prim, cgltf_attribute_type type, cgltf_int index);
|
||||
|
||||
cgltf_bool cgltf_accessor_read_float(const cgltf_accessor* accessor, cgltf_size index, cgltf_float* out, cgltf_size element_size);
|
||||
cgltf_bool cgltf_accessor_read_uint(const cgltf_accessor* accessor, cgltf_size index, cgltf_uint* out, cgltf_size element_size);
|
||||
cgltf_size cgltf_accessor_read_index(const cgltf_accessor* accessor, cgltf_size index);
|
||||
@@ -1697,7 +1727,20 @@ cgltf_result cgltf_validate(cgltf_data* data)
|
||||
{
|
||||
if (data->nodes[i].weights && data->nodes[i].mesh)
|
||||
{
|
||||
CGLTF_ASSERT_IF (data->nodes[i].mesh->primitives_count && data->nodes[i].mesh->primitives[0].targets_count != data->nodes[i].weights_count, cgltf_result_invalid_gltf);
|
||||
CGLTF_ASSERT_IF(data->nodes[i].mesh->primitives_count && data->nodes[i].mesh->primitives[0].targets_count != data->nodes[i].weights_count, cgltf_result_invalid_gltf);
|
||||
}
|
||||
|
||||
if (data->nodes[i].has_mesh_gpu_instancing)
|
||||
{
|
||||
CGLTF_ASSERT_IF(data->nodes[i].mesh == NULL, cgltf_result_invalid_gltf);
|
||||
CGLTF_ASSERT_IF(data->nodes[i].mesh_gpu_instancing.attributes_count == 0, cgltf_result_invalid_gltf);
|
||||
|
||||
cgltf_accessor* first = data->nodes[i].mesh_gpu_instancing.attributes[0].data;
|
||||
|
||||
for (cgltf_size k = 0; k < data->nodes[i].mesh_gpu_instancing.attributes_count; ++k)
|
||||
{
|
||||
CGLTF_ASSERT_IF(data->nodes[i].mesh_gpu_instancing.attributes[k].data->count != first->count, cgltf_result_invalid_gltf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2297,6 +2340,18 @@ const uint8_t* cgltf_buffer_view_data(const cgltf_buffer_view* view)
|
||||
return result;
|
||||
}
|
||||
|
||||
const cgltf_accessor* cgltf_find_accessor(const cgltf_primitive* prim, cgltf_attribute_type type, cgltf_int index)
|
||||
{
|
||||
for (cgltf_size i = 0; i < prim->attributes_count; ++i)
|
||||
{
|
||||
const cgltf_attribute* attr = &prim->attributes[i];
|
||||
if (attr->type == type && attr->index == index)
|
||||
return attr->data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cgltf_bool cgltf_accessor_read_float(const cgltf_accessor* accessor, cgltf_size index, cgltf_float* out, cgltf_size element_size)
|
||||
{
|
||||
if (accessor->is_sparse)
|
||||
@@ -4263,6 +4318,52 @@ static int cgltf_parse_json_iridescence(cgltf_options* options, jsmntok_t const*
|
||||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_diffuse_transmission(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_diffuse_transmission* out_diff_transmission)
|
||||
{
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
int size = tokens[i].size;
|
||||
++i;
|
||||
|
||||
// Defaults
|
||||
cgltf_fill_float_array(out_diff_transmission->diffuse_transmission_color_factor, 3, 1.0f);
|
||||
out_diff_transmission->diffuse_transmission_factor = 0.f;
|
||||
|
||||
for (int j = 0; j < size; ++j)
|
||||
{
|
||||
CGLTF_CHECK_KEY(tokens[i]);
|
||||
|
||||
if (cgltf_json_strcmp(tokens + i, json_chunk, "diffuseTransmissionFactor") == 0)
|
||||
{
|
||||
++i;
|
||||
out_diff_transmission->diffuse_transmission_factor = cgltf_json_to_float(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "diffuseTransmissionTexture") == 0)
|
||||
{
|
||||
i = cgltf_parse_json_texture_view(options, tokens, i + 1, json_chunk, &out_diff_transmission->diffuse_transmission_texture);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "diffuseTransmissionColorFactor") == 0)
|
||||
{
|
||||
i = cgltf_parse_json_float_array(tokens, i + 1, json_chunk, out_diff_transmission->diffuse_transmission_color_factor, 3);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "diffuseTransmissionColorTexture") == 0)
|
||||
{
|
||||
i = cgltf_parse_json_texture_view(options, tokens, i + 1, json_chunk, &out_diff_transmission->diffuse_transmission_color_texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_skip_json(tokens, i + 1);
|
||||
}
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int cgltf_parse_json_anisotropy(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_anisotropy* out_anisotropy)
|
||||
{
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
@@ -4391,8 +4492,8 @@ static int cgltf_parse_json_sampler(cgltf_options* options, jsmntok_t const* tok
|
||||
(void)options;
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
|
||||
out_sampler->wrap_s = 10497;
|
||||
out_sampler->wrap_t = 10497;
|
||||
out_sampler->wrap_s = cgltf_wrap_mode_repeat;
|
||||
out_sampler->wrap_t = cgltf_wrap_mode_repeat;
|
||||
|
||||
int size = tokens[i].size;
|
||||
++i;
|
||||
@@ -4409,28 +4510,28 @@ static int cgltf_parse_json_sampler(cgltf_options* options, jsmntok_t const* tok
|
||||
{
|
||||
++i;
|
||||
out_sampler->mag_filter
|
||||
= cgltf_json_to_int(tokens + i, json_chunk);
|
||||
= (cgltf_filter_type)cgltf_json_to_int(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "minFilter") == 0)
|
||||
{
|
||||
++i;
|
||||
out_sampler->min_filter
|
||||
= cgltf_json_to_int(tokens + i, json_chunk);
|
||||
= (cgltf_filter_type)cgltf_json_to_int(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "wrapS") == 0)
|
||||
{
|
||||
++i;
|
||||
out_sampler->wrap_s
|
||||
= cgltf_json_to_int(tokens + i, json_chunk);
|
||||
= (cgltf_wrap_mode)cgltf_json_to_int(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "wrapT") == 0)
|
||||
{
|
||||
++i;
|
||||
out_sampler->wrap_t
|
||||
= cgltf_json_to_int(tokens + i, json_chunk);
|
||||
= (cgltf_wrap_mode)cgltf_json_to_int(tokens + i, json_chunk);
|
||||
++i;
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "extras") == 0)
|
||||
@@ -4538,6 +4639,34 @@ static int cgltf_parse_json_texture(cgltf_options* options, jsmntok_t const* tok
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "EXT_texture_webp") == 0)
|
||||
{
|
||||
out_texture->has_webp = 1;
|
||||
++i;
|
||||
CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
|
||||
int num_properties = tokens[i].size;
|
||||
++i;
|
||||
|
||||
for (int t = 0; t < num_properties; ++t)
|
||||
{
|
||||
CGLTF_CHECK_KEY(tokens[i]);
|
||||
|
||||
if (cgltf_json_strcmp(tokens + i, json_chunk, "source") == 0)
|
||||
{
|
||||
++i;
|
||||
out_texture->webp_image = CGLTF_PTRINDEX(cgltf_image, cgltf_json_to_int(tokens + i, json_chunk));
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_skip_json(tokens, i + 1);
|
||||
}
|
||||
if (i < 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i = cgltf_parse_json_unprocessed_extension(options, tokens, i, json_chunk, &(out_texture->extensions[out_texture->extensions_count++]));
|
||||
@@ -4723,6 +4852,11 @@ static int cgltf_parse_json_material(cgltf_options* options, jsmntok_t const* to
|
||||
out_material->has_iridescence = 1;
|
||||
i = cgltf_parse_json_iridescence(options, tokens, i + 1, json_chunk, &out_material->iridescence);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "KHR_materials_diffuse_transmission") == 0)
|
||||
{
|
||||
out_material->has_diffuse_transmission = 1;
|
||||
i = cgltf_parse_json_diffuse_transmission(options, tokens, i + 1, json_chunk, &out_material->diffuse_transmission);
|
||||
}
|
||||
else if (cgltf_json_strcmp(tokens + i, json_chunk, "KHR_materials_anisotropy") == 0)
|
||||
{
|
||||
out_material->has_anisotropy = 1;
|
||||
@@ -6548,6 +6682,7 @@ static int cgltf_fixup_pointers(cgltf_data* data)
|
||||
{
|
||||
CGLTF_PTRFIXUP(data->textures[i].image, data->images, data->images_count);
|
||||
CGLTF_PTRFIXUP(data->textures[i].basisu_image, data->images, data->images_count);
|
||||
CGLTF_PTRFIXUP(data->textures[i].webp_image, data->images, data->images_count);
|
||||
CGLTF_PTRFIXUP(data->textures[i].sampler, data->samplers, data->samplers_count);
|
||||
}
|
||||
|
||||
@@ -6585,6 +6720,9 @@ static int cgltf_fixup_pointers(cgltf_data* data)
|
||||
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);
|
||||
|
||||
CGLTF_PTRFIXUP(data->materials[i].diffuse_transmission.diffuse_transmission_texture.texture, data->textures, data->textures_count);
|
||||
CGLTF_PTRFIXUP(data->materials[i].diffuse_transmission.diffuse_transmission_color_texture.texture, data->textures, data->textures_count);
|
||||
|
||||
CGLTF_PTRFIXUP(data->materials[i].anisotropy.anisotropy_texture.texture, data->textures, data->textures_count);
|
||||
}
|
||||
|
||||
|
||||
44
third_party/cgltf/cgltf_write.h
vendored
44
third_party/cgltf/cgltf_write.h
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* cgltf_write - a single-file glTF 2.0 writer written in C99.
|
||||
*
|
||||
* Version: 1.14
|
||||
* Version: 1.15
|
||||
*
|
||||
* Website: https://github.com/jkuhlmann/cgltf
|
||||
*
|
||||
@@ -87,6 +87,8 @@ cgltf_size cgltf_write(const cgltf_options* options, char* buffer, cgltf_size si
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_IRIDESCENCE (1 << 15)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_ANISOTROPY (1 << 16)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_DISPERSION (1 << 17)
|
||||
#define CGLTF_EXTENSION_FLAG_TEXTURE_WEBP (1 << 18)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_DIFFUSE_TRANSMISSION (1 << 19)
|
||||
|
||||
typedef struct {
|
||||
char* buffer;
|
||||
@@ -506,7 +508,7 @@ static void cgltf_write_primitive(cgltf_write_context* context, const cgltf_prim
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_DRACO_MESH_COMPRESSION;
|
||||
if (prim->attributes_count == 0 || prim->indices == 0)
|
||||
{
|
||||
context->required_extension_flags |= CGLTF_EXTENSION_FLAG_DRACO_MESH_COMPRESSION;
|
||||
context->required_extension_flags |= CGLTF_EXTENSION_FLAG_DRACO_MESH_COMPRESSION;
|
||||
}
|
||||
|
||||
cgltf_write_line(context, "\"KHR_draco_mesh_compression\": {");
|
||||
@@ -655,6 +657,11 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_IRIDESCENCE;
|
||||
}
|
||||
|
||||
if (material->has_diffuse_transmission)
|
||||
{
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_DIFFUSE_TRANSMISSION;
|
||||
}
|
||||
|
||||
if (material->has_anisotropy)
|
||||
{
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_ANISOTROPY;
|
||||
@@ -680,7 +687,7 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
|
||||
if (material->unlit || material->has_pbr_specular_glossiness || material->has_clearcoat || material->has_ior || material->has_specular || material->has_transmission || material->has_sheen || material->has_volume || material->has_emissive_strength || material->has_iridescence || material->has_anisotropy || material->has_dispersion)
|
||||
if (material->unlit || material->has_pbr_specular_glossiness || material->has_clearcoat || material->has_ior || material->has_specular || material->has_transmission || material->has_sheen || material->has_volume || material->has_emissive_strength || material->has_iridescence || material->has_anisotropy || material->has_dispersion || material->has_diffuse_transmission)
|
||||
{
|
||||
cgltf_write_line(context, "\"extensions\": {");
|
||||
if (material->has_clearcoat)
|
||||
@@ -732,7 +739,7 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater
|
||||
{
|
||||
cgltf_write_floatarrayprop(context, "attenuationColor", params->attenuation_color, 3);
|
||||
}
|
||||
if (params->attenuation_distance < FLT_MAX)
|
||||
if (params->attenuation_distance < FLT_MAX)
|
||||
{
|
||||
cgltf_write_floatprop(context, "attenuationDistance", params->attenuation_distance, FLT_MAX);
|
||||
}
|
||||
@@ -791,6 +798,19 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater
|
||||
CGLTF_WRITE_TEXTURE_INFO("iridescenceThicknessTexture", params->iridescence_thickness_texture);
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
if (material->has_diffuse_transmission)
|
||||
{
|
||||
const cgltf_diffuse_transmission* params = &material->diffuse_transmission;
|
||||
cgltf_write_line(context, "\"KHR_materials_diffuse_transmission\": {");
|
||||
CGLTF_WRITE_TEXTURE_INFO("diffuseTransmissionTexture", params->diffuse_transmission_texture);
|
||||
cgltf_write_floatprop(context, "diffuseTransmissionFactor", params->diffuse_transmission_factor, 0.f);
|
||||
if (cgltf_check_floatarray(params->diffuse_transmission_color_factor, 3, 1.f))
|
||||
{
|
||||
cgltf_write_floatarrayprop(context, "diffuseTransmissionColorFactor", params->diffuse_transmission_color_factor, 3);
|
||||
}
|
||||
CGLTF_WRITE_TEXTURE_INFO("diffuseTransmissionColorTexture", params->diffuse_transmission_color_texture);
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
if (material->has_anisotropy)
|
||||
{
|
||||
cgltf_write_line(context, "\"KHR_materials_anisotropy\": {");
|
||||
@@ -840,15 +860,23 @@ static void cgltf_write_texture(cgltf_write_context* context, const cgltf_textur
|
||||
CGLTF_WRITE_IDXPROP("source", texture->image, context->data->images);
|
||||
CGLTF_WRITE_IDXPROP("sampler", texture->sampler, context->data->samplers);
|
||||
|
||||
if (texture->has_basisu)
|
||||
if (texture->has_basisu || texture->has_webp)
|
||||
{
|
||||
cgltf_write_line(context, "\"extensions\": {");
|
||||
if (texture->has_basisu)
|
||||
{
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_TEXTURE_BASISU;
|
||||
cgltf_write_line(context, "\"KHR_texture_basisu\": {");
|
||||
CGLTF_WRITE_IDXPROP("source", texture->basisu_image, context->data->images);
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
if (texture->has_webp)
|
||||
{
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_TEXTURE_WEBP;
|
||||
cgltf_write_line(context, "\"EXT_texture_webp\": {");
|
||||
CGLTF_WRITE_IDXPROP("source", texture->webp_image, context->data->images);
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
cgltf_write_extras(context, &texture->extras);
|
||||
@@ -1280,12 +1308,18 @@ static void cgltf_write_extensions(cgltf_write_context* context, uint32_t extens
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_TEXTURE_BASISU) {
|
||||
cgltf_write_stritem(context, "KHR_texture_basisu");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_TEXTURE_WEBP) {
|
||||
cgltf_write_stritem(context, "EXT_texture_webp");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_EMISSIVE_STRENGTH) {
|
||||
cgltf_write_stritem(context, "KHR_materials_emissive_strength");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_IRIDESCENCE) {
|
||||
cgltf_write_stritem(context, "KHR_materials_iridescence");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_DIFFUSE_TRANSMISSION) {
|
||||
cgltf_write_stritem(context, "KHR_materials_diffuse_transmission");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_ANISOTROPY) {
|
||||
cgltf_write_stritem(context, "KHR_materials_anisotropy");
|
||||
}
|
||||
|
||||
10
third_party/cgltf/tnt/README
vendored
10
third_party/cgltf/tnt/README
vendored
@@ -1,10 +1,4 @@
|
||||
This folder was last updated as follows:
|
||||
edit update_cgltf.sh to assign desired value to shell variable 'tag'
|
||||
./update_cgltf.sh
|
||||
|
||||
export tag=v1.13
|
||||
cd third_party
|
||||
curl -L -O https://github.com/jkuhlmann/cgltf/archive/refs/tags/${tag}.zip
|
||||
unzip ${tag}.zip
|
||||
mv cgltf-* cgltf_new
|
||||
rsync -r cgltf_new/ cgltf/ --delete --exclude tnt
|
||||
rm -rf ${tag}.zip cgltf_new
|
||||
git add cgltf ; git status
|
||||
|
||||
14
third_party/cgltf/tnt/update_cgltf.sh
vendored
Executable file
14
third_party/cgltf/tnt/update_cgltf.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# converted instructions and command listing from README into shell script.
|
||||
owner=jkuhlmann
|
||||
project=cgltf
|
||||
tag=v1.15
|
||||
# ^^^ config / vvv github fetch repo tag archive and update boilerplate
|
||||
tp_dir=$(_dir=$(dirname "${0}"); cd "${_dir}" && cd .. && cd .. && pwd)
|
||||
cd "${tp_dir}" || exit 1
|
||||
curl -L -O https://github.com/${owner}/${project}/archive/refs/tags/${tag}.zip || exit 1
|
||||
unzip ${tag}.zip
|
||||
mv ${project}-* ${project}_new
|
||||
rsync -r ${project}_new/ ${project}/ --delete --exclude tnt
|
||||
rm -rf ${tag}.zip ${project}_new
|
||||
git add ${project} && git status
|
||||
Reference in New Issue
Block a user