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

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

51自学网 2021-06-03 08:57:57
  C++
这篇教程C++ trap_R_AddLightToScene函数代码示例写得很实用,希望能帮到您。

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

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

示例1: FX_RegenBeam

void FX_RegenBeam( vec3_t origin, vec3_t dir, int clientNum, qboolean alt_fire ){	trace_t			tr;	vec3_t			end;	VectorMA( origin, REGEN_BEAM_LENGTH, dir, end );	CG_Trace( &tr, origin, NULL, NULL, end, clientNum, CONTENTS_SOLID );	trap_R_AddLightToScene( origin, 30, 235.0f / 255, 74.0f / 255, 102.0f / 255 );	if ( tr.fraction != 1.0f )	{		float radius;		if ( alt_fire )			radius = flrandom(1.5f, 3.0f) * (1.0 - (tr.fraction*0.3));		else			radius = flrandom(0.5f, 1.5f) * (1.0 - (tr.fraction*0.3));		if ( !radius )			return;		CG_ImpactMark( cgs.media.regenDecal, tr.endpos, tr.plane.normal, 0, 1, 1, 1, 0.2*(1.0-tr.fraction), qfalse, radius, qtrue );		trap_R_AddLightToScene( origin, radius*5, 235.0f / 255, 74.0f / 255, 102.0f / 255 );	}}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:27,


示例2: CG_AddExplosion

