From 0feaa484bf9c57b09af55fa22f85735f08894748 Mon Sep 17 00:00:00 2001 From: Johannes Kuhlmann Date: Tue, 24 Aug 2021 21:07:58 +0200 Subject: [PATCH] Change writer to only write the alpha cutoff when using mask alpha mode to silence validator (bug #152). --- cgltf_write.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cgltf_write.h b/cgltf_write.h index 4305722..d7dfafd 100644 --- a/cgltf_write.h +++ b/cgltf_write.h @@ -534,7 +534,10 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater { cgltf_write_line(context, "{"); cgltf_write_strprop(context, "name", material->name); - cgltf_write_floatprop(context, "alphaCutoff", material->alpha_cutoff, 0.5f); + if (material->alpha_mode == cgltf_alpha_mode_mask) + { + cgltf_write_floatprop(context, "alphaCutoff", material->alpha_cutoff, 0.5f); + } cgltf_write_boolprop_optional(context, "doubleSided", material->double_sided, false); // cgltf_write_boolprop_optional(context, "unlit", material->unlit, false);