Changeset 604

Show
Ignore:
Timestamp:
07/17/08 22:22:36 (4 months ago)
Author:
phill
Message:

o Merged in some patches made in another branch.
o Exposing x42_GetAnimInfluenceMatrices to client code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/morph-targets/libx42/anim-skin.c

    r597 r604  
    187187} 
    188188 
    189 bool anim_skin_vertices( x42memStream_t *oPos, x42memStream_t *oNorm, x42memStream_t *oTan, x42memStream_t *oBin, 
    190         x42memStream_t *iPos, x42vertNormal_t * RESTRICT iNorm, x42vertTangent_t * RESTRICT iTan, 
    191         const x42data_t *x42, uint groupNum, const affine_t *boneMats ) 
    192 
    193         uint i, maxInfs; 
     189void anim_skin_get_influences( affine_t *infs, const x42data_t *x42, uint groupNum, const affine_t *boneMats ) 
     190
     191        uint i; 
    194192        const x42group_t *grp; 
    195         affine_t infs[X42_MAX_INFLUENCES_PER_BATCH_V5]; 
    196193 
    197194        grp = x42->groups + groupNum; 
     
    208205                        affine_cpy( infs + i, &inf->meshToBone ); 
    209206        } 
    210  
     207
     208 
     209bool anim_skin_vertices( x42memStream_t *oPos, x42memStream_t *oNorm, x42memStream_t *oTan, x42memStream_t *oBin, 
     210        x42memStream_t *iPos, x42vertNormal_t * RESTRICT iNorm, x42vertTangent_t * RESTRICT iTan, 
     211        const x42data_t *x42, uint groupNum, const affine_t *boneMats ) 
     212
     213        uint maxInfs; 
     214        const x42group_t *grp; 
     215        affine_t infs[X42_MAX_INFLUENCES_PER_BATCH_V5]; 
     216 
     217        anim_skin_get_influences( infs, x42, groupNum, boneMats ); 
     218 
     219        grp = x42->groups + groupNum; 
    211220        maxInfs = grp->maxVertInfluences > 0 ? grp->maxVertInfluences : 1; 
    212221 
     
    243252        return true; 
    244253} 
     254 
     255X42_EXPORT size_t X42_CALL x42_GetAnimInfluenceMatricesSize( const x42data_t *x42, uint groupNum ) 
     256{ 
     257#ifndef LIBX42_NO_PARAM_VALIDATION 
     258        demand_rz( x42 != NULL, X42_ERR_BADPTR, "x42 is NULL" ); 
     259        demand_rz( x42_ValidateHeader( &x42->header ), X42_ERR_BADDATA, "invalid x42 header data" ); 
     260        demand_rz( groupNum < x42->header.numGroups, X42_ERR_OUTOFRANGE, "group number out of range" ); 
     261#endif 
     262 
     263        return sizeof( affine_t ) * x42->groups[groupNum].numInfluences; 
     264} 
     265 
     266X42_EXPORT affine_t* X42_CALL x42_GetAnimInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
     267        const affine_t *boneMats, uint groupNum, x42opts_t *opts ) 
     268{ 
     269        affine_t *ret; 
     270 
     271#ifndef LIBX42_NO_PARAM_VALIDATION 
     272        demand_rn( x42 != NULL, X42_ERR_BADPTR, "x42 is NULL" ); 
     273        demand_rn( x42_ValidateHeader( &x42->header ), X42_ERR_BADDATA, "invalid x42 header data" ); 
     274        demand_rn( out_buffer != NULL, X42_ERR_BADPTR, "out_buffer is NULL" ); 
     275        demand_rn( boneMats != NULL, X42_ERR_BADPTR, "boneMats is NULL" ); 
     276        demand_rn( groupNum < x42->header.numGroups, X42_ERR_OUTOFRANGE, "group number out of range" ); 
     277#endif 
     278 
     279        REF_PARAM( opts ); 
     280 
     281        ret = (affine_t*)out_buffer; 
     282 
     283        anim_skin_get_influences( ret, x42, groupNum, boneMats ); 
     284 
     285        return ret; 
     286} 
  • branches/morph-targets/libx42/anim.c

    r593 r604  
    7272        x42tempMem_t *tmpMem, x42opts_t *opts ) 
    7373{ 
     74#ifndef LIBX42_NO_PARAM_VALIDATION 
    7475        uint i; 
     76#endif 
    7577 
    7678        x42memStream_t vPos; 
  • branches/morph-targets/libx42/include/x42.h

    r593 r604  
    474474*/ 
    475475 
     476X42_EXPORT size_t X42_CALL x42_GetAnimInfluenceMatricesSize( const x42data_t *x42, uint groupNum ); 
     477X42_EXPORT affine_t* X42_CALL x42_GetAnimInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
     478        const affine_t *boneMats, uint groupNum, x42opts_t *opts ); 
     479 
    476480#define X42_MEMSTREAM_UNRESTRICTED      0 
    477481#define X42_MEMSTREAM_WRITE_ONLY        0x00000001 
  • branches/morph-targets/libx42/local.h

    r593 r604  
    125125 
    126126/* internal calls */ 
     127void anim_skin_get_influences( affine_t *infs, const x42data_t *x42, uint groupNum, const affine_t *boneMats ); 
     128 
    127129bool anim_morph_vertices( vec4_t * RESTRICT oPos, x42vertNormal_t * RESTRICT oNorm, x42vertTangent_t * RESTRICT oTan, 
    128130        const x42data_t *x42, uint groupNum, const x42morphState_t *morphs, uint numMorphs, bool renormalize ); 
  • branches/morph-targets/libx42/platform/null/null_platform.c

    r462 r604  
    103103} 
    104104 
    105 bool opt_CopyStreamToStream( x42memStream_t *dest, x42memStream_t *src, 
     105bool opt_copy_stream_to_stream( x42memStream_t *dest, x42memStream_t *src, 
    106106        size_t elemSize, uint numElems, x42opts_t *opts ) 
    107107{ 
     
    114114        return false; 
    115115} 
     116 
     117bool opt_skin_vertices( x42memStream_t *oPos, x42memStream_t *oNorm, x42memStream_t *oTan, x42memStream_t *oBin, 
     118                x42memStream_t *iPos, x42vertNormal_t * RESTRICT iNorm, x42vertTangent_t * RESTRICT iTan, 
     119                const x42data_t *x42, uint groupNum, const affine_t *boneMats, x42opts_t *opts ) 
     120{ 
     121        REF_PARAM( oPos ); 
     122        REF_PARAM( oNorm ); 
     123        REF_PARAM( oTan ); 
     124        REF_PARAM( oBin ); 
     125        REF_PARAM( iPos ); 
     126        REF_PARAM( iNorm ); 
     127        REF_PARAM( iTan ); 
     128        REF_PARAM( x42 ); 
     129        REF_PARAM( groupNum ); 
     130        REF_PARAM( boneMats ); 
     131        REF_PARAM( opts ); 
     132 
     133        return false; 
     134} 
     135 
     136bool opt_morph_vertices( vec4_t * RESTRICT oPos, x42vertNormal_t * RESTRICT oNorm, x42vertTangent_t * RESTRICT oTan, const x42data_t *x42, uint groupNum, const x42morphState_t *morphs, uint numMorphs, bool renormalize, x42opts_t *opts ) 
     137{ 
     138        REF_PARAM( oPos ); 
     139        REF_PARAM( oNorm ); 
     140        REF_PARAM( oTan ); 
     141        REF_PARAM( x42 ); 
     142        REF_PARAM( groupNum ); 
     143        REF_PARAM( morphs ); 
     144        REF_PARAM( numMorphs ); 
     145        REF_PARAM( renormalize ); 
     146        REF_PARAM( opts ); 
     147 
     148        return false; 
     149} 
     150 
  • branches/morph-targets/libx42/vertattribs.c

    r462 r604  
    8484                return true; 
    8585 
    86         if( oTc
     86        if( oTc && x42->vertTc
    8787                copy_tc( x42->vertTc + g->firstVert, g->numVerts, oTc ); 
    8888 
    89         if( oCl
     89        if( oCl && x42->vertCl
    9090        { 
    9191                switch( color_type )