本文整理汇总了C++中AxisClear函数的典型用法代码示例。如果您正苦于以下问题:C++ AxisClear函数的具体用法?C++ AxisClear怎么用?C++ AxisClear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AxisClear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}
示例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
}
示例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] );
}
示例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 );
}
示例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;
}
示例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 );
}
}