LibT2FS 0.1
C API for accessing TEngine data in memory.
Loading...
Searching...
No Matches
models.h File Reference
#include <stdint.h>
#include "t2fs.h"
#include "array.h"
#include "models/common.h"

Go to the source code of this file.

Data Structures

struct  s_t2fsDataModelInfo
struct  s_t2fsDataBone
struct  s_t2fsDataBoneOrientation
struct  s_t2fsDataAnimationBoneIndices
struct  s_t2fsDataAnimationHeader
struct  s_t2fsDataHotpoint
struct  s_t2fsDataColorRGBA8
struct  s_t2fsDataMaterial
struct  s_t2fsDataVertex
struct  s_t2fsModelSurface
struct  s_t2fsModelMesh
struct  s_t2fsModel
struct  s_t2fsTCoord
struct  s_t2fsVertex
struct  s_t2fsIndices
struct  s_t2fsTriangles

Macros

#define T2FS_MODEL_BONE_SYMBOL_LEG   0b001
#define T2FS_MODEL_BONE_SYMBOL_NOT_HEAD   0b010
#define T2FS_MODEL_BONE_SYMBOL_RIGHT   0b100

Typedefs

typedef struct s_t2fsDataModelInfo t2fsDataModelInfo
typedef struct s_t2fsDataBone t2fsDataBone
typedef struct s_t2fsDataBoneOrientation t2fsDataBoneOrientation
typedef struct s_t2fsDataAnimationBoneIndices t2fsDataAnimationBoneIndices
typedef struct s_t2fsDataAnimationHeader t2fsDataAnimationHeader
typedef struct s_t2fsDataHotpoint t2fsDataHotpoint
typedef struct s_t2fsDataColorRGBA8 t2fsDataColorRGBA8
typedef struct s_t2fsDataMaterial t2fsDataMaterial
typedef struct s_t2fsDataVertex t2fsDataVertex
typedef struct s_t2fsModelSurface t2fsModelSurface
typedef struct s_t2fsModelMesh t2fsModelMesh
typedef struct s_t2fsModel t2fsModel
typedef struct s_t2fsTCoord t2fsTCoord
typedef struct s_t2fsVertex t2fsVertex
typedef struct s_t2fsIndices t2fsIndices
typedef struct s_t2fsTriangles t2fsTriangles

Functions

void t2fs_triangles_init (t2fsTriangles *tri)
void t2fs_triangles_free (t2fsTriangles *tri)
void t2fs_model_clear (t2fsModel *model)
uint32_t t2fs_model_count (t_t2fs *lib)
int t2fs_model_load (t_t2fs *lib, t2fsModel *model, uint32_t id)
void t2fs_model_unload (t2fsModel *model)
t2fsDataBonet2fs_model_get_bone (t2fsModel *model, uint32_t boneId)
int t2fs_model_get_bone_orientations (t2fsModel *model, t2fsArray *orientations, uint32_t poseId)
void t2fs_model_mesh_init (t2fsModelMesh *mesh)
int t2fs_model_get_mesh (t2fsModel *model, t2fsModelMesh *dest, uint32_t meshId)
void t2fs_model_mesh_surface_clear (t2fsModelSurface *surface)
int t2fs_model_mesh_get_surface (t2fsModelMesh *mesh, t2fsModelSurface *dest, uint32_t surfaceId)
int t2fs_model_surface_get_triangles (t2fsModelSurface *surface, t2fsTriangles *dest, uint32_t vertOffset)

Detailed Description

Example usage:

Assuming you are already familiar with the usage of t2fs.h and have an open t_t2fs object, in this example called lib.

