Updated cgltf.
This commit is contained in:
parent
66deeb10c2
commit
fa3aa2969e
20
3rdparty/cgltf/cgltf_write.h
vendored
20
3rdparty/cgltf/cgltf_write.h
vendored
@ -75,7 +75,8 @@ cgltf_size cgltf_write(const cgltf_options* options, char* buffer, cgltf_size si
|
||||
#define CGLTF_EXTENSION_FLAG_LIGHTS_PUNCTUAL (1 << 3)
|
||||
#define CGLTF_EXTENSION_FLAG_DRACO_MESH_COMPRESSION (1 << 4)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_CLEARCOAT (1 << 5)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_TRANSMISSION (1 << 6)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_IOR (1 << 6)
|
||||
#define CGLTF_EXTENSION_FLAG_MATERIALS_TRANSMISSION (1 << 7)
|
||||
|
||||
typedef struct {
|
||||
char* buffer;
|
||||
@ -508,6 +509,11 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_TRANSMISSION;
|
||||
}
|
||||
|
||||
if (material->has_ior)
|
||||
{
|
||||
context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_IOR;
|
||||
}
|
||||
|
||||
if (material->has_pbr_metallic_roughness)
|
||||
{
|
||||
const cgltf_pbr_metallic_roughness* params = &material->pbr_metallic_roughness;
|
||||
@ -524,7 +530,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_transmission)
|
||||
if (material->unlit || material->has_pbr_specular_glossiness || material->has_clearcoat || material->has_ior || material->has_transmission)
|
||||
{
|
||||
cgltf_write_line(context, "\"extensions\": {");
|
||||
if (material->has_clearcoat)
|
||||
@ -538,6 +544,13 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater
|
||||
cgltf_write_floatprop(context, "clearcoatRoughnessFactor", params->clearcoat_roughness_factor, 0.0f);
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
if (material->has_ior)
|
||||
{
|
||||
const cgltf_ior* params = &material->ior;
|
||||
cgltf_write_line(context, "\"KHR_materials_ior\": {");
|
||||
cgltf_write_floatprop(context, "ior", params->ior, 1.5f);
|
||||
cgltf_write_line(context, "}");
|
||||
}
|
||||
if (material->has_transmission)
|
||||
{
|
||||
const cgltf_transmission* params = &material->transmission;
|
||||
@ -914,6 +927,9 @@ static void cgltf_write_extensions(cgltf_write_context* context, uint32_t extens
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_CLEARCOAT) {
|
||||
cgltf_write_stritem(context, "KHR_materials_clearcoat");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_IOR) {
|
||||
cgltf_write_stritem(context, "KHR_materials_ior");
|
||||
}
|
||||
if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_TRANSMISSION) {
|
||||
cgltf_write_stritem(context, "KHR_materials_transmission");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user