picomodel.c File Reference

#include "picointernal.h"
Include dependency graph for picomodel.c:

Go to the source code of this file.

Data Structures

struct  _IndexArray
struct  _BinaryTreeNode
struct  _BinaryTree
struct  _UniqueIndices
struct  picoSmoothVertices_s

Defines

#define PICOMODEL_C
#define HASHTABLE_SIZE   7919
#define HASH_XYZ_EPSILON   0.01f
#define HASH_XYZ_EPSILONSPACE_MULTIPLIER   1.f / HASH_XYZ_EPSILON
#define HASH_ST_EPSILON   0.0001f
#define HASH_NORMAL_EPSILON   0.02f
#define NORMAL_UNIT_LENGTH_EPSILON   0.01
#define FLOAT_EQUAL_EPSILON(f, other, epsilon)   (fabs(f - other) < epsilon)

Typedefs

typedef struct _IndexArray IndexArray
typedef struct _BinaryTreeNode BinaryTreeNode
typedef struct _BinaryTree BinaryTree
typedef int(* LessFunc )(void *, picoIndex_t, picoIndex_t)
typedef struct _UniqueIndices UniqueIndices
typedef struct picoSmoothVertices_s picoSmoothVertices_t
typedef picoVec3_tpicoNormalIter_t
typedef picoIndex_tpicoIndexIter_t

Functions

int PicoInit (void)
void PicoShutdown (void)
 shuts the pico model library down
int PicoError (void)
 returns last picomodel error code (see PME_* defines)
void PicoSetMallocFunc (void *(*func)(size_t))
 sets the ptr to the malloc function
void PicoSetFreeFunc (void(*func)(void *))
 sets the ptr to the free function
void PicoSetLoadFileFunc (void(*func)(char *, unsigned char **, int *))
 sets the ptr to the file load function
void PicoSetFreeFileFunc (void(*func)(void *))
 sets the ptr to the free function
void PicoSetPrintFunc (void(*func)(int, const char *))
 sets the ptr to the print function
static picoModel_tPicoModuleLoadModel (const picoModule_t *pm, const char *fileName, picoByte_t *buffer, int bufSize, int frameNum)
picoModel_tPicoLoadModel (char *fileName, int frameNum)
 the meat and potatoes function
picoModel_tPicoModuleLoadModelStream (const picoModule_t *module, const char *fileName, void *inputStream, PicoInputStreamReadFunc inputStreamRead, size_t streamLength, int frameNum)
picoModel_tPicoNewModel (void)
 creates a new pico model
void PicoFreeModel (picoModel_t *model)
 frees a model and all associated data
int PicoAdjustModel (picoModel_t *model, int numShaders, int numSurfaces)
 adjusts a models's memory allocations to handle the requested sizes. will always grow, never shrink
picoShader_tPicoNewShader (picoModel_t *model)
 creates a new pico shader and returns its index. -sea
void PicoFreeShader (picoShader_t *shader)
 frees a shader and all associated data -sea
picoShader_tPicoFindShader (picoModel_t *model, char *name, int caseSensitive)
 finds a named shader in a model
picoSurface_tPicoNewSurface (picoModel_t *model)
 creates a new pico surface
void PicoFreeSurface (picoSurface_t *surface)
 frees a surface and all associated data
int PicoAdjustSurface (picoSurface_t *surface, int numVertexes, int numSTArrays, int numColorArrays, int numIndexes, int numFaceNormals)
 adjusts a surface's memory allocations to handle the requested sizes. will always grow, never shrink
picoSurface_tPicoFindSurface (picoModel_t *model, char *name, int caseSensitive)
 Finds first matching named surface in a model.
