本文整理汇总了C++中AxisClear函数的典型用法代码示例。如果您正苦于以下问题:C++ AxisClear函数的具体用法?C++ AxisClear怎么用?C++ AxisClear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AxisClear函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: R_LerpTag
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame,
float frac, const char *tagName ) {
md3Tag_t *start, *end;
#ifdef RAVENMD4
md3Tag_t start_space, end_space;
#endif
int i;
float frontLerp, backLerp;
model_t *model;
model = R_GetModelByHandle( handle );
if ( !model->md3[0] )
{
#ifdef RAVENMD4
if(model->type == MOD_MDR)
{
start = &start_space;
end = &end_space;
R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, start);
R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, end);
}
else
#endif
if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
AxisClear( tag->axis );
VectorClear( &tag->origin );
return qfalse;
}
}
else
{
start = R_GetTag( model->md3[0], startFrame, tagName );
end = R_GetTag( model->md3[0], endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( &tag->origin );
return qfalse;
}
}
frontLerp = frac;
backLerp = 1.0f - frac;
for ( i = 0 ; i < 3 ; i++ ) {
tag->origin.data[i] = start->origin.data[i] * backLerp + end->origin.data[i] * frontLerp;
tag->axis[0].data[i] = start->axis[0].data[i] * backLerp + end->axis[0].data[i] * frontLerp;
tag->axis[1].data[i] = start->axis[1].data[i] * backLerp + end->axis[1].data[i] * frontLerp;
tag->axis[2].data[i] = start->axis[2].data[i] * backLerp + end->axis[2].data[i] * frontLerp;
}
VectorNormalize( &tag->axis[0] );
VectorNormalize( &tag->axis[1] );
VectorNormalize( &tag->axis[2] );
return qtrue;
}
开发者ID:Razish,项目名称:QtZ,代码行数:60,代码来源:tr_model.c
示例2: R_LerpTag
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, float frac, const char *tagName )
{
const model_t* model = R_GetModelByHandle( handle );
if ( !model->md3[0] ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
const md3Tag_t* start = R_GetTag( model->md3[0], startFrame, tagName );
const md3Tag_t* end = R_GetTag( model->md3[0], endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
float backLerp = 1.0f - frac;
for ( int i = 0; i < 3; ++i ) {
tag->origin[i] = start->origin[i] * backLerp + end->origin[i] * frac;
tag->axis[0][i] = start->axis[0][i] * backLerp + end->axis[0][i] * frac;
tag->axis[1][i] = start->axis[1][i] * backLerp + end->axis[1][i] * frac;
tag->axis[2][i] = start->axis[2][i] * backLerp + end->axis[2][i] * frac;
}
VectorNormalize( tag->axis[0] );
VectorNormalize( tag->axis[1] );
VectorNormalize( tag->axis[2] );
return qtrue;
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:31,代码来源:tr_model.cpp
示例3: R_LerpTag
bool R_LerpTag( orientation_t* tag, qhandle_t handle, int startFrame, int endFrame,
float frac, const char* tagName ) {
int i;
float frontLerp, backLerp;
idRenderModel* model = R_GetModelByHandle( handle );
if ( !model->q3_md3[ 0 ].header ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return false;
}
md3Tag_t* start = R_GetTag( model->q3_md3[ 0 ].header, startFrame, tagName );
md3Tag_t* end = R_GetTag( model->q3_md3[ 0 ].header, endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return false;
}
frontLerp = frac;
backLerp = 1.0f - frac;
for ( i = 0; i < 3; i++ ) {
tag->origin[ i ] = start->origin[ i ] * backLerp + end->origin[ i ] * frontLerp;
tag->axis[ 0 ][ i ] = start->axis[ 0 ][ i ] * backLerp + end->axis[ 0 ][ i ] * frontLerp;
tag->axis[ 1 ][ i ] = start->axis[ 1 ][ i ] * backLerp + end->axis[ 1 ][ i ] * frontLerp;
tag->axis[ 2 ][ i ] = start->axis[ 2 ][ i ] * backLerp + end->axis[ 2 ][ i ] * frontLerp;
}
VectorNormalize( tag->axis[ 0 ] );
VectorNormalize( tag->axis[ 1 ] );
VectorNormalize( tag->axis[ 2 ] );
return true;
}
开发者ID:janisl,项目名称:jlquake,代码行数:34,代码来源:model.cpp
示例4: RE_LerpTagQ3A
/*
================
RE_LerpTagQ3A
================
*/
int RE_LerpTagQ3A( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, float frac, const char *tagNameIn )
{
mdvTag_t *start, *end;
int i;
float frontLerp, backLerp;
model_t *model;
char tagName[ MAX_QPATH ];
int retval;
Q_strncpyz( tagName, tagNameIn, MAX_QPATH );
model = R_GetModelByHandle( handle );
if ( !model->mdv[ 0 ] )
{
AxisClear( tag->axis );
VectorClear( tag->origin );
return -1;
}
start = end = NULL;
retval = R_GetTag( model->mdv[ 0 ], startFrame, tagName, 0, &start );
retval = R_GetTag( model->mdv[ 0 ], endFrame, tagName, 0, &end );
if ( !start || !end )
{
AxisClear( tag->axis );
VectorClear( tag->origin );
return -1;
}
frontLerp = frac;
backLerp = 1.0f - frac;
for ( i = 0; i < 3; i++ )
{
tag->origin[ i ] = start->origin[ i ] * backLerp + end->origin[ i ] * frontLerp;
tag->axis[ 0 ][ i ] = start->axis[ 0 ][ i ] * backLerp + end->axis[ 0 ][ i ] * frontLerp;
tag->axis[ 1 ][ i ] = start->axis[ 1 ][ i ] * backLerp + end->axis[ 1 ][ i ] * frontLerp;
tag->axis[ 2 ][ i ] = start->axis[ 2 ][ i ] * backLerp + end->axis[ 2 ][ i ] * frontLerp;
}
VectorNormalize( tag->axis[ 0 ] );
VectorNormalize( tag->axis[ 1 ] );
VectorNormalize( tag->axis[ 2 ] );
return retval;
}
开发者ID:Asvarox,项目名称:Unvanquished,代码行数:53,代码来源:tr_model.c
示例5: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
==================
*/
void CG_SpawnEffect( bvec3_t org ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = FIXED_INT32RATIO_G(1,( le->endTime - le->startTime ));
le->color[0] = le->color[1] = le->color[2] = le->color[3] = GFIXED_1;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = MSECTIME_G(cg.time);
#ifndef MISSIONPACK
re->customShader = cgs.media.teleportEffectShader;
#endif
re->hModel = cgs.media.teleportEffectModel;
AxisClear( re->axis );
VectorCopy( org, re->origin );
#ifdef MISSIONPACK
re->origin[2] += BFIXED(16,0);
#else
re->origin[2] -= BFIXED(24,0);
#endif
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:38,代码来源:cg_effects.cpp
示例6: CL_ParseLaser
/*
=================
CL_ParseLaser
=================
*/
static void CL_ParseLaser (sizebuf_t *msg, int colors)
{
vec3_t start;
vec3_t end;
laser_t *l;
int i;
MSG_ReadPos (msg, start);
MSG_ReadPos (msg, end);
for (i = 0, l = cl_lasers; i < MAX_LASERS; i++, l++)
{
if (l->endtime < cl.time)
{
l->ent.flags = RF_TRANSLUCENT | RF_BEAM;
VectorCopy (start, l->ent.origin);
VectorCopy (end, l->ent.oldorigin);
l->ent.alpha = 0.30f;
l->ent.skinnum = (colors >> ((rand() % 4)*8)) & 0xff;
l->ent.model = NULL;
l->ent.frame = 4;
l->endtime = cl.time + 100;
#ifdef GL_QUAKE
AxisClear(l->ent.axis);
#endif
return;
}
}
开发者ID:hifi-unmaintained,项目名称:aprq2,代码行数:33,代码来源:cl_tent.c
示例7: Com_Error
/*
====================
CG_MakeExplosion
====================
*/
localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
qhandle_t hModel, qhandle_t shader,
int offset, int duration, bool isSprite )
{
float ang;
localEntity_t *ex;
vec3_t tmpVec, newOrigin;
if ( duration <= 0 ) {
Com_Error( ERR_DROP, "CG_MakeExplosion: duration = %i", duration );
}
// skew the time a bit so they aren't all in sync
offset += rand() & 63;
ex = CG_AllocLocalEntity();
if ( isSprite )
{
ex->leType = LE_SPRITE_EXPLOSION;
// randomly rotate sprite orientation
ex->refEntity.rotation = rand() % 360;
VectorScale( dir, 16, tmpVec );
VectorAdd( tmpVec, origin, newOrigin );
}
else
{
ex->leType = LE_EXPLOSION;
VectorCopy( origin, newOrigin );
// set axis with random rotate
if ( !dir )
{
AxisClear( ex->refEntity.axis );
} else
{
ang = rand() % 360;
VectorCopy( dir, ex->refEntity.axis[0] );
RotateAroundDirection( ex->refEntity.axis, ang );
}
}
// calc the timings
ex->startTime = cg.time + offset;
ex->endTime = ex->startTime + duration;
// bias the time so all shader effects start correctly
ex->refEntity.shaderTime = ex->startTime / 1000.0f;
ex->refEntity.hModel = hModel;
ex->refEntity.customShader = shader;
// set origin
VectorCopy( newOrigin, ex->refEntity.origin );
VectorCopy( newOrigin, ex->refEntity.oldorigin );
ex->color[0] = ex->color[1] = ex->color[2] = 1;
return ex;
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:65,代码来源:cg_effects.c
示例8: CG_GrappleTrail
/*
==========================
CG_GrappleTrail
==========================
*/
void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi ) {
vec3_t origin;
entityState_t *es;
vec3_t forward, up;
refEntity_t beam;
es = &ent->currentState;
BG_EvaluateTrajectory( &es->pos, cg.time, origin );
ent->trailTime = cg.time;
memset( &beam, 0, sizeof( beam ) );
//FIXME adjust for muzzle position
VectorCopy ( cg_entities[ ent->currentState.otherEntityNum ].lerpOrigin, beam.origin );
beam.origin[2] += 26;
AngleVectors( cg_entities[ ent->currentState.otherEntityNum ].lerpAngles, forward, NULL, up );
VectorMA( beam.origin, -6, up, beam.origin );
VectorCopy( origin, beam.oldorigin );
if (Distance( beam.origin, beam.oldorigin ) < 64 )
return; // Don't draw if close
beam.reType = RT_LIGHTNING;
beam.customShader = cgs.media.lightningShader;
AxisClear( beam.axis );
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
beam.shaderRGBA[3] = 0xff;
trap_R_AddRefEntityToScene( &beam );
}
开发者ID:entdark,项目名称:q3mme,代码行数:37,代码来源:cg_weapons.c
示例9: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
RPG-X: RedTechie Added refEntity_t *ent_legs, refEntity_t *ent_torso, refEntity_t *ent_head
==================
*/
void CG_SpawnEffect( vec3_t org, refEntity_t *ent_legs, refEntity_t *ent_torso, refEntity_t *ent_head ) {
localEntity_t *le;
refEntity_t *re;
FX_Transporter(org);
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
//RPG-X: RedTechie - Playing with transporter crap
re->shaderTime = cg.time * 0.001f;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time * 0.001f;
re->customShader = cgs.media.teleportEffectShader;
re->hModel = cgs.media.teleportEffectModel;
AxisClear( re->axis );
VectorCopy( org, re->origin );
re->origin[2] -= 24;
}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:39,代码来源:cg_effects.c
示例10: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
==================
*/
void CG_SpawnEffect(vec3_t org)
{
localEntity_t *le;
refEntity_t *re;
return; // (SA) don't play spawn in effect right now
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = 1.0 / (le->endTime - le->startTime);
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time / 1000.0f;
re->customShader = cgs.media.teleportEffectShader;
re->hModel = cgs.media.teleportEffectModel;
AxisClear(re->axis);
VectorCopy(org, re->origin);
re->origin[2] -= 24;
}
开发者ID:morsik,项目名称:war-territory,代码行数:35,代码来源:cg_effects.c
示例11: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
==================
*/
void CG_SpawnEffect( vec3_t org ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time / 1000.0f;
#ifndef MISSIONPACK
re->customShader = cgs.media.teleportEffectShader;
#endif
re->hModel = cgs.media.teleportEffectModel;
AxisClear( re->axis );
VectorCopy( org, re->origin );
#ifdef MISSIONPACK
re->origin[2] += 16;
#else
re->origin[2] -= 24;
#endif
}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:38,代码来源:cg_effects.c
示例12: R_LerpTag
/*
================
R_LerpTag
================
*/
void R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame,
float frac, const char *tagName ) {
md3Tag_t *start, *finish;
int i;
float frontLerp, backLerp;
model_t *model;
model = R_GetModelByHandle( handle );
if ( model->md3[0] )
{
start = R_GetTag( model->md3[0], startFrame, tagName );
finish = R_GetTag( model->md3[0], endFrame, tagName );
}
else if ( model->md4 )
{
md3Tag_t tstart, tfinish;
start = &tstart;
R_GetAnimTag( model->md4, startFrame, tagName, start );
finish = &tfinish;
R_GetAnimTag( model->md4, endFrame, tagName, finish );
}
else
{
AxisClear( tag->axis );
VectorClear( tag->origin );
return;
}
if ( !start || !finish ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return;
}
frontLerp = frac;
backLerp = 1.0 - frac;
for ( i = 0 ; i < 3 ; i++ ) {
tag->origin[i] = start->origin[i] * backLerp + finish->origin[i] * frontLerp;
tag->axis[0][i] = start->axis[0][i] * backLerp + finish->axis[0][i] * frontLerp;
tag->axis[1][i] = start->axis[1][i] * backLerp + finish->axis[1][i] * frontLerp;
tag->axis[2][i] = start->axis[2][i] * backLerp + finish->axis[2][i] * frontLerp;
}
VectorNormalize( tag->axis[0] );
VectorNormalize( tag->axis[1] );
VectorNormalize( tag->axis[2] );
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:52,代码来源:tr_model.cpp
示例13: R_GetAnimTag
/*
================
R_GetAnimTag for MD4s or MDRs...
================
*/
static void R_GetAnimTag( md4Header_t *mod, int framenum, const char *tagName ,md3Tag_t * dest) {
int i;
int frameSize;
md4Frame_t *frame;
md4CompFrame_t *cframe;
md4Tag_t *tag;
md4Bone_t tbone;
if ( framenum >= mod->numFrames ) {
// it is possible to have a bad frame while changing models, so don't error
framenum = mod->numFrames - 1;
}
tag = (md4Tag_t *)((byte *)mod + mod->ofsTags);
for ( i = 0 ; i < mod->numTags ; i++, tag++ ) {
if ( !strcmp( tag->name, tagName ) )
{
if (mod->ofsFrames<0) //compressed model
{
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ mod->numBones ] );
cframe = (md4CompFrame_t *)((byte *)mod - mod->ofsFrames + framenum * frameSize );
MC_UnCompress(tbone.matrix,cframe->bones[tag->boneIndex].Comp);
{
int j,k;
for (j=0;j<3;j++)
{
for (k=0;k<3;k++)
dest->axis[j][k]=tbone.matrix[k][j];
}
}
dest->origin[0]=tbone.matrix[0][3];
dest->origin[1]=tbone.matrix[1][3];
dest->origin[2]=tbone.matrix[2][3];
}
else
{
frameSize = (int)( &((md4Frame_t *)0)->bones[ mod->numBones ] );
frame = (md4Frame_t *)((byte *)mod + mod->ofsFrames + framenum * frameSize );
{
int j,k;
for (j=0;j<3;j++)
{
for (k=0;k<3;k++)
dest->axis[j][k]=frame->bones[tag->boneIndex].matrix[k][j];
}
}
dest->origin[0]=frame->bones[tag->boneIndex].matrix[0][3];
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];
}
return;
}
}
AxisClear( dest->axis );
VectorClear( dest->origin );
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:61,代码来源:tr_model.cpp
示例14: CG_Error
/*
====================
CG_MakeExplosion
====================
*/
localEntity_t *CG_MakeExplosion( bvec3_t origin, avec3_t dir,
qhandle_t hModel, qhandle_t shader,
int msec, qboolean isSprite ) {
afixed ang;
localEntity_t *ex;
int offset;
bvec3_t tmpVec, newOrigin;
if ( msec <= 0 ) {
CG_Error( "CG_MakeExplosion: msec = %i", msec );
}
// skew the time a bit so they aren't all in sync
offset = rand() & 63;
ex = CG_AllocLocalEntity();
if ( isSprite ) {
ex->leType = LE_SPRITE_EXPLOSION;
// randomly rotate sprite orientation
ex->refEntity.rotation =MAKE_AFIXED(rand() % 360);
FIXED_VEC3SCALE_R( dir, BFIXED(16,0), tmpVec );
VectorAdd( tmpVec, origin, newOrigin );
} else {
ex->leType = LE_EXPLOSION;
VectorCopy( origin, newOrigin );
// set axis with random rotate
if ( !dir ) {
AxisClear( ex->refEntity.axis );
} else {
ang = MAKE_AFIXED(rand() % 360);
VectorCopy( dir, ex->refEntity.axis[0] );
RotateAroundDirection( ex->refEntity.axis, ang );
}
}
ex->startTime = cg.time - offset;
ex->endTime = ex->startTime + msec;
// bias the time so all shader effects start correctly
ex->refEntity.shaderTime = MSECTIME_G(ex->startTime);
ex->refEntity.hModel = hModel;
ex->refEntity.customShader = shader;
// set origin
VectorCopy( newOrigin, ex->refEntity.origin );
VectorCopy( newOrigin, ex->refEntity.oldorigin );
ex->color[0] = ex->color[1] = ex->color[2] = GFIXED_1;
return ex;
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:59,代码来源:cg_effects.cpp
示例15: FX_ProbeBeam
//TiM - Beam FX for the Neutrino Probe weapon
void FX_ProbeBeam( vec3_t origin, vec3_t dir, int clientNum, qboolean alt_fire )
{
trace_t tr;
refEntity_t beam;
vec3_t end;
float scale;
memset( &beam, 0, sizeof( beam ) );
if ( alt_fire )
scale = flrandom(7.0f, 12.0f);
else
scale = Q_fabs( 12.0f * sin( cg.time * 0.1f ) );
VectorMA( origin, PROBE_BEAM_LENGTH, dir, end );
CG_Trace( &tr, origin, NULL, NULL, end, clientNum, CONTENTS_SOLID );
trap_R_AddLightToScene( origin, 20, 114.0f / 255, 164.0f / 255, 1.0f );
VectorCopy( origin, beam.origin);
VectorCopy( tr.endpos, beam.oldorigin );
beam.reType = RT_LINE;
beam.customShader = cgs.media.probeBeam;
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
beam.shaderRGBA[3] = 0xff;
AxisClear( beam.axis );
beam.data.line.width = scale*0.1;
beam.data.line.width2 = scale;
beam.data.line.stscale = 1.0;
trap_R_AddRefEntityToScene( &beam );
if ( tr.fraction != 1.0f )
{
float radius;
if ( alt_fire )
radius = flrandom(1.5f, 3.0f) * (1.0 - (tr.fraction*0.3));
else
radius = flrandom(0.5f, 1.5f) * (1.0 - (tr.fraction*0.3));
if ( !radius )
return;
CG_ImpactMark( cgs.media.probeDecal, tr.endpos, tr.plane.normal, 0, 1, 1, 1, 0.2*(1.0-tr.fraction), qfalse, radius, qtrue );
trap_R_AddLightToScene( origin, radius*5, 114.0f / 255, 164.0f / 255, 1.0f );
}
}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:52,代码来源:fx_misc.c
示例16: R_LerpTag
/*
================
R_LerpTag
================
*/
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame,
float frac, const char *tagName ) {
md3Tag_t *start, *end;
md3Tag_t start_space, end_space;
int i;
float frontLerp, backLerp;
model_t *model;
model = R_GetModelByHandle( handle );
if ( !model->md3[0] )
{
if(model->type == MOD_MDR)
{
start = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, &start_space);
end = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, &end_space);
}
else if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, (iqmData_t *)model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
start = end = NULL;
}
}
else
{
start = R_GetTag( model->md3[0], startFrame, tagName );
end = R_GetTag( model->md3[0], endFrame, tagName );
}
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return false;
}
frontLerp = frac;
backLerp = 1.0f - frac;
for ( i = 0 ; i < 3 ; i++ ) {
tag->origin[i] = start->origin[i] * backLerp + end->origin[i] * frontLerp;
tag->axis[0][i] = start->axis[0][i] * backLerp + end->axis[0][i] * frontLerp;
tag->axis[1][i] = start->axis[1][i] * backLerp + end->axis[1][i] * frontLerp;
tag->axis[2][i] = start->axis[2][i] * backLerp + end->axis[2][i] * frontLerp;
}
VectorNormalize( tag->axis[0] );
VectorNormalize( tag->axis[1] );
VectorNormalize( tag->axis[2] );
return true;
}
开发者ID:ensiform,项目名称:q3pp,代码行数:55,代码来源:tr_model.cpp
示例17: R_GetAnimTag
void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t * dest)
{
int i;
int frameSize;
mdrFrame_t *frame;
mdrTag_t *tag;
if ( framenum >= mod->numFrames )
{
// it is possible to have a bad frame while changing models, so don't error
framenum = mod->numFrames - 1;
}
tag = (mdrTag_t *)((byte *)mod + mod->ofsTags);
for ( i = 0 ; i < mod->numTags ; i++, tag++ )
{
if ( !strcmp( tag->name, tagName ) )
{
Q_strncpyz(dest->name, tag->name, sizeof(dest->name));
// uncompressed model...
//
frameSize = (long)( &((mdrFrame_t *)0)->bones[ mod->numBones ] );
frame = (mdrFrame_t *)((byte *)mod + mod->ofsFrames + framenum * frameSize );
#if 1
VectorCopy(&frame->bones[tag->boneIndex].matrix[0][0], dest->axis[0] );
VectorCopy(&frame->bones[tag->boneIndex].matrix[1][0], dest->axis[1] );
VectorCopy(&frame->bones[tag->boneIndex].matrix[2][0], dest->axis[2] );
#else
{
int j,k;
for (j=0;j<3;j++)
{
for (k=0;k<3;k++)
dest->axis[j][k]=frame->bones[tag->boneIndex].matrix[k][j];
}
}
#endif
dest->origin[0]=frame->bones[tag->boneIndex].matrix[0][3];
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];
return;
}
}
AxisClear( dest->axis );
VectorClear( dest->origin );
strcpy(dest->name,"");
}
开发者ID:entdark,项目名称:q3mme,代码行数:50,代码来源:tr_model.c
示例18: R_IQMLerpTag
int R_IQMLerpTag( orientation_t *tag, iqmData_t *data,
qhandle_t frameModel, int startFrame,
qhandle_t endFrameModel, int endFrame,
float frac, const char *tagName ) {
iqmData_t *startSkeleton, *endSkeleton;
float jointMats[IQM_MAX_JOINTS * 12];
int joint;
char *names = data->names;
// get joint number by reading the joint names
for( joint = 0; joint < data->num_joints; joint++ ) {
if( !strcmp( tagName, names ) )
break;
names += strlen( names ) + 1;
}
if( joint >= data->num_joints ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
startSkeleton = R_GetIQMModelDataByHandle( frameModel, data );
endSkeleton = R_GetIQMModelDataByHandle( endFrameModel, data );
ComputeJointMats( data, startSkeleton, endSkeleton, startFrame, endFrame, frac, jointMats );
tag->axis[0][0] = jointMats[12 * joint + 0];
tag->axis[1][0] = jointMats[12 * joint + 1];
tag->axis[2][0] = jointMats[12 * joint + 2];
tag->origin[0] = jointMats[12 * joint + 3];
tag->axis[0][1] = jointMats[12 * joint + 4];
tag->axis[1][1] = jointMats[12 * joint + 5];
tag->axis[2][1] = jointMats[12 * joint + 6];
tag->origin[1] = jointMats[12 * joint + 7];
tag->axis[0][2] = jointMats[12 * joint + 8];
tag->axis[1][2] = jointMats[12 * joint + 9];
tag->axis[2][2] = jointMats[12 * joint + 10];
tag->origin[2] = jointMats[12 * joint + 11];
return qtrue;
}
开发者ID:DaneTheory,项目名称:spearmint,代码行数:41,代码来源:tr_model_iqm.c
示例19: CG_Draw3DModel
void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandle_t skin, vec3_t origin, vec3_t angles ) {
refdef_t refdef;
refEntity_t ent;
if ( !cg_draw3dIcons.integer || !cg_drawIcons.integer ) {
return;
}
CG_AdjustFrom640( &x, &y, &w, &h );
memset( &refdef, 0, sizeof( refdef ) );
memset( &ent, 0, sizeof( ent ) );
AnglesToAxis( angles, ent.axis );
VectorCopy( origin, ent.origin );
ent.hModel = model;
ent.customSkin = skin;
ent.renderfx = RF_NOSHADOW; // no stencil shadows
refdef.rdflags = RDF_NOWORLDMODEL;
AxisClear( refdef.viewaxis );
refdef.fov_x = 30;
refdef.fov_y = 30;
refdef.x = x;
refdef.y = y;
refdef.width = w;
refdef.height = h;
refdef.time = cg.time;
trap_R_ClearScene();
trap_R_AddRefEntityToScene( &ent );
trap_MME_TimeFraction(cg.timeFraction);
trap_R_RenderScene( &refdef );
}
开发者ID:entdark,项目名称:q3mme,代码行数:38,代码来源:cg_draw.c
示例20: CG_Draw3DModel
/*
================
CG_Draw3DModel
================
*/
void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandle_t skin, vec3_t origin, vec3_t angles ) {
refdef_t refdef;
refEntity_t ent;
CG_AdjustFrom640( &x, &y, &w, &h,qtrue);
memset( &refdef, 0, sizeof( refdef ) );
memset( &ent, 0, sizeof( ent ) );
AnglesToAxis( angles, ent.axis );
VectorCopy( origin, ent.origin );
ent.hModel = model;
ent.customSkin = skin;
ent.renderfx = RF_NOSHADOW | RF_DEPTHHACK | RF_LIGHTING_ORIGIN;
refdef.rdflags = RDF_NOWORLDMODEL;
AxisClear(refdef.viewaxis);
refdef.fov_x = 30;
refdef.fov_y = 30;
refdef.x = x;
refdef.y = y;
refdef.width = w;
refdef.height = h;
refdef.time = cg.time;
trap_R_ClearScene();
trap_R_AddRefEntityToScene(&ent);
trap_R_RenderScene(&refdef);
}
开发者ID:Aravind7z,项目名称:zeq2lite,代码行数:30,代码来源:cg_draw.c
注:本文中的AxisClear函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论