当前位置: 首页>>代码示例>>C++>>正文


C++ AxisCopy函数代码示例

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


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

示例1: CG_AddFadeScaleModel

static void CG_AddFadeScaleModel( localEntity_t *le ) {
	refEntity_t	*ent = &le->refEntity;

	float frac = (cg.time - le->startTime) / ((float)(le->endTime - le->startTime));

	frac *= frac * frac; // yes, this is completely ridiculous...but it causes the shell to grow slowly then "explode" at the end

	ent->nonNormalizedAxes = qtrue;

	AxisCopy( axisDefault, ent->axis );

	VectorScale( &ent->axis[0], le->radius*frac, &ent->axis[0] );
	VectorScale( &ent->axis[1], le->radius*frac, &ent->axis[1] );
	VectorScale( &ent->axis[2], le->radius*0.5f*frac, &ent->axis[2] );

	frac = 1.0f - frac;

	ent->shaderRGBA[0] = le->color[0] * frac;
	ent->shaderRGBA[1] = le->color[1] * frac;
	ent->shaderRGBA[2] = le->color[2] * frac;
	ent->shaderRGBA[3] = le->color[3] * frac;

	// add the entity
	SE_R_AddRefEntityToScene( ent, MAX_CLIENTS );
}
开发者ID:MatthewCZ,项目名称:Ja,代码行数:25,代码来源:cg_localents.c

示例2: CG_LaunchGib