void PicoSetModelName (picoModel_t *model, const char *name)
void PicoSetModelFileName (picoModel_t *model, const char *fileName)
void PicoSetModelFrameNum (picoModel_t *model, int frameNum)
void PicoSetModelNumFrames (picoModel_t *model, int numFrames)
void PicoSetModelData (picoModel_t *model, void *data)
void PicoSetShaderName (picoShader_t *shader, const char *name)
void PicoSetShaderMapName (picoShader_t *shader, char *mapName)
void PicoSetShaderAmbientColor (picoShader_t *shader, picoColor_t color)
void PicoSetShaderDiffuseColor (picoShader_t *shader, picoColor_t color)
void PicoSetShaderSpecularColor (picoShader_t *shader, picoColor_t color)
void PicoSetShaderTransparency (picoShader_t *shader, float value)
void PicoSetShaderShininess (picoShader_t *shader, float value)
void PicoSetSurfaceData (picoSurface_t *surface, void *data)
void PicoSetSurfaceType (picoSurface_t *surface, picoSurfaceType_t type)
void PicoSetSurfaceName (picoSurface_t *surface, char *name)
void PicoSetSurfaceShader (picoSurface_t *surface, picoShader_t *shader)
void PicoSetSurfaceXYZ (picoSurface_t *surface, int num, picoVec3_t xyz)
void PicoSetSurfaceNormal (picoSurface_t *surface, int num, picoVec3_t normal)
void PicoSetSurfaceST (picoSurface_t *surface, int array, int num, picoVec2_t st)
void PicoSetSurfaceColor (picoSurface_t *surface, int array, int num, const picoColor_t color)
void PicoSetSurfaceIndex (picoSurface_t *surface, int num, picoIndex_t index)
void PicoSetSurfaceIndexes (picoSurface_t *surface, int num, picoIndex_t *index, int count)
void PicoSetFaceNormal (picoSurface_t *surface, int num, picoVec3_t normal)
void PicoSetSurfaceSmoothingGroup (picoSurface_t *surface, int num, picoIndex_t smoothingGroup)
void PicoSetSurfaceSpecial (picoSurface_t *surface, int num, int special)
char * PicoGetModelName (picoModel_t *model)
char * PicoGetModelFileName (picoModel_t *model)
int PicoGetModelFrameNum (picoModel_t *model)
int PicoGetModelNumFrames (picoModel_t *model)
void * PicoGetModelData (picoModel_t *model)
int PicoGetModelNumShaders (picoModel_t *model)
picoShader_tPicoGetModelShader (picoModel_t *model, int num)
int PicoGetModelNumSurfaces (picoModel_t *model)
picoSurface_tPicoGetModelSurface (picoModel_t *model, int num)
int PicoGetModelTotalVertexes (picoModel_t *model)
int PicoGetModelTotalIndexes (picoModel_t *model)
char * PicoGetShaderName (picoShader_t *shader)
char * PicoGetShaderMapName (picoShader_t *shader)
picoByte_tPicoGetShaderAmbientColor (picoShader_t *shader)
picoByte_tPicoGetShaderDiffuseColor (picoShader_t *shader)
picoByte_tPicoGetShaderSpecularColor (picoShader_t *shader)
float PicoGetShaderTransparency (picoShader_t *shader)
float PicoGetShaderShininess (picoShader_t *shader)
void * PicoGetSurfaceData (picoSurface_t *surface)
picoSurfaceType_t PicoGetSurfaceType (picoSurface_t *surface)
char * PicoGetSurfaceName (picoSurface_t *surface)
picoShader_tPicoGetSurfaceShader (picoSurface_t *surface)
int PicoGetSurfaceNumVertexes (picoSurface_t *surface)
picoVec_tPicoGetSurfaceXYZ (picoSurface_t *surface, int num)
picoVec_tPicoGetSurfaceNormal (picoSurface_t *surface, int num)
picoVec_tPicoGetSurfaceST (picoSurface_t *surface, int array, int num)
picoByte_tPicoGetSurfaceColor (picoSurface_t *surface, int array, int num)
int PicoGetSurfaceNumIndexes (picoSurface_t *surface)
picoIndex_t PicoGetSurfaceIndex (picoSurface_t *surface, int num)
picoIndex_tPicoGetSurfaceIndexes (picoSurface_t *surface, int num)
picoVec_tPicoGetFaceNormal (picoSurface_t *surface, int num)
int PicoGetSurfaceSpecial (picoSurface_t *surface, int num)
unsigned int PicoVertexCoordGenerateHash (picoVec3_t xyz)
picoVertexCombinationHash_t ** PicoNewVertexCombinationHashTable (void)
void PicoFreeVertexCombinationHashTable (picoVertexCombinationHash_t **hashTable)
picoVertexCombinationHash_tPicoFindVertexCombinationInHashTable (picoVertexCombinationHash_t **hashTable, picoVec3_t xyz, picoVec3_t normal, picoVec3_t st, picoColor_t color)
picoVertexCombinationHash_tPicoAddVertexCombinationToHashTable (picoVertexCombinationHash_t **hashTable, picoVec3_t xyz, picoVec3_t normal, picoVec3_t st, picoColor_t color, picoIndex_t index)
int PicoFindSurfaceVertexNum (picoSurface_t *surface, picoVec3_t xyz, picoVec3_t normal, int numSTs, picoVec2_t *st, int numColors, picoColor_t *color, picoIndex_t smoothingGroup)
 finds a vertex matching the set parameters
