您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AnglesToAxis函数代码示例

51自学网 2021-06-01 19:47:00
  C++
这篇教程C++ AnglesToAxis函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中AnglesToAxis函数的典型用法代码示例。如果您正苦于以下问题:C++ AnglesToAxis函数的具体用法?C++ AnglesToAxis怎么用?C++ AnglesToAxis使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AnglesToAxis函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: R_SetupEntityLightingGrid

//.........这里部分代码省略.........		{			continue;	// ignore samples in walls		}#if 0		if ( !SV_inPVS( startLightOrigin, gridOrg ) )		{			continue;		}#endif		totalFactor += factor;		for(j=0;j<MAXLIGHTMAPS;j++)		{			if (data->styles[j] != LS_NONE)			{				const byte	style= data->styles[j];				ent->ambientLight[0] += factor * data->ambientLight[j][0] * styleColors[style][0] / 255.0f;				ent->ambientLight[1] += factor * data->ambientLight[j][1] * styleColors[style][1] / 255.0f;				ent->ambientLight[2] += factor * data->ambientLight[j][2] * styleColors[style][2] / 255.0f;				ent->directedLight[0] += factor * data->directLight[j][0] * styleColors[style][0] / 255.0f;				ent->directedLight[1] += factor * data->directLight[j][1] * styleColors[style][1] / 255.0f;				ent->directedLight[2] += factor * data->directLight[j][2] * styleColors[style][2] / 255.0f;			}			else			{				break;			}		}		lat = data->latLong[1];		lng = data->latLong[0];		lat *= (FUNCTABLE_SIZE/256);		lng *= (FUNCTABLE_SIZE/256);		// decode X as cos( lat ) * sin( long )		// decode Y as sin( lat ) * sin( long )		// decode Z as cos( long )		normal[0] = tr.sinTable[(lat+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK] * tr.sinTable[lng];		normal[1] = tr.sinTable[lat] * tr.sinTable[lng];		normal[2] = tr.sinTable[(lng+(FUNCTABLE_SIZE/4))&FUNCTABLE_MASK];		VectorMA( direction, factor, normal, direction );#if ACCURATE_LIGHTGRID_SAMPLING		if ( r_debugLight->integer && ent->e.hModel == -1 )		{			//draw 				refEntity_t refEnt;			refEnt.hModel = 0;			refEnt.ghoul2 = NULL;			refEnt.renderfx = 0;			VectorCopy( gridOrg, refEnt.origin );			vectoangles( normal, refEnt.angles );			AnglesToAxis( refEnt.angles, refEnt.axis );			refEnt.reType = RT_MODEL;			RE_AddRefEntityToScene( &refEnt );			refEnt.renderfx = RF_DEPTHHACK;			refEnt.reType = RT_SPRITE;			refEnt.customShader = RE_RegisterShader( "gfx/misc/debugAmbient" );			refEnt.shaderRGBA[0] = data->ambientLight[0][0];			refEnt.shaderRGBA[1] = data->ambientLight[0][1];			refEnt.shaderRGBA[2] = data->ambientLight[0][2];			refEnt.shaderRGBA[3] = 255;			refEnt.radius = factor*50+2.0f; // maybe always give it a minimum size?			refEnt.rotation = 0;			// don't let the sprite wobble around			RE_AddRefEntityToScene( &refEnt );			refEnt.reType = RT_LINE;			refEnt.customShader = RE_RegisterShader( "gfx/misc/debugArrow" );			refEnt.shaderRGBA[0] = data->directLight[0][0];			refEnt.shaderRGBA[1] = data->directLight[0][1];			refEnt.shaderRGBA[2] = data->directLight[0][2];			refEnt.shaderRGBA[3] = 255;			VectorCopy( refEnt.origin, refEnt.oldorigin );			VectorMA( gridOrg, (factor*-255) - 2.0f, normal, refEnt.origin ); // maybe always give it a minimum length			refEnt.radius = 1.5f;			RE_AddRefEntityToScene( &refEnt );		}#endif	}	if ( totalFactor > 0 && totalFactor < 0.99 ) 	{		totalFactor = 1.0 / totalFactor;		VectorScale( ent->ambientLight, totalFactor, ent->ambientLight );		VectorScale( ent->directedLight, totalFactor, ent->directedLight );	}	VectorScale( ent->ambientLight, r_ambientScale->value, ent->ambientLight );	VectorScale( ent->directedLight, r_directedScale->value, ent->directedLight );	VectorNormalize2( direction, ent->lightDir );}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:101,


示例2: CG_AddFragment