t2fsModel model;
t2fsTriangles triangles;
uint32_t modelId = 1337;
uint32_t meshId = 0;
// load model 1337
if (t2fs_model_load(&lib, &model, modelId) != 0) {
// error .. (no need to call t2fs_model_unload())
return;
}
// get first mesh (there might be more..)
if (t2fs_model_get_mesh(&model, &mesh, meshId) != 0) {
// error ..
return;
}
// go over the mesh surfaces
for (uint32_t surfaceId = 0; surfaceId < mesh.surfaceCount; ++surfaceId) {
if (t2fs_model_mesh_get_surface(&mesh, &surface, surfaceId) != 0) {
// error ..
return;
}
// Do stuff with the surface data here
// ..
}
// unload the model nodes and data
struct s_t2fsModelMesh t2fsModelMesh
int t2fs_model_get_mesh(t2fsModel *model, t2fsModelMesh *dest, uint32_t meshId)
struct s_t2fsModelSurface t2fsModelSurface
void t2fs_model_clear(t2fsModel *model)
void t2fs_model_mesh_surface_clear(t2fsModelSurface *surface)
int t2fs_model_mesh_get_surface(t2fsModelMesh *mesh, t2fsModelSurface *dest, uint32_t surfaceId)
struct s_t2fsModel t2fsModel
void t2fs_model_unload(t2fsModel *model)
int t2fs_model_load(t_t2fs *lib, t2fsModel *model, uint32_t id)
void t2fs_model_mesh_init(t2fsModelMesh *mesh)
struct s_t2fsTriangles t2fsTriangles
uint32_t surfaceCount
Definition models.h:250

Macro Definition Documentation

◆ T2FS_MODEL_BONE_SYMBOL_LEG

#define T2FS_MODEL_BONE_SYMBOL_LEG   0b001

◆ T2FS_MODEL_BONE_SYMBOL_NOT_HEAD

#define T2FS_MODEL_BONE_SYMBOL_NOT_HEAD   0b010

◆ T2FS_MODEL_BONE_SYMBOL_RIGHT

#define T2FS_MODEL_BONE_SYMBOL_RIGHT   0b100

Typedef Documentation

◆ t2fsModelSurface

◆ t2fsModelMesh

◆ t2fsModel

typedef struct s_t2fsModel t2fsModel

◆ t2fsTCoord

typedef struct s_t2fsTCoord t2fsTCoord

◆ t2fsVertex

typedef struct s_t2fsVertex t2fsVertex

◆ t2fsIndices

typedef struct s_t2fsIndices t2fsIndices

◆ t2fsTriangles

Function Documentation

◆ t2fs_triangles_init()

void t2fs_triangles_init ( t2fsTriangles * tri)

◆ t2fs_triangles_free()

void t2fs_triangles_free ( t2fsTriangles * tri)

◆ t2fs_model_clear()

void t2fs_model_clear ( t2fsModel * model)

◆ t2fs_model_count()

uint32_t t2fs_model_count ( t_t2fs * lib)

◆ t2fs_model_load()

int t2fs_model_load ( t_t2fs * lib,
t2fsModel * model,
uint32_t id )

◆ t2fs_model_unload()

void t2fs_model_unload ( t2fsModel * model)

◆ t2fs_model_get_bone()

t2fsDataBone * t2fs_model_get_bone ( t2fsModel * model,
uint32_t boneId )

◆ t2fs_model_get_bone_orientations()

int t2fs_model_get_bone_orientations ( t2fsModel * model,
t2fsArray * orientations,
uint32_t poseId )

◆ t2fs_model_mesh_init()

void t2fs_model_mesh_init ( t2fsModelMesh * mesh)

◆ t2fs_model_get_mesh()

int t2fs_model_get_mesh ( t2fsModel * model,
t2fsModelMesh * dest,
uint32_t meshId )

◆ t2fs_model_mesh_surface_clear()

void t2fs_model_mesh_surface_clear ( t2fsModelSurface * surface)

◆ t2fs_model_mesh_get_surface()

int t2fs_model_mesh_get_surface ( t2fsModelMesh * mesh,
t2fsModelSurface * dest,
uint32_t surfaceId )

◆ t2fs_model_surface_get_triangles()

int t2fs_model_surface_get_triangles ( t2fsModelSurface * surface,
t2fsTriangles * dest,
uint32_t vertOffset )