static void indexarray_push_back (IndexArray *self, picoIndex_t value)
static void indexarray_reserve (IndexArray *self, size_t size)
static void indexarray_clear (IndexArray *self)
static void binarytree_extend (BinaryTree *self)
static size_t binarytree_size (BinaryTree *self)
static void binarytree_reserve (BinaryTree *self, size_t size)
static void binarytree_clear (BinaryTree *self)
static size_t UniqueIndices_size (UniqueIndices *self)
static void UniqueIndices_reserve (UniqueIndices *self, size_t size)
static void UniqueIndices_init (UniqueIndices *self, LessFunc lessFunc, void *lessData)
static void UniqueIndices_destroy (UniqueIndices *self)
static picoIndex_t UniqueIndices_find_or_insert (UniqueIndices *self, picoIndex_t value)
static picoIndex_t UniqueIndices_insert (UniqueIndices *self, picoIndex_t value)
static int lessSmoothVertex (void *data, picoIndex_t first, picoIndex_t second)
static void _pico_vertices_combine_shared_normals (picoVec3_t *xyz, picoIndex_t *smoothingGroups, picoVec3_t *normals, picoIndex_t numVertices)
static void _pico_triangles_generate_weighted_normals (picoIndexIter_t first, picoIndexIter_t end, picoVec3_t *xyz, picoVec3_t *normals)
static void _pico_normals_zero (picoNormalIter_t first, picoNormalIter_t last)
static void _pico_normals_normalize (picoNormalIter_t first, picoNormalIter_t last)
static double _pico_length_vec (picoVec3_t vec)
static int _pico_normal_is_unit_length (picoVec3_t normal)
static int _pico_normal_within_tolerance (picoVec3_t normal, picoVec3_t other)
static void _pico_normals_assign_generated_normals (picoNormalIter_t first, picoNormalIter_t last, picoNormalIter_t generated)
void PicoFixSurfaceNormals (picoSurface_t *surface)
void PicoAddTriangleToModel (picoModel_t *model, picoVec3_t **xyz, picoVec3_t **normals, int numSTs, picoVec2_t **st, int numColors, picoColor_t **colors, picoShader_t *shader, picoIndex_t *smoothingGroup)
 A nice way to add individual triangles to the model. Chooses an appropriate surface based on the shader, or adds a new surface if necessary.

Define Documentation

#define FLOAT_EQUAL_EPSILON ( f,
other,
epsilon   )     (fabs(f - other) < epsilon)

Definition at line 1555 of file picomodel.c.

Referenced by _pico_normal_is_unit_length().

#define HASH_NORMAL_EPSILON   0.02f

Definition at line 1125 of file picomodel.c.

Referenced by PicoFindVertexCombinationInHashTable().

#define HASH_ST_EPSILON   0.0001f

Definition at line 1124 of file picomodel.c.

Referenced by PicoFindVertexCombinationInHashTable().

#define HASH_XYZ_EPSILON   0.01f

Definition at line 1122 of file picomodel.c.

Referenced by PicoFindVertexCombinationInHashTable().

#define HASH_XYZ_EPSILONSPACE_MULTIPLIER   1.f / HASH_XYZ_EPSILON

Definition at line 1123 of file picomodel.c.

Referenced by PicoVertexCoordGenerateHash().

#define HASHTABLE_SIZE   7919
#define NORMAL_UNIT_LENGTH_EPSILON   0.01

Definition at line 1554 of file picomodel.c.

Referenced by _pico_normal_is_unit_length().

#define PICOMODEL_C

Definition at line 36 of file picomodel.c.


Typedef Documentation

typedef struct _BinaryTree BinaryTree
typedef struct _IndexArray IndexArray
typedef int(* LessFunc)(void *, picoIndex_t, picoIndex_t)

Definition at line 1370 of file picomodel.c.

Definition at line 1509 of file picomodel.c.

