@@ -376,13 +376,29 @@ typedef struct cgltf_image
376376 cgltf_extension * extensions ;
377377} cgltf_image ;
378378
379+ typedef enum cgltf_filter_type {
380+ cgltf_filter_type_undefined = 0 ,
381+ cgltf_filter_type_nearest = 9728 ,
382+ cgltf_filter_type_linear = 9729 ,
383+ cgltf_filter_type_nearest_mipmap_nearest = 9984 ,
384+ cgltf_filter_type_linear_mipmap_nearest = 9985 ,
385+ cgltf_filter_type_nearest_mipmap_linear = 9986 ,
386+ cgltf_filter_type_linear_mipmap_linear = 9987
387+ } cgltf_filter_type ;
388+
389+ typedef enum cgltf_wrap_mode {
390+ cgltf_wrap_mode_clamp_to_edge = 33071 ,
391+ cgltf_wrap_mode_mirrored_repeat = 33648 ,
392+ cgltf_wrap_mode_repeat = 10497
393+ } cgltf_wrap_mode ;
394+
379395typedef struct cgltf_sampler
380396{
381397 char * name ;
382- cgltf_int mag_filter ;
383- cgltf_int min_filter ;
384- cgltf_int wrap_s ;
385- cgltf_int wrap_t ;
398+ cgltf_filter_type mag_filter ;
399+ cgltf_filter_type min_filter ;
400+ cgltf_wrap_mode wrap_s ;
401+ cgltf_wrap_mode wrap_t ;
386402 cgltf_extras extras ;
387403 cgltf_size extensions_count ;
388404 cgltf_extension * extensions ;
@@ -4420,8 +4436,8 @@ static int cgltf_parse_json_sampler(cgltf_options* options, jsmntok_t const* tok
44204436 (void )options ;
44214437 CGLTF_CHECK_TOKTYPE (tokens [i ], JSMN_OBJECT );
44224438
4423- out_sampler -> wrap_s = 10497 ;
4424- out_sampler -> wrap_t = 10497 ;
4439+ out_sampler -> wrap_s = cgltf_wrap_mode_repeat ;
4440+ out_sampler -> wrap_t = cgltf_wrap_mode_repeat ;
44254441
44264442 int size = tokens [i ].size ;
44274443 ++ i ;
@@ -4438,28 +4454,28 @@ static int cgltf_parse_json_sampler(cgltf_options* options, jsmntok_t const* tok
44384454 {
44394455 ++ i ;
44404456 out_sampler -> mag_filter
4441- = cgltf_json_to_int (tokens + i , json_chunk );
4457+ = ( cgltf_filter_type ) cgltf_json_to_int (tokens + i , json_chunk );
44424458 ++ i ;
44434459 }
44444460 else if (cgltf_json_strcmp (tokens + i , json_chunk , "minFilter" ) == 0 )
44454461 {
44464462 ++ i ;
44474463 out_sampler -> min_filter
4448- = cgltf_json_to_int (tokens + i , json_chunk );
4464+ = ( cgltf_filter_type ) cgltf_json_to_int (tokens + i , json_chunk );
44494465 ++ i ;
44504466 }
44514467 else if (cgltf_json_strcmp (tokens + i , json_chunk , "wrapS" ) == 0 )
44524468 {
44534469 ++ i ;
44544470 out_sampler -> wrap_s
4455- = cgltf_json_to_int (tokens + i , json_chunk );
4471+ = ( cgltf_wrap_mode ) cgltf_json_to_int (tokens + i , json_chunk );
44564472 ++ i ;
44574473 }
44584474 else if (cgltf_json_strcmp (tokens + i , json_chunk , "wrapT" ) == 0 )
44594475 {
44604476 ++ i ;
44614477 out_sampler -> wrap_t
4462- = cgltf_json_to_int (tokens + i , json_chunk );
4478+ = ( cgltf_wrap_mode ) cgltf_json_to_int (tokens + i , json_chunk );
44634479 ++ i ;
44644480 }
44654481 else if (cgltf_json_strcmp (tokens + i , json_chunk , "extras" ) == 0 )
0 commit comments