/*================CG_AddExplosion================*/static void CG_AddExplosion( localEntity_t *ex ) {	refEntity_t	*ent;	ent = &ex->refEntity;	// add the entity	CG_AddRefEntityWithMinLight(ent);	// add the dlight	if ( ex->light ) {		float		light;		light = (float)( cg.time - ex->startTime ) / ( ex->endTime - ex->startTime );		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		if ( cg_fadeExplosions.integer ) {			trap_R_AddLightToScene(ent->origin, ex->light, light, ex->lightColor[0], ex->lightColor[1], ex->lightColor[2] );		} else {			light = ex->light * light;			trap_R_AddLightToScene(ent->origin, light, 1.0f, ex->lightColor[0], ex->lightColor[1], ex->lightColor[2] );		}	}}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:32,


示例3: FX_ProbeBeam

//TiM - Beam FX for the Neutrino Probe weaponvoid FX_ProbeBeam( vec3_t origin, vec3_t dir, int clientNum, qboolean alt_fire ){	trace_t			tr;	refEntity_t		beam;	vec3_t			end;	float			scale;	memset( &beam, 0, sizeof( beam ) );	if ( alt_fire )		scale = flrandom(7.0f, 12.0f);	else		scale = Q_fabs( 12.0f * sin( cg.time * 0.1f ) );	VectorMA( origin, PROBE_BEAM_LENGTH, dir, end );	CG_Trace( &tr, origin, NULL, NULL, end, clientNum, CONTENTS_SOLID );	trap_R_AddLightToScene( origin, 20, 114.0f / 255, 164.0f / 255, 1.0f );	VectorCopy( origin, beam.origin);	VectorCopy( tr.endpos, beam.oldorigin );	beam.reType = RT_LINE;		beam.customShader = cgs.media.probeBeam;	beam.shaderRGBA[0] = 0xff;	beam.shaderRGBA[1] = 0xff;	beam.shaderRGBA[2] = 0xff;	beam.shaderRGBA[3] = 0xff;	AxisClear( beam.axis );		beam.data.line.width = scale*0.1;	beam.data.line.width2 = scale;	beam.data.line.stscale = 1.0;	trap_R_AddRefEntityToScene( &beam );	if ( tr.fraction != 1.0f )	{		float radius;		if ( alt_fire )			radius = flrandom(1.5f, 3.0f) * (1.0 - (tr.fraction*0.3));		else			radius = flrandom(0.5f, 1.5f) * (1.0 - (tr.fraction*0.3));		if ( !radius )			return;		CG_ImpactMark( cgs.media.probeDecal, tr.endpos, tr.plane.normal, 0, 1, 1, 1, 0.2*(1.0-tr.fraction), qfalse, radius, qtrue );		trap_R_AddLightToScene( origin, radius*5, 114.0f / 255, 164.0f / 255, 1.0f );	}}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:52,


示例4: CG_AddExplosion

/*================CG_AddExplosion================*/static void CG_AddExplosion( localEntity_t *ex ) {	refEntity_t	*ent;	float	life;	ent = &ex->refEntity;	life = (float)( cg.time - ex->startTime ) / ( ex->endTime - ex->startTime );	// get colors	ent->shaderRGBA[0] = 255 * ex->color[0] * ( 1.0 - life );	ent->shaderRGBA[1] = 255 * ex->color[1] * ( 1.0 - life );	ent->shaderRGBA[2] = 255 * ex->color[2] * ( 1.0 - life );	ent->shaderRGBA[3] = 255 * ex->color[3] * ( 1.0 - life );	// add the entity	trap_R_AddRefEntityToScene(ent);	// add the dlight	if ( ex->light ) {		float		light;		light = life;		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		light = ex->light * light;		trap_R_AddLightToScene(ent->origin, light, ex->lightColor[0], ex->lightColor[1], ex->lightColor[2] );	}}
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:36,


示例5: CG_AddExplosion

/*================CG_AddExplosion================*/static void CG_AddExplosion( localEntity_t *ex ) {	refEntity_t *ent;	ent = &ex->refEntity;	// add the entity	// RF, don't add if shader is invalid	if ( ent->customShader >= 0 ) {		trap_R_AddRefEntityToScene( ent );	}	// add the dlight	if ( ex->light ) {		float light;		light = (float)( cg.time - ex->startTime ) / ( ex->endTime - ex->startTime );		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		light = ex->light * light;		trap_R_AddLightToScene( ent->origin, light, ex->lightColor[0], ex->lightColor[1], ex->lightColor[2], 0 );	}}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:30,


示例6: CG_AddExplosion

/*=======================================================================================================================================CG_AddExplosion=======================================================================================================================================*/static void CG_AddExplosion(localEntity_t *le) {	refEntity_t *ent;	ent = &le->refEntity;	// add the entity	trap_R_AddRefEntityToScene(ent);	// add the dlight	if (le->light) {		float light;		float radius;		float intensity;		light = (float)(cg.time - le->startTime) / (le->endTime - le->startTime);		if (light < 0.5) {			light = 1.0;		} else {			light = 1.0 - (light - 0.5) * 2;		}		if (cg_fadeExplosions.integer) {			radius = le->light;			intensity = light;		} else {			radius = le->light * light;			intensity = 1;		}		trap_R_AddLightToScene(le->refEntity.origin, radius, intensity, le->lightColor[0], le->lightColor[1], le->lightColor[2], 0);	}}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:36,


示例7: CG_AddSpriteExplosion

/*================CG_AddSpriteExplosion================*/static void CG_AddSpriteExplosion( localEntity_t *le ) {	refEntity_t	re;	float c;	re = le->refEntity;	c = ( le->endTime - cg.time ) / ( float ) ( le->endTime - le->startTime );	if ( c > 1 ) {		c = 1.0;	// can happen during connection problems	}	re.shaderRGBA[0] = 0xff;	re.shaderRGBA[1] = 0xff;	re.shaderRGBA[2] = 0xff;	re.shaderRGBA[3] = 0xff * c * 0.33;	re.reType = RT_SPRITE;	re.radius = 42 * ( 1.0 - c ) + 30;	trap_R_AddRefEntityToScene( &re );	// add the dlight	if ( le->light ) {		float		light;		light = (float)( cg.time - le->startTime ) / ( le->endTime - le->startTime );		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		light = le->light * light;		trap_R_AddLightToScene(re.origin, light, le->lightColor[0], le->lightColor[1], le->lightColor[2] );	}}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:40,


示例8: CG_AddDlights

/** CG_AddDlights*/void CG_AddDlights( void ) {	int i;	cdlight_t *dl;	for( i = 0, dl = cg_dlights; i < cg_numDlights; i++, dl++ )		trap_R_AddLightToScene( dl->origin, dl->radius, dl->color[0], dl->color[1], dl->color[2] );	cg_numDlights = 0;}
开发者ID:Picmip,项目名称:qfusion,代码行数:12,


示例9: CG_AddSpriteExplosion

/*================CG_AddSpriteExplosion================*/static void CG_AddSpriteExplosion( localEntity_t *le ) {	refEntity_t re;	float c;	re = le->refEntity;	c = ( le->endTime - cg.time ) / ( float ) ( le->endTime - le->startTime );	if ( c > 1 ) {		c = 1.0;    // can happen during connection problems	}	re.shaderRGBA[0] = 0xff;	re.shaderRGBA[1] = 0xff;	re.shaderRGBA[2] = 0xff;	re.shaderRGBA[3] = 0xff * c * 0.33;	re.reType = RT_SPRITE;	re.radius = 42 * ( 1.0 - c ) + 30;	// Ridah, move away from surface	VectorMA( le->pos.trBase, ( 1.0 - c ), le->pos.trDelta, re.origin );	// done.	// RF, don't add if shader is invalid	if ( re.customShader >= 0 ) {		trap_R_AddRefEntityToScene( &re );	}	// add the dlight	if ( le->light ) {		float light;		// Ridah, modified this so the light fades out rather than shrinking		/*		light = (float)( cg.time - le->startTime ) / ( le->endTime - le->startTime );		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		light = le->light * light;		trap_R_AddLightToScene(re.origin, light, le->lightColor[0], le->lightColor[1], le->lightColor[2], 0 );		*/		light = (float)( cg.time - le->startTime ) / ( le->endTime - le->startTime );		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		trap_R_AddLightToScene( re.origin, le->light, light * le->lightColor[0], light * le->lightColor[1], light * le->lightColor[2], 0 );		// done.	}}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:58,


示例10: CG_Aura_AddDLight

/*===================CG_Aura_AddDLight===================*/static void CG_Aura_AddDLight( centity_t *player, auraState_t *state, auraConfig_t *config){	vec3_t	lightPos;	// add dynamic light when necessary	if(state->isActive ||(state->lightAmt > config->lightMin)){		// Since lerpOrigin is the lightingOrigin for the player, this will add a backsplash light for the aura.		VectorAdd( player->lerpOrigin, cg.refdef.viewaxis[0], lightPos);		trap_R_AddLightToScene( lightPos, state->lightAmt, // +(cos(cg.time / 50.0f) * state->lightDev),								config->lightColor[0] * state->modulate,								config->lightColor[1] * state->modulate,								config->lightColor[2] * state->modulate);	}}
开发者ID:burzumishi,项目名称:dragonballworld,代码行数:18,


示例11: CG_AddExplosion

/*================CG_AddExplosion================*/void CG_AddExplosion( localEntity_t *ex ){	refEntity_t	*ent;	ent = &ex->refEntity;	// calculate model frame	if ( ex->lifeRate > 0 ) {		float frac = (cg.time - ex->startTime) * ex->lifeRate;		int f = floor(frac);		if ( f < 0 ) {			f = 0;		}		ent->frame = f + 1;		ent->oldframe = f;		ent->backlerp = 1.0 - ( frac - f );		ent->renderfx |= RF_CAP_FRAMES;	}	// Explosions with zero shaders (using model default shader) don't fade, so	//		allow fading when this flag is set.	if ( ex->leFlags & LEF_FADE_RGB )	{		float frac = (float)( cg.time - ex->startTime )/(float)( ex->endTime - ex->startTime );		ent->shaderRGBA[0] = 		ent->shaderRGBA[1] = 		ent->shaderRGBA[2] = frac * 255;		ent->shaderRGBA[3] = 255;	}	// add the entity	trap_R_AddRefEntityToScene(ent);	// add the dlight	if ( ex->light ) {		float		light;		light = (float)( cg.time - ex->startTime ) / ( ex->endTime - ex->startTime );		if ( light < 0.5 ) {			light = 1.0;		} else {			light = 1.0 - ( light - 0.5 ) * 2;		}		light = ex->light * light;		trap_R_AddLightToScene(ent->origin, light, ex->lightColor[0], ex->lightColor[1], ex->lightColor[2] );	}}
开发者ID:UberGames,项目名称:RPG-X2-rpgxEF,代码行数:53,


示例12: CG_StartShadowCaster

/*===============CG_StartShadowCasterHelper function to add a inverse dynamic light to create shadows for thefollowing models.===============*/void CG_StartShadowCaster( vec3_t origin, vec3_t mins, vec3_t maxs ) {	vec3_t ambientLight, directedLight, lightDir;	vec3_t lightPos;	trace_t tr;	vec3_t traceMins = { -3.0f, -3.0f, -3.0f };	vec3_t traceMaxs = {  3.0f,  3.0f,  3.0f };	float maxLightDist = Distance( maxs, mins );	// find a point to place the light source by tracing in the	// average light direction	trap_R_LightForPoint( origin, ambientLight, directedLight, lightDir );	VectorMA( origin, 3.0f * maxLightDist, lightDir, lightPos );	CG_Trace( &tr, origin, traceMins, traceMaxs, lightPos, 0, MASK_OPAQUE, 0 );	if( !tr.startsolid ) {		VectorCopy( tr.endpos, lightPos );	}	trap_R_AddLightToScene( lightPos, 2.0f * Distance( lightPos, origin ),				3.0f, directedLight[0], directedLight[1],				directedLight[2], 0,				REF_RESTRICT_DLIGHT | REF_INVERSE_DLIGHT );}
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:32,


示例13: Wolfcam_AddPlayerWeapon

//.........这里部分代码省略.........	angles[ROLL] = crandom() * 10;	AnglesToAxis( angles, flash.axis );	// colorize the railgun blast	if ( weaponNum == WP_RAILGUN ) {		//clientInfo_t	*ci;		//ci = &cgs.clientinfo[ cent->currentState.clientNum ];		if (cg_railUseOwnColors.integer  &&  CG_IsUs(ci)) {			flash.shaderRGBA[0] = 255 * cg.color1[0];			flash.shaderRGBA[1] = 255 * cg.color1[1];			flash.shaderRGBA[2] = 255 * cg.color1[2];		} else {			flash.shaderRGBA[0] = 255 * ci->color1[0];			flash.shaderRGBA[1] = 255 * ci->color1[1];			flash.shaderRGBA[2] = 255 * ci->color1[2];		}	}	if (0) {  //(weapon->hasFlashScript) {		//CG_RunQ3mmeFlashScript(weapon, dlight, flash.shaderRGBA, &flashSize);		//VectorCopy(flash.origin, ScriptVars.origin);		//CG_RunQ3mmeScript((char *)weapon->flashScript);		//return;	} else {		dlight[0] = weapon->flashDlightColor[0];		dlight[1] = weapon->flashDlightColor[1];		dlight[2] = weapon->flashDlightColor[2];		/*		flash.shaderRGBA[0] = 255;		flash.shaderRGBA[1] = 255;		flash.shaderRGBA[2] = 255;		flash.shaderRGBA[3] = 0;		*/		flashSize = 300 + (rand()&31);	}	CG_PositionRotatedEntityOnTag( &flash, &gun, weapon->weaponModel, "tag_flash");	//Com_Printf("ps:%d  %p/n", ps != NULL, cent);	if (0) {  //(cent == &cg.predictedPlayerEntity  &&  !cg.renderingThirdPerson  &&  !ps) {		// don't run flash script twice for first person view	} else if (EffectScripts.weapons[weaponNum].hasFlashScript) {		//CG_RunQ3mmeFlashScript(weapon, dlight, flash.shaderRGBA, &flashSize);		//memset(&ScriptVars, 0, sizeof(ScriptVars));		//CG_Printf("addplayerweapon()  flash script cent %d/n", cent - cg_entities);		CG_ResetScriptVars();		CG_CopyPlayerDataToScriptData(cent);		VectorCopy(flash.origin, ScriptVars.origin);		VectorCopy(flash.origin, ScriptVars.parentOrigin);		VectorCopy(cent->lastFlashIntervalPosition, ScriptVars.lastIntervalPosition);		ScriptVars.lastIntervalTime = cent->lastFlashIntervalTime;		VectorCopy(cent->lastFlashDistancePosition, ScriptVars.lastDistancePosition);		ScriptVars.lastDistanceTime = cent->lastFlashDistanceTime;		CG_RunQ3mmeScript((char *)EffectScripts.weapons[weaponNum].flashScript, NULL);		VectorCopy(ScriptVars.lastIntervalPosition, cent->lastFlashIntervalPosition);		cent->lastFlashIntervalTime = ScriptVars.lastIntervalTime;		VectorCopy(ScriptVars.lastDistancePosition, cent->lastFlashDistancePosition);		cent->lastFlashDistanceTime = ScriptVars.lastDistanceTime;		//return;	}	if (!cg_muzzleFlash.integer) {		// pass	} else {		if (flash.hModel) {			CG_AddRefEntity(&flash);		}	}	// bolt:	if (1) {		// add lightning bolt		if (1) {			CG_LightningBolt( nonPredictedCent, flash.origin );			//Com_Printf("adding bolt/n");			// add rail trail			CG_SpawnRailTrail( cent, flash.origin );			//if ((dlight[0]  ||  dlight[1]  ||  dlight[2])  &&  !weapon->hasFlashScript) {			if ((dlight[0]  ||  dlight[1]  ||  dlight[2])  &&  !EffectScripts.weapons[weaponNum].hasFlashScript) {				trap_R_AddLightToScene(flash.origin, flashSize, dlight[0], dlight[1], dlight[2]);			}		}	} else {		//Com_Printf("%f no.../n", cg.ftime);	}	if (revertColors) {		VectorCopy(origColor1, ci->color1);		VectorCopy(origColor2, ci->color2);	}}
开发者ID:brugal,项目名称:wolfcamql,代码行数:101,


示例14: CG_EndShadowCaster

/*===============CG_EndShadowCasterHelper function to terminate the list of models for the last shadow caster.following models.===============*/void CG_EndShadowCaster( void ) {	trap_R_AddLightToScene( vec3_origin, 0.0f, 0.0f,				0.0f, 0.0f, 0.0f,				0, 0 );}
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:13,


示例15: CG_AddMissile

/*================CG_AddMissile================*/static void CG_AddMissile( localEntity_t *le ) {	refEntity_t			*re;	const weaponInfo_t	*weapon;	trace_t				trace;	centity_t			*other;	qboolean			inWater;	// just existing for server entity deletion	if ( le->leFlags & LEF_FINISHED ) {		return;	}	// get weapon info	if ( le->ti.weapon > WP_NUM_WEAPONS ) {		le->ti.weapon = 0;	}	weapon = &cg_weapons[le->ti.weapon];	re = &le->refEntity;	// calculate position	BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );	// special case for flames	if ( re->reType == RT_SPRITE ) {		int deltaTime;		// 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;		}		// change radius over time		deltaTime = cg.time - le->startTime;		re->radius = deltaTime * deltaTime * ( random()*0.4f + 0.8f ) / 2000.0f + 9;		// 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( re->origin, re->oldorigin );			// hit something			if ( trace.fraction < 1.0 ) {				CG_MissileHitWall( le->ti.weapon, 0, trace.endpos, trace.plane.normal, IMPACTSOUND_DEFAULT );				CG_FreeLocalEntity( le );				return;			}		}		// add to refresh list		trap_R_AddRefEntityToScene( re );		return;	}	// add trails	if ( weapon->missileTrailFunc ) weapon->missileTrailFunc( &le->ti, cg.time );	// add dynamic light	if ( weapon->missileDlight ) {		trap_R_AddLightToScene( re->origin, weapon->missileDlight, 			weapon->missileDlightColor[0], weapon->missileDlightColor[1], weapon->missileDlightColor[2] );	}	// flicker between two skins	re->skinNum = cg.clientFrame & 1;	// convert direction of travel into axis	if ( VectorNormalize2( le->pos.trDelta, re->axis[0] ) == 0 ) {		re->axis[0][2] = 1;	}	// spin as it moves	if ( le->pos.trType != TR_STATIONARY ) {		if ( le->pos.trType == TR_GRAVITY ) {			RotateAroundDirection( re->axis, cg.time / 4 );		} else if ( le->pos.trType == TR_WATER_GRAVITY ) {			RotateAroundDirection( re->axis, cg.time / 8 );		} else {			RotateAroundDirection( re->axis, cg.time );		}	} else {		RotateAroundDirection( re->axis, 0 );	}	// trace a line from previous position to new position	CG_Trace( &trace, re->oldorigin, NULL, NULL, re->origin, le->owner, MASK_SHOT );//.........这里部分代码省略.........
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:101,


示例16: CG_AddParticleToScene

//.........这里部分代码省略.........		verts[3].xyz[0]     += p->height;		verts[3].xyz[1]     -= p->width;		verts[3].st[0]       = 1;		verts[3].st[1]       = 0;		verts[3].modulate[0] = 255;		verts[3].modulate[1] = 255;		verts[3].modulate[2] = 255;		verts[3].modulate[3] = 255;	}	// Ridah	else if (p->type == P_ANIM || p->type == P_DLIGHT_ANIM) {    // ydnar		vec3_t rr, ru;		vec3_t rotate_ang;		int    i, j;		time  = cg.time - p->time;		time2 = p->endtime - p->time;		ratio = time / time2;		if (ratio >= 1.0) {			ratio = 0.9999;		} else if (ratio < 0.0) {			// rain - make sure that ratio isn't negative or			// we'll walk out of bounds when j is calculated below			ratio = 0.0001;		}		width  = p->width + (ratio * (p->endwidth - p->width));		height = p->height + (ratio * (p->endheight - p->height));		// ydnar: add dlight if necessary		if (p->type == P_DLIGHT_ANIM) {			// fixme: support arbitrary color			trap_R_AddLightToScene(org, 320,    //%	1.5 * (width > height ? width : height),			                       1.25 * (1.0 - ratio), 1.0, 0.95, 0.85, 0, 0);		}		// if we are "inside" this sprite, don't draw		if (VectorDistanceSquared(cg.snap->ps.origin, org) < SQR(width / 1.5f)) {			return;		}		i          = p->shaderAnim;		j          = (int)floor(ratio * shaderAnimCounts[p->shaderAnim]);		p->pshader = shaderAnims[i][j];		// JPW NERVE more particle testing		if (cg_fxflags & 1) {			p->roll          = 0;			p->pshader       = getTestShader();			rotate_ang[ROLL] = 90;		}		// jpw		if (p->roll) {			vectoangles(cg.refdef_current->viewaxis[0], rotate_ang);			rotate_ang[ROLL] += p->roll;			AngleVectors(rotate_ang, NULL, rr, ru);		}		if (p->roll) {			VectorMA(org, -height, ru, point);			VectorMA(point, -width, rr, point);		} else {			VectorMA(org, -height, vup, point);			VectorMA(point, -width, vright, point);
开发者ID:Exosum,项目名称:ETrun,代码行数:67,


示例17: CG_Spotlight

//.........这里部分代码省略.........		verts[j].st[1]  = 1;		verts[j].modulate[0] = color[0] * 255.0f;		verts[j].modulate[1] = color[1] * 255.0f;		verts[j].modulate[2] = color[2] * 255.0f;		verts[j].modulate[3] = color[3] * 255.0f;		if ( capStart ) {			VectorCopy( start_points[i], plugVerts[i].xyz );			plugVerts[i].st[0]  = 0;			plugVerts[i].st[1]  = 0;			plugVerts[i].modulate[0] = color[0] * 255.0f;			plugVerts[i].modulate[1] = color[1] * 255.0f;			plugVerts[i].modulate[2] = color[2] * 255.0f;			plugVerts[i].modulate[3] = color[3] * 255.0f;		}	}	trap_R_AddPolysToScene( cgs.media.spotLightBeamShader, 4, &verts[0], segs );	// plug up the start circle	if ( capStart ) {		trap_R_AddPolyToScene( cgs.media.spotLightBeamShader, segs, &plugVerts[0] );	}	// show the endpoint	if ( !( flags & SL_NOIMPACT ) ) {		if ( hitDist ) {			VectorMA( startvec, hitDist, conevec, endvec );			alpha = 0.3f;			radius = coreEndRadius * ( hitDist / beamLen );			VectorNegate( lightDir, proj );			CG_ImpactMark( cgs.media.spotLightShader, tr.endpos, proj, 0, colorNorm[0], colorNorm[1], colorNorm[2], alpha, qfalse, radius, qtrue, -1 );		}	}	// add d light at end	if ( !( flags & SL_NODLIGHT ) ) {		vec3_t dlightLoc;//		VectorMA(tr.endpos, -60, lightDir, dlightLoc);	// back away from the hit//		trap_R_AddLightToScene(dlightLoc, 200, colorNorm[0], colorNorm[1], colorNorm[2], 0);	// ,REF_JUNIOR_DLIGHT);		VectorMA( tr.endpos, 0, lightDir, dlightLoc );    // back away from the hit//		trap_R_AddLightToScene(dlightLoc, radius*2, colorNorm[0], colorNorm[1], colorNorm[2], 0);	// ,REF_JUNIOR_DLIGHT);		trap_R_AddLightToScene( dlightLoc, radius * 2, 0.3, 0.3, 0.3, 0 );  // ,REF_JUNIOR_DLIGHT);	}	// draw flare at source	if ( !( flags & SL_NOFLARE ) ) {		qboolean lightInEyes = qfalse;		vec3_t camloc, dirtolight;		float dot, deg, dist;		float flarescale = 0.0;       // TTimo: might be used uninitialized		// get camera position and direction to lightsource		VectorCopy( cg.snap->ps.origin, camloc );		camloc[2] += cg.snap->ps.viewheight;		VectorSubtract( start, camloc, dirtolight );		dist = VectorNormalize( dirtolight );		// first use dot to determine if it's facing the camera		dot = DotProduct( lightDir, dirtolight );		// it's facing the camera, find out how closely and trace to see if the source can be seen		deg = RAD2DEG( M_PI - acos( dot ) );		if ( deg <= 35 ) { // start flare a bit before the camera gets inside the cylinder			lightInEyes = qtrue;			flarescale = 1 - ( deg / 35 );		}		if ( lightInEyes ) {   // the dot check succeeded, now do a trace			CG_Trace( &tr, start, NULL, NULL, camloc, -1, MASK_ALL & ~( CONTENTS_MONSTERCLIP | CONTENTS_AREAPORTAL | CONTENTS_CLUSTERPORTAL ) );			if ( tr.fraction != 1 ) {				lightInEyes = qfalse;			}		}		if ( lightInEyes ) {			float coronasize = flarescale;			if ( dist < 512 ) { // make even bigger if you're close enough				coronasize *= ( 512.0f / dist );			}			trap_R_AddCoronaToScene( start, colorNorm[0], colorNorm[1], colorNorm[2], coronasize, cent->currentState.number, qtrue );		} else {			// even though it's off, still need to add it, but turned off so it can fade in/out properly			trap_R_AddCoronaToScene( start, colorNorm[0], colorNorm[1], colorNorm[2], 0, cent->currentState.number, qfalse );		}	}}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:101,


示例18: weapon

//.........这里部分代码省略.........      barrel.shadowPlane = parent->shadowPlane;      barrel.renderfx = parent->renderfx;      angles[ YAW ] = 0;      angles[ PITCH ] = 0;      angles[ ROLL ] = CG_MachinegunSpinAngle( cent, firing );      AnglesToAxis( angles, barrel.axis );      CG_PositionRotatedEntityOnTag( &barrel, &gun, gun.hModel, "tag_barrel" );      trap_R_AddRefEntityToScene( &barrel );    }  }  if( CG_IsParticleSystemValid( &cent->muzzlePS ) )  {    if( ps || cg.renderingThirdPerson ||        cent->currentState.number != cg.predictedPlayerState.clientNum )    {      if( noGunModel )        CG_SetAttachmentTag( &cent->muzzlePS->attachment, *parent, parent->hModel, "tag_weapon" );      else        CG_SetAttachmentTag( &cent->muzzlePS->attachment, gun, gun.hModel, "tag_flash" );    }    //if the PS is infinite disable it when not firing    if( !firing && CG_IsParticleSystemInfinite( cent->muzzlePS ) )      CG_DestroyParticleSystem( &cent->muzzlePS );  }  // add the flash  if( !weapon->wim[ weaponMode ].continuousFlash || !firing )  {    // impulse flash    if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME )      return;  }  VectorCopy( parent->lightingOrigin, flash.lightingOrigin );  flash.shadowPlane = parent->shadowPlane;  flash.renderfx = parent->renderfx;  if( !ps )  {    flash.hModel = weapon->flashModel3rdPerson;    if( !flash.hModel )      flash.hModel = weapon->flashModel;  }  else    flash.hModel = weapon->flashModel;  if( flash.hModel )  {    angles[ YAW ] = 0;    angles[ PITCH ] = 0;    angles[ ROLL ] = crandom( ) * 10;    AnglesToAxis( angles, flash.axis );    if( noGunModel )      CG_PositionRotatedEntityOnTag( &flash, parent, parent->hModel, "tag_weapon" );    else      CG_PositionRotatedEntityOnTag( &flash, &gun, gun.hModel, "tag_flash" );    trap_R_AddRefEntityToScene( &flash );  }  if( ps || cg.renderingThirdPerson ||      cent->currentState.number != cg.predictedPlayerState.clientNum )  {    if( weapon->wim[ weaponMode ].muzzleParticleSystem && cent->muzzlePsTrigger )    {      cent->muzzlePS = CG_SpawnNewParticleSystem( weapon->wim[ weaponMode ].muzzleParticleSystem );      if( CG_IsParticleSystemValid( &cent->muzzlePS ) )      {        if( noGunModel )          CG_SetAttachmentTag( &cent->muzzlePS->attachment, *parent, parent->hModel, "tag_weapon" );        else          CG_SetAttachmentTag( &cent->muzzlePS->attachment, gun, gun.hModel, "tag_flash" );        CG_SetAttachmentCent( &cent->muzzlePS->attachment, cent );        CG_AttachToTag( &cent->muzzlePS->attachment );      }      cent->muzzlePsTrigger = qfalse;    }    // make a dlight for the flash    if( weapon->wim[ weaponMode ].flashDlightColor[ 0 ] ||        weapon->wim[ weaponMode ].flashDlightColor[ 1 ] ||        weapon->wim[ weaponMode ].flashDlightColor[ 2 ] )    {      trap_R_AddLightToScene( flash.origin, 300 + ( rand( ) & 31 ),          weapon->wim[ weaponMode ].flashDlightColor[ 0 ],          weapon->wim[ weaponMode ].flashDlightColor[ 1 ],          weapon->wim[ weaponMode ].flashDlightColor[ 2 ] );    }  }}
开发者ID:ZdrytchX,项目名称:cuboid,代码行数:101,


示例19: CG_AddParticleToScene

//.........这里部分代码省略.........		verts[3].modulate[1] = 255;		verts[3].modulate[2] = 255;		verts[3].modulate[3] = 255;	}	break;	case P_ANIM:	case P_DLIGHT_ANIM:	{		vec3_t point, rr, ru, rotate_ang;		float  width, height;		float  time = cg.time - p->time;		float  time2 = p->endtime - p->time;		float  ratio = time / time2;		int    i, j;		if (ratio >= 1)		{			ratio = 0.9999f;		}		else if (ratio < 0)		{			// make sure that ratio isn't negative or			// we'll walk out of bounds when j is calculated below			ratio = 0.0001f;		}		width  = p->width + (ratio * (p->endwidth - p->width));		height = p->height + (ratio * (p->endheight - p->height));		// add dlight if necessary		if (p->type == P_DLIGHT_ANIM)		{			// fixme: support arbitrary color			trap_R_AddLightToScene(org, 320,        //%	1.5 * (width > height ? width : height),			                       1.25f * (1.0f - ratio), 1.0f, 0.95f, 0.85f, 0, 0);		}		// if we are "inside" this sprite, don't draw		if (VectorDistanceSquared(cg.snap->ps.origin, org) < Square(width / 1.5f))		{			return;		}		i          = p->shaderAnim;		j          = (int)floor((double)ratio * shaderAnimCounts[p->shaderAnim]);		p->pshader = shaderAnims[i][j];		if (p->roll)		{			vectoangles(cg.refdef_current->viewaxis[0], rotate_ang);			rotate_ang[ROLL] += p->roll;			AngleVectors(rotate_ang, NULL, rr, ru);		}		if (p->roll)		{			VectorMA(org, -height, ru, point);			VectorMA(point, -width, rr, point);		}		else		{			VectorMA(org, -height, vup, point);			VectorMA(point, -width, vright, point);		}		VectorCopy(point, verts[0].xyz);		verts[0].st[0]       = 0;
开发者ID:etlegacy,项目名称:etlegacy,代码行数:67,


示例20: weapon

//.........这里部分代码省略.........    {      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, firing );      AnglesToAxis( angles, barrel.axis );      CG_PositionRotatedEntityOnTag( &barrel, &gun, weapon->weaponModel, "tag_barrel" );      trap_R_AddRefEntityToScene( &barrel );    }  }  if( CG_IsParticleSystemValid( &cent->muzzlePS ) )  {    if( ps || cg.renderingThirdPerson ||        cent->currentState.number != cg.predictedPlayerState.clientNum )    {      if( noGunModel )        CG_SetAttachmentTag( &cent->muzzlePS->attachment, *parent, parent->hModel, "tag_weapon" );      else        CG_SetAttachmentTag( &cent->muzzlePS->attachment, gun, weapon->weaponModel, "tag_flash" );    }    //if the PS is infinite disable it when not firing    if( !firing && CG_IsParticleSystemInfinite( cent->muzzlePS ) )      CG_DestroyParticleSystem( &cent->muzzlePS );  }  // add the flash  if( !weapon->wim[ weaponMode ].continuousFlash || !firing )  {    // impulse flash    if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME )      return;  }  memset( &flash, 0, sizeof( flash ) );  VectorCopy( parent->lightingOrigin, flash.lightingOrigin );  flash.shadowPlane = parent->shadowPlane;  flash.renderfx = parent->renderfx;    //ZT hook  ZT_WallHack(&flash);    flash.hModel = weapon->flashModel;  if( flash.hModel )  {    angles[ YAW ] = 0;    angles[ PITCH ] = 0;    angles[ ROLL ] = crandom( ) * 10;    AnglesToAxis( angles, flash.axis );    if( noGunModel )      CG_PositionRotatedEntityOnTag( &flash, parent, parent->hModel, "tag_weapon" );    else      CG_PositionRotatedEntityOnTag( &flash, &gun, weapon->weaponModel, "tag_flash" );    trap_R_AddRefEntityToScene( &flash );  }  if( ps || cg.renderingThirdPerson ||      cent->currentState.number != cg.predictedPlayerState.clientNum )  {    if( weapon->wim[ weaponMode ].muzzleParticleSystem && cent->muzzlePsTrigger )    {      cent->muzzlePS = CG_SpawnNewParticleSystem( weapon->wim[ weaponMode ].muzzleParticleSystem );      if( CG_IsParticleSystemValid( &cent->muzzlePS ) )      {        if( noGunModel )          CG_SetAttachmentTag( &cent->muzzlePS->attachment, *parent, parent->hModel, "tag_weapon" );        else          CG_SetAttachmentTag( &cent->muzzlePS->attachment, gun, weapon->weaponModel, "tag_flash" );        CG_SetAttachmentCent( &cent->muzzlePS->attachment, cent );        CG_AttachToTag( &cent->muzzlePS->attachment );      }      cent->muzzlePsTrigger = qfalse;    }    // make a dlight for the flash    if( weapon->wim[ weaponMode ].flashDlightColor[ 0 ] ||        weapon->wim[ weaponMode ].flashDlightColor[ 1 ] ||        weapon->wim[ weaponMode ].flashDlightColor[ 2 ] )    {      trap_R_AddLightToScene( flash.origin, 300 + ( rand( ) & 31 ),          weapon->wim[ weaponMode ].flashDlightColor[ 0 ],          weapon->wim[ weaponMode ].flashDlightColor[ 1 ],          weapon->wim[ weaponMode ].flashDlightColor[ 2 ] );    }  }}
开发者ID:ztdretcher,项目名称:zt-tremulous,代码行数:101,


示例21: UI_DrawPlayer

//.........这里部分代码省略.........    trap_R_AddRefEntityToScene( &legs );    if (!legs.hModel) {        return;    }    //    // add the torso    //    torso.hModel = pi->torsoModel;    if (!torso.hModel) {        return;    }    torso.customSkin = pi->torsoSkin;    VectorCopy( origin, torso.lightingOrigin );    UI_PositionRotatedEntityOnTag( &torso, &legs, pi->legsModel, "tag_torso");    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    //    //    // 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:LuckyBro,项目名称:sgfork,代码行数:101,


示例22: 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;		CG_AddRefEntityWithMinLight( &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;		CG_AddRefEntityWithMinLight( re );		// add the dlight		trap_R_AddLightToScene( re->origin, c * 1000.0, 1.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;		}		memset(&shockwave, 0, sizeof(shockwave));		shockwave.hModel = cgs.media.kamikazeShockWave;		shockwave.reType = RT_MODEL;		shockwave.shaderTime = re->shaderTime;		VectorCopy(re->origin, shockwave.origin);		test[0] = le->angles.trBase[0];		test[1] = le->angles.trBase[1];//.........这里部分代码省略.........
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:101,


示例23: UI_DrawPlayer

//.........这里部分代码省略.........	copyv3(origin, head.lightingOrigin);	UI_PositionRotatedEntityOnTag(&head, &torso, pi->torsoModel, "tag_head");	head.renderfx = renderfx;	trap_R_AddRefEntityToScene(&head);	/*	 * add the gun	 *  */	if(pi->currentWeapon != Wnone){		memset(&gun, 0, sizeof(gun));		gun.hModel = pi->weaponModel;		if(pi->currentWeapon == Wrailgun)			byte4copy(pi->c1RGBA, gun.shaderRGBA);		else			byte4copy(colorWhite, gun.shaderRGBA);		copyv3(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 == Wmachinegun || pi->realWeapon == Wmelee){		Vec3 angles;		memset(&barrel, 0, sizeof(barrel));		copyv3(origin, barrel.lightingOrigin);		barrel.renderfx = renderfx;		barrel.hModel	= pi->barrelModel;		angles[YAW]	= 0;		angles[PITCH]	= 0;		angles[ROLL]	= UI_MachinegunSpinAngle(pi);		if(pi->realWeapon == Wmelee){			angles[PITCH] = angles[ROLL];			angles[ROLL] = 0;		}		eulertoaxis(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;			if(pi->currentWeapon == Wrailgun)				byte4copy(pi->c1RGBA, flash.shaderRGBA);			else				byte4copy(colorWhite, flash.shaderRGBA);			copyv3(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/balloon4"));	/*	 * 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:icanhas,项目名称:yantar,代码行数:101,


示例24: UI_DrawPlayer

//.........这里部分代码省略.........	memcpy( legs.torsoAxis, torso.axis, sizeof( torso.axis ) );	torso = legs;	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 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], 0 );		}	}	//	// add the backpack	//	if ( pi->backpackModel ) {		memset( &backpack, 0, sizeof( backpack ) );		backpack.hModel = pi->backpackModel;		VectorCopy( origin, backpack.lightingOrigin );		UI_PositionEntityOnTag( &backpack, &torso, pi->torsoModel, "tag_back" );		backpack.renderfx = renderfx;		trap_R_AddRefEntityToScene( &backpack );	}	//	// add the helmet	//	if ( pi->helmetModel ) {		memset( &helmet, 0, sizeof( helmet ) );		helmet.hModel = pi->helmetModel;		VectorCopy( origin, helmet.lightingOrigin );		UI_PositionEntityOnTag( &helmet, &head, pi->headModel, "tag_mouth" );		helmet.renderfx = renderfx;		trap_R_AddRefEntityToScene( &helmet );	}	//	// 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, 0 );	origin[0] -= 100;	origin[1] -= 100;	origin[2] -= 100;	trap_R_AddLightToScene( origin, 500, 1.0, 0.0, 0.0, 0 );	trap_R_RenderScene( &refdef );}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,


示例25: CG_RenderBeam

//.........这里部分代码省略.........		else if ( !prev && next )		{			//this is the front			GetPerpendicularViewVector( cg.refdef.vieworg, next->position, i->position, up );		}		else if ( prev && !next )		{			//this is the back			GetPerpendicularViewVector( cg.refdef.vieworg, i->position, prev->position, up );		}		else		{			break;		}		if ( prev )		{			VectorMA( i->position, i->halfWidth, up, verts[ numVerts ].xyz );			verts[ numVerts ].st[ 0 ] = i->textureCoord;			verts[ numVerts ].st[ 1 ] = 1.0f;			if ( btb->realLight )			{				CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );			}			else			{				VectorCopy( i->color, verts[ numVerts ].modulate );				verts[ numVerts ].modulate[ 3 ] = i->alpha;			}			numVerts++;			VectorMA( i->position, -i->halfWidth, up, verts[ numVerts ].xyz );			verts[ numVerts ].st[ 0 ] = i->textureCoord;			verts[ numVerts ].st[ 1 ] = 0.0f;			if ( btb->realLight )			{				CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );			}			else			{				VectorCopy( i->color, verts[ numVerts ].modulate );				verts[ numVerts ].modulate[ 3 ] = i->alpha;			}			numVerts++;		}		if ( next )		{			VectorMA( i->position, -i->halfWidth, up, verts[ numVerts ].xyz );			verts[ numVerts ].st[ 0 ] = i->textureCoord;			verts[ numVerts ].st[ 1 ] = 0.0f;			if ( btb->realLight )			{				CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );			}			else			{				VectorCopy( i->color, verts[ numVerts ].modulate );				verts[ numVerts ].modulate[ 3 ] = i->alpha;			}			numVerts++;			VectorMA( i->position, i->halfWidth, up, verts[ numVerts ].xyz );			verts[ numVerts ].st[ 0 ] = i->textureCoord;			verts[ numVerts ].st[ 1 ] = 1.0f;			if ( btb->realLight )			{				CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );			}			else			{				VectorCopy( i->color, verts[ numVerts ].modulate );				verts[ numVerts ].modulate[ 3 ] = i->alpha;			}			numVerts++;		}		if( btb->dynamicLight ) {			trap_R_AddLightToScene( i->position,						btb->dLightRadius,						3,						( float ) btb->dLightColor[ 0 ] / ( float ) 0xFF,						( float ) btb->dLightColor[ 1 ] / ( float ) 0xFF,						( float ) btb->dLightColor[ 2 ] / ( float ) 0xFF, 0, 0 );		}		i = i->next;	}	while ( i );	trap_R_AddPolysToScene( tb->class_->shader, 4, &verts[ 0 ], numVerts / 4 );}
开发者ID:Unvanquished,项目名称:Unvanquished,代码行数:101,


示例26: CG_Buildable

//.........这里部分代码省略.........    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;    memset( &turretTop, 0, sizeof( turretTop ) );    VectorCopy( es->angles2, swivelAngles );    swivelAngles[ PITCH ] = 0.0f;    turretTop.hModel = cg_buildables[ es->modelindex ].models[ 2 ];    CG_PositionRotatedEntityOnTag( &turretTop, &ent, ent.hModel, "tag_turret" );    VectorCopy( cent->lerpOrigin, turretTop.lightingOrigin );    AnglesToAxis( swivelAngles, flatAxis );    RotatePointAroundVector( turretTop.axis[ 0 ], xNormal, flatAxis[ 0 ], -rotAngle );    RotatePointAroundVector( turretTop.axis[ 1 ], xNormal, flatAxis[ 1 ], -rotAngle );    RotatePointAroundVector( turretTop.axis[ 2 ], xNormal, flatAxis[ 2 ], -rotAngle );    turretTop.oldframe = ent.oldframe;    turretTop.frame    = ent.frame;    turretTop.backlerp = ent.backlerp;    turretTop.customShader = ent.customShader;    if( scale != 1.0f )    {      VectorScale( turretTop.axis[ 0 ], scale, turretTop.axis[ 0 ] );      VectorScale( turretTop.axis[ 1 ], scale, turretTop.axis[ 1 ] );      VectorScale( turretTop.axis[ 2 ], scale, turretTop.axis[ 2 ] );      turretTop.nonNormalizedAxes = qtrue;    }    else      turretTop.nonNormalizedAxes = qfalse;    trap_R_AddRefEntityToScene( &turretTop );  }  //weapon effects for turrets  if( es->eFlags & EF_FIRING )  {    weaponInfo_t  *weapon = &cg_weapons[ es->weapon ];    if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME ||        BG_FindProjTypeForBuildable( es->modelindex ) == WP_TESLAGEN )    {      if( weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 0 ] ||          weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 1 ] ||          weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 2 ] )      {        trap_R_AddLightToScene( cent->lerpOrigin, 300 + ( rand( ) & 31 ),            weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 0 ],            weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 1 ],            weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 2 ] );      }    }    if( weapon->wim[ WPM_PRIMARY ].firingSound )    {      trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin,          weapon->wim[ WPM_PRIMARY ].firingSound );    }    else if( weapon->readySound )      trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, weapon->readySound );  }  health = es->generic1 & B_HEALTH_MASK;  healthScale = (float)health / B_HEALTH_MASK;  if( healthScale < cent->lastBuildableHealthScale && ( es->generic1 & B_SPAWNED_TOGGLEBIT ) )  {    if( cent->lastBuildableDamageSoundTime + BUILDABLE_SOUND_PERIOD < cg.time )    {      if( team == BIT_HUMANS )      {        int i = rand( ) % 4;        trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.humanBuildableDamage[ i ] );      }      else if( team == BIT_ALIENS )        trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.alienBuildableDamage );      cent->lastBuildableDamageSoundTime = cg.time;    }  }  cent->lastBuildableHealthScale = healthScale;  //smoke etc for damaged buildables  CG_BuildableParticleEffects( cent );}
开发者ID:AlienHoboken,项目名称:Tremulous-W-Server,代码行数:101,


示例27: UI_DrawPlayer

//.........这里部分代码省略.........	head.renderfx = renderfx;	CG_AddRefEntityWithMinLight( &head );	//	// add the gun	//	if ( pi->currentWeapon != WP_NONE ) {		memset( &gun, 0, sizeof(gun) );		gun.hModel = pi->weaponModel;		if( pi->currentWeapon == WP_RAILGUN ) {			Byte4Copy( pi->c1RGBA, gun.shaderRGBA );		}		else {			Byte4Copy( colorWhite, gun.shaderRGBA );		}		VectorCopy( origin, gun.lightingOrigin );		UI_PositionEntityOnTag( &gun, &torso, pi->torsoModel, "tag_weapon");		gun.renderfx = renderfx;		CG_AddRefEntityWithMinLight( &gun );	}	//	// add the spinning barrel	//	if ( pi->realWeapon == WP_MACHINEGUN || pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG#ifdef MISSIONPACK		|| pi->realWeapon == WP_CHAINGUN#endif		) {		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");		CG_AddRefEntityWithMinLight( &barrel );	}	//	// add muzzle flash	//	if ( dp_realtime <= pi->muzzleFlashTime ) {		if ( pi->flashModel ) {			memset( &flash, 0, sizeof(flash) );			flash.hModel = pi->flashModel;			if( pi->currentWeapon == WP_RAILGUN ) {				Byte4Copy( pi->c1RGBA, flash.shaderRGBA );			}			else {				Byte4Copy( colorWhite, flash.shaderRGBA );			}			VectorCopy( origin, flash.lightingOrigin );			UI_PositionEntityOnTag( &flash, &gun, pi->weaponModel, "tag_flash");			flash.renderfx = renderfx;			CG_AddRefEntityWithMinLight( &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), 1.0f, 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, 1.0 );	origin[0] -= 100;	origin[1] -= 100;	origin[2] -= 100;	trap_R_AddLightToScene( origin, 500, 1.0, 1.0, 0.0, 0.0 );	trap_R_RenderScene( &refdef );}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:101,



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


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