Definition at line 1508 of file picomodel.c.

typedef struct _UniqueIndices UniqueIndices

Function Documentation

static double _pico_length_vec ( picoVec3_t  vec  )  [static]

Definition at line 1549 of file picomodel.c.

Referenced by _pico_normal_is_unit_length().

static int _pico_normal_is_unit_length ( picoVec3_t  normal  )  [static]
static int _pico_normal_within_tolerance ( picoVec3_t  normal,
picoVec3_t  other 
) [static]

Definition at line 1562 of file picomodel.c.

References _pico_dot_vec().

Referenced by _pico_normals_assign_generated_normals().

static void _pico_normals_assign_generated_normals ( picoNormalIter_t  first,
picoNormalIter_t  last,
picoNormalIter_t  generated 
) [static]
static void _pico_normals_normalize ( picoNormalIter_t  first,
picoNormalIter_t  last 
) [static]

Definition at line 1542 of file picomodel.c.

References _pico_normalize_vec().

Referenced by PicoFixSurfaceNormals().

static void _pico_normals_zero ( picoNormalIter_t  first,
picoNormalIter_t  last 
) [static]

Definition at line 1535 of file picomodel.c.

References _pico_zero_vec().

Referenced by PicoFixSurfaceNormals().

static void _pico_triangles_generate_weighted_normals ( picoIndexIter_t  first,
picoIndexIter_t  end,
picoVec3_t xyz,
picoVec3_t normals 
) [static]

Definition at line 1511 of file picomodel.c.

References _pico_add_vec(), _pico_cross_vec(), and _pico_subtract_vec().

Referenced by PicoFixSurfaceNormals().

static void _pico_vertices_combine_shared_normals ( picoVec3_t xyz,
picoIndex_t smoothingGroups,
picoVec3_t normals,
picoIndex_t  numVertices 
) [static]
static void binarytree_clear ( BinaryTree self  )  [static]

Definition at line 1365 of file picomodel.c.

References _pico_free().

Referenced by UniqueIndices_destroy().

static void binarytree_extend ( BinaryTree self  )  [static]

Definition at line 1348 of file picomodel.c.

Referenced by UniqueIndices_find_or_insert(), and UniqueIndices_insert().

static void binarytree_reserve ( BinaryTree self,
size_t  size 
) [static]

Definition at line 1360 of file picomodel.c.

References _pico_calloc().

Referenced by UniqueIndices_reserve().

static size_t binarytree_size ( BinaryTree self  )  [static]

Definition at line 1355 of file picomodel.c.

Referenced by UniqueIndices_find_or_insert(), and UniqueIndices_size().

static void indexarray_clear ( IndexArray self  )  [static]

Definition at line 1331 of file picomodel.c.

References _pico_free().

Referenced by _pico_vertices_combine_shared_normals(), and UniqueIndices_destroy().

static void indexarray_push_back ( IndexArray self,
picoIndex_t  value 
) [static]
static void indexarray_reserve ( IndexArray self,
size_t  size 
) [static]

Definition at line 1326 of file picomodel.c.

References _pico_calloc().

Referenced by _pico_vertices_combine_shared_normals(), and UniqueIndices_reserve().

static int lessSmoothVertex ( void *  data,
picoIndex_t  first,
picoIndex_t  second 
) [static]
void PicoAddTriangleToModel ( picoModel_t model,
picoVec3_t **  xyz,
picoVec3_t **  normals,
int  numSTs,
picoVec2_t **  st,
int  numColors,
picoColor_t **  colors,
picoShader_t shader,
picoIndex_t smoothingGroup 
)
picoVertexCombinationHash_t* PicoAddVertexCombinationToHashTable ( picoVertexCombinationHash_t **  hashTable,
picoVec3_t  xyz,
picoVec3_t  normal,
picoVec3_t  st,
picoColor_t  color,
picoIndex_t  index 
)
int PicoAdjustModel ( picoModel_t model,
int  numShaders,
int  numSurfaces 
)

adjusts a models's memory allocations to handle the requested sizes. will always grow, never shrink

Definition at line 285 of file picomodel.c.

References _pico_realloc(), picoModel_s::maxShaders, picoModel_s::maxSurfaces, picoModel_s::numShaders, picoModel_s::numSurfaces, PICO_GROW_SHADERS, PICO_GROW_SURFACES, picoModel_s::shader, and picoModel_s::surface.