/*================CG_AddFragment================*/void CG_AddFragment( localEntity_t *le ) {	vec3_t	newOrigin;	trace_t	trace;	if (le->forceAlpha)	{		le->refEntity.renderfx |= RF_FORCE_ENT_ALPHA;		le->refEntity.shaderRGBA[3] = le->forceAlpha;	}	if ( le->pos.trType == TR_STATIONARY ) {		// sink into the ground if near the removal time		int		t;		float	t_e;		t = le->endTime - cg.time;		if ( t < (SINK_TIME*2) ) {			le->refEntity.renderfx |= RF_FORCE_ENT_ALPHA;			t_e = (float)((float)(le->endTime - cg.time)/(SINK_TIME*2));			t_e = (int)((t_e)*255);			if (t_e > 255)			{				t_e = 255;			}			if (t_e < 1)			{				t_e = 1;			}			if (le->refEntity.shaderRGBA[3] && t_e > le->refEntity.shaderRGBA[3])			{				t_e = le->refEntity.shaderRGBA[3];			}			le->refEntity.shaderRGBA[3] = t_e;			trap_R_AddRefEntityToScene( &le->refEntity );		} else {			trap_R_AddRefEntityToScene( &le->refEntity );		}		return;	}	// calculate new position	BG_EvaluateTrajectory( &le->pos, cg.time, newOrigin );	// trace a line from previous position to new position	CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, -1, CONTENTS_SOLID );	if ( trace.fraction == 1.0 ) {		// still in free fall		VectorCopy( newOrigin, le->refEntity.origin );		if ( le->leFlags & LEF_TUMBLE ) {			vec3_t angles;			BG_EvaluateTrajectory( &le->angles, cg.time, angles );			AnglesToAxis( angles, le->refEntity.axis );		}		trap_R_AddRefEntityToScene( &le->refEntity );		// add a blood trail		if ( le->leBounceSoundType == LEBS_BLOOD ) {			CG_BloodTrail( le );		}		return;	}	// if it is in a nodrop zone, remove it	// this keeps gibs from waiting at the bottom of pits of death	// and floating levels	if ( trap_CM_PointContents( trace.endpos, 0 ) & CONTENTS_NODROP ) {		CG_FreeLocalEntity( le );		return;	}	if (!trace.startsolid)	{		// leave a mark		CG_FragmentBounceMark( le, &trace );		// do a bouncy sound		CG_FragmentBounceSound( le, &trace );		if (le->bounceSound)		{ //specified bounce sound (debris)			trap_S_StartSound(le->pos.trBase, ENTITYNUM_WORLD, CHAN_AUTO, le->bounceSound);		}		// reflect the velocity on the trace plane		CG_ReflectVelocity( le, &trace );//.........这里部分代码省略.........
开发者ID:aufau,项目名称:jk2sdk-gpl-fork,代码行数:101,


示例3: CG_AddKamikaze

/*====================CG_AddKamikaze====================*/void CG_AddKamikaze( localEntity_t *le ) {	refEntity_t	*re;	refEntity_t shockwave;	float		c;	vec3_t		test, axis[3];	int			t;	re = &le->refEntity;	t = cg.time - le->startTime;	VectorClear( test );	AnglesToAxis( test, axis );	if (t > KAMI_SHOCKWAVE_STARTTIME && t < KAMI_SHOCKWAVE_ENDTIME) {		if (!(le->leFlags & LEF_SOUND1)) {//			trap_S_StartSound (re->origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.kamikazeExplodeSound );			trap_S_StartLocalSound(cgs.media.kamikazeExplodeSound, CHAN_AUTO);			le->leFlags |= LEF_SOUND1;		}		// 1st kamikaze shockwave		memset(&shockwave, 0, sizeof(shockwave));		shockwave.hModel = cgs.media.kamikazeShockWave;		shockwave.reType = RT_MODEL;		shockwave.shaderTime = re->shaderTime;		VectorCopy(re->origin, shockwave.origin);		c = (float)(t - KAMI_SHOCKWAVE_STARTTIME) / (float)(KAMI_SHOCKWAVE_ENDTIME - KAMI_SHOCKWAVE_STARTTIME);		VectorScale( axis[0], c * KAMI_SHOCKWAVE_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[0] );		VectorScale( axis[1], c * KAMI_SHOCKWAVE_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[1] );		VectorScale( axis[2], c * KAMI_SHOCKWAVE_MAXRADIUS / KAMI_SHOCKWAVEMODEL_RADIUS, shockwave.axis[2] );		shockwave.nonNormalizedAxes = qtrue;		if (t > KAMI_SHOCKWAVEFADE_STARTTIME) {			c = (float)(t - KAMI_SHOCKWAVEFADE_STARTTIME) / (float)(KAMI_SHOCKWAVE_ENDTIME - KAMI_SHOCKWAVEFADE_STARTTIME);		}		else {			c = 0;		}		c *= 0xff;		shockwave.shaderRGBA[0] = 0xff - c;		shockwave.shaderRGBA[1] = 0xff - c;		shockwave.shaderRGBA[2] = 0xff - c;		shockwave.shaderRGBA[3] = 0xff - c;		trap_R_AddRefEntityToScene( &shockwave );	}	if (t > KAMI_EXPLODE_STARTTIME && t < KAMI_IMPLODE_ENDTIME) {		// explosion and implosion		c = ( le->endTime - cg.time ) * le->lifeRate;		c *= 0xff;		re->shaderRGBA[0] = le->color[0] * c;		re->shaderRGBA[1] = le->color[1] * c;		re->shaderRGBA[2] = le->color[2] * c;		re->shaderRGBA[3] = le->color[3] * c;		if( t < KAMI_IMPLODE_STARTTIME ) {			c = (float)(t - KAMI_EXPLODE_STARTTIME) / (float)(KAMI_IMPLODE_STARTTIME - KAMI_EXPLODE_STARTTIME);		}		else {			if (!(le->leFlags & LEF_SOUND2)) {//				trap_S_StartSound (re->origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.kamikazeImplodeSound );				trap_S_StartLocalSound(cgs.media.kamikazeImplodeSound, CHAN_AUTO);				le->leFlags |= LEF_SOUND2;			}			c = (float)(KAMI_IMPLODE_ENDTIME - t) / (float) (KAMI_IMPLODE_ENDTIME - KAMI_IMPLODE_STARTTIME);		}		VectorScale( axis[0], c * KAMI_BOOMSPHERE_MAXRADIUS / KAMI_BOOMSPHEREMODEL_RADIUS, re->axis[0] );		VectorScale( axis[1], c * KAMI_BOOMSPHERE_MAXRADIUS / KAMI_BOOMSPHEREMODEL_RADIUS, re->axis[1] );		VectorScale( axis[2], c * KAMI_BOOMSPHERE_MAXRADIUS / KAMI_BOOMSPHEREMODEL_RADIUS, re->axis[2] );		re->nonNormalizedAxes = qtrue;		trap_R_AddRefEntityToScene( re );		// add the dlight		trap_R_AddLightToScene( re->origin, c * 1000.0, 1.0, 1.0, c );	}	if (t > KAMI_SHOCKWAVE2_STARTTIME && t < KAMI_SHOCKWAVE2_ENDTIME) {		// 2nd kamikaze shockwave		if (le->angles.trBase[0] == 0 &&			le->angles.trBase[1] == 0 &&			le->angles.trBase[2] == 0) {			le->angles.trBase[0] = random() * 360;			le->angles.trBase[1] = random() * 360;			le->angles.trBase[2] = random() * 360;		}		else {			c = 0;		}		memset(&shockwave, 0, sizeof(shockwave));		shockwave.hModel = cgs.media.kamikazeShockWave;		shockwave.reType = RT_MODEL;		shockwave.shaderTime = re->shaderTime;		VectorCopy(re->origin, shockwave.origin);//.........这里部分代码省略.........
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:101,


示例4: strike

//.........这里部分代码省略.........The cent should be the non-predicted cent if it is from the player,so the endpoint will reflect the simulated strike (lagging the predictedangle)===============*/static void CG_LightningBolt( centity_t *cent, vec3_t origin, int viewHeight ) {	trace_t  trace;	refEntity_t  beam;	vec3_t   forward;	vec3_t   muzzlePoint, endPoint;	fxParent_t fxParent;	if (cent->currentState.weapon != WP_LIGHTNING) {		return;	}	memset( &beam, 0, sizeof( beam ) );	// CPMA  "true" lightning	if (cg.playerCent && (cent->currentState.number == cg.playerCent->currentState.number) && (cg_trueLightning.value != 0)) {		vec3_t angle;		int i;		for (i = 0; i < 3; i++) {			float a = cent->lerpAngles[i] - cg.refdefViewAngles[i];			if (a > 180) {				a -= 360;			}			if (a < -180) {				a += 360;			}			angle[i] = cg.refdefViewAngles[i] + a * (1.0 - cg_trueLightning.value);			if (angle[i] < 0) {				angle[i] += 360;			}			if (angle[i] > 360) {				angle[i] -= 360;			}		}		AngleVectors(angle, forward, NULL, NULL );		VectorCopy(cent->lerpOrigin, muzzlePoint );//		VectorCopy(cg.refdef.vieworg, muzzlePoint );	} else {		// !CPMA		AngleVectors( cent->lerpAngles, forward, NULL, NULL );		VectorCopy(cent->lerpOrigin, muzzlePoint );	}	// FIXME: crouch	//Cana viewheight fix//	muzzlePoint[2] += DEFAULT_VIEWHEIGHT;	muzzlePoint[2] += viewHeight;	VectorMA( muzzlePoint, 14, forward, muzzlePoint );	// project forward by the lightning range	VectorMA( muzzlePoint, LIGHTNING_RANGE, forward, endPoint );	// see if it hit a wall	CG_Trace( &trace, muzzlePoint, vec3_origin, vec3_origin, endPoint, 		cent->currentState.number, MASK_SHOT );#if 1 	VectorCopy( origin, fxParent.origin );	VectorSubtract( trace.endpos, origin, fxParent.dir );	fxParent.flags = FXP_ORIGIN | FXP_DIR;	trap_FX_Run( cgs.fx.lightning.trail, &fxParent, cent );#else	// this is the endpoint	VectorCopy( trace.endpos, beam.oldorigin );	// use the provided origin, even though it may be slightly	// different than the muzzle origin	VectorCopy( origin, beam.origin );	beam.reType = RT_LIGHTNING;	beam.customShader = cgs.media.lightningShader;	trap_R_AddRefEntityToScene( &beam );	// add the impact flare if it hit something	if ( trace.fraction < 1.0 ) {		vec3_t	angles;		vec3_t	dir;		VectorSubtract( beam.oldorigin, beam.origin, dir );		VectorNormalize( dir );		memset( &beam, 0, sizeof( beam ) );		beam.hModel = cgs.media.lightningExplosionModel;		VectorMA( trace.endpos, -16, dir, beam.origin );		// make a random orientation		angles[0] = rand() % 360;		angles[1] = rand() % 360;		angles[2] = rand() % 360;		AnglesToAxis( angles, beam.axis );		trap_R_AddRefEntityToScene( &beam );	}#endif}
开发者ID:entdark,项目名称:q3mme,代码行数:101,


示例5: CG_SkeletalPoseGetAttachment

/** CG_SkeletalPoseGetAttachment* Get the tag from the interpolated and transformed pose*/qboolean CG_SkeletalPoseGetAttachment( orientation_t *orient, cgs_skeleton_t *skel, bonepose_t *boneposes, char *bonename ){	int i;	quat_t quat;	cgs_bone_t *bone;	bonepose_t *bonepose;	cg_tagmask_t *tagmask;	if( !boneposes || !skel )	{		CG_Printf( "CG_SkeletalPoseLerpAttachment: Wrong model or boneposes %s/n", bonename );		return qfalse;	}	tagmask = CG_TagMask( bonename, skel );	// find the appropriate attachment bone	if( tagmask )	{		bone = skel->bones;		for( i = 0; i < skel->numBones; i++, bone++ )		{			if( !Q_stricmp( bone->name, tagmask->bonename ) )				break;		}	}	else	{		bone = skel->bones;		for( i = 0; i < skel->numBones; i++, bone++ )		{			if( !Q_stricmp( bone->name, bonename ) )				break;		}	}	if( i == skel->numBones )	{		CG_Printf( "CG_SkeletalPoseLerpAttachment: no such bone %s/n", bonename );		return qfalse;	}	// get the desired bone	bonepose = boneposes + i;	// copy the inverted bone into the tag	Quat_Inverse( &bonepose->dualquat[0], quat ); // inverse the tag direction	Quat_Matrix( quat, orient->axis );	DualQuat_GetVector( bonepose->dualquat, orient->origin );	// normalize each axis	for( i = 0; i < 3; i++ )		VectorNormalizeFast( orient->axis[i] );	// do the offseting if having a tagmask	if( tagmask )	{		// we want to place a rotated model over this tag, not to rotate the tag, 		// because all rotations would move. So we create a new orientation for the		// model and we position the new orientation in tag space		if( tagmask->rotate[YAW] || tagmask->rotate[PITCH] || tagmask->rotate[ROLL] )		{			orientation_t modOrient, newOrient;			VectorCopy( tagmask->offset, modOrient.origin );			AnglesToAxis( tagmask->rotate, modOrient.axis );			VectorCopy( vec3_origin, newOrient.origin );			Matrix_Identity( newOrient.axis );			CG_MoveToTag( newOrient.origin, newOrient.axis,				orient->origin, orient->axis,				modOrient.origin, modOrient.axis				 );			Matrix_Copy( newOrient.axis, orient->axis );			VectorCopy( newOrient.origin, orient->origin );		}		else		{			// offset			for( i = 0; i < 3; i++ )			{				if( tagmask->offset[i] )					VectorMA( orient->origin, tagmask->offset[i], orient->axis[i], orient->origin );			}		}	}	return qtrue;}
开发者ID:Kaperstone,项目名称:warsow,代码行数:94,


示例6: Main_MenuDraw

/*===============Main_MenuDraw===============*/static void Main_MenuDraw( void ) {	refdef_t		refdef;	refEntity_t		ent;	vec3_t			origin;	vec3_t			angles;	float			adjust;	float			x, y, w, h;	vec4_t			color = {0.5, 0, 0, 1};	// setup the refdef	memset( &refdef, 0, sizeof( refdef ) );	refdef.rdflags = RDF_NOWORLDMODEL;	AxisClear( refdef.viewaxis );	x = 0;	y = 0;	w = 640;	h = 120;	UI_AdjustFrom640( &x, &y, &w, &h );	refdef.x = x;	refdef.y = y;	refdef.width = w;	refdef.height = h;		adjust = 0; // JDC: Kenneth asked me to stop this  1.0 * sin( (float)uis.realtime / 1000 );	refdef.fov_x = 70 + adjust;	refdef.fov_y = 19.6875 + adjust;	refdef.time = uis.realtime;	origin[0] = 300;	origin[1] = 0;	origin[2] = -32;	trap_R_ClearScene();	// add the model	memset( &ent, 0, sizeof(ent) );	adjust = 20.0 * sin( (float)uis.realtime / 3000 );	VectorSet( angles, 0, 180 + adjust, 0 );	AnglesToAxis( angles, ent.axis );	ent.hModel = s_main.bannerModel;	VectorCopy( origin, ent.origin );	VectorCopy( origin, ent.lightingOrigin );	ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;	VectorCopy( ent.origin, ent.oldorigin );	trap_R_AddRefEntityToScene( &ent );	// standard menu drawing	Menu_Draw( &s_main.menu );	trap_R_RenderScene( &refdef );/*	if (uis.demoversion) {		UI_DrawProportionalString( 320, 372, "DEMO      FOR MATURE AUDIENCES      DEMO", UI_CENTER|UI_SMALLFONT, color );		UI_DrawString( 320, 400, "Quake III Arena(c) 1999-2000, Id Software, Inc.  All Rights Reserved", UI_CENTER|UI_SMALLFONT, color );	} else {		UI_DrawString( 320, 450, "Quake III Arena(c) 1999-2000, Id Software, Inc.  All Rights Reserved", UI_CENTER|UI_SMALLFONT, color );	}*/}
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:72,


示例7: CG_PlasmaTrail

static void CG_PlasmaTrail( centity_t *cent, const weaponInfo_t *wi ) {	localEntity_t	*le;	refEntity_t		*re;	entityState_t	*es;	vec3_t			velocity, xvelocity, origin;	vec3_t			offset, xoffset;	vec3_t			v[3];	int				t, startTime, step;	float	waterScale = 1.0f;	if ( cg_noProjectileTrail.integer || cg_oldPlasma.integer ) {		return;	}	step = 50;	es = &cent->currentState;	startTime = cent->trailTime;	t = step * ( (startTime + step) / step );	BG_EvaluateTrajectory( &es->pos, cg.time, origin );	le = CG_AllocLocalEntity();	re = &le->refEntity;	velocity[0] = 60 - 120 * crandom();	velocity[1] = 40 - 80 * crandom();	velocity[2] = 100 - 200 * crandom();	le->leType = LE_MOVE_SCALE_FADE;	le->leFlags = LEF_TUMBLE;	le->leBounceSoundType = LEBS_NONE;	le->leMarkType = LEMT_NONE;	le->startTime = cg.time;	le->endTime = le->startTime + 600;	le->pos.trType = TR_GRAVITY;	le->pos.trTime = cg.time;	AnglesToAxis( cent->lerpAngles, v );	offset[0] = 2;	offset[1] = 2;	offset[2] = 2;	xoffset[0] = offset[0] * v[0][0] + offset[1] * v[1][0] + offset[2] * v[2][0];	xoffset[1] = offset[0] * v[0][1] + offset[1] * v[1][1] + offset[2] * v[2][1];	xoffset[2] = offset[0] * v[0][2] + offset[1] * v[1][2] + offset[2] * v[2][2];	VectorAdd( origin, xoffset, re->origin );	VectorCopy( re->origin, le->pos.trBase );	if ( CG_PointContents( re->origin, -1 ) & CONTENTS_WATER ) {		waterScale = 0.10f;	}	xvelocity[0] = velocity[0] * v[0][0] + velocity[1] * v[1][0] + velocity[2] * v[2][0];	xvelocity[1] = velocity[0] * v[0][1] + velocity[1] * v[1][1] + velocity[2] * v[2][1];	xvelocity[2] = velocity[0] * v[0][2] + velocity[1] * v[1][2] + velocity[2] * v[2][2];	VectorScale( xvelocity, waterScale, le->pos.trDelta );	AxisCopy( axisDefault, re->axis );    re->shaderTime = cg.time / 1000.0f;    re->reType = RT_SPRITE;    re->radius = 0.25f;	re->customShader = cgs.media.railRingsShader;	le->bounceFactor = 0.3f;    re->shaderRGBA[0] = wi->flashDlightColor[0] * 63;    re->shaderRGBA[1] = wi->flashDlightColor[1] * 63;    re->shaderRGBA[2] = wi->flashDlightColor[2] * 63;    re->shaderRGBA[3] = 63;    le->color[0] = wi->flashDlightColor[0] * 0.2;    le->color[1] = wi->flashDlightColor[1] * 0.2;    le->color[2] = wi->flashDlightColor[2] * 0.2;    le->color[3] = 0.25f;	le->angles.trType = TR_LINEAR;	le->angles.trTime = cg.time;	le->angles.trBase[0] = rand()&31;	le->angles.trBase[1] = rand()&31;	le->angles.trBase[2] = rand()&31;	le->angles.trDelta[0] = 1;	le->angles.trDelta[1] = 0.5;	le->angles.trDelta[2] = 0;}
开发者ID:entdark,项目名称:q3mme,代码行数:90,


示例8: R_LoadMDC

//.........这里部分代码省略.........			{				frame->bounds[0][j] = 128;				frame->bounds[1][j] = -128;				frame->localOrigin[j] = LittleFloat(mdcFrame->localOrigin[j]);			}		}		else#endif		{			frame->radius = LittleFloat(mdcFrame->radius);			for(j = 0; j < 3; j++)			{				frame->bounds[0][j] = LittleFloat(mdcFrame->bounds[0][j]);				frame->bounds[1][j] = LittleFloat(mdcFrame->bounds[1][j]);				frame->localOrigin[j] = LittleFloat(mdcFrame->localOrigin[j]);			}		}	}	// swap all the tags	mdvModel->numTags = mdcModel->numTags;	mdvModel->tags = tag = ri.Hunk_Alloc(sizeof(*tag) * (mdcModel->numTags * mdcModel->numFrames), h_low);	mdcTag = (mdcTag_t *) ((byte *) mdcModel + mdcModel->ofsTags);	for(i = 0; i < mdcModel->numTags * mdcModel->numFrames; i++, tag++, mdcTag++)	{		vec3_t		angles;		for(j = 0; j < 3; j++)		{			tag->origin[j] = (float)LittleShort(mdcTag->xyz[j]) * MD3_XYZ_SCALE;			angles[j] = (float)LittleShort(mdcTag->angles[j]) * MDC_TAG_ANGLE_SCALE;		}		AnglesToAxis(angles, tag->axis);	}	mdvModel->tagNames = tagName = ri.Hunk_Alloc(sizeof(*tagName) * (mdcModel->numTags), h_low);	mdcTagName = (mdcTagName_t *) ((byte *) mdcModel + mdcModel->ofsTagNames);	for(i = 0; i < mdcModel->numTags; i++, tagName++, mdcTagName++)	{		Q_strncpyz(tagName->name, mdcTagName->name, sizeof(tagName->name));	}	// swap all the surfaces	mdvModel->numSurfaces = mdcModel->numSurfaces;	mdvModel->surfaces = surf = ri.Hunk_Alloc(sizeof(*surf) * mdcModel->numSurfaces, h_low);	mdcSurf = (mdcSurface_t *) ((byte *) mdcModel + mdcModel->ofsSurfaces);	for(i = 0; i < mdcModel->numSurfaces; i++)	{		LL(mdcSurf->ident);		LL(mdcSurf->flags);		LL(mdcSurf->numBaseFrames);		LL(mdcSurf->numCompFrames);		LL(mdcSurf->numShaders);		LL(mdcSurf->numTriangles);		LL(mdcSurf->ofsTriangles);		LL(mdcSurf->numVerts);		LL(mdcSurf->ofsShaders);		LL(mdcSurf->ofsSt);		LL(mdcSurf->ofsXyzNormals);		LL(mdcSurf->ofsXyzNormals);		LL(mdcSurf->ofsXyzCompressed);		LL(mdcSurf->ofsFrameBaseFrames);		LL(mdcSurf->ofsFrameCompFrames);
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:67,


示例9: CGCam_Update

//.........这里部分代码省略.........			for ( i = 0; i < 3; i++ )			{				cg.refdefViewAngles[i] = AngleNormalize360( ( client_camera.angles[i] + client_camera.angles2[i] ) );			}		}		else		{			//Note: does not actually change the camera's angles until the pan time is done!			if ( client_camera.pan_time + client_camera.pan_duration < cg.time )			{//finished panning				for ( i = 0; i < 3; i++ )				{					client_camera.angles[i] = AngleNormalize360( ( client_camera.angles[i] + client_camera.angles2[i] ) );				}				client_camera.info_state &= ~CAMERA_PANNING;				VectorCopy(client_camera.angles, cg.refdefViewAngles );			}			else			{//still panning				for ( i = 0; i < 3; i++ )				{					//NOTE: does not store the resultant angle in client_camera.angles until pan is done					cg.refdefViewAngles[i] = client_camera.angles[i] + ( client_camera.angles2[i] / client_camera.pan_duration ) * ( cg.time - client_camera.pan_time );				}			}		}	}	else 	{		checkFollow = qtrue;	}	//Check for movement	if ( client_camera.info_state & CAMERA_MOVING )	{		//NOTE: does not actually move the camera until the movement time is done!		if ( client_camera.move_time + client_camera.move_duration < cg.time )		{			VectorCopy( client_camera.origin2, client_camera.origin );			client_camera.info_state &= ~CAMERA_MOVING;			VectorCopy( client_camera.origin, cg.refdef.vieworg );		}		else		{			if (client_camera.info_state & CAMERA_CUT)			{				// we're doing a cut, so just go to the new origin. none of this fancypants lerping stuff.				for ( i = 0; i < 3; i++ )				{					cg.refdef.vieworg[i] = client_camera.origin2[i];				}			}			else			{				for ( i = 0; i < 3; i++ )				{					cg.refdef.vieworg[i] = client_camera.origin[i] + (( ( client_camera.origin2[i] - client_camera.origin[i] ) ) / client_camera.move_duration ) * ( cg.time - client_camera.move_time );				}			}		}	}	else	{		checkTrack = qtrue;	}	if ( checkFollow )	{		if ( client_camera.info_state & CAMERA_FOLLOWING )		{//This needs to be done after camera movement			CGCam_FollowUpdate();		}		VectorCopy(client_camera.angles, cg.refdefViewAngles );	}	if ( checkTrack )	{		if ( client_camera.info_state & CAMERA_TRACKING )		{//This has to run AFTER Follow if the camera is following a cameraGroup			CGCam_TrackUpdate();		}		VectorCopy( client_camera.origin, cg.refdef.vieworg );	}	//Bar fading	if ( client_camera.info_state & CAMERA_BAR_FADING )	{		CGCam_UpdateBarFade();	}	//Normal fading - separate call because can finish after camera is disabled	CGCam_UpdateFade();	//Update shaking if there's any	//CGCam_UpdateSmooth( cg.refdef.vieworg, cg.refdefViewAngles );	CGCam_UpdateShake( cg.refdef.vieworg, cg.refdefViewAngles );	AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );}
开发者ID:Septarius,项目名称:OpenJK,代码行数:101,


示例10: Wolfcam_AddViewWeapon

void Wolfcam_AddViewWeapon (void){    vec3_t origin;    centity_t *cent;    const entityState_t *es;    refEntity_t hand;    const clientInfo_t *ci;    float fovOffset;    vec3_t angles;    const weaponInfo_t *weapon;    float gunX;    int fov;    if (!wolfcam_following) {        return;    }    cent = &cg_entities[wcg.clientNum];    es = &cent->currentState;    if (!cg_drawGun.integer) {        if (es->eFlags & EF_FIRING  &&  es->weapon == WP_LIGHTNING) {            // special hack for lightning gun...            VectorCopy( cg.refdef.vieworg, origin );            VectorMA( origin, -8, cg.refdef.viewaxis[2], origin );            CG_LightningBolt( &cg_entities[es->number], origin );            //FIXME is this adding the sound twice?            CG_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cg_weapons[es->weapon].firingSound );        }        return;    }    // don't draw if testing a gun model    if (cg.testGun) {        return;    }    gunX = cg_gun_x.value;    if (es->weapon == WP_GRAPPLING_HOOK) {        gunX += 8.9;    }    fov = cg_fov.integer;    //FIXME option    // drop gun lower at higher fov    if (fov > 90) {        fovOffset = -0.2 * (fov - 90);    } else {        fovOffset = 0;    }    CG_RegisterWeapon(es->weapon);    weapon = &cg_weapons[es->weapon];    memset(&hand, 0, sizeof(hand));    // set up gun position    Wolfcam_CalculateWeaponPosition(hand.origin, angles);    VectorMA( hand.origin, gunX, cg.refdef.viewaxis[0], hand.origin );	VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[1], hand.origin );	VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin );	AnglesToAxis( angles, hand.axis );	// map torso animations to weapon animations	//cg_gun_frame.integer = 1;	if ( cg_gun_frame.integer ) {		// development tool		hand.frame = hand.oldframe = cg_gun_frame.integer;		hand.backlerp = 0;	} else {  //if (0) {		// these are just for calling CG_PlayerAnimation()		int legsOld;		int legs;		float legsBackLerp;		int torsoOld;		int torso;		float torsoBackLerp;		// get clientinfo for animation map		ci = &cgs.clientinfo[ cent->currentState.clientNum ];		// animations weren't run for /follow'ed player		CG_PlayerAnimation(cent, &legsOld, &legs, &legsBackLerp, &torsoOld, &torso, &torsoBackLerp);		hand.frame = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.frame );		hand.oldframe = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.oldFrame );		hand.backlerp = cent->pe.torso.backlerp;	}	hand.hModel = weapon->handsModel;	hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT;	// add everything onto the hand	Wolfcam_AddPlayerWeapon(&hand, cent, cgs.clientinfo[cent->currentState.clientNum].team);}
开发者ID:brugal,项目名称:wolfcamql,代码行数:100,


示例11: VectorMA

//----------------------------void CEmitter::UpdateAngles(){	VectorMA( mAngles, theFxHelper.mFrameTime * 0.01f, mAngleDelta, mAngles ); // was 0.001f, but then you really have to jack up the delta to even notice anything	AnglesToAxis( mAngles, mRefEnt.axis );}
开发者ID:Christian-Barrett,项目名称:OpenJK,代码行数:6,


示例12: Wolfcam_AddPlayerWeapon

//.........这里部分代码省略.........	// custom weapon shaders	{		vmCvar_t *firstPersonShaders[MAX_WEAPONS] = { NULL, &cg_firstPersonShaderWeaponGauntlet, &cg_firstPersonShaderWeaponMachineGun, &cg_firstPersonShaderWeaponShotgun, &cg_firstPersonShaderWeaponGrenadeLauncher, &cg_firstPersonShaderWeaponRocketLauncher, &cg_firstPersonShaderWeaponLightningGun, &cg_firstPersonShaderWeaponRailGun, &cg_firstPersonShaderWeaponPlasmaGun, &cg_firstPersonShaderWeaponBFG, &cg_firstPersonShaderWeaponGrapplingHook, &cg_firstPersonShaderWeaponNailGun, &cg_firstPersonShaderWeaponProximityLauncher, &cg_firstPersonShaderWeaponChainGun, &cg_firstPersonShaderWeaponHeavyMachineGun };		if (firstPersonShaders[weaponNum]  &&  *(firstPersonShaders[weaponNum]->string)) {			gun.customShader = trap_R_RegisterShader(firstPersonShaders[weaponNum]->string);		}	}	if (gun.hModel) {		if (cg_drawGun.integer > 2) {			gun.customShader = cgs.media.ghostWeaponShader;			gun.shaderRGBA[0] = 255;			gun.shaderRGBA[1] = 255;			gun.shaderRGBA[2] = 255;			gun.shaderRGBA[3] = 255;		}		CG_AddWeaponWithPowerups( &gun, cent->currentState.powerups );	}	// add the spinning barrel	if ( weapon->barrelModel ) {		memset( &barrel, 0, sizeof( barrel ) );		VectorCopy( parent->lightingOrigin, barrel.lightingOrigin );		barrel.shadowPlane = parent->shadowPlane;		barrel.renderfx = parent->renderfx;		barrel.hModel = weapon->barrelModel;		angles[YAW] = 0;		angles[PITCH] = 0;		angles[ROLL] = CG_MachinegunSpinAngle( cent );		AnglesToAxis( angles, barrel.axis );		CG_PositionRotatedEntityOnTag( &barrel, &gun, weapon->weaponModel, "tag_barrel" );        CG_ScaleModel(&barrel, cg_gunSize.value);		if (cg_drawGun.integer > 2) {			barrel.customShader = cgs.media.ghostWeaponShader;			barrel.shaderRGBA[0] = 255;			barrel.shaderRGBA[1] = 255;			barrel.shaderRGBA[2] = 255;			barrel.shaderRGBA[3] = 255;		}		CG_AddWeaponWithPowerups( &barrel, cent->currentState.powerups );	}	// make sure we aren't looking at cg.predictedPlayerEntity for LG	nonPredictedCent = &cg_entities[cent->currentState.clientNum];#if 0	// if the index of the nonPredictedCent is not the same as the clientNum	// then this is a fake player (like on teh single player podiums), so	// go ahead and use the cent	if( ( nonPredictedCent - cg_entities ) != cent->currentState.clientNum ) {		nonPredictedCent = cent;		//Com_Printf("fake player %d  ->  %d/n", nonPredictedCent - cg_entities, cent->currentState.clientNum);	}#endif	// add the flash	//if ( ( weaponNum == WP_LIGHTNING || weaponNum == WP_GAUNTLET || weaponNum == WP_GRAPPLING_HOOK )  &&  (cent->currentState.eFlags & EF_FIRING)) {
开发者ID:brugal,项目名称:wolfcamql,代码行数:67,


示例13: CG_Buildable

//.........这里部分代码省略.........  scale = BG_FindModelScaleForBuildable( es->modelindex );  if( scale != 1.0f )  {    VectorScale( ent.axis[ 0 ], scale, ent.axis[ 0 ] );    VectorScale( ent.axis[ 1 ], scale, ent.axis[ 1 ] );    VectorScale( ent.axis[ 2 ], scale, ent.axis[ 2 ] );    ent.nonNormalizedAxes = qtrue;  }  else    ent.nonNormalizedAxes = qfalse;  //add to refresh list  trap_R_AddRefEntityToScene( &ent );  CrossProduct( surfNormal, refNormal, xNormal );  VectorNormalize( xNormal );  rotAngle = RAD2DEG( acos( DotProduct( surfNormal, refNormal ) ) );  //turret barrel bit  if( cg_buildables[ es->modelindex ].models[ 1 ] )  {    refEntity_t turretBarrel;    vec3_t      flatAxis[ 3 ];    memset( &turretBarrel, 0, sizeof( turretBarrel ) );    turretBarrel.hModel = cg_buildables[ es->modelindex ].models[ 1 ];    CG_PositionEntityOnTag( &turretBarrel, &ent, ent.hModel, "tag_turret" );    VectorCopy( cent->lerpOrigin, turretBarrel.lightingOrigin );    AnglesToAxis( es->angles2, flatAxis );    RotatePointAroundVector( turretBarrel.axis[ 0 ], xNormal, flatAxis[ 0 ], -rotAngle );    RotatePointAroundVector( turretBarrel.axis[ 1 ], xNormal, flatAxis[ 1 ], -rotAngle );    RotatePointAroundVector( turretBarrel.axis[ 2 ], xNormal, flatAxis[ 2 ], -rotAngle );    turretBarrel.oldframe = ent.oldframe;    turretBarrel.frame    = ent.frame;    turretBarrel.backlerp = ent.backlerp;    turretBarrel.customShader = ent.customShader;    if( scale != 1.0f )    {      VectorScale( turretBarrel.axis[ 0 ], scale, turretBarrel.axis[ 0 ] );      VectorScale( turretBarrel.axis[ 1 ], scale, turretBarrel.axis[ 1 ] );      VectorScale( turretBarrel.axis[ 2 ], scale, turretBarrel.axis[ 2 ] );      turretBarrel.nonNormalizedAxes = qtrue;    }    else      turretBarrel.nonNormalizedAxes = qfalse;    trap_R_AddRefEntityToScene( &turretBarrel );  }  //turret barrel bit  if( cg_buildables[ es->modelindex ].models[ 2 ] )  {    refEntity_t turretTop;    vec3_t      flatAxis[ 3 ];    vec3_t      swivelAngles;
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:66,


示例14: CG_Buildable

//.........这里部分代码省略.........  if( scale != 1.0f )  {    VectorScale( ent.axis[ 0 ], scale, ent.axis[ 0 ] );    VectorScale( ent.axis[ 1 ], scale, ent.axis[ 1 ] );    VectorScale( ent.axis[ 2 ], scale, ent.axis[ 2 ] );    ent.nonNormalizedAxes = qtrue;  }  else    ent.nonNormalizedAxes = qfalse;  if( CG_PlayerIsBuilder( es->modelindex ) && CG_BuildableRemovalPending( es->number ) )    ent.customShader = cgs.media.redBuildShader;  //add to refresh list  trap_R_AddRefEntityToScene( &ent );  CrossProduct( surfNormal, refNormal, xNormal );  VectorNormalize( xNormal );  rotAngle = RAD2DEG( acos( DotProduct( surfNormal, refNormal ) ) );  //turret barrel bit  if( cg_buildables[ es->modelindex ].models[ 1 ] )  {    refEntity_t turretBarrel;    vec3_t      flatAxis[ 3 ];    memset( &turretBarrel, 0, sizeof( turretBarrel ) );    turretBarrel.hModel = cg_buildables[ es->modelindex ].models[ 1 ];    CG_PositionEntityOnTag( &turretBarrel, &ent, ent.hModel, "tag_turret" );    VectorCopy( cent->lerpOrigin, turretBarrel.lightingOrigin );    AnglesToAxis( es->angles2, flatAxis );    RotatePointAroundVector( turretBarrel.axis[ 0 ], xNormal, flatAxis[ 0 ], -rotAngle );    RotatePointAroundVector( turretBarrel.axis[ 1 ], xNormal, flatAxis[ 1 ], -rotAngle );    RotatePointAroundVector( turretBarrel.axis[ 2 ], xNormal, flatAxis[ 2 ], -rotAngle );    turretBarrel.oldframe = ent.oldframe;    turretBarrel.frame    = ent.frame;    turretBarrel.backlerp = ent.backlerp;    turretBarrel.customShader = ent.customShader;    if( scale != 1.0f )    {      VectorScale( turretBarrel.axis[ 0 ], scale, turretBarrel.axis[ 0 ] );      VectorScale( turretBarrel.axis[ 1 ], scale, turretBarrel.axis[ 1 ] );      VectorScale( turretBarrel.axis[ 2 ], scale, turretBarrel.axis[ 2 ] );      turretBarrel.nonNormalizedAxes = qtrue;    }    else      turretBarrel.nonNormalizedAxes = qfalse;    if( CG_PlayerIsBuilder( es->modelindex ) && CG_BuildableRemovalPending( es->number ) )      turretBarrel.customShader = cgs.media.redBuildShader;    trap_R_AddRefEntityToScene( &turretBarrel );  }  //turret barrel bit  if( cg_buildables[ es->modelindex ].models[ 2 ] )  {    refEntity_t turretTop;
开发者ID:ppetr,项目名称:new-edge,代码行数:67,


示例15: CG_Spotlight

//.........这里部分代码省略.........		}	} else {		hitDist = 0;		beamLen = range;	}	if ( flags & SL_LOCKUV ) {		if ( beamLen < range ) {			endAlpha = 255.0f * ( color[3] - ( color[3] * beamLen / range ) );		}	}	if ( segs >= MAX_SPOT_SEGS ) {		segs = MAX_SPOT_SEGS - 1;	}	// TODO: adjust segs based on r_lodbias	// TODO: move much of this to renderer// model at base	if ( cent->currentState.modelindex ) {		memset( &ent, 0, sizeof( ent ) );		ent.frame = 0;		ent.oldframe = 0;		ent.backlerp = 0;		VectorCopy( cent->lerpOrigin, ent.origin );		VectorCopy( cent->lerpOrigin, ent.oldorigin );		ent.hModel = cgs.gameModels[cent->currentState.modelindex];		//	AnglesToAxis( cent->lerpAngles, ent.axis );		vectoangles( lightDir, angles );		AnglesToAxis( angles, ent.axis );		trap_R_AddRefEntityToScene( &ent );		memcpy( &cent->refEnt, &ent, sizeof( refEntity_t ) );		// push start out a bit so the beam fits to the front of the base model		VectorMA( start, 14, lightDir, start );	}//// BEAM	PerpendicularVector( up, lightDir );	CrossProduct( lightDir, up, right );	// find first vert of the start	VectorScale( right, startWidth, startvec );	// find the first vert of the end	RotatePointAroundVector( conevec, up, lightDir, -coneAngle );	VectorMA( startvec, beamLen, conevec, endvec );   // this applies the offset of the start diameter before finding the end points	VectorScale( lightDir, beamLen, endCenter );	VectorSubtract( endCenter, endvec, coreverts[3].xyz );    // get a vector of the radius out at the end for the core to use	coreEndRadius = VectorLength( coreverts[3].xyz );#define CORESCALE 0.6f////	generate the flat beam 'core'//	if ( !( flags & SL_NOCORE ) ) {		VectorSubtract( start, cg.refdef.vieworg, v1 );		VectorNormalize( v1 );		VectorSubtract( traceEnd, cg.refdef.vieworg, v2 );		VectorNormalize( v2 );		CrossProduct( v1, v2, coreright );
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:67,


示例16: CG_LQM

/*===============CG_GroundVehicle===============*/void CG_LQM( centity_t *cent, clientInfo_t *ci ) {	vec3_t			velocity;		vec3_t		    right, up, temp, start;	DrawInfo_LQM_t drawInfo;	int				ONOFF = cent->currentState.ONOFF;	memset( &drawInfo, 0, sizeof(drawInfo) );	drawInfo.basicInfo.vehicleIndex = ci->vehicle;	drawInfo.basicInfo.ONOFF = ONOFF;	// Copy Weapon Index	drawInfo.weaponIndex = cent->currentState.weaponIndex;	// Copy animation state	drawInfo.anim = cent->currentState.vehicleAnim;	// Copy animation frames	drawInfo.lastTorsoAngle = cent->bayAnim;	drawInfo.lastLegsAngle = cent->gearAnim;	drawInfo.torsoFrame = cent->bayAnimFrame;	drawInfo.legsFrame = cent->gearAnimFrame;	drawInfo.torsoTime = cent->bayAnimStartTime;	drawInfo.legsTime = cent->gearAnimStartTime;	// get speed	VectorCopy( cent->currentState.pos.trDelta, velocity );	drawInfo.basicInfo.speed = VectorLength( velocity );		// entitynum	drawInfo.basicInfo.entityNum = cent->currentState.number;    // get the rotation information    VectorCopy( cent->currentState.angles, cent->lerpAngles );    AnglesToAxis( cent->lerpAngles, drawInfo.basicInfo.axis );	// position and orientation	VectorCopy( cent->lerpOrigin, drawInfo.basicInfo.origin );	VectorCopy( cent->lerpAngles, drawInfo.basicInfo.angles );	// throttle	drawInfo.basicInfo.throttle = cent->currentState.frame;	// loadout	drawInfo.basicInfo.usedLoadout = 0;//&cg_loadouts[cent->currentState.number];	// muzzleflash	if( cg.time - cent->muzzleFlashTime <= MUZZLE_FLASH_TIME ) {		drawInfo.basicInfo.drawMuzzleFlash = true;		drawInfo.basicInfo.flashWeaponIndex = cent->muzzleFlashWeapon;	}	// draw lqm	CG_DrawLQM(&drawInfo);	// return frames	cent->bayAnim = drawInfo.lastTorsoAngle;	cent->gearAnim = drawInfo.lastLegsAngle;	cent->bayAnimFrame = drawInfo.torsoFrame;	cent->bayAnimStartTime = drawInfo.torsoTime;	cent->gearAnimFrame = drawInfo.legsFrame;	cent->gearAnimStartTime = drawInfo.legsTime;		// flags	CG_LQMFlags( cent );	// reticles	if( cent == &cg.predictedPlayerEntity )	{		refEntity_t		reticle;		vec3_t	forward, ang, end;		trace_t	tr;//		playerState_t * ps = &cg.snap->ps;		float len;		float mindist = cg_thirdPersonRange.integer + availableVehicles[ci->vehicle].cam_dist[ CAMERA_V_DEFAULT ] + availableVehicles[ci->vehicle].maxs[0] + 20;		memset( &reticle, 0, sizeof(reticle) );			CG_ResetReticles();		reticle.customShader = availableWeapons[availableVehicles[ci->vehicle].weapons[cent->currentState.weaponNum]].crosshair;		reticle.hModel = cgs.media.reticle[availableWeapons[availableVehicles[ci->vehicle].weapons[cent->currentState.weaponNum]].crosshair];		AngleVectors( cent->currentState.angles, forward, right, up );		RotatePointAroundVector( temp, up, forward, cent->currentState.angles2[ROLL] );		CrossProduct( up, temp, right );		RotatePointAroundVector( forward, right, temp, cent->currentState.angles2[PITCH] );		VectorMA( cent->lerpOrigin, availableVehicles[ci->vehicle].gunoffset[0], forward, start );		VectorMA( start, availableVehicles[ci->vehicle].gunoffset[1], right, start );		VectorMA( start, availableVehicles[ci->vehicle].gunoffset[2], up, start );		VectorMA( start, 2000, forward, end );		vectoangles( forward, ang );//.........这里部分代码省略.........
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:101,


示例17: CG_LaunchGib

/*==================CG_LaunchGib==================*/void CG_LaunchGib( centity_t *cent, vec3_t origin, vec3_t angles, vec3_t velocity, qhandle_t hModel, float sizeScale, int breakCount ) {	localEntity_t   *le;	refEntity_t     *re;	int i;	if ( !cg_blood.integer ) {		return;	}	le = CG_AllocLocalEntity();	re = &le->refEntity;	le->leType = LE_FRAGMENT;	le->startTime = cg.time;	// le->endTime = le->startTime + 60000 + random() * 60000;	le->endTime = le->startTime + 20000 + ( crandom() * 5000 );	le->breakCount = breakCount;	le->sizeScale = sizeScale;	VectorCopy( angles, le->angles.trBase );	VectorCopy( origin, re->origin );	AnglesToAxis( angles, re->axis );	if ( sizeScale != 1.0 ) {		for ( i = 0; i < 3; i++ ) VectorScale( re->axis[i], sizeScale, re->axis[i] );	}	re->hModel = hModel;	// re->fadeStartTime		= le->endTime - 3000;	re->fadeStartTime       = le->endTime - 1000;	re->fadeEndTime         = le->endTime;	switch ( cent->currentState.aiChar ) {	case AICHAR_ZOMBIE:		le->pos.trType = TR_GRAVITY_LOW;		le->angles.trDelta[0] = 400 * crandom();		le->angles.trDelta[1] = 400 * crandom();		le->angles.trDelta[2] = 400 * crandom();		le->leBounceSoundType = LEBS_BONE;		le->bounceFactor = 0.5;		break;	default:		le->leBounceSoundType = LEBS_BLOOD;		le->leMarkType = LEMT_BLOOD;		le->pos.trType = TR_GRAVITY;		le->angles.trDelta[0] = ( 10 + ( rand() & 50 ) ) - 30;		//	le->angles.trDelta[0] = (100 + (rand()&500)) - 300;	// pitch		le->angles.trDelta[1] = ( 100 + ( rand() & 500 ) ) - 300; // (SA) this is the safe one right now (yaw)  turn the others up when I have tumbling things landing properly		le->angles.trDelta[2] = ( 10 + ( rand() & 50 ) ) - 30;		//	le->angles.trDelta[2] = (100 + (rand()&500)) - 300;	// roll		le->bounceFactor = 0.3;		break;	}	VectorCopy( origin, le->pos.trBase );	VectorCopy( velocity, le->pos.trDelta );	le->pos.trTime = cg.time;	le->angles.trType = TR_LINEAR;	le->angles.trTime = cg.time;	le->ownerNum = cent->currentState.number;	// Ridah, if the player is on fire, then spawn some flaming gibs	if ( cent && CG_EntOnFire( cent ) ) {		le->onFireStart = cent->currentState.onFireStart;		le->onFireEnd = re->fadeEndTime + 1000;	} else if ( ( cent->currentState.aiChar == AICHAR_ZOMBIE ) && IS_FLAMING_ZOMBIE( cent->currentState ) ) {		le->onFireStart = cg.time - 1000;		le->onFireEnd = re->fadeEndTime + 1000;	}}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:81,


示例18: R_CalcBone

/*==============R_CalcBone==============*/void R_CalcBone(mdsHeader_t *header, const refEntity_t *refent, int boneNum){	thisBoneInfo = &boneInfo[boneNum];	if (thisBoneInfo->torsoWeight)	{		cTBonePtr = &cBoneListTorso[boneNum];		isTorso   = qtrue;		if (thisBoneInfo->torsoWeight == 1.0f)		{			fullTorso = qtrue;		}	}	else	{		isTorso   = qfalse;		fullTorso = qfalse;	}	cBonePtr = &cBoneList[boneNum];	bonePtr = &bones[boneNum];	// we can assume the parent has already been uncompressed for this frame + lerp	if (thisBoneInfo->parent >= 0)	{		parentBone     = &bones[thisBoneInfo->parent];		parentBoneInfo = &boneInfo[thisBoneInfo->parent];	}	else	{		parentBone     = NULL;		parentBoneInfo = NULL;	}#ifdef HIGH_PRECISION_BONES	// rotation	if (fullTorso)	{		VectorCopy(cTBonePtr->angles, angles);	}	else	{		VectorCopy(cBonePtr->angles, angles);		if (isTorso)		{			VectorCopy(cTBonePtr->angles, tangles);			// blend the angles together			for (j = 0; j < 3; j++)			{				diff = tangles[j] - angles[j];				if (Q_fabs(diff) > 180)				{					diff = AngleNormalize180(diff);				}				angles[j] = angles[j] + thisBoneInfo->torsoWeight * diff;			}		}	}#else	// rotation	if (fullTorso)	{		sh = (short *)cTBonePtr->angles;		pf = angles;		ANGLES_SHORT_TO_FLOAT(pf, sh);	}	else	{		sh = (short *)cBonePtr->angles;		pf = angles;		ANGLES_SHORT_TO_FLOAT(pf, sh);		if (isTorso)		{			int j;			sh = (short *)cTBonePtr->angles;			pf = tangles;			ANGLES_SHORT_TO_FLOAT(pf, sh);			// blend the angles together			for (j = 0; j < 3; j++)			{				diff = tangles[j] - angles[j];				if (Q_fabs(diff) > 180)				{					diff = AngleNormalize180(diff);				}				angles[j] = angles[j] + thisBoneInfo->torsoWeight * diff;			}		}	}#endif	AnglesToAxis(angles, bonePtr->matrix);	// translation	if (parentBone)	{//.........这里部分代码省略.........
开发者ID:Ododo,项目名称:etlegacy,代码行数:101,


示例19: SV_Push

/** SV_Push** Objects need to be moved back on a failed push,* otherwise riders would continue to slide.*/static bool SV_Push( edict_t *pusher, vec3_t move, vec3_t amove ) {	int i, e;	edict_t *check, *block;	vec3_t mins, maxs;	pushed_t *p;	mat3_t axis;	vec3_t org, org2, move2;	// find the bounding box	for( i = 0; i < 3; i++ ) {		mins[i] = pusher->r.absmin[i] + move[i];		maxs[i] = pusher->r.absmax[i] + move[i];	}	// we need this for pushing things later	VectorNegate( amove, org );	AnglesToAxis( org, axis );	// save the pusher's original position	pushed_p->ent = pusher;	VectorCopy( pusher->s.origin, pushed_p->origin );	VectorCopy( pusher->s.angles, pushed_p->angles );	if( pusher->r.client ) {		VectorCopy( pusher->r.client->ps.pmove.velocity, pushed_p->pmove_origin );		pushed_p->yaw = pusher->r.client->ps.viewangles[YAW];	}	pushed_p++;	// move the pusher to its final position	VectorAdd( pusher->s.origin, move, pusher->s.origin );	VectorAdd( pusher->s.angles, amove, pusher->s.angles );	GClip_LinkEntity( pusher );	// see if any solid entities are inside the final position	check = game.edicts + 1;	for( e = 1; e < game.numentities; e++, check++ ) {		if( !check->r.inuse ) {			continue;		}		if( check->movetype == MOVETYPE_PUSH			|| check->movetype == MOVETYPE_STOP			|| check->movetype == MOVETYPE_NONE			|| check->movetype == MOVETYPE_NOCLIP ) {			continue;		}		if( !check->areagrid[0].prev ) {			continue; // not linked in anywhere		}		// if the entity is standing on the pusher, it will definitely be moved		if( check->groundentity != pusher ) {			// see if the ent needs to be tested			if( check->r.absmin[0] >= maxs[0]				|| check->r.absmin[1] >= maxs[1]				|| check->r.absmin[2] >= maxs[2]				|| check->r.absmax[0] <= mins[0]				|| check->r.absmax[1] <= mins[1]				|| check->r.absmax[2] <= mins[2] ) {				continue;			}			// see if the ent's bbox is inside the pusher's final position			if( !SV_TestEntityPosition( check ) ) {				continue;			}		}		if( ( pusher->movetype == MOVETYPE_PUSH ) || ( check->groundentity == pusher ) ) {			// move this entity			pushed_p->ent = check;			VectorCopy( check->s.origin, pushed_p->origin );			VectorCopy( check->s.angles, pushed_p->angles );			pushed_p++;			// try moving the contacted entity			VectorAdd( check->s.origin, move, check->s.origin );			if( check->r.client ) {				// FIXME: doesn't rotate monsters?				VectorAdd( check->r.client->ps.pmove.origin, move, check->r.client->ps.pmove.origin );				check->r.client->ps.viewangles[YAW] += amove[YAW];			}			// figure movement due to the pusher's amove			VectorSubtract( check->s.origin, pusher->s.origin, org );			Matrix3_TransformVector( axis, org, org2 );			VectorSubtract( org2, org, move2 );			VectorAdd( check->s.origin, move2, check->s.origin );			if( check->movetype != MOVETYPE_BOUNCEGRENADE ) {				// may have pushed them off an edge				if( check->groundentity != pusher ) {					check->groundentity = NULL;//.........这里部分代码省略.........
开发者ID:Picmip,项目名称:qfusion,代码行数:101,


示例20: R_CalcBoneLerp

//.........这里部分代码省略.........		*(pf++) = a1 - backlerp * diff;		a1      = SHORT2ANGLE(*(sh++)); a2 = SHORT2ANGLE(*(sh2++)); diff = AngleNormalize180(a1 - a2);		*(pf++) = a1 - backlerp * diff;		if (isTorso)		{			int j;			sh  = (short *)cTBonePtr->angles;			sh2 = (short *)cOldTBonePtr->angles;			pf  = tangles;			a1      = SHORT2ANGLE(*(sh++)); a2 = SHORT2ANGLE(*(sh2++)); diff = AngleNormalize180(a1 - a2);			*(pf++) = a1 - torsoBacklerp * diff;			a1      = SHORT2ANGLE(*(sh++)); a2 = SHORT2ANGLE(*(sh2++)); diff = AngleNormalize180(a1 - a2);			*(pf++) = a1 - torsoBacklerp * diff;			a1      = SHORT2ANGLE(*(sh++)); a2 = SHORT2ANGLE(*(sh2++)); diff = AngleNormalize180(a1 - a2);			*(pf++) = a1 - torsoBacklerp * diff;			// blend the angles together			for (j = 0; j < 3; j++)			{				diff = tangles[j] - angles[j];				if (Q_fabs(diff) > 180)				{					diff = AngleNormalize180(diff);				}				angles[j] = angles[j] + thisBoneInfo->torsoWeight * diff;			}		}	}	AnglesToAxis(angles, bonePtr->matrix);	if (parentBone)	{		if (fullTorso)		{			sh  = (short *)cTBonePtr->ofsAngles;			sh2 = (short *)cOldTBonePtr->ofsAngles;		}		else		{			sh  = (short *)cBonePtr->ofsAngles;			sh2 = (short *)cOldBonePtr->ofsAngles;		}		pf      = angles;		*(pf++) = SHORT2ANGLE(*(sh++));		*(pf++) = SHORT2ANGLE(*(sh++));		*(pf++) = 0;		LocalAngleVector(angles, v2);       // new		pf      = angles;		*(pf++) = SHORT2ANGLE(*(sh2++));		*(pf++) = SHORT2ANGLE(*(sh2++));		*(pf++) = 0;		LocalAngleVector(angles, vec);      // old		// blend the angles together		if (fullTorso)		{			SLerp_Normal(vec, v2, torsoFrontlerp, dir);		}		else
开发者ID:Ododo,项目名称:etlegacy,代码行数:67,


示例21: CG_MachineGunEjectBrass

/*==========================CG_MachineGunEjectBrass==========================*/static void CG_MachineGunEjectBrass( centity_t *cent ) {	localEntity_t	*le;	refEntity_t		*re;	vec3_t			velocity, xvelocity;	vec3_t			offset, xoffset;	float			waterScale = 1.0f;	vec3_t			v[3];	if ( cg_brassTime.integer <= 0 ) {		return;	}	le = CG_AllocLocalEntity();	re = &le->refEntity;	velocity[0] = 0;	velocity[1] = -50 + 40 * crandom();	velocity[2] = 100 + 50 * crandom();	le->leType = LE_FRAGMENT;	le->startTime = cg.time;	le->endTime = le->startTime + cg_brassTime.integer + ( cg_brassTime.integer / 4 ) * random();	le->pos.trType = TR_GRAVITY;	le->pos.trTime = cg.time - (rand()&15);	AnglesToAxis( cent->lerpAngles, v );	offset[0] = 8;	offset[1] = -4;	offset[2] = 24;	xoffset[0] = offset[0] * v[0][0] + offset[1] * v[1][0] + offset[2] * v[2][0];	xoffset[1] = offset[0] * v[0][1] + offset[1] * v[1][1] + offset[2] * v[2][1];	xoffset[2] = offset[0] * v[0][2] + offset[1] * v[1][2] + offset[2] * v[2][2];	VectorAdd( cent->lerpOrigin, xoffset, re->origin );	VectorCopy( re->origin, le->pos.trBase );	if ( CG_PointContents( re->origin, -1 ) & CONTENTS_WATER ) {		waterScale = 0.10f;	}	xvelocity[0] = velocity[0] * v[0][0] + velocity[1] * v[1][0] + velocity[2] * v[2][0];	xvelocity[1] = velocity[0] * v[0][1] + velocity[1] * v[1][1] + velocity[2] * v[2][1];	xvelocity[2] = velocity[0] * v[0][2] + velocity[1] * v[1][2] + velocity[2] * v[2][2];	VectorScale( xvelocity, waterScale, le->pos.trDelta );	AxisCopy( axisDefault, re->axis );	re->hModel = cgs.media.machinegunBrassModel;	le->bounceFactor = 0.4 * waterScale;	le->angles.trType = TR_LINEAR;	le->angles.trTime = cg.time;	le->angles.trBase[0] = rand()&31;	le->angles.trBase[1] = rand()&31;	le->angles.trBase[2] = rand()&31;	le->angles.trDelta[0] = 2;	le->angles.trDelta[1] = 1;	le->angles.trDelta[2] = 0;	le->leFlags = LEF_TUMBLE;	le->leBounceSoundType = LEBS_BRASS;	le->leMarkType = LEMT_NONE;}
开发者ID:entdark,项目名称:q3mme,代码行数:71,


示例22: CG_CalcViewValues

/*===============CG_CalcViewValuesSets cg.refdef view values===============*/static int CG_CalcViewValues( void ) {	playerState_t	*ps;	memset( &cg.refdef, 0, sizeof( cg.refdef ) );	// strings for in game rendering	// Q_strncpyz( cg.refdef.text[0], "Park Ranger", sizeof(cg.refdef.text[0]) );	// Q_strncpyz( cg.refdef.text[1], "19", sizeof(cg.refdef.text[1]) );	// calculate size of 3D view	CG_CalcVrect();	ps = &cg.predictedPlayerState;	// intermission view	if ( ps->pm_type == PM_INTERMISSION ) {		VectorCopy( ps->origin, cg.refdef.vieworg );		VectorCopy( ps->viewangles, cg.refdefViewAngles );		AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );		return CG_CalcFov();	}	cg.bobcycle = ( ps->bobCycle & 128 ) >> 7;	cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );	cg.bobfraccos = fabs( cos( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );	cg.bobfracsin2 = fabs( sin( ( ps->bobCycle & 127) / 127.0 * (M_PI) ));	cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] +		ps->velocity[1] * ps->velocity[1] );	VectorCopy( ps->origin, cg.refdef.vieworg );	VectorCopy( ps->viewangles, cg.refdefViewAngles );	if (cg_cameraOrbit.integer) {		if (cg.time > cg.nextOrbitTime) {			cg.nextOrbitTime = cg.time + cg_cameraOrbitDelay.integer;			cg_thirdPersonAngle.value += cg_cameraOrbit.value;		}	}	// add error decay	if ( cg_errorDecay.value > 0 ) {		int		t;		float	f;		t = cg.time - cg.predictedErrorTime;		f = ( cg_errorDecay.value - t ) / cg_errorDecay.value;		if ( f > 0 && f < 1 ) {			VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg );		} else {			cg.predictedErrorTime = 0;		}	}	if ( cg.renderingThirdPerson ) {		// back away from character		CG_OffsetThirdPersonView();	} else {		// offset for local bobbing and kicks		CG_OffsetFirstPersonView();	}	// leilei - View-from-the-model-eyes feature, aka "fullbody awareness" lol	if (cg_cameraEyes.integer && !cg.renderingThirdPerson){		vec3_t		forward, right, up;			cg.refdefViewAngles[ROLL] = headang[ROLL];		cg.refdefViewAngles[PITCH] = headang[PITCH];		cg.refdefViewAngles[YAW] = headang[YAW];		AngleVectors( headang, forward, NULL, up );		if (cg_cameraEyes.integer == 2){			VectorMA( headpos, 0, forward, headpos );			VectorMA( headpos, 4, up, headpos );		}		else		{			VectorMA( headpos, cg_cameraEyes_Fwd.value, forward, headpos );			VectorMA( headpos, cg_cameraEyes_Up.value, up, headpos );		}		cg.refdef.vieworg[0] = ps->origin[0] + headpos[0];		cg.refdef.vieworg[1] = ps->origin[1] + headpos[1];		cg.refdef.vieworg[2] = ps->origin[2] + headpos[2];			}	// position eye reletive to origin	AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );	if ( cg.hyperspace ) {		cg.refdef.rdflags |= RDF_NOWORLDMODEL | RDF_HYPERSPACE;//.........这里部分代码省略.........
开发者ID:OpenArena,项目名称:leixperimental,代码行数:101,


示例23: CG_AddPlayerWeapon

// Used for both the view weapon (ps is valid) and the world modelother character models (ps is NULL)// The main player will have this called for BOTH cases, so effects like light and sound should only be done on the//	world model case.void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent, int team, vector3 *newAngles, qboolean thirdPerson ) {	refEntity_t gun, barrel, flash;	vector3 angles;	weapon_t weaponNum;	weaponInfo_t *weapon;	centity_t *nonPredictedCent;	if ( !thirdPerson && cg_fakeGun.integer ) {		weaponNum = (weapon_t)cg_fakeGun.integer;	}	else {		weaponNum = (weapon_t)cent->currentState.weapon;	}	if ( weaponNum == WP_EMPLACED_GUN )		return;	// spectator mode, don't draw it...	if ( cg.predictedPlayerState.pm_type == PM_SPECTATOR		&& cent->currentState.number == cg.predictedPlayerState.clientNum )	{		return;	}	CG_RegisterWeapon( weaponNum );	weapon = &cg_weapons[weaponNum];	memset( &gun, 0, sizeof(gun) );	// only do this if we are in first person, since world weapons are now handled on the server by Ghoul2	if ( !thirdPerson ) {		// add the weapon		VectorCopy( &parent->lightingOrigin, &gun.lightingOrigin );		gun.shadowPlane = parent->shadowPlane;		gun.renderfx = parent->renderfx;		// this player, in first person view		if ( ps )			gun.hModel = weapon->viewModel;		else			gun.hModel = weapon->weaponModel;		if ( !gun.hModel )			return;		if ( !ps ) {			// add weapon ready sound			if ( (cent->currentState.eFlags & EF_FIRING) && weapon->firingSound ) {				trap->S_AddLoopingSound( cent->currentState.number, &cent->lerpOrigin, &vec3_origin,					weapon->firingSound				);			}			else if ( weapon->readySound ) {				trap->S_AddLoopingSound( cent->currentState.number, &cent->lerpOrigin, &vec3_origin,					weapon->readySound				);			}		}		CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon" );		if ( !CG_IsMindTricked( cent->currentState.trickedEntIndex, cg.snap->ps.clientNum ) ) {			// don't draw the weapon if the player is invisible			CG_AddWeaponWithPowerups( &gun, cent->currentState.powerups );		}		if ( weaponNum == WP_STUN_BATON ) {			int i;			for ( i = 0; i < 3; i++ ) {				memset( &barrel, 0, sizeof(barrel) );				VectorCopy( &parent->lightingOrigin, &barrel.lightingOrigin );				barrel.shadowPlane = parent->shadowPlane;				barrel.renderfx = parent->renderfx;				if ( i == 0 ) {					barrel.hModel = trap->R_RegisterModel( "models/weapons2/stun_baton/baton_barrel.md3" );				}				else if ( i == 1 ) {					barrel.hModel = trap->R_RegisterModel( "models/weapons2/stun_baton/baton_barrel2.md3" );				}				else {					barrel.hModel = trap->R_RegisterModel( "models/weapons2/stun_baton/baton_barrel3.md3" );				}				angles.yaw = 0;				angles.pitch = 0;				angles.roll = 0;				AnglesToAxis( &angles, barrel.axis );				if ( i == 0 ) {					CG_PositionRotatedEntityOnTag( &barrel, parent, weapon->handsModel, "tag_barrel" );				}				else if ( i == 1 ) {					CG_PositionRotatedEntityOnTag( &barrel, parent, weapon->handsModel, "tag_barrel2" );				}				else {					CG_PositionRotatedEntityOnTag( &barrel, parent, weapon->handsModel, "tag_barrel3" );//.........这里部分代码省略.........
开发者ID:Razish,项目名称:japp,代码行数:101,


示例24: UI_DrawPlayer

//.........这里部分代码省略.........	torso.renderfx = renderfx;	trap_R_AddRefEntityToScene( &torso );	//	// add the head	//	head.hModel = pi->headModel;	if (!head.hModel) {		return;	}	head.customSkin = pi->headSkin;	VectorCopy( origin, head.lightingOrigin );	UI_PositionRotatedEntityOnTag( &head, &torso, pi->torsoModel, "tag_head");	head.renderfx = renderfx;	trap_R_AddRefEntityToScene( &head );	//	// add the gun	//	if ( pi->currentWeapon != WP_NONE ) {		memset( &gun, 0, sizeof(gun) );		gun.hModel = pi->weaponModel;		VectorCopy( origin, gun.lightingOrigin );		UI_PositionEntityOnTag( &gun, &torso, pi->torsoModel, "tag_weapon");		gun.renderfx = renderfx;		trap_R_AddRefEntityToScene( &gun );	}	//	// add the spinning barrel	//	if ( pi->realWeapon == WP_MACHINEGUN || pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {		vec3_t	angles;		memset( &barrel, 0, sizeof(barrel) );		VectorCopy( origin, barrel.lightingOrigin );		barrel.renderfx = renderfx;		barrel.hModel = pi->barrelModel;		angles[YAW] = 0;		angles[PITCH] = 0;		angles[ROLL] = UI_MachinegunSpinAngle( pi );		if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {			angles[PITCH] = angles[ROLL];			angles[ROLL] = 0;		}		AnglesToAxis( angles, barrel.axis );		UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");		trap_R_AddRefEntityToScene( &barrel );	}	//	// add muzzle flash	//	if ( dp_realtime <= pi->muzzleFlashTime ) {		if ( pi->flashModel ) {			memset( &flash, 0, sizeof(flash) );			flash.hModel = pi->flashModel;			VectorCopy( origin, flash.lightingOrigin );			UI_PositionEntityOnTag( &flash, &gun, pi->weaponModel, "tag_flash");			flash.renderfx = renderfx;			trap_R_AddRefEntityToScene( &flash );		}		// make a dlight for the flash		if ( pi->flashDlightColor[0] || pi->flashDlightColor[1] || pi->flashDlightColor[2] ) {			trap_R_AddLightToScene( flash.origin, 200 + (rand()&31), pi->flashDlightColor[0],				pi->flashDlightColor[1], pi->flashDlightColor[2] );		}	}	//	// add the chat icon	//	if ( pi->chat ) {		UI_PlayerFloatSprite( pi, origin, trap_R_RegisterShaderNoMip( "sprites/balloon3" ) );	}	//	// add an accent light	//	origin[0] -= 100;	// + = behind, - = in front	origin[1] += 100;	// + = left, - = right	origin[2] += 100;	// + = above, - = below	trap_R_AddLightToScene( origin, 500, 1.0, 1.0, 1.0 );	origin[0] -= 100;	origin[1] -= 100;	origin[2] -= 100;	trap_R_AddLightToScene( origin, 500, 1.0, 0.0, 0.0 );	trap_R_RenderScene( &refdef );}
开发者ID:bass3001,项目名称:ioq3,代码行数:101,


示例25: CG_AddViewWeapon

// Add the weapon, and flash for the player's viewvoid CG_AddViewWeapon( playerState_t *ps ) {	// no gun if in third person view or a camera is active	if ( ps->persistant[PERS_TEAM] == TEAM_SPECTATOR || ps->pm_type == PM_INTERMISSION || cg.renderingThirdPerson ) {		return;	}	const int weap = cg_fakeGun.integer ? cg_fakeGun.integer : ps->weapon;	float desiredFov = 0.0f;	if ( !cg.renderingThirdPerson		&& (cg_trueGuns.integer || weap == WP_SABER || weap == WP_MELEE)		&& cg_trueFOV.value		&& cg.predictedPlayerState.pm_type != PM_SPECTATOR		&& cg.predictedPlayerState.pm_type != PM_INTERMISSION )	{		desiredFov = cg_fovViewmodel.integer ? cg_fovViewmodel.value : cg_trueFOV.value;	}	else {		desiredFov = cg_fovViewmodel.integer ? cg_fovViewmodel.value : cg_fov.value;	}	desiredFov = Q_clampi( 1, desiredFov, 180 );	// allow the gun to be completely removed	if ( !cg_fakeGun.integer && (!cg_drawGun.integer || cg.predictedPlayerState.zoomMode || cg_trueGuns.integer		|| weap == WP_SABER || weap == WP_MELEE) ) {		return;	}	// don't draw if testing a gun model	if ( cg.testGun ) {		return;	}	centity_t *cent = &cg_entities[cg.predictedPlayerState.clientNum];	CG_RegisterWeapon( weap );	refEntity_t hand;	memset( &hand, 0, sizeof(hand) );	// set up gun position	vector3 angles;	CG_CalculateWeaponPosition( &hand.origin, &angles );	refdef_t *refdef = CG_GetRefdef();	VectorMA( &hand.origin, cg.gunAlign.x, &refdef->viewaxis[0], &hand.origin );	VectorMA( &hand.origin, cg.gunAlign.y, &refdef->viewaxis[1], &hand.origin );	VectorMA( &hand.origin, cg.gunAlign.z, &refdef->viewaxis[2], &hand.origin );	AnglesToAxis( &angles, hand.axis );	if ( cg_fovViewmodel.integer ) {		float fracDistFOV, fracWeapFOV;		float fov = desiredFov;		if ( cg_fovAspectAdjust.integer ) {			// Based on LordHavoc's code for Darkplaces			// http://www.quakeworld.nu/forum/topic/53/what-does-your-qw-look-like/page/30			const float baseAspect = 0.75f; // 3/4			const float aspect = (float)cgs.glconfig.vidWidth / (float)cgs.glconfig.vidHeight;			fov = atanf( tanf( desiredFov*M_PI / 360.0f ) * baseAspect*aspect )*360.0f / M_PI;		}		fracDistFOV = tanf( refdef->fov_x * M_PI / 360.0f );		fracWeapFOV = (1.0f / fracDistFOV) * tanf( fov * M_PI / 360.0f );		VectorScale( &hand.axis[0], fracWeapFOV, &hand.axis[0] );	}	// map torso animations to weapon animations	if ( cg_debugGunFrame.integer ) {		// development tool		hand.frame = hand.oldframe = cg_debugGunFrame.integer;		hand.backlerp = 0;	}	else {		float currentFrame;		// get clientinfo for animation map		clientInfo_t *ci = nullptr;		if ( cent->currentState.eType == ET_NPC ) {			if ( !cent->npcClient ) {				return;			}			ci = cent->npcClient;		}		else {			ci = &cgs.clientinfo[cent->currentState.clientNum];		}		// smoother first-person anims by eezstreet http://jkhub.org/topic/1499-/		//		actually ported from SP#if 1		// Sil's fix		trap->G2API_GetBoneFrame( cent->ghoul2, "lower_lumbar", cg.time, &currentFrame, cgs.gameModels, 0 );		hand.frame = CG_MapTorsoToWeaponFrame( ci, ceilf( currentFrame ), cent->currentState.torsoAnim );		hand.oldframe = CG_MapTorsoToWeaponFrame( ci, floorf( currentFrame ), cent->currentState.torsoAnim );		hand.backlerp = 1.0f - (currentFrame - floorf( currentFrame ));#else		// basejka style		hand.frame = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.frame, cent->currentState.torsoAnim );		hand.oldframe = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.oldFrame, cent->currentState.torsoAnim );//.........这里部分代码省略.........
开发者ID:Razish,项目名称:japp,代码行数:101,


示例26: CG_AddFragment

/*================CG_AddFragment================*/void CG_AddFragment( localEntity_t *le ) {	vec3_t	newOrigin;	trace_t	trace;	if ( le->pos.trType == TR_STATIONARY ) {		// sink into the ground if near the removal time		int		t;		float	oldZ;				t = le->endTime - cg.time;		if ( t < SINK_TIME ) {			// we must use an explicit lighting origin, otherwise the			// lighting would be lost as soon as the origin went			// into the ground			VectorCopy( le->refEntity.origin, le->refEntity.lightingOrigin );			le->refEntity.renderfx |= RF_LIGHTING_ORIGIN;			oldZ = le->refEntity.origin[2];			le->refEntity.origin[2] -= 16 * ( 1.0 - (float)t / SINK_TIME );			trap_R_AddRefEntityToScene( &le->refEntity );			le->refEntity.origin[2] = oldZ;		} else {			trap_R_AddRefEntityToScene( &le->refEntity );		}		return;	}	// calculate new position	BG_EvaluateTrajectory( &le->pos, cg.time, newOrigin );	// trace a line from previous position to new position	CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, -1, CONTENTS_SOLID );	if ( trace.fraction == 1.0 ) {		// still in free fall		VectorCopy( newOrigin, le->refEntity.origin );		if ( le->leFlags & LEF_TUMBLE ) {			vec3_t angles;			BG_EvaluateTrajectory( &le->angles, cg.time, angles );			AnglesToAxis( angles, le->refEntity.axis );		}		trap_R_AddRefEntityToScene( &le->refEntity );		// add a blood trail		if ( le->leBounceSoundType == LEBS_BLOOD ) {			CG_BloodTrail( le );		}		return;	}	// if it is in a nodrop zone, remove it	// this keeps gibs from waiting at the bottom of pits of death	// and floating levels	if ( trap_CM_PointContents( trace.endpos, 0 ) & CONTENTS_NODROP ) {		CG_FreeLocalEntity( le );		return;	}	// leave a mark	CG_FragmentBounceMark( le, &trace );	// do a bouncy sound	CG_FragmentBounceSound( le, &trace );	// reflect the velocity on the trace plane	CG_ReflectVelocity( le, &trace );	trap_R_AddRefEntityToScene( &le->refEntity );}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:77,


示例27: CG_CalcViewValues

/*===============CG_CalcViewValuesSets cg.refdef view values===============*/static int CG_CalcViewValues( void ) {	playerState_t   *ps;	memset( &cg.refdef, 0, sizeof( cg.refdef ) );	// strings for in game rendering	// Q_strncpyz( cg.refdef.text[0], "Park Ranger", sizeof(cg.refdef.text[0]) );	// Q_strncpyz( cg.refdef.text[1], "19", sizeof(cg.refdef.text[1]) );	// calculate size of 3D view	CG_CalcVrect();	ps = &cg.predictedPlayerState;	if ( cg.cameraMode ) {		vec3_t origin, angles;		float fov = 90;		float x;		if ( trap_getCameraInfo( CAM_PRIMARY, cg.time, &origin, &angles, &fov ) ) {			VectorCopy( origin, cg.refdef.vieworg );			angles[ROLL] = 0;			angles[PITCH] = -angles[PITCH];     // (SA) compensate for reversed pitch (this makes the game match the editor, however I'm guessing the real fix is to be done there)			VectorCopy( angles, cg.refdefViewAngles );			AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );			x = cg.refdef.width / tan( fov / 360 * M_PI );			cg.refdef.fov_y = atan2( cg.refdef.height, x );			cg.refdef.fov_y = cg.refdef.fov_y * 360 / M_PI;			cg.refdef.fov_x = fov;			trap_SendClientCommand( va( "setCameraOrigin %f %f %f", origin[0], origin[1], origin[2] ) );			return 0;		} else {			cg.cameraMode = qfalse;			trap_Cvar_Set( "cg_letterbox", "0" );			trap_SendClientCommand( "stopCamera" );			CG_Fade( 0, 0, 0, 255, 0 );   // go black			CG_Fade( 0, 0, 0, 0, 1500 );  // then fadeup		}	}	// intermission view	if ( ps->pm_type == PM_INTERMISSION ) {		VectorCopy( ps->origin, cg.refdef.vieworg );		VectorCopy( ps->viewangles, cg.refdefViewAngles );		AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );		return CG_CalcFov();	}	cg.bobcycle = ( ps->bobCycle & 128 ) >> 7;	cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );	cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] +					   ps->velocity[1] * ps->velocity[1] );//	VectorCopy( ps->origin, cg.refdef.vieworg );	// Arnout: see if we're attached to a gun	if ( cg.renderingThirdPerson && ps->eFlags & EF_MG42_ACTIVE ) {		centity_t *mg42 = &cg_entities[ps->viewlocked_entNum];		vec3_t forward, right, up;		AngleVectors( ps->viewangles, forward, right, up );		VectorMA( mg42->currentState.pos.trBase, -36, forward, cg.refdef.vieworg );		cg.refdef.vieworg[2] = ps->origin[2];	} else {		VectorCopy( ps->origin, cg.refdef.vieworg );	}	VectorCopy( ps->viewangles, cg.refdefViewAngles );	// add error decay	if ( cg_errorDecay.value > 0 ) {		int t;		float f;		t = cg.time - cg.predictedErrorTime;		f = ( cg_errorDecay.value - t ) / cg_errorDecay.value;		if ( f > 0 && f < 1 ) {			VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg );		} else {			cg.predictedErrorTime = 0;		}	}	// Ridah, lock the viewangles if the game has told us to	if ( ps->viewlocked ) {		/*		if (ps->viewlocked == 4)		{			centity_t *tent;			tent = &cg_entities[ps->viewlocked_entNum];//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,


示例28: CG_DistortionOrb

static void CG_DistortionOrb( centity_t *cent ){	refEntity_t ent;	vec3_t ang;	float scale = 0.5f;	float vLen;	if (!cg_renderToTextureFX.integer)	{		return;	}	memset( &ent, 0, sizeof( ent ) );	VectorCopy( cent->lerpOrigin, ent.origin );	VectorSubtract(ent.origin, cg.refdef.vieworg, ent.axis[0]);	vLen = VectorLength(ent.axis[0]);	if (VectorNormalize(ent.axis[0]) <= 0.1f)	{	// Entity is right on vieworg.  quit.		return;	}//	VectorCopy(cg.refdef.viewaxis[2], ent.axis[2]);//	CrossProduct(ent.axis[0], ent.axis[2], ent.axis[1]);	vectoangles(ent.axis[0], ang);	ang[ROLL] = cent->trickAlpha;	cent->trickAlpha += 16; //spin the half-sphere to give a "screwdriver" effect	AnglesToAxis(ang, ent.axis);	//radius must be a power of 2, and is the actual captured texture size	if (vLen < 128)	{		ent.radius = 256;	}	else if (vLen < 256)	{		ent.radius = 128;	}	else if (vLen < 512)	{		ent.radius = 64;	}	else	{		ent.radius = 32;	}	VectorScale(ent.axis[0], scale, ent.axis[0]);	VectorScale(ent.axis[1], scale, ent.axis[1]);	VectorScale(ent.axis[2], -scale, ent.axis[2]);	ent.hModel = cgs.media.halfShieldModel;	ent.customShader = 0;//cgs.media.halfShieldShader;	#if 1	ent.renderfx = (RF_DISTORTION|RF_RGB_TINT);	//tint the whole thing a shade of blue	ent.shaderRGBA[0] = 200.0f;	ent.shaderRGBA[1] = 200.0f;	ent.shaderRGBA[2] = 255.0f;#else //no tint	ent.renderfx = RF_DISTORTION;#endif	trap->R_AddRefEntityToScene( &ent );}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:67,


示例29: SP_misc_gamemodel

void SP_misc_gamemodel(void){    char   *model;    vec_t  angle;    vec3_t angles;    vec_t  scale;    vec3_t vScale;    vec3_t org;    cg_gamemodel_t *gamemodel;    int i;    if (CG_SpawnString("targetname", "", &model) || CG_SpawnString("scriptname", "", &model) || CG_SpawnString("spawnflags", "", &model))    {        // Gordon: this model may not be static, so let the server handle it        return;    }    if (cg.numMiscGameModels >= MAX_STATIC_GAMEMODELS)    {        CG_Error("^1MAX_STATIC_GAMEMODELS(%i) hit", MAX_STATIC_GAMEMODELS);    }    CG_SpawnString("model", "", &model);    CG_SpawnVector("origin", "0 0 0", org);    if (!CG_SpawnVector("angles", "0 0 0", angles))    {        if (CG_SpawnFloat("angle", "0", &angle))        {            angles[YAW] = angle;        }    }    if (!CG_SpawnVector("modelscale_vec", "1 1 1", vScale))    {        if (CG_SpawnFloat("modelscale", "1", &scale))        {            VectorSet(vScale, scale, scale, scale);        }    }    gamemodel        = &cgs.miscGameModels[cg.numMiscGameModels++];    gamemodel->model = trap_R_RegisterModel(model);    AnglesToAxis(angles, gamemodel->axes);    for (i = 0; i < 3; i++)    {        VectorScale(gamemodel->axes[i], vScale[i], gamemodel->axes[i]);    }    VectorCopy(org, gamemodel->org);    if (gamemodel->model)    {        vec3_t mins, maxs;        trap_R_ModelBounds(gamemodel->model, mins, maxs);        for (i = 0; i < 3; i++)        {            mins[i] *= vScale[i];            maxs[i] *= vScale[i];        }        gamemodel->radius = RadiusFromBounds(mins, maxs);    }    else    {        gamemodel->radius = 0;    }}
开发者ID:morsik,项目名称:war-territory,代码行数:74,



注:本文中的AnglesToAxis函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Animation函数代码示例
C++ AngleVectors函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。