@@ -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 ;
@@ -4476,8 +4492,8 @@ static int cgltf_parse_json_sampler(cgltf_options* options, jsmntok_t const* tok
44764492 (void )options ;
44774493 CGLTF_CHECK_TOKTYPE (tokens [i ], JSMN_OBJECT );
44784494
4479- out_sampler -> wrap_s = 10497 ;
4480- out_sampler -> wrap_t = 10497 ;
4495+ out_sampler -> wrap_s = cgltf_wrap_mode_repeat ;
4496+ out_sampler -> wrap_t = cgltf_wrap_mode_repeat ;
44814497
44824498 int size = tokens [i ].size ;
44834499 ++ i ;
@@ -4494,28 +4510,28 @@ static int cgltf_parse_json_sampler(cgltf_options* options, jsmntok_t const* tok
44944510 {
44954511 ++ i ;
44964512 out_sampler -> mag_filter
4497- = cgltf_json_to_int (tokens + i , json_chunk );
4513+ = ( cgltf_filter_type ) cgltf_json_to_int (tokens + i , json_chunk );
44984514 ++ i ;
44994515 }
45004516 else if (cgltf_json_strcmp (tokens + i , json_chunk , "minFilter" ) == 0 )
45014517 {
45024518 ++ i ;
45034519 out_sampler -> min_filter
4504- = cgltf_json_to_int (tokens + i , json_chunk );
4520+ = ( cgltf_filter_type ) cgltf_json_to_int (tokens + i , json_chunk );
45054521 ++ i ;
45064522 }
45074523 else if (cgltf_json_strcmp (tokens + i , json_chunk , "wrapS" ) == 0 )
45084524 {
45094525 ++ i ;
45104526 out_sampler -> wrap_s
4511- = cgltf_json_to_int (tokens + i , json_chunk );
4527+ = ( cgltf_wrap_mode ) cgltf_json_to_int (tokens + i , json_chunk );
45124528 ++ i ;
45134529 }
45144530 else if (cgltf_json_strcmp (tokens + i , json_chunk , "wrapT" ) == 0 )
45154531 {
45164532 ++ i ;
45174533 out_sampler -> wrap_t
4518- = cgltf_json_to_int (tokens + i , json_chunk );
4534+ = ( cgltf_wrap_mode ) cgltf_json_to_int (tokens + i , json_chunk );
45194535 ++ i ;
45204536 }
45214537 else if (cgltf_json_strcmp (tokens + i , json_chunk , "extras" ) == 0 )
0 commit comments