Referenced by PicoNewShader(), and PicoNewSurface().

int PicoAdjustSurface ( picoSurface_t surface,
int  numVertexes,
int  numSTArrays,
int  numColorArrays,
int  numIndexes,
int  numFaceNormals 
)
int PicoError ( void   ) 

returns last picomodel error code (see PME_* defines)

Definition at line 62 of file picomodel.c.

picoShader_t* PicoFindShader ( picoModel_t model,
char *  name,
int  caseSensitive 
)

finds a named shader in a model

Definition at line 387 of file picomodel.c.

References _pico_stricmp, i, picoShader_s::name, picoModel_s::numShaders, and picoModel_s::shader.

picoSurface_t* PicoFindSurface ( picoModel_t model,
char *  name,
int  caseSensitive 
)

Finds first matching named surface in a model.

Definition at line 587 of file picomodel.c.

References _pico_stricmp, i, picoSurface_s::name, picoModel_s::numSurfaces, and picoModel_s::surface.

int PicoFindSurfaceVertexNum ( picoSurface_t surface,
picoVec3_t  xyz,
picoVec3_t  normal,
int  numSTs,
picoVec2_t st,
int  numColors,
picoColor_t color,
picoIndex_t  smoothingGroup 
)

finds a vertex matching the set parameters

Todo:
needs non-naive algorithm

Definition at line 1262 of file picomodel.c.

References picoSurface_s::color, i, picoSurface_s::normal, picoSurface_s::numVertexes, picoSurface_s::smoothingGroup, picoSurface_s::st, and picoSurface_s::xyz.

Referenced by PicoAddTriangleToModel().

picoVertexCombinationHash_t* PicoFindVertexCombinationInHashTable ( picoVertexCombinationHash_t **  hashTable,
picoVec3_t  xyz,
picoVec3_t  normal,
picoVec3_t  st,
picoColor_t  color 
)
void PicoFixSurfaceNormals ( picoSurface_t surface  ) 
void PicoFreeModel ( picoModel_t model  ) 
void PicoFreeShader ( picoShader_t shader  ) 

frees a shader and all associated data -sea

Definition at line 368 of file picomodel.c.

References _pico_free(), picoShader_s::mapName, and picoShader_s::name.

Referenced by PicoFreeModel().

void PicoFreeSurface ( picoSurface_t surface  ) 
void PicoFreeVertexCombinationHashTable ( picoVertexCombinationHash_t **  hashTable  ) 
picoVec_t* PicoGetFaceNormal ( picoSurface_t surface,
int  num 
)

Definition at line 1099 of file picomodel.c.

References picoSurface_s::faceNormal, and picoSurface_s::numFaceNormals.

void* PicoGetModelData ( picoModel_t model  ) 

Definition at line 879 of file picomodel.c.

References picoModel_s::data.

char* PicoGetModelFileName ( picoModel_t model  ) 

Definition at line 856 of file picomodel.c.

References picoModel_s::fileName.

int PicoGetModelFrameNum ( picoModel_t model  ) 

Definition at line 865 of file picomodel.c.

References picoModel_s::frameNum.

char* PicoGetModelName ( picoModel_t model  ) 

Definition at line 847 of file picomodel.c.

References picoModel_s::name.

int PicoGetModelNumFrames ( picoModel_t model  ) 

Definition at line 872 of file picomodel.c.

References picoModel_s::numFrames.

int PicoGetModelNumShaders ( picoModel_t model  ) 

Definition at line 886 of file picomodel.c.

References picoModel_s::numShaders.

int PicoGetModelNumSurfaces ( picoModel_t model  ) 

Definition at line 907 of file picomodel.c.

References picoModel_s::numSurfaces.

picoShader_t* PicoGetModelShader ( picoModel_t model,
int  num 
)

Definition at line 893 of file picomodel.c.

References picoModel_s::numShaders, and picoModel_s::shader.

Referenced by _md2_load().

picoSurface_t* PicoGetModelSurface ( picoModel_t model,
int  num 
)

Definition at line 914 of file picomodel.c.

References picoModel_s::numSurfaces, and picoModel_s::surface.

int PicoGetModelTotalIndexes ( picoModel_t model  ) 
int PicoGetModelTotalVertexes ( picoModel_t model  ) 
picoByte_t* PicoGetShaderAmbientColor ( picoShader_t shader  ) 

