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

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

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

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

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

示例1: CG_AddFireEffect

/*================CG_AddFireEffect================*/static void CG_AddFireEffect( localEntity_t *le ) {	refEntity_t			*re;	trace_t				trace;	re = &le->refEntity;	if ( le->pos.trType == TR_STATIONARY ) {		if ( le->leFlags & LEF_LESSOVERDRAW ) {			// avoid too much overdraw			if ( CG_NearbyDrawnLeCount( le, re->origin, le->leType, 52 + !!cg_lowDetailEffects.integer * 24 ) > 0 ) return;		}		// add to refresh list		trap_R_AddRefEntityToScene( re );		return;	}	// calculate position	BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );	// check for water	if ( trap_CM_PointContents( re->origin, 0 ) & CONTENTS_WATER ) {		// do a trace to get water surface normals		CG_Trace( &trace, re->oldorigin, NULL, NULL, re->origin, le->owner, MASK_WATER );		CG_FreeLocalEntity( le );		CG_MakeExplosion( trace.endpos, trace.plane.normal, 			cgs.media.ringFlashModel, cgs.media.vaporShader,			500, qfalse, qtrue );		return;	}	// do a trace sometimes	if ( le->ti.trailTime++ > 5 ) {		le->ti.trailTime = 0;		CG_Trace( &trace, re->oldorigin, NULL, NULL, re->origin, le->owner, MASK_SHOT );		VectorCopy( trace.endpos, re->origin );		VectorCopy( trace.endpos, re->oldorigin );		// hit something		if ( trace.fraction < 1.0 ) {			// free le if another one is nearby, otherwise make it stationary			if ( CG_CheckDistance( re->origin, le->leType, TR_STATIONARY, re->customShader, 200, 32 ) ) { 				CG_FreeLocalEntity( le );				return;			} else {				le->pos.trType = TR_STATIONARY;			}		}	}	if ( le->leFlags & LEF_LESSOVERDRAW ) {		// avoid too much overdraw		if ( CG_NearbyDrawnLeCount( le, re->origin, le->leType, 52 + !!cg_lowDetailEffects.integer * 24 ) > 0 ) return;	}	// add to refresh list	trap_R_AddRefEntityToScene( re );}
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:64,


示例2: CG_AddGore

void CG_AddGore( 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;				CG_FreeLocalEntity( le ); // kill it		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 );		CG_SmallBloodTrail( 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_GoreMark( le, &trace );	// do a juicy sound	CG_SplatSound( le, &trace );	CG_JustSplat( le, &trace );	trap_R_AddRefEntityToScene( &le->refEntity );}
开发者ID:OpenArena,项目名称:legacy,代码行数:55,


示例3: CG_AddRefEntity

/*===================CG_AddRefEntity===================*/void CG_AddRefEntity( localEntity_t *le ) {	if (le->endTime < cg.time) {		CG_FreeLocalEntity( le );		return;	}	CG_AddRefEntityWithMinLight( &le->refEntity );}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:12,


示例4: CG_AddPuff

/*==================CG_AddPuff==================*/static void CG_AddPuff( localEntity_t *le ) {	refEntity_t	*re;	float		c;	vec3_t		delta;	float		len;	re = &le->refEntity;	// fade / grow time	c = ( le->endTime - cg.time ) / (float)( le->endTime - le->startTime );	re->shaderRGBA[0] = le->color[0] * c;	re->shaderRGBA[1] = le->color[1] * c;	re->shaderRGBA[2] = le->color[2] * c;	if ( !( le->leFlags & LEF_PUFF_DONT_SCALE ) ) {		re->radius = le->radius * ( 1.0 - c ) + 8;	}	BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	trap->R_AddRefEntityToScene( re );}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:37,


示例5: CG_ResetMissileEntity

/*================CG_ResetMissileEntity================*/void CG_ResetMissileEntity( centity_t *cent ) {		// link trajectory	cent->ti.trPos = &cent->currentState.pos;	cent->ti.weapon = cent->currentState.weapon;	// check for predicted missiles if necessary	if ( cg.predictWeapons && cent->currentState.clientNum == cg.snap->ps.clientNum ) {		localEntity_t	*le;		le = cg_activeLocalEntities.prev;		for ( ; le != &cg_activeLocalEntities ; le = le->prev ) {			// the first (and oldest) missile le is the one represented by the new one			if ( le->leType == LE_MISSILE && weLi[le->ti.weapon].prediction != PR_FLAME ) {				// set the correct trailTime				cent->ti.trailTime = le->ti.trailTime;				VectorCopy( le->ti.lastPos, cent->ti.lastPos );				// free the local entity				CG_FreeLocalEntity( le );				return;			}		}		}	// there isn't a predicted missile, use normal trailTime reset	cent->ti.trailTime = cent->currentState.pos.trTime + TRAIL_DELAY;	BG_EvaluateTrajectory( cent->ti.trPos, cent->ti.trailTime, cent->ti.lastPos );}
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:32,


示例6: CG_AddFallScaleFade

/*=================CG_AddFallScaleFadeThis is just an optimized CG_AddMoveScaleFadeFor blood mists that drift down, fade out, and areremoved if the view passes through them.There are often 100+ of these, so it needs to be simple.=================*/static void CG_AddFallScaleFade( localEntity_t *le ) {	refEntity_t	*re;	gfixed		c;	bvec3_t		delta;	bfixed		len;	re = &le->refEntity;	// fade time	c = MAKE_GFIXED( le->endTime - cg.time ) * le->lifeRate;	re->shaderRGBA[3] = FIXED_TO_INT(GFIXED(255,0) * c * le->color[3]);	re->origin[2] = le->pos.trBase[2] - MAKE_BFIXED( GFIXED_1 - c ) * le->pos.trDelta[2];	re->radius = le->radius * MAKE_BFIXED( GFIXED_1 - c ) + BFIXED(16,0);	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = FIXED_VEC3LEN( delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	_CG_trap_R_AddRefEntityToScene( re );}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:38,


示例7: CG_FreeLocalEntity

/*===================CG_AllocLocalEntityWill allways succeed, even if it requires freeing an old active entity===================*/localEntity_t	*CG_AllocLocalEntity( void ) {	localEntity_t	*le;	if ( !cg_freeLocalEntities ) {		// no free entities, so free the one at the end of the chain		// remove the oldest active entity		CG_FreeLocalEntity( cg_activeLocalEntities.prev );	}	// Ridah, debugging	localEntCount++;//	trap_Print( va("AllocLocalEntity: locelEntCount = %d/n", localEntCount) );	// done.	le = cg_freeLocalEntities;	cg_freeLocalEntities = cg_freeLocalEntities->next;	memset( le, 0, sizeof( *le ) );	// link into the active list	le->next = cg_activeLocalEntities.next;	le->prev = &cg_activeLocalEntities;	cg_activeLocalEntities.next->prev = le;	cg_activeLocalEntities.next = le;	return le;}
开发者ID:natelo,项目名称:rtcwPub,代码行数:33,


示例8: CG_AddFallScaleFade

/*=================CG_AddFallScaleFadeThis is just an optimized CG_AddMoveScaleFadeFor blood mists that drift down, fade out, and areremoved if the view passes through them.There are often 100+ of these, so it needs to be simple.=================*/static void CG_AddFallScaleFade( localEntity_t *le ) {	refEntity_t	*re;	float		c;	vec3_t		delta;	float		len;	re = &le->refEntity;	// fade time	c = ( le->endTime - cg.time ) * le->lifeRate;	re->shaderRGBA[3] = 0xff * c * le->color[3];	re->origin[2] = le->pos.trBase[2] - ( 1.0 - c ) * le->pos.trDelta[2];	re->radius = le->radius * ( 1.0 - c ) + 16;	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	trap->R_AddRefEntityToScene( re );}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:38,


示例9: CG_AddRefEntity

void CG_AddRefEntity( localEntity_t *le ) {	if ( le->endTime < cg.time ) {		CG_FreeLocalEntity( le );		return;	}	SE_R_AddRefEntityToScene( &le->refEntity, MAX_CLIENTS );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:7,


示例10: CG_AddOLine

// For forcefields/other rectangular thingsvoid CG_AddOLine( localEntity_t *le ) {	refEntity_t	*re;	float		frac, alpha;	re = &le->refEntity;	frac = (cg.time - le->startTime) / (float)(le->endTime - le->startTime);	if ( frac > 1 )		frac = 1.0f;	// can happen during connection problems	else if ( frac < 0 )		frac = 0.0f;	// Use the liferate to set the scale over time.	re->data.line.width = le->data.line.width + (le->data.line.dwidth * frac);	if ( re->data.line.width <= 0 ) {		CG_FreeLocalEntity( le );		return;	}	// We will assume here that we want additive transparency effects.	alpha = le->alpha + (le->dalpha * frac);	re->shaderRGBA[0] = 0xff * alpha;	re->shaderRGBA[1] = 0xff * alpha;	re->shaderRGBA[2] = 0xff * alpha;	re->shaderRGBA[3] = 0xff * alpha;	// Yes, we could apply c to this too, but fading the color is better for lines.	re->shaderTexCoord.x = 1;	re->shaderTexCoord.y = 1;	re->rotation = 90;	re->reType = RT_ORIENTEDLINE;	SE_R_AddRefEntityToScene( re, MAX_CLIENTS );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:36,


示例11: CG_AddRefEntity

/*===================CG_AddRefEntity===================*/void CG_AddRefEntity( localEntity_t *le ) {	if (le->endTime < cg.time) {		CG_FreeLocalEntity( le );		return;	}	trap->R_AddRefEntityToScene( &le->refEntity );}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:12,


示例12: CG_AddScaleFade

// For rocket smokes that hang in place, fade out, and are removed if the view passes through them.//	There are often many of these, so it needs to be simple.static void CG_AddScaleFade( localEntity_t *le ) {	refEntity_t	*re;	float		c;	vector3		delta;	float		len;	refdef_t *refdef = CG_GetRefdef();	re = &le->refEntity;	// fade / grow time	c = (le->endTime - cg.time) * le->lifeRate;	re->shaderRGBA[3] = 0xff * c * le->color[3];	re->radius = le->radius * (1.0f - c) + 8;	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( &re->origin, &refdef->vieworg, &delta );	len = VectorLength( &delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	SE_R_AddRefEntityToScene( re, MAX_CLIENTS );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:28,


示例13: CG_AddScaleFade

/*===================CG_AddScaleFadeFor rocket smokes that hang in place, fade out, and areremoved if the view passes through them.There are often many of these, so it needs to be simple.===================*/static void CG_AddScaleFade( localEntity_t *le ) {	refEntity_t	*re;	float		c;	vec3_t		delta;	float		len;	re = &le->refEntity;	// fade / grow time	c = ( le->endTime - cg.time ) * le->lifeRate;	re->shaderRGBA[3] = 0xff * c * le->color[3];	re->radius = le->radius * ( 1.0 - c ) + 8;	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	CG_AddRefEntityWithMinLight( re );}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:34,


示例14: CG_AddLine2

/*===================CG_AddLine2For trek, for beams and the like.===================*/void CG_AddLine2( localEntity_t *le ){	refEntity_t	*re;	float		frac, alpha;	vec3_t		curRGB;	re = &le->refEntity;	frac = (cg.time - le->startTime) / ( float ) ( le->endTime - le->startTime );	if ( frac > 1 ) 		frac = 1.0;	// can happen during connection problems	else if (frac < 0)		frac = 0.0;	// Use the liferate to set the scale over time.	re->data.line.width = le->data.line2.width + (le->data.line2.dwidth * frac);	re->data.line.width2 = le->data.line2.width2 + (le->data.line2.dwidth2 * frac);	if (re->data.line.width <= 0)	{		CG_FreeLocalEntity( le );		return;	}	// We will assume here that we want additive transparency effects.	alpha = le->alpha + (le->dalpha * frac);	VectorMA(le->data.line2.startRGB, frac, le->data.line2.dRGB, curRGB);	re->shaderRGBA[0] = 0xff * alpha * curRGB[0];	re->shaderRGBA[1] = 0xff * alpha * curRGB[1];	re->shaderRGBA[2] = 0xff * alpha * curRGB[2];	re->shaderRGBA[3] = 0xff * alpha;	// Yes, we could apply c to this too, but fading the color is better for lines.	re->reType = RT_LINE2;	trap_R_AddRefEntityToScene( re );}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:42,


示例15: CG_AddFallScaleFade

// This is just an optimized CG_AddMoveScaleFade for blood mists that drift down, fade out, and are removed if the view passes through them.//	There are often 100+ of these, so it needs to be simple.static void CG_AddFallScaleFade( localEntity_t *le ) {	refEntity_t	*re;	float		c;	vector3		delta;	float		len;	re = &le->refEntity;	// fade time	c = ( le->endTime - cg.time ) * le->lifeRate;	re->shaderRGBA[3] = (byte)(255 * c * le->color.a);	re->origin.z = le->pos.trBase.z - ( 1.0f - c ) * le->pos.trDelta.z;	re->radius = le->radius * ( 1.0f - c ) + 16;	// if the view would be "inside" the sprite, kill the sprite so it doesn't add too much overdraw	VectorSubtract( &re->origin, &cg.refdef.vieworg, &delta );	len = VectorLength( &delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	trap->R_AddRefEntityToScene( re );}
开发者ID:Razish,项目名称:QtZ,代码行数:29,


示例16: CG_AddMoveScaleFade

/*==================CG_AddMoveScaleFade==================*/void CG_AddMoveScaleFade( localEntity_t *le ){	refEntity_t	*re;	float		c;	vec3_t		delta;	float		len;	re = &le->refEntity;	// fade / grow time	c = ( le->endTime - cg.time ) * le->lifeRate;	re->shaderRGBA[3] = 0xff * c * le->color[3];	if ( !( le->leFlags & LEF_PUFF_DONT_SCALE ) ) {		re->data.sprite.radius = le->data.sprite.radius * ( 1.0 - c ) + 8;	}	BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < le->data.sprite.radius ) {		CG_FreeLocalEntity( le );		return;	}	trap_R_AddRefEntityToScene( re );}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:36,


示例17: CG_AddQuad

/*===================CG_AddQuadOf Trek, by Trek, and for Trek===================*/void CG_AddQuad( localEntity_t *le ){	refEntity_t	*re;	float		frac, alpha;	vec3_t		delta;	float		len;	vec3_t		curRGB;	re = &le->refEntity;	frac = ( cg.time - le->startTime ) / ( float ) ( le->endTime - le->startTime );	if ( frac > 1 )		frac = 1.0;	// can happen during connection problems	else if (frac < 0)		frac = 0.0;	// Use the liferate to set the scale over time.	re->data.sprite.radius = le->data.sprite.radius + (le->data.sprite.dradius*frac);	if (re->data.sprite.radius <= 0)	{		CG_FreeLocalEntity( le );		return;	}	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < le->data.sprite.radius ) {		CG_FreeLocalEntity( le );		return;	}	// Calculate the current alpha.	alpha = le->alpha + (le->dalpha * frac);	VectorMA(le->data.sprite.startRGB, frac, le->data.sprite.dRGB, curRGB);	re->shaderRGBA[0] = 0xff * alpha * curRGB[0];	re->shaderRGBA[1] = 0xff * alpha * curRGB[1];	re->shaderRGBA[2] = 0xff * alpha * curRGB[2];	re->shaderRGBA[3] = 0xff;		re->reType = RT_ORIENTEDSPRITE;	trap_R_AddRefEntityToScene( re );}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:52,


示例18: CG_AddSpawner

static void CG_AddSpawner( localEntity_t *le ) {	refEntity_t	*re;	vec3_t		dir;	trace_t		trace;	re = &le->refEntity;	if (le->leFlags & LEF_MOVE)	{		// kef -- do these two lines _before_ copying origin into oldorigin		VectorSubtract(re->oldorigin, re->origin, dir);		VectorNormalize(dir);		VectorCopy(re->origin, re->oldorigin);		BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );		if (le->leFlags & LEF_USE_COLLISION)		{			// trace a line from previous position to new position			CG_Trace( &trace, re->oldorigin, NULL, NULL, re->origin, -1, CONTENTS_SOLID );			if ( trace.fraction != 1.0 ) 			{	// Hit something.				// 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;				}				// reflect the velocity on the trace plane				CG_ReflectVelocity( le, &trace );			}			VectorSubtract(re->oldorigin, re->origin, dir);			VectorNormalize(dir);		}	}	// kef -- here's where I, in my infinite wisdom, have decided to emulate the singleplayer	//particle think function	if (cg.time < le->data.spawner.nextthink)	{		return;	}	le->data.spawner.nextthink = cg.time + (le->data.spawner.delay + 		(le->data.spawner.delay*flrandom(-le->data.spawner.variance,le->data.spawner.variance)));	if (le->data.spawner.thinkFn)	{		le->data.spawner.thinkFn(le);	}	if (le->data.spawner.dontDie)	{		le->endTime = le->endTime + 10000;	}}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:57,


示例19: CG_AddCylinder

/*===================CG_AddCylinderFor trek, cylinder primitive.===================*/void CG_AddCylinder( localEntity_t *le ){	refEntity_t	*re;	float		frac, alpha;	re = &le->refEntity;	frac = ( cg.time - le->startTime ) / ( float ) ( le->endTime - le->startTime );	if ( frac > 1 )		frac = 1.0;	// can happen during connection problems	else if (frac < 0)		frac = 0.0;	// Use the liferate to set the scale over time.	re->data.cylinder.height = le->data.cylinder.height + (le->data.cylinder.dheight*frac);	if (re->data.cylinder.height <= 0)	{		CG_FreeLocalEntity( le );		return;	}	re->data.cylinder.width = le->data.cylinder.width + (le->data.cylinder.dwidth*frac);	if (re->data.cylinder.width <= 0)	{		CG_FreeLocalEntity( le );		return;	}	re->data.cylinder.width2 = le->data.cylinder.width2 + (le->data.cylinder.dwidth2*frac);	if (re->data.cylinder.width2 <= 0)	{		CG_FreeLocalEntity( le );		return;	}	// Calculate the current alpha.	alpha = le->alpha + (le->dalpha * frac);	re->shaderRGBA[0] = 0xff * alpha;	re->shaderRGBA[1] = 0xff * alpha;	re->shaderRGBA[2] = 0xff * alpha;	re->shaderRGBA[3] = 0xff;		re->reType = RT_CYLINDER;	trap_R_AddRefEntityToScene( re );}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:51,


示例20: CG_AddScaleFadeSprite

/*===================CG_AddScaleFadeSpriteFor trek, oriented sprites like blast rings and the like.===================*/void CG_AddScaleFadeSprite( localEntity_t *le ){	refEntity_t	*re;	float		c;	vec3_t		delta;	float		len;	re = &le->refEntity;	c = ( le->endTime - cg.time ) / ( float ) ( le->endTime - le->startTime );	if ( c > 1 ) {		c = 1.0;	// can happen during connection problems	}	// Use the liferate to set the scale over time.	re->data.sprite.radius = le->data.sprite.radius + (le->lifeRate * (cg.time - le->startTime));	if (re->data.sprite.radius <= 0)	{		CG_FreeLocalEntity( le );		return;	}	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < le->data.sprite.radius ) {		CG_FreeLocalEntity( le );		return;	}	// We will assume here that we want additive transparency effects.	re->shaderRGBA[0] = 0xff * c;	re->shaderRGBA[1] = 0xff * c;	re->shaderRGBA[2] = 0xff * c;	re->shaderRGBA[3] = 0xff * le->color[3];	re->reType = RT_ORIENTEDSPRITE;	trap_R_AddRefEntityToScene( re );}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:48,


示例21: CG_AddBezier

/*===================CG_AddBezierFor trek, for the imod and the...uh...imod.===================*/void CG_AddBezier( localEntity_t *le ){	refEntity_t	*re;	float		frac, alpha;	float		t = (cg.time - le->startTime)*0.001; // time elapsed since beginning of effect	vec3_t		vTempPos;	re = &le->refEntity;	frac = (cg.time - le->startTime) / ( float ) ( le->endTime - le->startTime );	if ( frac > 1 ) 		frac = 1.0;	// can happen during connection problems	else if (frac < 0)		frac = 0.0;	// Use the liferate to set the scale over time.	re->data.bezier.width = le->data.line.width + (le->data.line.dwidth * frac);	if (re->data.bezier.width <= 0)	{		CG_FreeLocalEntity( le );		return;	}	// We will assume here that we want additive transparency effects.	alpha = le->alpha + (le->dalpha * frac);	re->shaderRGBA[0] = 0xff * alpha;	re->shaderRGBA[1] = 0xff * alpha;	re->shaderRGBA[2] = 0xff * alpha;	re->shaderRGBA[3] = 0xff;	// Yes, we could apply c to this too, but fading the color is better for lines.	re->reType = RT_BEZIER;	// the refEntity only stores the two control points, so we need to update them here with 	//the control_velocity and control_acceleration, then store the results in refEntity. 	//use (cg.time - le->startTime) as a value for elapsed time t, plug it into the position formula:	//	// x = x0 + (v0 * t) + (0.5 * a * t * t)	//	//...where x is the position at time t, x0 is initial control point position, v0 is control point velocity,	//and a is control point acceleration	//	// update control point 1	VectorMA(le->data.line.control1, t, le->data.line.control1_velocity, vTempPos);	VectorMA(vTempPos, (0.5*t*t), le->data.line.control1_acceleration, re->data.bezier.control1);	// update control point 2	VectorMA(le->data.line.control2, t, le->data.line.control2_velocity, vTempPos);	VectorMA(vTempPos, (0.5*t*t), le->data.line.control2_acceleration, re->data.bezier.control2);	trap_R_AddRefEntityToScene( re );}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:60,


示例22: CG_FreeLocalEntities

/** CG_FreeLocalEntities*/void CG_FreeLocalEntities( void ){	lentity_t *le, *next, *hnode;	hnode = &cg_localents_headnode;	for( le = hnode->next; le != hnode; le = next )	{		next = le->next;		le->type = LE_FREE;		CG_FreeLocalEntity( le );	}	CG_ClearLocalEntities();}
开发者ID:QaleQ,项目名称:racemod,代码行数:18,


示例23: CG_BubbleThink

/*=======================================================================================================================================CG_BubbleThink=======================================================================================================================================*/void CG_BubbleThink(localEntity_t *le) {	int contents;	vec3_t newOrigin;	trace_t trace;	// 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);	contents = CG_PointContents(trace.endpos, -1);	if (!(contents & (CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA))) {		// bubble isn't in liquid anymore, remove it		CG_FreeLocalEntity(le);		return;	}	CG_AddMoveScaleFade(le);}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:25,


示例24: CG_FreeLocalEntity

/*===================CG_AllocLocalEntityWill allways succeed, even if it requires freeing an old active entity===================*/localEntity_t	*CG_AllocLocalEntity( void ) {	localEntity_t	*le;	if ( !cg_freeLocalEntities ) {		// no free entities, so free the one at the end of the chain		// remove the oldest active entity		CG_FreeLocalEntity( cg_activeLocalEntities.prev );	}	le = cg_freeLocalEntities;	cg_freeLocalEntities = cg_freeLocalEntities->next;	memset( le, 0, sizeof( *le ) );	// link into the active list	le->next = cg_activeLocalEntities.next;	le->prev = &cg_activeLocalEntities;	cg_activeLocalEntities.next->prev = le;	cg_activeLocalEntities.next = le;	return le;}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:28,


示例25: CG_AddFadeModel

//---------------------------------------------------static void CG_AddFadeModel( localEntity_t *le ){	refEntity_t	*ent = &le->refEntity;	if ( cg.time < le->startTime )	{		CG_FreeLocalEntity( le );		return;	}	float frac = 1.0f - ((float)( cg.time - le->startTime )/(float)( le->endTime - le->startTime ));	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;	EvaluateTrajectory( &le->pos, cg.time, ent->origin );	// add the entity	cgi_R_AddRefEntityToScene( ent );}
开发者ID:Christian-Barrett,项目名称:OpenJK,代码行数:23,


示例26: CG_AddMoveScaleFade

static void CG_AddMoveScaleFade( localEntity_t *le ) {	refEntity_t	*re;	float		c;	vector3		delta;	float		len;	refdef_t *refdef = CG_GetRefdef();	re = &le->refEntity;	if ( le->fadeInTime > le->startTime && cg.time < le->fadeInTime ) {		// fade / grow time		c = 1.0f - (float)(le->fadeInTime - cg.time) / (le->fadeInTime - le->startTime);	}	else {		// fade / grow time		c = (le->endTime - cg.time) * le->lifeRate;	}	re->shaderRGBA[3] = 0xff * c * le->color[3];	if ( !(le->leFlags & LEF_PUFF_DONT_SCALE) ) {		re->radius = le->radius * (1.0f - c) + 8;	}	BG_EvaluateTrajectory( &le->pos, cg.time, &re->origin );	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( &re->origin, &refdef->vieworg, &delta );	len = VectorLength( &delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	SE_R_AddRefEntityToScene( re, MAX_CLIENTS );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:37,


示例27: CG_AddPressureEntity

void CG_AddPressureEntity(localEntity_t * le){	vec3_t velocity;//	vec3_t origin;	float alpha;	// Kill it if LCA.	if (cg.lca)		CG_FreeLocalEntity(le);	alpha = -(cg.time - le->startTime) + (le->endTime - le->startTime);	alpha /= (le->endTime - le->startTime);	//steamSound!!!	// steam:	if ( le->leFlags != LEF_AIR && le->leFlags != LEF_WATER ) {		VectorScale(le->pos.trDelta, le->size + rand() % 30, velocity);		velocity[0] += rand() % 40 - 20;		velocity[1] += rand() % 40 - 20;	} else		VectorScale(le->pos.trDelta, le->size, velocity);//	VectorCopy(le->pos.trBase, origin);	if (le->leFlags == LEF_AIR)		CG_ParticleAir(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 2, 1);	else if (le->leFlags == LEF_FLAME)		CG_ParticleSteam(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 2, 1,				cgs.media.flamePressureShader);	else if (le->leFlags == LEF_WATER)		CG_ParticleWater(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 1, 2);	else		CG_ParticleSteam(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 2, 1, 				cgs.media.smokePuffShader);}
开发者ID:Zekom,项目名称:reaction,代码行数:37,


示例28: CG_AddMoveScaleFade

/*==================CG_AddMoveScaleFade==================*/static void CG_AddMoveScaleFade( localEntity_t *le ) {	refEntity_t	*re;	gfixed		c;	bvec3_t		delta;	bfixed		len;	re = &le->refEntity;	if ( le->fadeInTime > le->startTime && cg.time < le->fadeInTime ) {		// fade / grow time		c = GFIXED_1 - MAKE_GFIXED( le->fadeInTime - cg.time ) / MAKE_GFIXED( le->fadeInTime - le->startTime );	}	else {		// fade / grow time		c = MAKE_GFIXED( le->endTime - cg.time ) * le->lifeRate;	}	re->shaderRGBA[3] = FIXED_TO_INT( GFIXED(255,0) * c * le->color[3] );	if ( !( le->leFlags & LEF_PUFF_DONT_SCALE ) ) {		re->radius = (le->radius * ( GFIXED_1 - c )) + BFIXED(8,0);	}	BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( re->origin, cg.refdef.vieworg, delta );	len = FIXED_VEC3LEN( delta );	if ( len < le->radius ) {		CG_FreeLocalEntity( le );		return;	}	_CG_trap_R_AddRefEntityToScene( re );}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:41,


示例29: CG_AddLocalEntities

/*===================CG_AddLocalEntities===================*/void CG_AddLocalEntities( void ) {	localEntity_t	*le, *next;	// walk the list backwards, so any new local entities generated	// (trails, marks, etc) will be present this frame	le = cg_activeLocalEntities.prev;	for ( ; le != &cg_activeLocalEntities ; le = next ) {		// grab next now, so if the local entity is freed we		// still have it		next = le->prev;		if ( cg.time >= le->endTime ) {			CG_FreeLocalEntity( le );			continue;		}		switch ( le->leType ) {		default:			trap->Error( ERR_DROP, "Bad leType: %i", le->leType );			break;		case LE_MARK:			break;		case LE_SPRITE_EXPLOSION:			CG_AddSpriteExplosion( le );			break;		case LE_EXPLOSION:			CG_AddExplosion( le );			break;		case LE_FADE_SCALE_MODEL:			CG_AddFadeScaleModel( le );			break;		case LE_FRAGMENT:			// gibs and brass			CG_AddFragment( le );			break;		case LE_PUFF:			CG_AddPuff( le );			break;		case LE_MOVE_SCALE_FADE:		// water bubbles			CG_AddMoveScaleFade( le );			break;		case LE_FADE_RGB:				// teleporters, railtrails			CG_AddFadeRGB( le );			break;		case LE_FALL_SCALE_FADE: // gib blood trails			CG_AddFallScaleFade( le );			break;		case LE_SCALE_FADE:		// rocket trails			CG_AddScaleFade( le );			break;		case LE_SCOREPLUM:			CG_AddScorePlum( le );			break;		case LE_OLINE:			CG_AddOLine( le );			break;		case LE_SHOWREFENTITY:			CG_AddRefEntity( le );			break;		case LE_LINE:					// oriented lines for FX			CG_AddLine( le );			break;		}	}}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:83,


示例30: CG_AddScorePlum

void CG_AddScorePlum( localEntity_t *le ) {	refEntity_t	*re;	vec3_t		origin, delta, dir, vec, up = {0, 0, 1};	float		c, len;	int			i, score, digits[10], numdigits, negative;	re = &le->refEntity;	c = ( le->endTime - cg.time ) * le->lifeRate;	score = le->radius;	if (score < 0) {		re->shaderRGBA[0] = 0xff;		re->shaderRGBA[1] = 0x11;		re->shaderRGBA[2] = 0x11;	}	else {		re->shaderRGBA[0] = 0xff;		re->shaderRGBA[1] = 0xff;		re->shaderRGBA[2] = 0xff;		if (score >= 50) {			re->shaderRGBA[1] = 0;		} else if (score >= 20) {			re->shaderRGBA[0] = re->shaderRGBA[1] = 0;		} else if (score >= 10) {			re->shaderRGBA[2] = 0;		} else if (score >= 2) {			re->shaderRGBA[0] = re->shaderRGBA[2] = 0;		}	}	if (c < 0.25)		re->shaderRGBA[3] = 0xff * 4 * c;	else		re->shaderRGBA[3] = 0xff;	re->radius = NUMBER_SIZE / 2;	VectorCopy(le->pos.trBase, origin);	origin[2] += 110 - c * 100;	VectorSubtract(cg.refdef.vieworg, origin, dir);	CrossProduct(dir, up, vec);	VectorNormalize(vec);	VectorMA(origin, -10 + 20 * sin(c * 2 * M_PI), vec, origin);	// if the view would be "inside" the sprite, kill the sprite	// so it doesn't add too much overdraw	VectorSubtract( origin, cg.refdef.vieworg, delta );	len = VectorLength( delta );	if ( len < 20 ) {		CG_FreeLocalEntity( le );		return;	}	negative = qfalse;	if (score < 0) {		negative = qtrue;		score = -score;	}	for (numdigits = 0; !(numdigits && !score); numdigits++) {		digits[numdigits] = score % 10;		score = score / 10;	}	if (negative) {		digits[numdigits] = 10;		numdigits++;	}	for (i = 0; i < numdigits; i++) {		VectorMA(origin, (float) (((float) numdigits / 2) - i) * NUMBER_SIZE, vec, re->origin);		re->customShader = cgs.media.numberShaders[digits[numdigits-1-i]];		trap->R_AddRefEntityToScene( re );	}}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:78,



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


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