Changeset 605

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

o Extra entry point. Can now build all influences or just some.

Files:

Legend:

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

    r604 r605  
    187187} 
    188188 
    189 void anim_skin_get_influences( affine_t *infs, const x42data_t *x42, uint groupNum, const affine_t *boneMats ) 
     189void anim_skin_get_group_influences( affine_t *infs, const x42data_t *x42, uint groupNum, const affine_t *boneMats ) 
    190190{ 
    191191        uint i; 
     
    207207} 
    208208 
     209void anim_skin_get_influences( affine_t *infs, const x42data_t *x42, const affine_t *boneMats ) 
     210{ 
     211        uint i; 
     212        for( i = 0; i < x42->header.numInfluences; i++ ) 
     213        { 
     214                const x42influence_t *inf = x42->influences + i; 
     215 
     216                if( inf->bone != X42_MODEL_BONE ) 
     217                        affine_mul( infs + i, boneMats + inf->bone, &inf->meshToBone ); 
     218                else if( x42->header.runFlags & X42_RF_ROOT_MATRIX ) 
     219                        affine_mul( infs + i, &x42->rootMatrix, &inf->meshToBone ); 
     220                else 
     221                        affine_cpy( infs + i, &inf->meshToBone ); 
     222        } 
     223} 
     224 
    209225bool anim_skin_vertices( x42memStream_t *oPos, x42memStream_t *oNorm, x42memStream_t *oTan, x42memStream_t *oBin, 
    210226        x42memStream_t *iPos, x42vertNormal_t * RESTRICT iNorm, x42vertTangent_t * RESTRICT iTan, 
     
    215231        affine_t infs[X42_MAX_INFLUENCES_PER_BATCH_V5]; 
    216232 
    217         anim_skin_get_influences( infs, x42, groupNum, boneMats ); 
     233        anim_skin_get_group_influences( infs, x42, groupNum, boneMats ); 
    218234 
    219235        grp = x42->groups + groupNum; 
     
    253269} 
    254270 
    255 X42_EXPORT size_t X42_CALL x42_GetAnimInfluenceMatricesSize( const x42data_t *x42, uint groupNum ) 
     271X42_EXPORT size_t X42_CALL x42_GetAnimGroupInfluenceMatricesSize( const x42data_t *x42, uint groupNum ) 
    256272{ 
    257273#ifndef LIBX42_NO_PARAM_VALIDATION 
     
    264280} 
    265281 
    266 X42_EXPORT affine_t* X42_CALL x42_GetAnimInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
     282X42_EXPORT affine_t* X42_CALL x42_GetAnimGroupInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
    267283        const affine_t *boneMats, uint groupNum, x42opts_t *opts ) 
    268284{ 
     
    281297        ret = (affine_t*)out_buffer; 
    282298 
    283         anim_skin_get_influences( ret, x42, groupNum, boneMats ); 
     299        anim_skin_get_group_influences( ret, x42, groupNum, boneMats ); 
    284300 
    285301        return ret; 
    286302} 
     303 
     304X42_EXPORT size_t X42_CALL x42_GetAnimInfluenceMatricesSize( const x42data_t *x42 ) 
     305{ 
     306#ifndef LIBX42_NO_PARAM_VALIDATION 
     307        demand_rz( x42 != NULL, X42_ERR_BADPTR, "x42 is NULL" ); 
     308        demand_rz( x42_ValidateHeader( &x42->header ), X42_ERR_BADDATA, "invalid x42 header data" ); 
     309#endif 
     310 
     311        return sizeof( affine_t ) * x42->header.numInfluences; 
     312} 
     313 
     314X42_EXPORT affine_t* X42_CALL x42_GetAnimInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
     315        const affine_t *boneMats, x42opts_t *opts ) 
     316{ 
     317        affine_t *ret; 
     318 
     319#ifndef LIBX42_NO_PARAM_VALIDATION 
     320        demand_rn( x42 != NULL, X42_ERR_BADPTR, "x42 is NULL" ); 
     321        demand_rn( x42_ValidateHeader( &x42->header ), X42_ERR_BADDATA, "invalid x42 header data" ); 
     322        demand_rn( out_buffer != NULL, X42_ERR_BADPTR, "out_buffer is NULL" ); 
     323        demand_rn( boneMats != NULL, X42_ERR_BADPTR, "boneMats is NULL" ); 
     324#endif 
     325 
     326        REF_PARAM( opts ); 
     327 
     328        ret = (affine_t*)out_buffer; 
     329 
     330        anim_skin_get_influences( ret, x42, boneMats ); 
     331 
     332        return ret; 
     333} 
  • branches/morph-targets/libx42/include/x42.h

    r604 r605  
    445445X42_EXPORT size_t X42_CALL x42_GetAnimBoneMatricesSize( const x42data_t *x42 ); 
    446446X42_EXPORT size_t X42_CALL x42_GetAnimTagMatricesSize( const x42data_t *x42 ); 
     447X42_EXPORT size_t X42_CALL x42_GetAnimInfluenceMatricesSize( const x42data_t *x42 ); 
    447448 
    448449X42_EXPORT affine_t* X42_CALL x42_GetAnimBoneMatrices( void *out_buffer, const x42data_t *x42, 
    449450        const x42animLerp_t *lerp, x42opts_t *opts ); 
    450451X42_EXPORT affine_t* X42_CALL x42_GetAnimTagMatrices( void *out_buffer, const x42data_t *x42, 
     452        const affine_t *boneMats, x42opts_t *opts ); 
     453X42_EXPORT affine_t* X42_CALL x42_GetAnimInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
    451454        const affine_t *boneMats, x42opts_t *opts ); 
    452455 
     
    474477*/ 
    475478 
    476 X42_EXPORT size_t X42_CALL x42_GetAnimInfluenceMatricesSize( const x42data_t *x42, uint groupNum ); 
    477 X42_EXPORT affine_t* X42_CALL x42_GetAnimInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
     479X42_EXPORT size_t X42_CALL x42_GetAnimGroupInfluenceMatricesSize( const x42data_t *x42, uint groupNum ); 
     480X42_EXPORT affine_t* X42_CALL x42_GetAnimGroupInfluenceMatrices( void *out_buffer, const x42data_t *x42, 
    478481        const affine_t *boneMats, uint groupNum, x42opts_t *opts ); 
    479482 
  • branches/morph-targets/libx42/local.h

    r604 r605  
    125125 
    126126/* internal calls */ 
    127 void anim_skin_get_influences( affine_t *infs, const x42data_t *x42, uint groupNum, const affine_t *boneMats ); 
     127void anim_skin_get_group_influences( affine_t *infs, const x42data_t *x42, uint groupNum, const affine_t *boneMats ); 
     128void anim_skin_get_influences( affine_t *infs, const x42data_t *x42, const affine_t *boneMats ); 
    128129 
    129130bool anim_morph_vertices( vec4_t * RESTRICT oPos, x42vertNormal_t * RESTRICT oNorm, x42vertTangent_t * RESTRICT oTan,