Definition at line 978 of file picomodel.c.

References picoShader_s::ambientColor.

picoByte_t* PicoGetShaderDiffuseColor ( picoShader_t shader  ) 

Definition at line 985 of file picomodel.c.

References picoShader_s::diffuseColor.

char* PicoGetShaderMapName ( picoShader_t shader  ) 

Definition at line 969 of file picomodel.c.

References picoShader_s::mapName.

char* PicoGetShaderName ( picoShader_t shader  ) 

Definition at line 960 of file picomodel.c.

References picoShader_s::name.

float PicoGetShaderShininess ( picoShader_t shader  ) 

Definition at line 1006 of file picomodel.c.

References picoShader_s::shininess.

picoByte_t* PicoGetShaderSpecularColor ( picoShader_t shader  ) 

Definition at line 992 of file picomodel.c.

References picoShader_s::specularColor.

float PicoGetShaderTransparency ( picoShader_t shader  ) 

Definition at line 999 of file picomodel.c.

References picoShader_s::transparency.

picoByte_t* PicoGetSurfaceColor ( picoSurface_t surface,
int  array,
int  num 
)
void* PicoGetSurfaceData ( picoSurface_t surface  ) 

Definition at line 1013 of file picomodel.c.

References picoSurface_s::data.

picoIndex_t PicoGetSurfaceIndex ( picoSurface_t surface,
int  num 
)

Definition at line 1085 of file picomodel.c.

References picoSurface_s::index, and picoSurface_s::numIndexes.

picoIndex_t* PicoGetSurfaceIndexes ( picoSurface_t surface,
int  num 
)

Definition at line 1092 of file picomodel.c.

References picoSurface_s::index, and picoSurface_s::numIndexes.

char * PicoGetSurfaceName ( picoSurface_t surface  ) 

Definition at line 1027 of file picomodel.c.

References picoSurface_s::name.

picoVec_t* PicoGetSurfaceNormal ( picoSurface_t surface,
int  num 
)

Definition at line 1057 of file picomodel.c.

References picoSurface_s::normal, and picoSurface_s::numVertexes.

int PicoGetSurfaceNumIndexes ( picoSurface_t surface  ) 

Definition at line 1078 of file picomodel.c.

References picoSurface_s::numIndexes.

Referenced by PicoAddTriangleToModel(), and PicoGetModelTotalIndexes().

int PicoGetSurfaceNumVertexes ( picoSurface_t surface  ) 

Definition at line 1043 of file picomodel.c.

References picoSurface_s::numVertexes.

Referenced by PicoAddTriangleToModel(), and PicoGetModelTotalVertexes().

picoShader_t* PicoGetSurfaceShader ( picoSurface_t surface  ) 

Definition at line 1036 of file picomodel.c.

References picoSurface_s::shader.

int PicoGetSurfaceSpecial ( picoSurface_t surface,
int  num 
)

Definition at line 1106 of file picomodel.c.

References PICO_MAX_SPECIAL, and picoSurface_s::special.

picoVec_t* PicoGetSurfaceST ( picoSurface_t surface,
int  array,
int  num 
)
picoSurfaceType_t PicoGetSurfaceType ( picoSurface_t surface  ) 

Definition at line 1020 of file picomodel.c.

References PICO_BAD, and picoSurface_s::type.

picoVec_t* PicoGetSurfaceXYZ ( picoSurface_t surface,
int  num 
)

Definition at line 1050 of file picomodel.c.

References picoSurface_s::numVertexes, and picoSurface_s::xyz.

int PicoInit ( void   ) 

Definition at line 46 of file picomodel.c.

picoModel_t* PicoLoadModel ( char *  fileName,
int  frameNum 
)
static picoModel_t* PicoModuleLoadModel ( const picoModule_t pm,
const char *  fileName,
picoByte_t buffer,
int  bufSize,
int  frameNum 
) [static]
picoModel_t* PicoModuleLoadModelStream ( const picoModule_t module,
const char *  fileName,
void *  inputStream,
PicoInputStreamReadFunc  inputStreamRead,
size_t  streamLength,
int  frameNum 
)
picoModel_t* PicoNewModel ( void   ) 

creates a new pico model

Definition at line 227 of file picomodel.c.

