@@ -518,6 +518,8 @@ static bool freeUnusedBuffers(cgltf_data* data)
518
518
519
519
static cgltf_result decompressMeshopt (cgltf_data* data)
520
520
{
521
+ bool warned = false ;
522
+
521
523
for (size_t i = 0 ; i < data->buffer_views_count ; ++i)
522
524
{
523
525
if (!data->buffer_views [i].has_meshopt_compression )
@@ -536,18 +538,22 @@ static cgltf_result decompressMeshopt(cgltf_data* data)
536
538
data->buffer_views [i].data = result;
537
539
538
540
int rc = -1 ;
541
+ bool warn = false ;
539
542
540
543
switch (mc->mode )
541
544
{
542
545
case cgltf_meshopt_compression_mode_attributes:
546
+ warn = meshopt_decodeVertexVersion (source, mc->size ) != 0 ;
543
547
rc = meshopt_decodeVertexBuffer (result, mc->count , mc->stride , source, mc->size );
544
548
break ;
545
549
546
550
case cgltf_meshopt_compression_mode_triangles:
551
+ warn = meshopt_decodeIndexVersion (source, mc->size ) != 1 ;
547
552
rc = meshopt_decodeIndexBuffer (result, mc->count , mc->stride , source, mc->size );
548
553
break ;
549
554
550
555
case cgltf_meshopt_compression_mode_indices:
556
+ warn = meshopt_decodeIndexVersion (source, mc->size ) != 1 ;
551
557
rc = meshopt_decodeIndexSequence (result, mc->count , mc->stride , source, mc->size );
552
558
break ;
553
559
@@ -558,6 +564,12 @@ static cgltf_result decompressMeshopt(cgltf_data* data)
558
564
if (rc != 0 )
559
565
return cgltf_result_io_error;
560
566
567
+ if (warn && !warned)
568
+ {
569
+ fprintf (stderr, " Warning: EXT_meshopt_compression data uses versions outside of the glTF specification (vertex 0 / index 1 expected)\n " );
570
+ warned = true ;
571
+ }
572
+
561
573
switch (mc->filter )
562
574
{
563
575
case cgltf_meshopt_compression_filter_octahedral:
0 commit comments