/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchGib( vector3 *origin, vector3 *velocity, qhandle_t hModel ) {
	localEntity_t	*le;
	refEntity_t		*re;

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 5000 + random() * 3000;

	VectorCopy( origin, &re->origin );
	AxisCopy( axisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	VectorCopy( origin, &le->pos.trBase );
	VectorCopy( velocity, &le->pos.trDelta );
	le->pos.trTime = cg.time;

	le->bounceFactor = 0.6f;

	le->leBounceSoundType = LEBS_BLOOD;
	le->leMarkType = LEMT_BLOOD;
}
开发者ID:Geptun,项目名称:japp,代码行数:30,代码来源:cg_effects.c

示例3: CG_LaunchGib

/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchGib( bvec3_t origin, bvec3_t velocity, qhandle_t hModel ) {
	localEntity_t	*le;
	refEntity_t		*re;

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 5000 + FIXED_TO_INT(random() * GFIXED(3000,0));

	VectorCopy( origin, re->origin );
	AxisCopy( aaxisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	VectorCopy( origin, le->pos.trBase );
	VectorCopy( velocity, le->pos.trDelta );
	le->pos.trTime = cg.time;

	le->bounceFactor = BFIXED(0,6);

	le->leBounceSoundType = LEBS_BLOOD;
	le->leMarkType = LEMT_BLOOD;
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:30,代码来源:cg_effects.cpp

示例4: CG_LaunchExplode

/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchExplode( vec3_t origin, vec3_t velocity, qhandle_t hModel ) {
	localEntity_t	*le;
	refEntity_t		*re;

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 10000 + random() * 6000;

	VectorCopy( origin, re->origin );
	AxisCopy( axisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	VectorCopy( origin, le->pos.trBase );
	VectorCopy( velocity, le->pos.trDelta );
	le->pos.trTime = cg.time;

	le->bounceFactor = 0.1f;

	le->leBounceSoundType = LEBS_BRASS;
	le->leMarkType = LEMT_NONE;
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:30,代码来源:cg_effects.c

示例5: CG_ThrowChunk

/*
==================
CG_ThrowChunk
==================
*/
void CG_ThrowChunk( vec3_t origin, vec3_t velocity, qhandle_t hModel, int optionalSound, int startalpha ) {
	localEntity_t	*le;
	refEntity_t		*re;

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 5000 + random() * 3000;

	VectorCopy( origin, re->origin );
	AxisCopy( axisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	le->angles.trType = TR_GRAVITY;
	VectorCopy( origin, le->pos.trBase );
	VectorCopy( velocity, le->pos.trDelta );
	VectorSet(le->angles.trBase, 20, 20, 20);
	VectorCopy( velocity, le->angles.trDelta );
	le->pos.trTime = cg.time;
	le->angles.trTime = cg.time;

	le->leFlags = LEF_TUMBLE;

	le->angles.trBase[YAW] = 180;

	le->bounceFactor = 0.3f;
	le->bounceSound = optionalSound;

	le->forceAlpha = startalpha;
}
开发者ID:aufau,项目名称:jk2sdk-gpl-fork,代码行数:38,代码来源:cg_effects.c

示例6: CG_LaunchGib

/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchGib( vec3_t origin, vec3_t velocity, qhandle_t hModel ) {
	localEntity_t	*le;
	refEntity_t		*re;

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 5000 + random() * 3000;

	VectorCopy( origin, re->origin );
	AxisCopy( axisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	VectorCopy( origin, le->pos.trBase );
	VectorCopy( velocity, le->pos.trDelta );
	le->pos.trTime = cg.time;

	le->bounceFactor = 0.6f;

	le->leBounceSoundType = LEBS_BLOOD;
	le->leMarkType = LEMT_BLOOD;
		if ( cg_leiSuperGoreyAwesome.integer ) {
			CG_SpurtBlood( origin, velocity, 7); // LEILEI toss some extra juice
			CG_SpurtBlood( origin, velocity, 22); 
			CG_SpurtBlood( origin, velocity, 11); 
			}
	
}
开发者ID:OpenArena,项目名称:legacy,代码行数:36,代码来源:cg_effects.c

示例7: CG_smoothWJTransitions

/*
===============
CG_smoothWJTransitions
===============
*/
static void CG_smoothWJTransitions( playerState_t *ps, const vec3_t in, vec3_t out )
{
	int      i;
	float    stLocal, sFraction;
	qboolean performed = qfalse;
	vec3_t   inAxis[ 3 ], outAxis[ 3 ];

	Q_UNUSED(ps);

	if ( cg.snap->ps.pm_flags & PMF_FOLLOW )
	{
		VectorCopy( in, out );
		return;
	}

	AnglesToAxis( in, inAxis );

	//iterate through ops
	for ( i = MAXSMOOTHS - 1; i >= 0; i-- )
	{
		//if this op has time remaining, perform it
		if ( cg.time < cg.sList[ i ].time + cg_wwSmoothTime.integer )
		{
			stLocal = ( ( cg.sList[ i ].time + cg_wwSmoothTime.integer ) - cg.time ) / cg_wwSmoothTime.integer;
			sFraction = 1.0f - ( ( cos( stLocal * M_PI * 2.0f ) + 1.0f ) / 2.0f );

			RotatePointAroundVector( outAxis[ 0 ], cg.sList[ i ].rotAxis,
			                         inAxis[ 0 ], sFraction * cg.sList[ i ].rotAngle );
			RotatePointAroundVector( outAxis[ 1 ], cg.sList[ i ].rotAxis,
			                         inAxis[ 1 ], sFraction * cg.sList[ i ].rotAngle );
			RotatePointAroundVector( outAxis[ 2 ], cg.sList[ i ].rotAxis,
			                         inAxis[ 2 ], sFraction * cg.sList[ i ].rotAngle );

			AxisCopy( outAxis, inAxis );
			performed = qtrue;
		}
	}

	//if we performed any ops then return the smoothed angles
	//otherwise simply return the in angles
	if ( performed )
	{
		AxisToAngles( outAxis, out );
	}
	else
	{
		VectorCopy( in, out );
	}
}
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:54,代码来源:cg_view.c

示例8: CG_LaunchGib

/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchGib( vec3_t origin, vec3_t velocity, qhandle_t hModel ) {
	localEntity_t	*le;
	refEntity_t		*re;
//freeze
	int	num;
	centity_t	*cent;
//freeze

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 5000 + random() * 3000;

	VectorCopy( origin, re->origin );
	AxisCopy( axisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	VectorCopy( origin, le->pos.trBase );
	VectorCopy( velocity, le->pos.trDelta );
	le->pos.trTime = cg.time;

	le->bounceFactor = 0.6f;

	le->leBounceSoundType = LEBS_BLOOD;
	le->leMarkType = LEMT_BLOOD;
//freeze
	for ( num = 0; num < cg.snap->numEntities; num++ ) {
		cent = &cg_entities[ cg.snap->entities[ num ].number ];
		if ( cent->currentState.eventParm != 255 ) continue;
		if ( VectorCompare( cent->lerpOrigin, origin ) ) {
			re->customShader = cgs.media.freezeShader;
			break;
		}
	}
//freeze
}
开发者ID:dbircsak,项目名称:freeze-tag,代码行数:44,代码来源:cg_effects.c

示例9: 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,代码来源:cg_weapons.c

示例10: CG_OffsetThirdPersonView


//.........这里部分代码省略.........
    if( fabs(deltaPitch) < 200.0f )
    {
      pitch += deltaPitch;
    }

    mouseInputAngles[ PITCH ] = pitch;
    mouseInputAngles[ YAW ] = -1.0f * SHORT2ANGLE( cmd.angles[ YAW ] ); // yaw is inverted
    mouseInputAngles[ ROLL ] = 0.0f;

    for( i = 0; i < 3; i++ )
      mouseInputAngles[ i ] = AngleNormalize180( mouseInputAngles[ i ] );

    // Set the rotation angles to be the view angles offset by the mouse input
    // Ignore the original pitch though; it's too jerky otherwise
    if( !cg_thirdPersonPitchFollow.integer ) 
      cg.refdefViewAngles[ PITCH ] = 0.0f;

    for( i = 0; i < 3; i++ )
    {
      rotationAngles[ i ] = AngleNormalize180(cg.refdefViewAngles[ i ]) + mouseInputAngles[ i ];
      AngleNormalize180( rotationAngles[ i ] );
    }

    // Don't let pitch go too high/too low or the camera flips around and
    // that's really annoying.
    // However, when we're not on the floor or ceiling (wallwalk) pitch 
    // may not be pitch, so just let it go.
    if( surfNormal[ 2 ] > 0.5f || surfNormal[ 2 ] < -0.5f ) 
    {
      if( rotationAngles[ PITCH ] > 85.0f )
        rotationAngles[ PITCH ] = 85.0f;
      else if( rotationAngles[ PITCH ] < -85.0f )
        rotationAngles[ PITCH ] = -85.0f;
    }

    // Perform the rotations specified by rotationAngles.
    AnglesToAxis( rotationAngles, axis );
    if( !( cg.snap->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) ||
        !BG_RotateAxis( cg.snap->ps.grapplePoint, axis, rotaxis, qfalse,
                        cg.snap->ps.eFlags & EF_WALLCLIMBCEILING ) )
      AxisCopy( axis, rotaxis );

    // Convert the new axis back to angles.
    AxisToAngles( rotaxis, rotationAngles );
  }
  else 
  {
    if( cg.predictedPlayerState.stats[ STAT_HEALTH ] > 0 )
    {
      // If we're playing the game in third person, the viewangles already
      // take care of our mouselook, so just use them.
      for( i = 0; i < 3; i++ )
        rotationAngles[ i ] = cg.refdefViewAngles[ i ];
    }
    else // dead
    {
      rotationAngles[ PITCH ] = 20.0f;
      rotationAngles[ YAW ] = cg.refdefViewAngles[ YAW ];
    }
  }

  rotationAngles[ YAW ] -= cg_thirdPersonAngle.value;

  // Move the camera range distance back.
  AngleVectors( rotationAngles, forward, right, up );
  VectorCopy( cg.refdef.vieworg, view );
  VectorMA( view, -range, forward, view );

  // Ensure that the current camera position isn't out of bounds and that there
  // is nothing between the camera and the player.
  if( !cg_cameraMode.integer )
  {
    // Trace a ray from the origin to the viewpoint to make sure the view isn't
    // in a solid block.  Use an 8 by 8 block to prevent the view from near clipping anything
    CG_Trace( &trace, cg.refdef.vieworg, mins, maxs, view, cg.predictedPlayerState.clientNum, MASK_SOLID );

    if( trace.fraction != 1.0f )
    {
      VectorCopy( trace.endpos, view );
      view[ 2 ] += ( 1.0f - trace.fraction ) * 32;
      // Try another trace to this position, because a tunnel may have the ceiling
      // close enogh that this is poking out.

      CG_Trace( &trace, cg.refdef.vieworg, mins, maxs, view, cg.predictedPlayerState.clientNum, MASK_SOLID );
      VectorCopy( trace.endpos, view );
    }
  }

  // Set the camera position to what we calculated.
  VectorCopy( view, cg.refdef.vieworg );

  // The above checks may have moved the camera such that the existing viewangles
  // may not still face the player. Recalculate them to do so.
  // but if we're dead, don't bother because we'd rather see what killed us
  if( cg.predictedPlayerState.stats[ STAT_HEALTH ] > 0 )
  {
    VectorSubtract( focusPoint, cg.refdef.vieworg, focusPoint );
    vectoangles( focusPoint, cg.refdefViewAngles );
  }
}
开发者ID:lepe,项目名称:trem-gpp-bots,代码行数:101,代码来源:cg_view.c

示例11: R_GetPortalOrientations

/*
=================
R_GetPortalOrientation

entityNum is the entity that the portal surface is a part of, which may
be moving and rotating.

Returns qtrue if it should be mirrored
=================
*/
qboolean R_GetPortalOrientations( drawSurf_t *drawSurf, int entityNum,
							 orientation_t *surface, orientation_t *camera,
							 vec3_t pvsOrigin, qboolean *mirror ) {
	int			i;
	cplane_t	originalPlane, plane;
	trRefEntity_t	*e;
	float		d;
	vec3_t		transformed;

	// create plane axis for the portal we are seeing
	R_PlaneForSurface( drawSurf->surface, &originalPlane );

	// rotate the plane if necessary
	if ( entityNum != REFENTITYNUM_WORLD ) {
		tr.currentEntityNum = entityNum;
		tr.currentEntity = &tr.refdef.entities[entityNum];

		// get the orientation of the entity
		R_RotateForEntity( tr.currentEntity, &tr.viewParms, &tr.ori );

		// rotate the plane, but keep the non-rotated version for matching
		// against the portalSurface entities
		R_LocalNormalToWorld( originalPlane.normal, plane.normal );
		plane.dist = originalPlane.dist + DotProduct( plane.normal, tr.ori.origin );

		// translate the original plane
		originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.ori.origin );
	} else {
		plane = originalPlane;
	}

	VectorCopy( plane.normal, surface->axis[0] );
	PerpendicularVector( surface->axis[1], surface->axis[0] );
	CrossProduct( surface->axis[0], surface->axis[1], surface->axis[2] );

	// locate the portal entity closest to this plane.
	// origin will be the origin of the portal, origin2 will be
	// the origin of the camera
	for ( i = 0 ; i < tr.refdef.num_entities ; i++ ) {
		e = &tr.refdef.entities[i];
		if ( e->e.reType != RT_PORTALSURFACE ) {
			continue;
		}

		d = DotProduct( e->e.origin, originalPlane.normal ) - originalPlane.dist;
		if ( d > 64 || d < -64) {
			continue;
		}

		// get the pvsOrigin from the entity
		VectorCopy( e->e.oldorigin, pvsOrigin );

		// if the entity is just a mirror, don't use as a camera point
		if ( e->e.oldorigin[0] == e->e.origin[0] &&
			e->e.oldorigin[1] == e->e.origin[1] &&
			e->e.oldorigin[2] == e->e.origin[2] ) {
			VectorScale( plane.normal, plane.dist, surface->origin );
			VectorCopy( surface->origin, camera->origin );
			VectorSubtract( vec3_origin, surface->axis[0], camera->axis[0] );
			VectorCopy( surface->axis[1], camera->axis[1] );
			VectorCopy( surface->axis[2], camera->axis[2] );

			*mirror = qtrue;
			return qtrue;
		}

		// project the origin onto the surface plane to get
		// an origin point we can rotate around
		d = DotProduct( e->e.origin, plane.normal ) - plane.dist;
		VectorMA( e->e.origin, -d, surface->axis[0], surface->origin );

		// now get the camera origin and orientation
		VectorCopy( e->e.oldorigin, camera->origin );
		AxisCopy( e->e.axis, camera->axis );
		VectorSubtract( vec3_origin, camera->axis[0], camera->axis[0] );
		VectorSubtract( vec3_origin, camera->axis[1], camera->axis[1] );

		// optionally rotate
		if ( e->e.oldframe ) {
			// if a speed is specified
			if ( e->e.frame ) {
				// continuous rotate
				d = (tr.refdef.time/1000.0f) * e->e.frame;
				VectorCopy( camera->axis[1], transformed );
				RotatePointAroundVector( camera->axis[1], camera->axis[0], transformed, d );
				CrossProduct( camera->axis[0], camera->axis[1], camera->axis[2] );
			} else {
				// bobbing rotate, with skinNum being the rotation offset
				d = sin( tr.refdef.time * 0.003f );
				d = e->e.skinNum + d * 4;
//.........这里部分代码省略.........
开发者ID:LeadGuitar,项目名称:OpenJK,代码行数:101,代码来源:tr_main.cpp

示例12: ME_DrawVehicle

void ME_DrawVehicle( IGME_vehicle_t* veh ) 
{
	if( !veh ) return;

	if( veh->groundInstallation ) {
		DrawInfo_GI_t drawInfo;
		memset( &drawInfo, 0, sizeof(drawInfo) );
		VectorCopy( veh->angles, drawInfo.basicInfo.angles );
		VectorCopy( veh->origin, drawInfo.basicInfo.origin );
		AnglesToAxis( veh->angles, drawInfo.basicInfo.axis );
		drawInfo.basicInfo.vehicleIndex = veh->vehidx;
		drawInfo.basicInfo.entityNum = -1;
		drawInfo.turretAngle = 0;
		drawInfo.gunAngle = 10;
		drawInfo.upgrades = availableGroundInstallations[veh->vehidx].upgrades;
		CG_DrawGI(&drawInfo);
	} else {
		switch( availableVehicles[veh->vehidx].cat ) {
		case CAT_PLANE:
			{
				DrawInfo_Plane_t drawInfo;
				memset( &drawInfo, 0, sizeof(drawInfo) );
				VectorCopy( veh->angles, drawInfo.basicInfo.angles );
				VectorCopy( veh->origin, drawInfo.basicInfo.origin );
				AnglesToAxis( veh->angles, drawInfo.basicInfo.axis );
				drawInfo.basicInfo.vehicleIndex = veh->vehidx;
				drawInfo.basicInfo.entityNum = -1;
				drawInfo.basicInfo.usedLoadout = &availableLoadouts[veh->vehidx];
				CG_DrawPlane(&drawInfo);	
			}
			break;
		case CAT_GROUND:
			{
				DrawInfo_GV_t drawInfo;
				memset( &drawInfo, 0, sizeof(drawInfo) );
				VectorCopy( veh->angles, drawInfo.basicInfo.angles );
				VectorCopy( veh->origin, drawInfo.basicInfo.origin );
				AnglesToAxis( veh->angles, drawInfo.basicInfo.axis );
				drawInfo.basicInfo.vehicleIndex = veh->vehidx;
				drawInfo.basicInfo.entityNum = -1;
				drawInfo.basicInfo.usedLoadout = &availableLoadouts[veh->vehidx];
				CG_DrawGV(&drawInfo);	
			}
			break;
		case CAT_BOAT:
			{
				DrawInfo_Boat_t drawInfo;
				memset( &drawInfo, 0, sizeof(drawInfo) );
				VectorCopy( veh->angles, drawInfo.basicInfo.angles );
				VectorCopy( veh->origin, drawInfo.basicInfo.origin );
				AnglesToAxis( veh->angles, drawInfo.basicInfo.axis );
				drawInfo.basicInfo.vehicleIndex = veh->vehidx;
				drawInfo.basicInfo.entityNum = -1;
				drawInfo.basicInfo.usedLoadout = &availableLoadouts[veh->vehidx];
				CG_DrawBoat(&drawInfo);
			}
			break;
		case CAT_HELO:
			break;
		case CAT_LQM:
			break;
		}
	}

	// draw selectors
	if( veh->selected ) {
		refEntity_t	sel;
		int j;
		memset( &sel, 0, sizeof(sel) );
		sel.hModel = cgs.media.IGME_selector;
		VectorCopy( veh->origin, sel.origin );
		VectorCopy( veh->origin, sel.lightingOrigin );
		VectorCopy( veh->origin, sel.oldorigin );
		AnglesToAxis( veh->angles, sel.axis );
		for( j = 0; j < 3; ++j ) {
			VectorScale( sel.axis[j], veh->selectorScale[j], sel.axis[j] );
		}
		sel.nonNormalizedAxes = true;
		refExport.AddRefEntityToScene( &sel );
	}
	// draw waypoints
	if( cgs.IGME.waypointmode && (veh->selected || cgs.IGME.showAllWaypoints) ) {
		int k;
		vec3_t lastpos, dir, ang;
		VectorCopy( veh->origin, lastpos );
		for( k = 0; k < IGME_MAX_WAYPOINTS; ++k ) {
			refEntity_t	wpt, lnk;
			int l;
			float dist;
			if( !veh->waypoints[k].active ) break;//as they are in a row
			memset( &wpt, 0, sizeof(wpt) );
			wpt.hModel = cgs.media.IGME_selector;
			VectorCopy( veh->waypoints[k].origin, wpt.origin );
			VectorCopy( wpt.origin, wpt.lightingOrigin );
			VectorCopy( wpt.origin, wpt.oldorigin );
			AxisCopy( axisDefault, wpt.axis );
			for( l = 0; l < 3; ++l ) {
				VectorScale( wpt.axis[l], 0.25f, wpt.axis[l] );
			}
			wpt.nonNormalizedAxes = true;
//.........这里部分代码省略.........
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:101,代码来源:cg_missioneditor.c

示例13: CG_Chunks


//.........这里部分代码省略.........
			}
		}

		if ( !chunk )
		{
			// No custom chunk.  Pick a random chunk type at run-time so we don't get the same chunks
			switch( chunkType )
			{
			case MAT_METAL2: //bluegrey
				chunkModel = cgs.media.chunkModels[CHUNK_METAL2][Q_irand(0, 3)];
				break;
			case MAT_GREY_STONE://gray
				chunkModel = cgs.media.chunkModels[CHUNK_ROCK1][Q_irand(0, 3)];
				break;
			case MAT_LT_STONE: //tan
				chunkModel = cgs.media.chunkModels[CHUNK_ROCK2][Q_irand(0, 3)];
				break;
			case MAT_DRK_STONE://brown
				chunkModel = cgs.media.chunkModels[CHUNK_ROCK3][Q_irand(0, 3)];
				break;
			case MAT_WHITE_METAL:
				chunkModel = cgs.media.chunkModels[CHUNK_WHITE_METAL][Q_irand(0, 3)];
				break;
			case MAT_CRATE1://yellow multi-colored crate chunks
				chunkModel = cgs.media.chunkModels[CHUNK_CRATE1][Q_irand(0, 3)];
				break;
			case MAT_CRATE2://red multi-colored crate chunks
				chunkModel = cgs.media.chunkModels[CHUNK_CRATE2][Q_irand(0, 3)];
				break;
			case MAT_ELEC_METAL:
			case MAT_GLASS_METAL:
			case MAT_METAL://grey
				chunkModel = cgs.media.chunkModels[CHUNK_METAL1][Q_irand(0, 3)];
				break;
			case MAT_METAL3:
				if ( rand() & 1 )
				{
					chunkModel = cgs.media.chunkModels[CHUNK_METAL1][Q_irand(0, 3)];
				}
				else
				{
					chunkModel = cgs.media.chunkModels[CHUNK_METAL2][Q_irand(0, 3)];
				}
				break;
			default:
				break;
			}
		}

		// It wouldn't look good to throw a bunch of RGB axis models...so make sure we have something to work with.
		if ( chunkModel )
		{
			le = CG_AllocLocalEntity();
			re = &le->refEntity;

			re->hModel = chunkModel;
			le->leType = LE_FRAGMENT;
			le->endTime = cg.time + 1300 + Q_flrand(0.0f, 1.0f) * 900;

			// spawn chunk roughly in the bbox of the thing...bias towards center in case thing blowing up doesn't complete fill its bbox.
			for( j = 0; j < 3; j++ )
			{
				r = Q_flrand(0.0f, 1.0f) * 0.8f + 0.1f;
				re->origin[j] = ( r * mins[j] + ( 1 - r ) * maxs[j] );
			}
			VectorCopy( re->origin, le->pos.trBase );

			// Move out from center of thing, otherwise you can end up things moving across the brush in an undesirable direction.  Visually looks wrong
			VectorSubtract( re->origin, origin, dir );
			VectorNormalize( dir );
			VectorScale( dir, Q_flrand( speed * 0.5f, speed * 1.25f ) * speedMod, le->pos.trDelta );

			// Angular Velocity
			VectorSet( le->angles.trBase, Q_flrand(0.0f, 1.0f) * 360, Q_flrand(0.0f, 1.0f) * 360, Q_flrand(0.0f, 1.0f) * 360 );

			le->angles.trDelta[0] = Q_flrand(-1.0f, 1.0f);
			le->angles.trDelta[1] = Q_flrand(-1.0f, 1.0f);
			le->angles.trDelta[2] = 0; // don't do roll

			VectorScale( le->angles.trDelta, Q_flrand(0.0f, 1.0f) * 600.0f + 200.0f, le->angles.trDelta );

			le->pos.trType = TR_GRAVITY;
			le->angles.trType = TR_LINEAR;
			le->pos.trTime = le->angles.trTime = cg.time;
			le->bounceFactor = 0.2f + Q_flrand(0.0f, 1.0f) * 0.2f;
			le->leFlags |= LEF_TUMBLE;
			le->ownerGentNum = owner;
			le->leBounceSoundType = bounce;

			// Make sure that we have the desired start size set
			le->radius = Q_flrand( baseScale * 0.75f, baseScale * 1.25f );
			re->nonNormalizedAxes = qtrue;
			AxisCopy( axisDefault, re->axis ); // could do an angles to axis, but this is cheaper and works ok
			for( k = 0; k < 3; k++ )
			{
				VectorScale( re->axis[k], le->radius, re->axis[k] );
			}
		}
	}
}
开发者ID:smcv,项目名称:OpenJK,代码行数:101,代码来源:cg_effects.cpp

示例14: CG_LoseHat

/*
==============
CG_LoseHat
==============
*/
void CG_LoseHat(centity_t *cent, vec3_t dir)
{
	clientInfo_t *ci;
	int          clientNum;
//	int				i, count, tagIndex, gibIndex;
	int            tagIndex;
	vec3_t         origin, velocity;
	bg_character_t *character;

	clientNum = cent->currentState.clientNum;
	if (clientNum < 0 || clientNum >= MAX_CLIENTS)
	{
		CG_Error("Bad clientNum on player entity");
	}
	ci        = &cgs.clientinfo[clientNum];
	character = CG_CharacterForClientinfo(ci, cent);

	// don't launch anything if they don't have one
	if (!character->accModels[ACC_HAT])
	{
		return;
	}

	tagIndex = CG_GetOriginForTag(cent, &cent->pe.headRefEnt, "tag_mouth", 0, origin, NULL);

	velocity[0] = dir[0] * (0.75 + random()) * GIB_VELOCITY;
	velocity[1] = dir[1] * (0.75 + random()) * GIB_VELOCITY;
	velocity[2] = GIB_JUMP - 50 + dir[2] * (0.5 + random()) * GIB_VELOCITY;

	{
		localEntity_t *le;
		refEntity_t   *re;

		le = CG_AllocLocalEntity();
		re = &le->refEntity;

		le->leType    = LE_FRAGMENT;
		le->startTime = cg.time;
		le->endTime   = le->startTime + 20000 + (crandom() * 5000);

		VectorCopy(origin, re->origin);
		AxisCopy(axisDefault, re->axis);
		re->hModel     = character->accModels[ACC_HAT];
		re->customSkin = character->accSkins[ACC_HAT];

		re->fadeStartTime = le->endTime - 1000;
		re->fadeEndTime   = le->endTime;

		// (SA) FIXME: origin of hat md3 is offset from center.  need to center the origin when you toss it
		le->pos.trType = TR_GRAVITY;
		VectorCopy(origin, le->pos.trBase);
		VectorCopy(velocity, le->pos.trDelta);
		le->pos.trTime = cg.time;

		// spin it a bit
		le->angles.trType = TR_LINEAR;
		VectorCopy(tv(0, 0, 0), le->angles.trBase);
		le->angles.trDelta[0] = 0;
		le->angles.trDelta[1] = (100 + (rand() & 500)) - 300;
//		le->angles.trDelta[2]	= 0;
		le->angles.trDelta[2] = 400;    // (SA) this is set with a very particular value to try to get it
		                                // to flip exactly once before landing (based on player alive
		                                // (standing) and on level ground) and will be unnecessary when
		                                // I have things landing properly on their own

		le->angles.trTime = cg.time;

		le->bounceFactor = 0.2;

		// Ridah, if the player is on fire, then make the hat on fire
		if (cent && CG_EntOnFire(cent))
		{
			le->onFireStart = cent->currentState.onFireStart;
			le->onFireEnd   = cent->currentState.onFireEnd + 4000;
		}
	}
}
开发者ID:morsik,项目名称:war-territory,代码行数:82,代码来源:cg_effects.c

示例15: memset

void
CBulletVolume::render( centity_t& ent )
{
    entityState_t& es = ent.currentState;

    if (!(es.groundEntityNum & BVF_ENABLED))
        return;

    // Setup refent.
    refEntity_t re;
    memset( &re, 0, sizeof(re) );

    re.reType            = RT_MODEL;
    re.renderfx          = RF_NOSHADOW;
    re.hModel            = cgs.media.polygonCubeFO;
    re.nonNormalizedAxes = qtrue;
    re.customShader      = cgs.media.bulletVolumeShader;

    re.shaderRGBA[3] = byte(es.angles2[2] * 255.0f);
    switch (es.modelindex) {
        default: // UNKNWON -> GRAY
        case 0:
            re.shaderRGBA[0] = byte(0.5f * 255.0f);
            re.shaderRGBA[1] = byte(0.5f * 255.0f);
            re.shaderRGBA[2] = byte(0.5f * 255.0f);
            break;

        case 1: // NOHIT -> BLUE
            re.shaderRGBA[0] = byte(0.0f * 255.0f);
            re.shaderRGBA[1] = byte(0.0f * 255.0f);
            re.shaderRGBA[2] = byte(1.0f * 255.0f);
            break;

        case 2: // HIT -> RED
            re.shaderRGBA[0] = byte(1.0f * 255.0f);
            re.shaderRGBA[1] = byte(0.0f * 255.0f);
            re.shaderRGBA[2] = byte(0.0f * 255.0f);
            break;

        case 3: // REFERENCE NOHIT -> GREEN
            re.shaderRGBA[0] = byte(0.0f * 255.0f);
            re.shaderRGBA[1] = byte(1.0f * 255.0f);
            re.shaderRGBA[2] = byte(0.0f * 255.0f);
            break;

        case 4: // REFERENCE HIT -> YELLOW
            re.shaderRGBA[0] = byte(1.0f * 255.0f);
            re.shaderRGBA[1] = byte(1.0f * 255.0f);
            re.shaderRGBA[2] = byte(0.0f * 255.0f);
            break;
    }

    // Apply entity rotation.
    AxisClear( re.axis );
    AnglesToAxis( es.angles, re.axis );

    // Apply scaling matrix.
    vec3_t smatrix[3];
    AxisClear( smatrix );

    smatrix[0][0] *= es.origin2[0];
    smatrix[1][1] *= es.origin2[1];
    smatrix[2][2] *= es.origin2[2];

    vec3_t tmp[3];
    MatrixMultiply( smatrix, re.axis, tmp );
    AxisCopy( tmp, re.axis );

    // Set origins.
    VectorCopy( es.origin, re.origin );
    VectorCopy( es.origin, re.oldorigin );
    VectorCopy( es.origin, re.lightingOrigin );

    trap_R_AddRefEntityToScene( &re );
}
开发者ID:Dragonji,项目名称:jaymod,代码行数:75,代码来源:CBulletVolume.cpp


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