References _pico_alloc(), _pico_zero_bounds(), picoModel_s::maxs, picoModel_s::mins, and picoModel_s::numFrames.

Referenced by _ase_load(), _md2_load(), _md3_load(), and _obj_load().

picoShader_t* PicoNewShader ( picoModel_t model  ) 
picoSurface_t* PicoNewSurface ( picoModel_t model  ) 
picoVertexCombinationHash_t** PicoNewVertexCombinationHashTable ( void   ) 

Definition at line 1150 of file picomodel.c.

References _pico_alloc(), and HASHTABLE_SIZE.

void PicoSetFaceNormal ( picoSurface_t surface,
int  num,
picoVec3_t  normal 
)

Definition at line 822 of file picomodel.c.

References _pico_copy_vec(), picoSurface_s::faceNormal, and PicoAdjustSurface().

void PicoSetFreeFileFunc ( void(*)(void *)  func  ) 

sets the ptr to the free function

Definition at line 97 of file picomodel.c.

References _pico_ptr_free_file.

void PicoSetFreeFunc ( void(*)(void *)  func  ) 

sets the ptr to the free function

Definition at line 79 of file picomodel.c.

References _pico_ptr_free.

void PicoSetLoadFileFunc ( void(*)(char *, unsigned char **, int *)  func  ) 

sets the ptr to the file load function

Definition at line 88 of file picomodel.c.

References _pico_ptr_load_file.

void PicoSetMallocFunc ( void *(*)(size_t)  func  ) 

sets the ptr to the malloc function

Definition at line 70 of file picomodel.c.

References _pico_ptr_malloc.

void PicoSetModelData ( picoModel_t model,
void *  data 
)

Definition at line 648 of file picomodel.c.

References picoModel_s::data.

void PicoSetModelFileName ( picoModel_t model,
const char *  fileName 
)

Definition at line 624 of file picomodel.c.

References _pico_clone_alloc(), _pico_free(), and picoModel_s::fileName.

Referenced by _ase_load(), _md2_load(), _md3_load(), and _obj_load().

void PicoSetModelFrameNum ( picoModel_t model,
int  frameNum 
)

Definition at line 634 of file picomodel.c.

References picoModel_s::frameNum.

Referenced by _ase_load(), _md2_load(), _md3_load(), and _obj_load().

void PicoSetModelName ( picoModel_t model,
const char *  name 
)

Definition at line 614 of file picomodel.c.

References _pico_clone_alloc(), _pico_free(), and picoModel_s::name.

Referenced by _ase_load(), _md2_load(), _md3_load(), and _obj_load().

void PicoSetModelNumFrames ( picoModel_t model,
int  numFrames 
)

Definition at line 641 of file picomodel.c.

References picoModel_s::numFrames.

Referenced by _md2_load(), and _md3_load().

void PicoSetPrintFunc ( void(*)(int, const char *)  func  ) 

sets the ptr to the print function

Definition at line 106 of file picomodel.c.

References _pico_ptr_print.

void PicoSetShaderAmbientColor ( picoShader_t shader,
picoColor_t  color 
)

Definition at line 675 of file picomodel.c.

References picoShader_s::ambientColor.

Referenced by _ase_load().

void PicoSetShaderDiffuseColor ( picoShader_t shader,
picoColor_t  color 
)

Definition at line 685 of file picomodel.c.

References picoShader_s::diffuseColor.

Referenced by _ase_load().

void PicoSetShaderMapName ( picoShader_t shader,
char *  mapName 
)

Definition at line 665 of file picomodel.c.

References _pico_clone_alloc(), _pico_free(), and picoShader_s::mapName.

Referenced by _ase_load().

void PicoSetShaderName ( picoShader_t shader,
const char *  name 
)

Definition at line 655 of file picomodel.c.

References _pico_clone_alloc(), _pico_free(), and picoShader_s::name.

Referenced by _ase_load(), _md2_load(), _md3_load(), and _obj_default_shader().

void PicoSetShaderShininess ( picoShader_t shader,
float  value 
)

Definition at line 718 of file picomodel.c.

References picoShader_s::shininess.

Referenced by _ase_load().

void PicoSetShaderSpecularColor ( picoShader_t shader,
picoColor_t  color 
)

Definition at line 695 of file picomodel.c.

References picoShader_s::specularColor.

Referenced by _ase_load().

