6#define SF3_FORMAT_ID_MODEL 0x05
95 return ((type >> 0) & 1) +
109 ((type >> 0) & 1) * 3 +
110 ((type >> 1) & 1) * 2 +
111 ((type >> 2) & 1) * 3 +
112 ((type >> 3) & 1) * 3 +
113 ((type >> 4) & 1) * 3;
140 for(uint8_t i=0; i<8; ++i){
141 uint8_t bit = (1 << i);
165 default:
return "Unknown";
172 const void *start = (
const void *)model;
173 const void *end = (
const void *)verts;
174 return (end-start) +
sizeof(uint32_t) + verts->
count *
sizeof(
float);
#define SF3_SKIP_STRP(STR)
SF3_EXPORT enum sf3_material_type sf3_model_texture_material(const struct sf3_model *model, uint8_t index)
Returns the material usage type for the given texture index in the model.
sf3_vertex_format
The vertex attributes that can be stored, as bit-field flags.
@ SF3_VERTEX_NORMAL
The vertex normal vector as an X, Y, Z triplet.
@ SF3_VERTEX_TANGENT
The vertex tangent vector as an X, Y, Z triplet.
@ SF3_VERTEX_POSITION
The vertex position vector as an X, Y, Z triplet.
@ SF3_VERTEX_UV
The texture coordinates as a U, V duplet.
@ SF3_VERTEX_COLOR
The vertex colour as an R, G, B triplet.
SF3_INLINE uint8_t sf3_model_vertex_attribute_count(enum sf3_vertex_format format)
SF3_INLINE uint8_t sf3_model_texture_count(const struct sf3_model *model)
Returns the number of textures stored in the model.
SF3_INLINE uint8_t sf3_model_vertex_stride(const struct sf3_model *model)
Returns the number of floats per vertex.
SF3_EXPORT size_t sf3_model_size(const struct sf3_model *model)
Computes the size of the model file in bytes.
SF3_EXPORT const char * sf3_model_material_type(enum sf3_material_type type)
SF3_INLINE const struct sf3_faces * sf3_model_faces(const struct sf3_model *model)
Returns the faces array of the model.
SF3_INLINE uint32_t sf3_model_vertex_count(const struct sf3_model *model)
Returns the number of vertices stored in the model.
SF3_INLINE const struct sf3_vertices * sf3_model_vertices(const struct sf3_model *model)
Returns the vertices array of the model.
sf3_material_type
The material types that can be stored, as bit-field flags.
@ SF3_MATERIAL_OCCLUSION
The texture stores the occlusion value.
@ SF3_MATERIAL_ALBEDO
The texture stores the albedo colour.
@ SF3_MATERIAL_EMISSION
The texture stores the emission colour.
@ SF3_MATERIAL_SPECULAR
The texture stores the specular reflectivity value.
@ SF3_MATERIAL_NORMAL
The texture stores the normal vectors.
@ SF3_MATERIAL_METALNESS
The texture stores the metalness value.
@ SF3_MATERIAL_ROUGHNESS
The texture stores the roughness value.
SF3_INLINE const sf3_str16 * sf3_model_next_texture(const struct sf3_str16 *texture)
uint32_t count
The number of vertex indices stored.
uint32_t faces[]
The vertex indices, three of which make up a face.
The basic header structure of every SF3 file.
uint32_t material_size
The size of the textures array in octets.
uint8_t material_type
The material type description.
uint8_t vertex_format
The vertex attribute format description.
uint32_t count
The number of floats stored.