void PicoSetShaderTransparency ( picoShader_t shader,
float  value 
)

Definition at line 705 of file picomodel.c.

References picoShader_s::transparency.

Referenced by _ase_load().

void PicoSetSurfaceColor ( picoSurface_t surface,
int  array,
int  num,
const picoColor_t  color 
)

Definition at line 792 of file picomodel.c.

References picoSurface_s::color, and PicoAdjustSurface().

Referenced by _md2_load(), _md3_load(), and PicoAddTriangleToModel().

void PicoSetSurfaceData ( picoSurface_t surface,
void *  data 
)

Definition at line 731 of file picomodel.c.

References picoSurface_s::data.

void PicoSetSurfaceIndex ( picoSurface_t surface,
int  num,
picoIndex_t  index 
)

Definition at line 804 of file picomodel.c.

References picoSurface_s::index, and PicoAdjustSurface().

Referenced by _md2_load(), _md3_load(), _obj_load(), and PicoAddTriangleToModel().

void PicoSetSurfaceIndexes ( picoSurface_t surface,
int  num,
picoIndex_t index,
int  count 
)

Definition at line 813 of file picomodel.c.

References picoSurface_s::index, and PicoAdjustSurface().

void PicoSetSurfaceName ( picoSurface_t surface,
char *  name 
)
void PicoSetSurfaceNormal ( picoSurface_t surface,
int  num,
picoVec3_t  normal 
)
void PicoSetSurfaceShader ( picoSurface_t surface,
picoShader_t shader 
)

Definition at line 755 of file picomodel.c.

References picoSurface_s::shader.

Referenced by _md2_load(), _md3_load(), _obj_load(), and PicoAddTriangleToModel().

void PicoSetSurfaceSmoothingGroup ( picoSurface_t surface,
int  num,
picoIndex_t  smoothingGroup 
)

Definition at line 831 of file picomodel.c.

References PicoAdjustSurface(), and picoSurface_s::smoothingGroup.

Referenced by PicoAddTriangleToModel().

void PicoSetSurfaceSpecial ( picoSurface_t surface,
int  num,
int  special 
)

Definition at line 840 of file picomodel.c.

References PICO_MAX_SPECIAL, and picoSurface_s::special.

void PicoSetSurfaceST ( picoSurface_t surface,
int  array,
int  num,
picoVec2_t  st 
)

Definition at line 782 of file picomodel.c.

References PicoAdjustSurface(), and picoSurface_s::st.

Referenced by _md2_load(), _md3_load(), _obj_load(), and PicoAddTriangleToModel().

void PicoSetSurfaceType ( picoSurface_t surface,
picoSurfaceType_t  type 
)

Definition at line 738 of file picomodel.c.

References picoSurface_s::type.

Referenced by _md2_load(), _md3_load(), _obj_load(), and PicoAddTriangleToModel().

void PicoSetSurfaceXYZ ( picoSurface_t surface,
int  num,
picoVec3_t  xyz 
)
void PicoShutdown ( void   ) 

shuts the pico model library down

Definition at line 55 of file picomodel.c.

unsigned int PicoVertexCoordGenerateHash ( picoVec3_t  xyz  ) 
static void UniqueIndices_destroy ( UniqueIndices self  )  [static]

Definition at line 1397 of file picomodel.c.

References binarytree_clear(), and indexarray_clear().

Referenced by _pico_vertices_combine_shared_normals().

static picoIndex_t UniqueIndices_find_or_insert ( UniqueIndices self,
picoIndex_t  value 
) [static]
static void UniqueIndices_init ( UniqueIndices self,
LessFunc  lessFunc,
void *  lessData 
) [static]

Definition at line 1391 of file picomodel.c.

Referenced by _pico_vertices_combine_shared_normals().

static picoIndex_t UniqueIndices_insert ( UniqueIndices self,
picoIndex_t  value 
) [static]
static void UniqueIndices_reserve ( UniqueIndices self,
size_t  size 
) [static]

Definition at line 1385 of file picomodel.c.

References binarytree_reserve(), and indexarray_reserve().

Referenced by _pico_vertices_combine_shared_normals().

static size_t UniqueIndices_size ( UniqueIndices self  )  [static]

Definition at line 1380 of file picomodel.c.

References binarytree_size().

Referenced by _pico_vertices_combine_shared_normals().


Generated by  doxygen 1.6.2