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

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

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

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

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

示例1: CG_AddMarks

void CG_AddMarks(){	int        j;	markPoly_t *mp, *next;	int        t;	int        fade;	if ( !cg_addMarks.integer )	{		return;	}	mp = cg_activeMarkPolys.nextMark;	for ( ; mp != &cg_activeMarkPolys; mp = next )	{		// grab next now, so if the local entity is freed we		// still have it		next = mp->nextMark;		// see if it is time to completely remove it		if ( cg.time > mp->time + MARK_TOTAL_TIME )		{			CG_FreeMarkPoly( mp );			continue;		}		// fade all marks out with time		t = mp->time + MARK_TOTAL_TIME - cg.time;		if ( t < MARK_FADE_TIME )		{			fade = 255 * t / MARK_FADE_TIME;			if ( mp->alphaFade )			{				for ( j = 0; j < mp->poly.numVerts; j++ )				{					mp->verts[ j ].modulate[ 3 ] = fade;				}			}			else			{				for ( j = 0; j < mp->poly.numVerts; j++ )				{					mp->verts[ j ].modulate[ 0 ] = mp->color[ 0 ] * fade;					mp->verts[ j ].modulate[ 1 ] = mp->color[ 1 ] * fade;					mp->verts[ j ].modulate[ 2 ] = mp->color[ 2 ] * fade;				}			}		}		trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );	}}
开发者ID:ChunHungLiu,项目名称:Unvanquished,代码行数:54,


示例2: CG_EmitPolyVerts

/*=======================================================================================================================================CG_EmitPolyVerts=======================================================================================================================================*/static void CG_EmitPolyVerts(const refEntity_t *re) {	polyVert_t verts[4];	float sinR, cosR;	float angle;	vec3_t left, up;	int i;	if (re->rotation) {		angle = M_PI * re->rotation / 180.0;		sinR = sin(angle);		cosR = cos(angle);		VectorScale(cg.refdef.viewaxis[1], cosR * re->radius, left);		VectorMA(left, -sinR * re->radius, cg.refdef.viewaxis[2], left);		VectorScale(cg.refdef.viewaxis[2], cosR * re->radius, up);		VectorMA(up, sinR * re->radius, cg.refdef.viewaxis[1], up);	} else {		VectorScale(cg.refdef.viewaxis[1], re->radius, left);		VectorScale(cg.refdef.viewaxis[2], re->radius, up);	}	verts[0].xyz[0] = re->origin[0] + left[0] + up[0];	verts[0].xyz[1] = re->origin[1] + left[1] + up[1];	verts[0].xyz[2] = re->origin[2] + left[2] + up[2];	verts[0].st[0] = 0.0;	verts[0].st[1] = 0.0;	verts[1].xyz[0] = re->origin[0] - left[0] + up[0];	verts[1].xyz[1] = re->origin[1] - left[1] + up[1];	verts[1].xyz[2] = re->origin[2] - left[2] + up[2];	verts[1].st[0] = 1.0;	verts[1].st[1] = 0.0;	verts[2].xyz[0] = re->origin[0] - left[0] - up[0];	verts[2].xyz[1] = re->origin[1] - left[1] - up[1];	verts[2].xyz[2] = re->origin[2] - left[2] - up[2];	verts[2].st[0] = 1.0;	verts[2].st[1] = 1.0;	verts[3].xyz[0] = re->origin[0] + left[0] - up[0];	verts[3].xyz[1] = re->origin[1] + left[1] - up[1];	verts[3].xyz[2] = re->origin[2] + left[2] - up[2];	verts[3].st[0] = 0.0;	verts[3].st[1] = 1.0;	for (i = 0; i < 4; i++) {		verts[i].modulate[0] = re->shaderRGBA[0];		verts[i].modulate[1] = re->shaderRGBA[1];		verts[i].modulate[2] = re->shaderRGBA[2];		verts[i].modulate[3] = re->shaderRGBA[3];	}	trap_R_AddPolyToScene(re->customShader, 4, verts, 0, 0);}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:59,


示例3: CG_AddMarks

/*===============CG_AddMarks===============*/void CG_AddMarks(void){	int        j;	markPoly_t *mp, *next;	int        t;	int        fade;	if (!cg_markTime.integer)	{		return;	}	mp = cg_activeMarkPolys.nextMark;	for ( ; mp != &cg_activeMarkPolys ; mp = next)	{		// grab next now, so if the local entity is freed we		// still have it		next = mp->nextMark;		// see if it is time to completely remove it		if (cg.time > mp->time + mp->duration)		{			CG_FreeMarkPoly(mp);			continue;		}		// fade all marks out with time		t = mp->time + mp->duration - cg.time;		if (t < (float)mp->duration / 2.0)		{			fade = (int)(255.0 * (float)t / ((float)mp->duration / 2.0));			if (mp->alphaFade)			{				for (j = 0 ; j < mp->poly.numVerts ; j++)				{					mp->verts[j].modulate[3] = fade;				}			}			else			{				for (j = 0 ; j < mp->poly.numVerts ; j++)				{					mp->verts[j].modulate[0] = mp->color[0] * fade;					mp->verts[j].modulate[1] = mp->color[1] * fade;					mp->verts[j].modulate[2] = mp->color[2] * fade;				}			}		}		trap_R_AddPolyToScene(mp->markShader, mp->poly.numVerts, mp->verts);	}}
开发者ID:GenaSG,项目名称:etlegacy,代码行数:57,


示例4: CG_EffectMark

void CG_EffectMark(qhandle_t markShader, const vec3_t origin, const vec3_t dir, float alpha, float radius){	// 'quick' version of the CG_ImpactMark function	vec3_t axis[3], originalPoints[4];	float texCoordScale;	byte colors[4];	int i;	polyVert_t *v, verts[4];	if (!cg_addMarks.integer) {		return;	}	if (radius <= 0) {		CG_Error("CG_EffectMark called with <= 0 radius");	}	// create the texture axis	VectorNormalize2(dir, axis[0]);	PerpendicularVector(axis[1], axis[0]);	VectorSet(axis[2], 1, 0, 0);	// This is _wrong_, but the function is for water anyway (i.e. usually flat)	CrossProduct(axis[0], axis[2], axis[1]);	texCoordScale = 0.5 * 1.0 / radius;	// create the full polygon	for (i = 0; i < 3; i++) {		originalPoints[0][i] = origin[i] - radius * axis[1][i] - radius * axis[2][i];		originalPoints[1][i] = origin[i] + radius * axis[1][i] - radius * axis[2][i];		originalPoints[2][i] = origin[i] + radius * axis[1][i] + radius * axis[2][i];		originalPoints[3][i] = origin[i] - radius * axis[1][i] + radius * axis[2][i];	}	colors[0] = 127;	colors[1] = 127;	colors[2] = 127;	colors[3] = alpha * 255;	for (i = 0, v = verts; i < 4; i++, v++) {		vec3_t delta;		VectorCopy(originalPoints[i], v->xyz);		VectorSubtract(v->xyz, origin, delta);		v->st[0] = 0.5 + DotProduct(delta, axis[1]) * texCoordScale;		v->st[1] = 0.5 + DotProduct(delta, axis[2]) * texCoordScale;		*(int *) v->modulate = *(int *) colors;	}	trap_R_AddPolyToScene(markShader, 4, verts);}
开发者ID:Zekom,项目名称:reaction,代码行数:50,


示例5: CG_AddPolys

/** CG_Addpolys*/void CG_AddPolys( void ){	int i;	float fade;	cpoly_t	*cgpoly, *next, *hnode;	poly_t *poly;	static vec3_t angles;	// add polys in first-spawned - first-drawn order	hnode = &cg_polys_headnode;	for( cgpoly = hnode->prev; cgpoly != hnode; cgpoly = next )	{		next = cgpoly->prev;		// it's time to die		if( cgpoly->die <= cg.time )		{			CG_FreePoly( cgpoly );			continue;		}		poly = cgpoly->poly;		for( i = 0; i < poly->numverts; i++ )			VectorCopy( cgpoly->verts[i], poly->verts[i] );		for( i = 0; i < 3; i++ )			angles[i] = anglemod( cgpoly->angles[i] );		CG_OrientPolygon( cgpoly->origin, angles, poly );		// fade out		if( cgpoly->fadetime < cg.time )		{			fade = ( cgpoly->die - cg.time ) * cgpoly->fadefreq;			for( i = 0; i < poly->numverts; i++ )			{				poly->colors[i][0] = ( uint8_t )( cgpoly->color[0] * fade * 255 );				poly->colors[i][1] = ( uint8_t )( cgpoly->color[1] * fade * 255 );				poly->colors[i][2] = ( uint8_t )( cgpoly->color[2] * fade * 255 );				poly->colors[i][3] = ( uint8_t )( cgpoly->color[3] * fade * 255 );			}		}		trap_R_AddPolyToScene( poly );	}}
开发者ID:ultimatecode7,项目名称:qfusion,代码行数:50,


示例6: CG_DrawPlane

/*===============CG_DrawPlaneDraw a quad in 3 space - basically CG_DrawPic in 3 space===============*/void CG_DrawPlane( vec3_t origin, vec3_t down, vec3_t right, qhandle_t shader ){	polyVert_t verts[ 4 ];	vec3_t     temp;	VectorCopy( origin, verts[ 0 ].xyz );	verts[ 0 ].st[ 0 ] = 0;	verts[ 0 ].st[ 1 ] = 0;	verts[ 0 ].modulate[ 0 ] = 255;	verts[ 0 ].modulate[ 1 ] = 255;	verts[ 0 ].modulate[ 2 ] = 255;	verts[ 0 ].modulate[ 3 ] = 255;	VectorAdd( origin, right, temp );	VectorCopy( temp, verts[ 1 ].xyz );	verts[ 1 ].st[ 0 ] = 1;	verts[ 1 ].st[ 1 ] = 0;	verts[ 1 ].modulate[ 0 ] = 255;	verts[ 1 ].modulate[ 1 ] = 255;	verts[ 1 ].modulate[ 2 ] = 255;	verts[ 1 ].modulate[ 3 ] = 255;	VectorAdd( origin, right, temp );	VectorAdd( temp, down, temp );	VectorCopy( temp, verts[ 2 ].xyz );	verts[ 2 ].st[ 0 ] = 1;	verts[ 2 ].st[ 1 ] = 1;	verts[ 2 ].modulate[ 0 ] = 255;	verts[ 2 ].modulate[ 1 ] = 255;	verts[ 2 ].modulate[ 2 ] = 255;	verts[ 2 ].modulate[ 3 ] = 255;	VectorAdd( origin, down, temp );	VectorCopy( temp, verts[ 3 ].xyz );	verts[ 3 ].st[ 0 ] = 0;	verts[ 3 ].st[ 1 ] = 1;	verts[ 3 ].modulate[ 0 ] = 255;	verts[ 3 ].modulate[ 1 ] = 255;	verts[ 3 ].modulate[ 2 ] = 255;	verts[ 3 ].modulate[ 3 ] = 255;	trap_R_AddPolyToScene( shader, 4, verts );}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:50,


示例7: CG_DrawSurfNormal

/*===============CG_DrawSurfNormalDraws a vector againstthe surface player is looking at===============*/static void CG_DrawSurfNormal( void ){	trace_t    tr;	vec3_t     end, temp;	polyVert_t normal[ 4 ];	vec4_t     color = { 0.0f, 255.0f, 0.0f, 128.0f };	VectorMA( cg.refdef.vieworg, 8192, cg.refdef.viewaxis[ 0 ], end );	CG_Trace( &tr, cg.refdef.vieworg, NULL, NULL, end, cg.predictedPlayerState.clientNum,	          MASK_SOLID, 0 );	VectorCopy( tr.endpos, normal[ 0 ].xyz );	normal[ 0 ].st[ 0 ] = 0;	normal[ 0 ].st[ 1 ] = 0;	Vector4Copy( color, normal[ 0 ].modulate );	VectorMA( tr.endpos, NORMAL_WIDTH, cg.refdef.viewaxis[ 1 ], temp );	VectorCopy( temp, normal[ 1 ].xyz );	normal[ 1 ].st[ 0 ] = 0;	normal[ 1 ].st[ 1 ] = 1;	Vector4Copy( color, normal[ 1 ].modulate );	VectorMA( tr.endpos, NORMAL_HEIGHT, tr.plane.normal, temp );	VectorMA( temp, NORMAL_WIDTH, cg.refdef.viewaxis[ 1 ], temp );	VectorCopy( temp, normal[ 2 ].xyz );	normal[ 2 ].st[ 0 ] = 1;	normal[ 2 ].st[ 1 ] = 1;	Vector4Copy( color, normal[ 2 ].modulate );	VectorMA( tr.endpos, NORMAL_HEIGHT, tr.plane.normal, temp );	VectorCopy( temp, normal[ 3 ].xyz );	normal[ 3 ].st[ 0 ] = 1;	normal[ 3 ].st[ 1 ] = 0;	Vector4Copy( color, normal[ 3 ].modulate );	trap_R_AddPolyToScene( cgs.media.outlineShader, 4, normal );}
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:46,


示例8: CG_Aura_DrawSpike

/*===================CG_Aura_DrawSpike===================  Draws the polygons for one aura spike*/static void CG_Aura_DrawSpike (vec3_t start, vec3_t end, float width, qhandle_t shader, vec4_t RGBModulate){	vec3_t line, offset, viewLine;	polyVert_t verts[4];	float len;	int i, j;		VectorSubtract (end, start, line);	VectorSubtract (start, cg.refdef.vieworg, viewLine);	CrossProduct (viewLine, line, offset);	len = VectorNormalize (offset);		if (!len){		return;	}		VectorMA (end, -width, offset, verts[0].xyz);	verts[0].st[0] = 1;	verts[0].st[1] = 0;	VectorMA (end, width, offset, verts[1].xyz);	verts[1].st[0] = 0;	verts[1].st[1] = 0;	VectorMA (start, width, offset, verts[2].xyz);	verts[2].st[0] = 0;	verts[2].st[1] = 1;	VectorMA (start, -width, offset, verts[3].xyz);	verts[3].st[0] = 1;	verts[3].st[1] = 1;		for (i = 0;i < 4;i++){		for (j = 0;j < 4;j++){			verts[i].modulate[j] = 255 * RGBModulate[j];		}	}	trap_R_AddPolyToScene( shader, 4, verts);}
开发者ID:burzumishi,项目名称:dragonballworld,代码行数:42,


示例9: CG_AddFragmentedDecal

//.........这里部分代码省略.........	int numfragments;	poly_t poly;	vec4_t verts[MAX_BLOBSHADOW_VERTS];	static vec4_t t_verts[MAX_TEMPDECAL_VERTS * MAX_TEMPDECALS];	static vec4_t t_norms[MAX_TEMPDECAL_VERTS * MAX_TEMPDECALS];	static vec2_t t_stcoords[MAX_TEMPDECAL_VERTS * MAX_TEMPDECALS];	static byte_vec4_t t_colors[MAX_TEMPDECAL_VERTS * MAX_TEMPDECALS];	if( radius <= 0 || VectorCompare( dir, vec3_origin ) ) {		return; // invalid	}	// calculate orientation matrix	VectorNormalize2( dir, axis[0] );	PerpendicularVector( axis[1], axis[0] );	RotatePointAroundVector( axis[2], axis[0], axis[1], orient );	CrossProduct( axis[0], axis[2], axis[1] );	numfragments = trap_R_GetClippedFragments( origin, radius, axis, // clip it											   MAX_BLOBSHADOW_VERTS, verts, MAX_TEMPDECAL_FRAGMENTS, fragments );	// no valid fragments	if( !numfragments ) {		return;	}	// clamp and scale colors	if( r < 0 ) {		r = 0;	} else if( r > 1 ) {		r = 255;	} else {		r *= 255;	}	if( g < 0 ) {		g = 0;	} else if( g > 1 ) {		g = 255;	} else {		g *= 255;	}	if( b < 0 ) {		b = 0;	} else if( b > 1 ) {		b = 255;	} else {		b *= 255;	}	if( a < 0 ) {		a = 0;	} else if( a > 1 ) {		a = 255;	} else {		a *= 255;	}	color[0] = ( uint8_t )( r );	color[1] = ( uint8_t )( g );	color[2] = ( uint8_t )( b );	color[3] = ( uint8_t )( a );	c = *( int * )color;	radius = 0.5f / radius;	VectorScale( axis[1], radius, axis[1] );	VectorScale( axis[2], radius, axis[2] );	memset( &poly, 0, sizeof( poly ) );	for( i = 0, fr = fragments; i < numfragments; i++, fr++ ) {		if( fr->numverts <= 0 ) {			continue;		}		if( cg_numDecalVerts + (unsigned)fr->numverts > sizeof( t_verts ) / sizeof( t_verts[0] ) ) {			return;		}		poly.shader = shader;		poly.verts = &t_verts[cg_numDecalVerts];		poly.normals = &t_norms[cg_numDecalVerts];		poly.stcoords = &t_stcoords[cg_numDecalVerts];		poly.colors = &t_colors[cg_numDecalVerts];		poly.numverts = fr->numverts;		poly.fognum = fr->fognum;		cg_numDecalVerts += (unsigned)fr->numverts;		for( j = 0; j < fr->numverts; j++ ) {			vec3_t v;			Vector4Copy( verts[fr->firstvert + j], poly.verts[j] );			VectorCopy( axis[0], poly.normals[j] ); poly.normals[j][3] = 0;			VectorSubtract( poly.verts[j], origin, v );			poly.stcoords[j][0] = DotProduct( v, axis[1] ) + 0.5f;			poly.stcoords[j][1] = DotProduct( v, axis[2] ) + 0.5f;			*( int * )poly.colors[j] = c;		}		trap_R_AddPolyToScene( &poly );	}}
开发者ID:Picmip,项目名称:qfusion,代码行数:101,


示例10: CG_AddParticles

/** CG_AddParticles*/void CG_AddParticles( void ) {	int i, j, k;	float alpha;	float time, time2;	vec3_t org;	vec3_t corner;	byte_vec4_t color;	int maxparticle, activeparticles;	float alphaValues[MAX_PARTICLES];	cparticle_t *p, *free_particles[MAX_PARTICLES];	if( !cg_numparticles ) {		return;	}	j = 0;	maxparticle = -1;	activeparticles = 0;	for( i = 0, p = particles; i < cg_numparticles; i++, p++ ) {		time = ( cg.time - p->time ) * 0.001f;		alpha = alphaValues[i] = p->alpha + time * p->alphavel;		if( alpha <= 0 ) { // faded out			free_particles[j++] = p;			continue;		}		maxparticle = i;		activeparticles++;		time2 = time * time * 0.5f;		org[0] = p->org[0] + p->vel[0] * time + p->accel[0] * time2;		org[1] = p->org[1] + p->vel[1] * time + p->accel[1] * time2;		org[2] = p->org[2] + p->vel[2] * time + p->accel[2] * time2;		color[0] = (uint8_t)( bound( 0, p->color[0], 1.0f ) * 255 );		color[1] = (uint8_t)( bound( 0, p->color[1], 1.0f ) * 255 );		color[2] = (uint8_t)( bound( 0, p->color[2], 1.0f ) * 255 );		color[3] = (uint8_t)( bound( 0, alpha, 1.0f ) * 255 );		corner[0] = org[0];		corner[1] = org[1] - 0.5f * p->scale;		corner[2] = org[2] - 0.5f * p->scale;		Vector4Set( p->pVerts[0], corner[0], corner[1] + p->scale, corner[2] + p->scale, 1 );		Vector4Set( p->pVerts[1], corner[0], corner[1], corner[2] + p->scale, 1 );		Vector4Set( p->pVerts[2], corner[0], corner[1], corner[2], 1 );		Vector4Set( p->pVerts[3], corner[0], corner[1] + p->scale, corner[2], 1 );		for( k = 0; k < 4; k++ ) {			Vector4Copy( color, p->pColor[k] );		}		p->poly.numverts = 4;		p->poly.verts = p->pVerts;		p->poly.stcoords = p->pStcoords;		p->poly.colors = p->pColor;		p->poly.fognum = p->fog ? 0 : -1;		p->poly.shader = ( p->shader == NULL ) ? CG_MediaShader( cgs.media.shaderParticle ) : p->shader;		trap_R_AddPolyToScene( &p->poly );	}	i = 0;	while( maxparticle >= activeparticles ) {		*free_particles[i++] = particles[maxparticle--];		while( maxparticle >= activeparticles ) {			if( alphaValues[maxparticle] <= 0 ) {				maxparticle--;			} else {				break;			}		}	}	cg_numparticles = activeparticles;}
开发者ID:Picmip,项目名称:qfusion,代码行数:82,


示例11: CG_Tracer

/*===============CG_Tracer===============*/void CG_Tracer( vec3_t source, vec3_t dest ){  vec3_t      forward, right;  polyVert_t  verts[ 4 ];  vec3_t      line;  float       len, begin, end;  vec3_t      start, finish;  vec3_t      midpoint;  // tracer  VectorSubtract( dest, source, forward );  len = VectorNormalize( forward );  // start at least a little ways from the muzzle  if( len < 100 )    return;  begin = 50 + random( ) * ( len - 60 );  end = begin + cg_tracerLength.value;  if( end > len )    end = len;  VectorMA( source, begin, forward, start );  VectorMA( source, end, forward, finish );  line[ 0 ] = DotProduct( forward, cg.refdef.viewaxis[ 1 ] );  line[ 1 ] = DotProduct( forward, cg.refdef.viewaxis[ 2 ] );  VectorScale( cg.refdef.viewaxis[ 1 ], line[ 1 ], right );  VectorMA( right, -line[ 0 ], cg.refdef.viewaxis[ 2 ], right );  VectorNormalize( right );  VectorMA( finish, cg_tracerWidth.value, right, verts[ 0 ].xyz );  verts[ 0 ].st[ 0 ] = 0;  verts[ 0 ].st[ 1 ] = 1;  verts[ 0 ].modulate[ 0 ] = 255;  verts[ 0 ].modulate[ 1 ] = 255;  verts[ 0 ].modulate[ 2 ] = 255;  verts[ 0 ].modulate[ 3 ] = 255;  VectorMA( finish, -cg_tracerWidth.value, right, verts[ 1 ].xyz );  verts[ 1 ].st[ 0 ] = 1;  verts[ 1 ].st[ 1 ] = 0;  verts[ 1 ].modulate[ 0 ] = 255;  verts[ 1 ].modulate[ 1 ] = 255;  verts[ 1 ].modulate[ 2 ] = 255;  verts[ 1 ].modulate[ 3 ] = 255;  VectorMA( start, -cg_tracerWidth.value, right, verts[ 2 ].xyz );  verts[ 2 ].st[ 0 ] = 1;  verts[ 2 ].st[ 1 ] = 1;  verts[ 2 ].modulate[ 0 ] = 255;  verts[ 2 ].modulate[ 1 ] = 255;  verts[ 2 ].modulate[ 2 ] = 255;  verts[ 2 ].modulate[ 3 ] = 255;  VectorMA( start, cg_tracerWidth.value, right, verts[ 3 ].xyz );  verts[ 3 ].st[ 0 ] = 0;  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;  trap_R_AddPolyToScene( cgs.media.tracerShader, 4, verts );  midpoint[ 0 ] = ( start[ 0 ] + finish[ 0 ] ) * 0.5;  midpoint[ 1 ] = ( start[ 1 ] + finish[ 1 ] ) * 0.5;  midpoint[ 2 ] = ( start[ 2 ] + finish[ 2 ] ) * 0.5;  // add the tracer sound  trap_S_StartSound( midpoint, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.tracerSound );}
开发者ID:ztdretcher,项目名称:zt-tremulous,代码行数:78,


示例12: CG_VolumetricFog

void CG_VolumetricFog( vec3_t source, vec3_t dest ) {	vec3_t forward, right;	polyVert_t verts[4];	vec3_t line;	float len, begin, end;	vec3_t start, finish;	float width = 2.0;	vec4_t rgba;	if ( fogshader < 0 ) {		fogshader = trap_R_RegisterShader( "nsq3_sfx/volumetricfog" );	}	rgba[0] = 1.0;	rgba[1] = 1.0;	rgba[2] = 1.0;	rgba[3] = 1.0;	VectorSubtract( dest, source, forward );	len = VectorNormalize( forward );	begin = 1;	end = len;	VectorMA( source, begin, forward, start );	VectorMA( source, end, forward, finish );	line[0] = DotProduct( forward, cg.refdef.viewaxis[1] );	line[1] = DotProduct( forward, cg.refdef.viewaxis[2] );	VectorScale( cg.refdef.viewaxis[1], line[1], right );	VectorMA( right, -line[0], cg.refdef.viewaxis[2], right );	VectorNormalize( right );	VectorMA( finish, width, right, verts[0].xyz );	verts[0].st[0] = 0;	verts[0].st[1] = 1;	verts[0].modulate[0] = 255 * rgba[0];	verts[0].modulate[1] = 255 * rgba[1];	verts[0].modulate[2] = 255 * rgba[2];	verts[0].modulate[3] = 255 * rgba[3];	VectorMA( finish, -width, right, verts[1].xyz );	verts[1].st[0] = 1;	verts[1].st[1] = 1;	verts[1].modulate[0] = 255 * rgba[0];	verts[1].modulate[1] = 255 * rgba[1];	verts[1].modulate[2] = 255 * rgba[2];	verts[1].modulate[3] = 255 * rgba[3];	VectorMA( start, -width, right, verts[2].xyz );	verts[2].st[0] = 1;	verts[2].st[1] = 0;	verts[2].modulate[0] = 255 * rgba[0];	verts[2].modulate[1] = 255 * rgba[1];	verts[2].modulate[2] = 255 * rgba[2];	verts[2].modulate[3] = 255 * rgba[3];	VectorMA( start, width, right, verts[3].xyz );	verts[3].st[0] = 0;	verts[3].st[1] = 0;	verts[3].modulate[0] = 255 * rgba[0];	verts[3].modulate[1] = 255 * rgba[1];	verts[3].modulate[2] = 255 * rgba[2];	verts[3].modulate[3] = 255 * rgba[3];	trap_R_AddPolyToScene( fogshader, 4, verts );}
开发者ID:zturtleman,项目名称:navy-seals,代码行数:68,


示例13: CG_AddParticleToScene

//.........这里部分代码省略.........		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);		}		VectorCopy(point, verts[0].xyz);		verts[0].st[0]       = 0;		verts[0].st[1]       = 0;		verts[0].modulate[0] = 255;		verts[0].modulate[1] = 255;		verts[0].modulate[2] = 255;		verts[0].modulate[3] = 255;		if (p->roll) {			VectorMA(point, 2 * height, ru, point);		} else {			VectorMA(point, 2 * height, vup, point);		}		VectorCopy(point, verts[1].xyz);		verts[1].st[0]       = 0;		verts[1].st[1]       = 1;		verts[1].modulate[0] = 255;		verts[1].modulate[1] = 255;		verts[1].modulate[2] = 255;		verts[1].modulate[3] = 255;		if (p->roll) {			VectorMA(point, 2 * width, rr, point);		} else {			VectorMA(point, 2 * width, vright, point);		}		VectorCopy(point, verts[2].xyz);		verts[2].st[0]       = 1;		verts[2].st[1]       = 1;		verts[2].modulate[0] = 255;		verts[2].modulate[1] = 255;		verts[2].modulate[2] = 255;		verts[2].modulate[3] = 255;		if (p->roll) {			VectorMA(point, -2 * height, ru, point);		} else {			VectorMA(point, -2 * height, vup, point);		}		VectorCopy(point, verts[3].xyz);		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;	}	// done.	if (!cg_wolfparticles.integer) {		return;	}	if (!p->pshader) {		return;	}	if (p->type == P_WEATHER || p->type == P_WEATHER_TURBULENT || p->type == P_WEATHER_FLURRY) {		trap_R_AddPolyToScene(p->pshader, 3, TRIverts);	} else {		trap_R_AddPolyToScene(p->pshader, 4, verts);	}}
开发者ID:Exosum,项目名称:ETrun,代码行数:101,


示例14: CGSyscall_R_AddPolysToScene

void CGSyscall_R_AddPolysToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int num ) { trap_R_AddPolyToScene( hShader, numVerts, verts ); }
开发者ID:Almightygir,项目名称:OpenJK,代码行数:1,


示例15: CG_ImpactMark

//.........这里部分代码省略.........	//if ( markTotal >= MAX_MARK_POLYS ) {	//	return;	//}#endif	// create the texture axis	VectorNormalize2( dir, axis[0] );	PerpendicularVector( axis[1], axis[0] );	RotatePointAroundVector( axis[2], axis[0], axis[1], orientation );	CrossProduct( axis[0], axis[2], axis[1] );	texCoordScale = 0.5 * 1.0 / radius;	// create the full polygon	for ( i = 0 ; i < 3 ; i++ ) {		originalPoints[0][i] = origin[i] - radius * axis[1][i] - radius * axis[2][i];		originalPoints[1][i] = origin[i] + radius * axis[1][i] - radius * axis[2][i];		originalPoints[2][i] = origin[i] + radius * axis[1][i] + radius * axis[2][i];		originalPoints[3][i] = origin[i] - radius * axis[1][i] + radius * axis[2][i];	}	// get the fragments	VectorScale( dir, -20, projection );	numFragments = trap_CM_MarkFragments( 4, (void *)originalPoints,					projection, MAX_MARK_POINTS, markPoints[0],					MAX_MARK_FRAGMENTS, markFragments );	colors[0] = red * 255;	colors[1] = green * 255;	colors[2] = blue * 255;	colors[3] = alpha * 255;	for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ ) {		polyVert_t	*v;		polyVert_t	verts[MAX_VERTS_ON_POLY];		markPoly_t	*mark;		vec3_t		delta;		vec3_t		localOrigin;		// create the texture axis		VectorNormalize2( mf->projectionDir, axis[0] );		VectorScale( axis[0], -1, axis[0] ); // ZTM: the dir was scaled to -20 before giving to renderer, turn it back around. :S		PerpendicularVector( axis[1], axis[0] );		RotatePointAroundVector( axis[2], axis[0], axis[1], orientation );		CrossProduct( axis[0], axis[2], axis[1] );		if ( mf->bmodelNum ) {			// ZTM: TODO?: compensate for scale in the axes if necessary? see R_RotateForEntity			// ZTM: FIXME: cgame should be able to get origin and axis from entity !			VectorSubtract( origin, mf->bmodelOrigin, delta );			localOrigin[0] = DotProduct( delta, mf->bmodelAxis[0] );			localOrigin[1] = DotProduct( delta, mf->bmodelAxis[1] );			localOrigin[2] = DotProduct( delta, mf->bmodelAxis[2] );		} else {			VectorCopy( origin, localOrigin );		}		// we have an upper limit on the complexity of polygons		// that we store persistantly		if ( mf->numPoints > MAX_VERTS_ON_POLY ) {			mf->numPoints = MAX_VERTS_ON_POLY;		}		for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ ) {			VectorCopy( markPoints[mf->firstPoint + j], v->xyz );			VectorSubtract( v->xyz, localOrigin, delta );			v->st[0] = 0.5 + DotProduct( delta, axis[1] ) * texCoordScale;			v->st[1] = 0.5 + DotProduct( delta, axis[2] ) * texCoordScale;			*(int *)v->modulate = *(int *)colors;		}		// if it is a temporary (shadow) mark, add it immediately and forget about it		if ( temporary ) {			trap_R_AddPolyToScene( markShader, mf->numPoints, verts, mf->bmodelNum, 0 );			continue;		}		// otherwise save it persistantly		mark = CG_AllocMark();		mark->bmodelNum = mf->bmodelNum;		mark->time = cg.time;		mark->alphaFade = alphaFade;		mark->markShader = markShader;		mark->numVerts = mf->numPoints;		mark->color[0] = red;		mark->color[1] = green;		mark->color[2] = blue;		mark->color[3] = alpha;		memcpy( mark->verts, verts, mf->numPoints * sizeof( verts[0] ) );#ifndef IOQ3ZTM		markTotal++;#endif#ifdef TA_WEAPSYS		addedMark = qtrue;#endif	}#ifdef TA_WEAPSYS	return addedMark;#endif}
开发者ID:Extraordinary-Beat-X,项目名称:ebx-code,代码行数:101,


示例16: CG_RainParticleRender

static void CG_RainParticleRender(cg_atmosphericParticle_t * particle){	// Draw a raindrop	vec3_t forward, right;	polyVert_t verts[4];	vec2_t line;	float len, frac;	vec3_t start, finish;	if (!particle->active)		return;	VectorCopy(particle->pos, start);	len = particle->height;	if (start[2] <= particle->minz) {		// Stop rain going through surfaces.		len = particle->height - particle->minz + start[2];		frac = start[2];		VectorMA(start, len - particle->height, particle->deltaNormalized, start);		if (!cg_lowEffects.integer) {			frac = (ATMOSPHERIC_CUTHEIGHT - particle->minz + frac) / (float) ATMOSPHERIC_CUTHEIGHT;			// Splash effects on different surfaces			if (particle->contents & (CONTENTS_WATER | CONTENTS_SLIME)) {				// Water splash				if (cg_atmFx.effectwatershader && frac > 0 && frac < 1)					CG_EffectMark(cg_atmFx.effectwatershader, start, particle->surfacenormal,						      frac * 0.5, 8 - frac * 8);			} else if (!(particle->contents & CONTENTS_LAVA)				   && !(particle->					surface & (SURF_NODAMAGE | SURF_NOIMPACT | SURF_NOMARKS | SURF_SKY))) {				// Solid splash				if (cg_atmFx.effectlandshader && frac > 0 && frac < 1)					CG_ImpactMark(cg_atmFx.effectlandshader, start, particle->surfacenormal, 0, 1,						      1, 1, frac * 0.5, qfalse, 3 - frac * 2, qtrue);			}		}	}	if (len <= 0)		return;	VectorCopy(particle->deltaNormalized, forward);	VectorMA(start, -len, forward, finish);	line[0] = DotProduct(forward, cg.refdef.viewaxis[1]);	line[1] = DotProduct(forward, cg.refdef.viewaxis[2]);	VectorScale(cg.refdef.viewaxis[1], line[1], right);	VectorMA(right, -line[0], cg.refdef.viewaxis[2], right);	VectorNormalize(right);	VectorMA(finish, particle->weight, right, verts[0].xyz);	verts[0].st[0] = 1;	verts[0].st[1] = 0;	verts[0].modulate[0] = 255;	verts[0].modulate[1] = 255;	verts[0].modulate[2] = 255;	verts[0].modulate[3] = 0;	VectorMA(finish, -particle->weight, right, verts[1].xyz);	verts[1].st[0] = 0;	verts[1].st[1] = 0;	verts[1].modulate[0] = 255;	verts[1].modulate[1] = 255;	verts[1].modulate[2] = 255;	verts[1].modulate[3] = 0;	VectorMA(start, -particle->weight, right, verts[2].xyz);	verts[2].st[0] = 0;	verts[2].st[1] = 1;	verts[2].modulate[0] = 255;	verts[2].modulate[1] = 255;	verts[2].modulate[2] = 255;	verts[2].modulate[3] = 127;	VectorMA(start, particle->weight, right, verts[3].xyz);	verts[3].st[0] = 1;	verts[3].st[1] = 1;	verts[3].modulate[0] = 255;	verts[3].modulate[1] = 255;	verts[3].modulate[2] = 255;	verts[3].modulate[3] = 127;	trap_R_AddPolyToScene(*particle->effectshader, 4, verts);}
开发者ID:Zekom,项目名称:reaction,代码行数:86,


示例17: CG_AddBlobShadow

/** CG_AddBlobShadow* * Ok, to not use decals space we need these arrays to store the* polygons info. We do not need the linked list nor registration*/static void CG_AddBlobShadow( vec3_t origin, vec3_t dir, float orient, float radius,							 float r, float g, float b, float a, cgshadebox_t *shadeBox ){	int i, j, c, nverts;	vec3_t axis[3];	byte_vec4_t color;	fragment_t *fr, fragments[MAX_BLOBSHADOW_FRAGMENTS];	int numfragments;	poly_t poly;	vec4_t verts[MAX_BLOBSHADOW_VERTS];	if( radius <= 0 || VectorCompare( dir, vec3_origin ) )		return; // invalid	// calculate orientation matrix	VectorNormalize2( dir, axis[0] );	PerpendicularVector( axis[1], axis[0] );	RotatePointAroundVector( axis[2], axis[0], axis[1], orient );	CrossProduct( axis[0], axis[2], axis[1] );	numfragments = trap_R_GetClippedFragments( origin, radius, axis, // clip it		MAX_BLOBSHADOW_VERTS, verts, MAX_BLOBSHADOW_FRAGMENTS, fragments );	// no valid fragments	if( !numfragments )		return;	// clamp and scale colors	if( r < 0 ) r = 0;else if( r > 1 ) r = 255;else r *= 255;	if( g < 0 ) g = 0;else if( g > 1 ) g = 255;else g *= 255;	if( b < 0 ) b = 0;else if( b > 1 ) b = 255;else b *= 255;	if( a < 0 ) a = 0;else if( a > 1 ) a = 255;else a *= 255;	color[0] = ( qbyte )( r );	color[1] = ( qbyte )( g );	color[2] = ( qbyte )( b );	color[3] = ( qbyte )( a );	c = *( int * )color;	radius = 0.5f / radius;	VectorScale( axis[1], radius, axis[1] );	VectorScale( axis[2], radius, axis[2] );	memset( &poly, 0, sizeof( poly ) );	for( i = 0, nverts = 0, fr = fragments; i < numfragments; i++, fr++ )	{		if( nverts+fr->numverts > MAX_BLOBSHADOW_VERTS )			return;		if( fr->numverts <= 0 )			continue;		poly.shader = shadeBox->shader;		poly.verts = &shadeBox->verts[nverts];		poly.normals = &shadeBox->norms[nverts];		poly.stcoords = &shadeBox->stcoords[nverts];		poly.colors = &shadeBox->colors[nverts];		poly.numverts = fr->numverts;		poly.fognum = fr->fognum;		nverts += fr->numverts;		for( j = 0; j < fr->numverts; j++ )		{			vec3_t v;			Vector4Copy( verts[fr->firstvert+j], poly.verts[j] );			VectorCopy( axis[0], poly.normals[j] ); poly.normals[j][3] = 0;			VectorSubtract( poly.verts[j], origin, v );			poly.stcoords[j][0] = DotProduct( v, axis[1] ) + 0.5f;			poly.stcoords[j][1] = DotProduct( v, axis[2] ) + 0.5f;			*( int * )poly.colors[j] = c;		}		trap_R_AddPolyToScene( &poly );	}}
开发者ID:futurepneu,项目名称:racesow,代码行数:82,


示例18: CG_AddMarks

void CG_AddMarks( void ) {	int			j;	markPoly_t	*mp, *next;	int			t;	int			fade;	if ( !cg_addMarks.integer ) {		return;	}	mp = cg_activeMarkPolys.nextMark;	for ( ; mp != &cg_activeMarkPolys ; mp = next ) {		// grab next now, so if the local entity is freed we		// still have it		next = mp->nextMark;		if(mp->markShader == cgs.media.SchaumShader)		{			if(cg.time> mp->time + 10000 )			{				CG_FreeMarkPoly( mp );				continue;			}			if((fade=cg.time-mp->time-8000)>=0)			{				fade=1.0f-(fade/2000.0f);				if ( mp->verts[0].modulate[0] != 0 ) {					for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {						mp->verts[j].modulate[0] = mp->color[0] * fade;						mp->verts[j].modulate[1] = mp->color[1] * fade;						mp->verts[j].modulate[2] = mp->color[2] * fade;					}				}			}			trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );			continue;		}		// see if it is time to completely remove it		if ( cg.time > mp->time + MARK_TOTAL_TIME ) {			CG_FreeMarkPoly( mp );			continue;		}		// fade out the energy bursts		if ( mp->markShader == cgs.media.energyMarkShader ) {			fade = 450 - 450 * ( (cg.time - mp->time ) / 3000.0 );			if ( fade < 255 ) {				if ( fade < 0 ) {					fade = 0;				}				if ( mp->verts[0].modulate[0] != 0 ) {					for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {						mp->verts[j].modulate[0] = mp->color[0] * fade;						mp->verts[j].modulate[1] = mp->color[1] * fade;						mp->verts[j].modulate[2] = mp->color[2] * fade;					}				}			}		}		// fade all marks out with time		t = mp->time + MARK_TOTAL_TIME - cg.time;		if ( t < MARK_FADE_TIME ) {			fade = 255 * t / MARK_FADE_TIME;			if ( mp->alphaFade ) {				for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {					mp->verts[j].modulate[3] = fade;				}			} else {				for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {					mp->verts[j].modulate[0] = mp->color[0] * fade;					mp->verts[j].modulate[1] = mp->color[1] * fade;					mp->verts[j].modulate[2] = mp->color[2] * fade;				}			}		}		trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );	}}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:86,


示例19: CG_ImpactMark

void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir, 				   float orientation, float red, float green, float blue, float alpha,				   qboolean alphaFade, float radius, qboolean temporary ) {	vec3_t			axis[3];	float			texCoordScale;	vec3_t			originalPoints[4];	byte			colors[4];	int				i, j;	int				numFragments;	markFragment_t	markFragments[MAX_MARK_FRAGMENTS], *mf;	vec3_t			markPoints[MAX_MARK_POINTS];	vec3_t			projection;	markPoly_t		*mp, *next;	vec3_t			delta;	if ( !cg_addMarks.integer ) {		return;	}	if ( radius <= 0 ) {		CG_Error( "CG_ImpactMark called with <= 0 radius" );	}	//if ( markTotal >= MAX_MARK_POLYS ) {	//	return;	//}	// HERBY: Bubble G overdraw fix	mp = cg_activeMarkPolys.nextMark;	for ( ; mp != &cg_activeMarkPolys; mp = next ) {		next = mp->nextMark;		if(temporary) break; // keep all marks if the new one is just the shadow		if(mp->markShader == cgs.media.SchaumShader) continue;//die slick-ents einfach übergehen		VectorSubtract( mp->origin, origin, delta );		if ( radius <= mp->radius + 4 && VectorLength( delta ) < ( radius + mp->radius ) * MIN_MARK_DISTANCE ) {			CG_FreeMarkPoly( mp );		}	}		// create the texture axis	VectorNormalize2( dir, axis[0] );	PerpendicularVector( axis[1], axis[0] );	RotatePointAroundVector( axis[2], axis[0], axis[1], orientation );	CrossProduct( axis[0], axis[2], axis[1] );	texCoordScale = 0.5 * 1.0 / radius;	// create the full polygon	for ( i = 0 ; i < 3 ; ++i ) {		originalPoints[0][i] = origin[i] - radius * axis[1][i] - radius * axis[2][i];		originalPoints[1][i] = origin[i] + radius * axis[1][i] - radius * axis[2][i];		originalPoints[2][i] = origin[i] + radius * axis[1][i] + radius * axis[2][i];		originalPoints[3][i] = origin[i] - radius * axis[1][i] + radius * axis[2][i];	}	// get the fragments	VectorScale( dir, -20, projection );	numFragments = trap_CM_MarkFragments( 4, (void *)originalPoints,					projection, MAX_MARK_POINTS, markPoints[0],					MAX_MARK_FRAGMENTS, markFragments );	if(!numFragments && markShader == cgs.media.SchaumShader)	{		numFragments = 1;		markFragments->firstPoint = 0;		markFragments->numPoints = 4;		for(i=0;i<4;++i)			VectorCopy(originalPoints[i],markPoints[i]);	}	colors[0] = red * 255;	colors[1] = green * 255;	colors[2] = blue * 255;	colors[3] = alpha * 255;	for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ ) {		polyVert_t	*v;		polyVert_t	verts[MAX_VERTS_ON_POLY];		markPoly_t	*mark;		// we have an upper limit on the complexity of polygons		// that we store persistantly		if ( mf->numPoints > MAX_VERTS_ON_POLY ) {			mf->numPoints = MAX_VERTS_ON_POLY;		}		for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ ) {			vec3_t		delta;			VectorCopy( markPoints[mf->firstPoint + j], v->xyz );			VectorSubtract( v->xyz, origin, delta );			v->st[0] = 0.5 + DotProduct( delta, axis[1] ) * texCoordScale;			v->st[1] = 0.5 + DotProduct( delta, axis[2] ) * texCoordScale;			*(int *)v->modulate = *(int *)colors;		}		// if it is a temporary (shadow) mark, add it immediately and forget about it		if ( temporary ) {			trap_R_AddPolyToScene( markShader, mf->numPoints, verts );			continue;//.........这里部分代码省略.........
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:101,


示例20: CG_AddMarks

void CG_AddMarks( void ) {	int			j;	markPoly_t	*mp, *next;	int			t;	int			fade;	if ( !cg_addMarks.integer ) {		return;	}	mp = cg_activeMarkPolys.nextMark;	for ( ; mp != &cg_activeMarkPolys ; mp = next ) {		// grab next now, so if the local entity is freed we		// still have it		next = mp->nextMark;		// see if it is time to completely remove it		if ( cg.time > mp->time + MARK_TOTAL_TIME ) {			CG_FreeMarkPoly( mp );			continue;		}		// fade out the energy bursts#ifdef IOQ3ZTM // IOQ3BUGFIX: Use alphaFade instead of shader num (As only energyMark used alphaFade)		if ( mp->alphaFade )#else		if ( mp->markShader == cgs.media.energyMarkShader )#endif		{			fade = 450 - 450 * ( (cg.time - mp->time ) / 3000.0 );			if ( fade < 255 ) {				if ( fade < 0 ) {					fade = 0;				}				if ( mp->verts[0].modulate[0] != 0 ) {					for ( j = 0 ; j < mp->numVerts ; j++ ) {						mp->verts[j].modulate[0] = mp->color[0] * fade;						mp->verts[j].modulate[1] = mp->color[1] * fade;						mp->verts[j].modulate[2] = mp->color[2] * fade;					}				}			}		}		// fade all marks out with time		t = mp->time + MARK_TOTAL_TIME - cg.time;		if ( t < MARK_FADE_TIME ) {			fade = 255 * t / MARK_FADE_TIME;			if ( mp->alphaFade ) {				for ( j = 0 ; j < mp->numVerts ; j++ ) {					mp->verts[j].modulate[3] = fade;				}			} else {				for ( j = 0 ; j < mp->numVerts ; j++ ) {					mp->verts[j].modulate[0] = mp->color[0] * fade;					mp->verts[j].modulate[1] = mp->color[1] * fade;					mp->verts[j].modulate[2] = mp->color[2] * fade;				}			}		}		trap_R_AddPolyToScene( mp->markShader, mp->numVerts, mp->verts, mp->bmodelNum, 0 );	}}
开发者ID:Extraordinary-Beat-X,项目名称:ebx-code,代码行数:66,


示例21: CG_AddMarks

void CG_AddMarks( void ) {	int			j, k;	markPoly_t	*mp, *next;	int			t;	int			fade;	if ( !cg_addMarks.integer ) {		return;	}	mp = cg_activeMarkPolys.nextMark;	for ( ; mp != &cg_activeMarkPolys ; mp = next ) {		// grab next now, so if the local entity is freed we		// still have it		next = mp->nextMark;		// see if it is time to completely remove it		if ( cg.time > mp->time + MARK_TOTAL_TIME ) {			CG_FreeMarkPoly( mp );			continue;		}		// fade out the energy bursts -- eh... don't/*		if ( mp->markShader == cgs.media.energyMarkShader ) {			fade = 450 - 450 * ( (cg.time - mp->time ) / 3000.0 );			if ( fade < 255 ) {				if ( fade < 0 ) {					fade = 0;				}				if ( mp->verts[0].modulate[0] != 0 ) {					for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {						mp->verts[j].modulate[0] = mp->color[0] * fade;						mp->verts[j].modulate[1] = mp->color[1] * fade;						mp->verts[j].modulate[2] = mp->color[2] * fade;					}				}			}		}*/		// trippy marks :)		if ( mp->markShader == cgs.media.energyMarkShader && cgs.valkyrMode ) {			k = ( mp->time / 4 + cg.time / 4 ) % 256;			for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {				mp->verts[j].modulate[0] = trippyColors[k].red;				mp->verts[j].modulate[1] = trippyColors[k].green;				mp->verts[j].modulate[2] = trippyColors[k].blue;			}		}		// fade all marks out with time		t = mp->time + MARK_TOTAL_TIME - cg.time;		if ( t < MARK_FADE_TIME ) {			fade = 255 * t / MARK_FADE_TIME;			if ( mp->alphaFade ) {				for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {					mp->verts[j].modulate[3] = fade;				}			} else {				for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {					mp->verts[j].modulate[0] = mp->color[0] * fade;					mp->verts[j].modulate[1] = mp->color[1] * fade;					mp->verts[j].modulate[2] = mp->color[2] * fade;				}			}		}		trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );	}}
开发者ID:linux26,项目名称:corkscrew,代码行数:73,


示例22: CG_ImpactMark

void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir, 				   float orientation, float red, float green, float blue, float alpha,				   qboolean alphaFade, float radius, qboolean temporary, int duration ) {	vec3_t			axis[3];	float			texCoordScale;	vec3_t			originalPoints[4];	byte			colors[4];	int				i, j;	int				numFragments;	markFragment_t	markFragments[MAX_MARK_FRAGMENTS], *mf;	vec5_t			markPoints[MAX_MARK_POINTS];	// Ridah, made it vec5_t so it includes S/T	vec3_t			projection;	int				multMaxFragments=1;	if ( !cg_markTime.integer ) {		return;	}	if ( radius <= 0 ) {		CG_Error( "CG_ImpactMark called with <= 0 radius" );	}	// Ridah, if no duration, use the default	if (duration < 0) {		if (duration == -2) {			multMaxFragments = -1;	// use original mapping		}//		duration = MARK_TOTAL_TIME;		duration = cg_markTime.integer;	}	// create the texture axis	VectorNormalize2( dir, axis[0] );	PerpendicularVector( axis[1], axis[0] );	RotatePointAroundVector( axis[2], axis[0], axis[1], orientation );	CrossProduct( axis[0], axis[2], axis[1] );	texCoordScale = 0.5 * 1.0 / radius;	// create the full polygon	for ( i = 0 ; i < 3 ; i++ ) {		originalPoints[0][i] = origin[i] - radius * axis[1][i] - radius * axis[2][i];		originalPoints[1][i] = origin[i] + radius * axis[1][i] - radius * axis[2][i];		originalPoints[2][i] = origin[i] + radius * axis[1][i] + radius * axis[2][i];		originalPoints[3][i] = origin[i] - radius * axis[1][i] + radius * axis[2][i];	}	// get the fragments	//VectorScale( dir, -20, projection );	VectorScale( dir, radius*2, projection );	numFragments = trap_CM_MarkFragments( (int)orientation, (void *)originalPoints,					projection, MAX_MARK_POINTS, (float *)&markPoints[0],					MAX_MARK_FRAGMENTS*multMaxFragments, markFragments );	colors[0] = red * 255;	colors[1] = green * 255;	colors[2] = blue * 255;	colors[3] = alpha * 255;	for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ ) {		polyVert_t	*v;		polyVert_t	verts[MAX_VERTS_ON_POLY];		markPoly_t	*mark;		qboolean	hasST;		// we have an upper limit on the complexity of polygons		// that we store persistantly		if ( mf->numPoints > MAX_VERTS_ON_POLY ) {			mf->numPoints = MAX_VERTS_ON_POLY;		}		if (mf->numPoints < 0) {			hasST = qtrue;			mf->numPoints *= -1;		} else {			hasST = qfalse;		}		for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ ) {			vec3_t		delta;			VectorCopy( markPoints[mf->firstPoint + j], v->xyz );			if (!hasST) {				VectorSubtract( v->xyz, origin, delta );				v->st[0] = 0.5 + DotProduct( delta, axis[1] ) * texCoordScale;				v->st[1] = 0.5 + DotProduct( delta, axis[2] ) * texCoordScale;			} else {				v->st[0] = markPoints[mf->firstPoint + j][3];				v->st[1] = markPoints[mf->firstPoint + j][4];			}			*(int *)v->modulate = *(int *)colors;		}		// if it is a temporary (shadow) mark, add it immediately and forget about it		if ( temporary ) {			trap_R_AddPolyToScene( markShader, mf->numPoints, verts );			continue;		}//.........这里部分代码省略.........
开发者ID:smiley22,项目名称:WolfBot,代码行数:101,


示例23: CG_SnowParticleRender

static void CG_SnowParticleRender(cg_atmosphericParticle_t * particle){	// Draw a snowflake	vec3_t forward, right;	polyVert_t verts[4];	vec2_t line;	float len, sinTumbling, cosTumbling, particleWidth;	vec3_t start, finish;	if (!particle->active)		return;	VectorCopy(particle->pos, start);	sinTumbling = sin(particle->pos[2] * 0.03125f);	cosTumbling = cos((particle->pos[2] + particle->pos[1]) * 0.03125f);	start[0] += 24 * (1 - particle->deltaNormalized[2]) * sinTumbling;	start[1] += 24 * (1 - particle->deltaNormalized[2]) * cosTumbling;	len = particle->height;	if (start[2] <= particle->minz) {		// Stop snow going through surfaces.		len = particle->height - particle->minz + start[2];//		frac = start[2];		VectorMA(start, len - particle->height, particle->deltaNormalized, start);	}	if (len <= 0)		return;	VectorCopy(particle->deltaNormalized, forward);	VectorMA(start, -(len * sinTumbling), forward, finish);	line[0] = DotProduct(forward, cg.refdef.viewaxis[1]);	line[1] = DotProduct(forward, cg.refdef.viewaxis[2]);	VectorScale(cg.refdef.viewaxis[1], line[1], right);	VectorMA(right, -line[0], cg.refdef.viewaxis[2], right);	VectorNormalize(right);	particleWidth = cosTumbling * particle->weight;	VectorMA(finish, particleWidth, right, verts[0].xyz);	verts[0].st[0] = 1;	verts[0].st[1] = 0;	verts[0].modulate[0] = 255;	verts[0].modulate[1] = 255;	verts[0].modulate[2] = 255;	verts[0].modulate[3] = 255;	VectorMA(finish, -particleWidth, right, verts[1].xyz);	verts[1].st[0] = 0;	verts[1].st[1] = 0;	verts[1].modulate[0] = 255;	verts[1].modulate[1] = 255;	verts[1].modulate[2] = 255;	verts[1].modulate[3] = 255;	VectorMA(start, -particleWidth, right, verts[2].xyz);	verts[2].st[0] = 0;	verts[2].st[1] = 1;	verts[2].modulate[0] = 255;	verts[2].modulate[1] = 255;	verts[2].modulate[2] = 255;	verts[2].modulate[3] = 255;	VectorMA(start, particleWidth, right, verts[3].xyz);	verts[3].st[0] = 1;	verts[3].st[1] = 1;	verts[3].modulate[0] = 255;	verts[3].modulate[1] = 255;	verts[3].modulate[2] = 255;	verts[3].modulate[3] = 255;	trap_R_AddPolyToScene(*particle->effectshader, 4, verts);}
开发者ID:Zekom,项目名称:reaction,代码行数:77,


示例24: CG_ImpactMark

void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir,                    float orientation, float red, float green, float blue, float alpha,                    bool alphaFade, float radius, bool temporary ){	vec3_t         axis[ 3 ];	float          texCoordScale;	vec3_t         originalPoints[ 4 ];	byte           colors[ 4 ];	int            i, j;	int            numFragments;	markFragment_t markFragments[ MAX_MARK_FRAGMENTS ], *mf;	vec3_t         markPoints[ MAX_MARK_POINTS ];	vec3_t         projection;	if ( !cg_addMarks.integer )	{		return;	}	if( temporary )	{		if( CG_CullPointAndRadius( origin, M_SQRT2 * radius ) )		{			return;		}	}	if ( radius <= 0 )	{		Com_Error(errorParm_t::ERR_DROP,  "CG_ImpactMark called with <= 0 radius" );	}	//if ( markTotal >= MAX_MARK_POLYS ) {	//  return;	//}	// create the texture axis	VectorNormalize2( dir, axis[ 0 ] );	PerpendicularVector( axis[ 1 ], axis[ 0 ] );	RotatePointAroundVector( axis[ 2 ], axis[ 0 ], axis[ 1 ], orientation );	CrossProduct( axis[ 0 ], axis[ 2 ], axis[ 1 ] );	texCoordScale = 0.5 * 1.0 / radius;	// create the full polygon	for ( i = 0; i < 3; i++ )	{		originalPoints[ 0 ][ i ] = origin[ i ] - radius * axis[ 1 ][ i ] - radius * axis[ 2 ][ i ];		originalPoints[ 1 ][ i ] = origin[ i ] + radius * axis[ 1 ][ i ] - radius * axis[ 2 ][ i ];		originalPoints[ 2 ][ i ] = origin[ i ] + radius * axis[ 1 ][ i ] + radius * axis[ 2 ][ i ];		originalPoints[ 3 ][ i ] = origin[ i ] - radius * axis[ 1 ][ i ] + radius * axis[ 2 ][ i ];	}	// get the fragments	VectorScale( dir, -20, projection );	numFragments = trap_CM_MarkFragments( 4, ( const vec3_t * ) originalPoints,	                                      projection, MAX_MARK_POINTS, markPoints[ 0 ],	                                      MAX_MARK_FRAGMENTS, markFragments );	colors[ 0 ] = red * 255;	colors[ 1 ] = green * 255;	colors[ 2 ] = blue * 255;	colors[ 3 ] = alpha * 255;	for ( i = 0, mf = markFragments; i < numFragments; i++, mf++ )	{		polyVert_t *v;		polyVert_t verts[ MAX_VERTS_ON_POLY ];		markPoly_t *mark;		// we have an upper limit on the complexity of polygons		// that we store persistently		if ( mf->numPoints > MAX_VERTS_ON_POLY )		{			mf->numPoints = MAX_VERTS_ON_POLY;		}		for ( j = 0, v = verts; j < mf->numPoints; j++, v++ )		{			vec3_t delta;			VectorCopy( markPoints[ mf->firstPoint + j ], v->xyz );			VectorSubtract( v->xyz, origin, delta );			v->st[ 0 ] = 0.5 + DotProduct( delta, axis[ 1 ] ) * texCoordScale;			v->st[ 1 ] = 0.5 + DotProduct( delta, axis[ 2 ] ) * texCoordScale;			* ( int * ) v->modulate = * ( int * ) colors;		}		// if it is a temporary (shadow) mark, add it immediately and forget about it		if ( temporary )		{			trap_R_AddPolyToScene( markShader, mf->numPoints, verts );			continue;		}		// otherwise save it persistently		mark = CG_AllocMark();		mark->time = cg.time;		mark->alphaFade = alphaFade;//.........这里部分代码省略.........
开发者ID:ChunHungLiu,项目名称:Unvanquished,代码行数:101,


示例25: CG_AddParticleToScene

//.........这里部分代码省略.........	}	// Ridah	else if (p->type == P_ANIM) {		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.0f) {			ratio = 0.9999f;		}		width = p->width + ( ratio * ( p->endwidth - p->width) );		height = p->height + ( ratio * ( p->endheight - p->height) );		// if we are "inside" this sprite, don't draw		if (Distance( cg.snap->ps.origin, org ) < width/1.5) {			return;		}		i = p->shaderAnim;		j = (int)floor(ratio * shaderAnimCounts[p->shaderAnim]);		p->pshader = shaderAnims[i][j];		if (p->roll) {			vectoangles( cg.refdef.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, pvup, point);				VectorMA (point, -width, pvright, point);			}		VectorCopy (point, verts[0].xyz);			verts[0].st[0] = 0;			verts[0].st[1] = 0;			verts[0].modulate[0] = 255;			verts[0].modulate[1] = 255;			verts[0].modulate[2] = 255;			verts[0].modulate[3] = 255;		if (p->roll) {			VectorMA (point, 2*height, ru, point);			} else {			VectorMA (point, 2*height, pvup, point);			}		VectorCopy (point, verts[1].xyz);			verts[1].st[0] = 0;			verts[1].st[1] = 1;			verts[1].modulate[0] = 255;			verts[1].modulate[1] = 255;			verts[1].modulate[2] = 255;			verts[1].modulate[3] = 255;			if (p->roll) {			VectorMA (point, 2*width, rr, point);			} else {			VectorMA (point, 2*width, pvright, point);			}		VectorCopy (point, verts[2].xyz);			verts[2].st[0] = 1;			verts[2].st[1] = 1;			verts[2].modulate[0] = 255;			verts[2].modulate[1] = 255;			verts[2].modulate[2] = 255;			verts[2].modulate[3] = 255;			if (p->roll) {			VectorMA (point, -2*height, ru, point);			} else {			VectorMA (point, -2*height, pvup, point);			}		VectorCopy (point, verts[3].xyz);			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;		}	// done.		if (!p->pshader) {// (SA) temp commented out for DM//		CG_Printf ("CG_AddParticleToScene type %d p->pshader == ZERO/n", p->type);		return;	}	if (p->type == P_WEATHER || p->type == P_WEATHER_TURBULENT || p->type == P_WEATHER_FLURRY)		trap_R_AddPolyToScene( p->pshader, 3, TRIverts );	else		trap_R_AddPolyToScene( p->pshader, 4, verts );}
开发者ID:mecwerks,项目名称:quake3-ios,代码行数:101,


示例26: CG_DrawBinaryShadersFinalPhases

/*================CG_DrawBinaryShadersFinalPhases================*/static void CG_DrawBinaryShadersFinalPhases(){	float      ss;	char       str[ 20 ];	float      f, l, u;	polyVert_t verts[ 4 ] =	{		{ { 0, 0, 0 }, { 0, 0 }, { 255, 255, 255, 255 } },		{ { 0, 0, 0 }, { 1, 0 }, { 255, 255, 255, 255 } },		{ { 0, 0, 0 }, { 1, 1 }, { 255, 255, 255, 255 } },		{ { 0, 0, 0 }, { 0, 1 }, { 255, 255, 255, 255 } }	};	if ( !cg.numBinaryShadersUsed )	{		return;	}	ss = cg_binaryShaderScreenScale.value;	if ( ss <= 0.0f )	{		cg.numBinaryShadersUsed = 0;		return;	}	else if ( ss > 1.0f )	{		ss = 1.0f;	}	ss = sqrt( ss );	trap_Cvar_VariableStringBuffer( "r_znear", str, sizeof( str ) );	f = atof( str ) + 0.01;	l = f * tan( DEG2RAD( cg.refdef.fov_x / 2 ) ) * ss;	u = f * tan( DEG2RAD( cg.refdef.fov_y / 2 ) ) * ss;	VectorMA( cg.refdef.vieworg, f, cg.refdef.viewaxis[ 0 ], verts[ 0 ].xyz );	VectorMA( verts[ 0 ].xyz, l, cg.refdef.viewaxis[ 1 ], verts[ 0 ].xyz );	VectorMA( verts[ 0 ].xyz, u, cg.refdef.viewaxis[ 2 ], verts[ 0 ].xyz );	VectorMA( verts[ 0 ].xyz, -2 * l, cg.refdef.viewaxis[ 1 ], verts[ 1 ].xyz );	VectorMA( verts[ 1 ].xyz, -2 * u, cg.refdef.viewaxis[ 2 ], verts[ 2 ].xyz );	VectorMA( verts[ 0 ].xyz, -2 * u, cg.refdef.viewaxis[ 2 ], verts[ 3 ].xyz );	trap_R_AddPolyToScene( cgs.media.binaryAlpha1Shader, 4, verts );	for ( int i = 0; i < cg.numBinaryShadersUsed; ++i )	{		for ( int j = 0; j < 4; ++j )		{			auto alpha = verts[ j ].modulate[ 3 ];			cg.binaryShaderSettings[ i ].color.ToArray( verts[ j ].modulate );			verts[ j ].modulate[ 3 ] = alpha;		}		if ( cg.binaryShaderSettings[ i ].drawFrontline )		{			trap_R_AddPolyToScene( cgs.media.binaryShaders[ i ].f3, 4, verts );		}		if ( cg.binaryShaderSettings[ i ].drawIntersection )		{			trap_R_AddPolyToScene( cgs.media.binaryShaders[ i ].b3, 4, verts );		}	}	cg.numBinaryShadersUsed = 0;}
开发者ID:t4im,项目名称:Unvanquished,代码行数:73,


示例27: CG_AddParticleToScene

//.........这里部分代码省略.........		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;		verts[0].st[1]       = 0;		verts[0].modulate[0] = 255;		verts[0].modulate[1] = 255;		verts[0].modulate[2] = 255;		verts[0].modulate[3] = 255;		if (p->roll)		{			VectorMA(point, 2 * height, ru, point);		}		else		{			VectorMA(point, 2 * height, vup, point);		}		VectorCopy(point, verts[1].xyz);		verts[1].st[0]       = 0;		verts[1].st[1]       = 1;		verts[1].modulate[0] = 255;		verts[1].modulate[1] = 255;		verts[1].modulate[2] = 255;		verts[1].modulate[3] = 255;		if (p->roll)		{			VectorMA(point, 2 * width, rr, point);		}		else		{			VectorMA(point, 2 * width, vright, point);		}		VectorCopy(point, verts[2].xyz);		verts[2].st[0]       = 1;		verts[2].st[1]       = 1;		verts[2].modulate[0] = 255;		verts[2].modulate[1] = 255;		verts[2].modulate[2] = 255;		verts[2].modulate[3] = 255;		if (p->roll)		{			VectorMA(point, -2 * height, ru, point);		}		else		{			VectorMA(point, -2 * height, vup, point);		}		VectorCopy(point, verts[3].xyz);		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;	}	break;	default:		break;	}	if (!cg_wolfparticles.integer)	{		return;	}	if (!p->pshader)	{		CG_Printf("CG_AddParticleToScene type %d p->pshader == ZERO/n", p->type);		return;	}	if (p->type == P_WEATHER || p->type == P_WEATHER_TURBULENT || p->type == P_WEATHER_FLURRY)	{		trap_R_AddPolyToScene(p->pshader, 3, TRIverts);	}	else	{		trap_R_AddPolyToScene(p->pshader, 4, verts);	}}
开发者ID:etlegacy,项目名称:etlegacy,代码行数:101,


示例28: CG_AddTrailToScene

void CG_AddTrailToScene(trailJunc_t *trail, int iteration, int numJuncs){#define MAX_TRAIL_VERTS     2048	polyVert_t verts[MAX_TRAIL_VERTS];	polyVert_t outVerts[MAX_TRAIL_VERTS * 3];	int k, i, n, l, numOutVerts;	polyVert_t mid;	float mod[4];	float sInc = 0.0f, s = 0.0f;   // TTimo: init	trailJunc_t *j, *jNext;	vec3_t fwd, up, p, v;	(void)fwd; // Ignore compiler warning -- Justasic	// clipping vars#define TRAIL_FADE_CLOSE_DIST   64.0#define TRAIL_FADE_FAR_SCALE    4.0	vec3_t viewProj;	float viewDist, fadeAlpha;	// add spark shader at head position	if(trail->flags & TJFL_SPARKHEADFLARE)	{		j = trail;		VectorCopy(j->pos, p);		VectorMA(p, -j->width * 2, vup, p);		VectorMA(p, -j->width * 2, vright, p);		VectorCopy(p, verts[0].xyz);		verts[0].st[0] = 0;		verts[0].st[1] = 0;		verts[0].modulate[0] = 255;		verts[0].modulate[1] = 255;		verts[0].modulate[2] = 255;		verts[0].modulate[3] = (unsigned char)(j->alpha * 255.0);		VectorCopy(j->pos, p);		VectorMA(p, -j->width * 2, vup, p);		VectorMA(p, j->width * 2, vright, p);		VectorCopy(p, verts[1].xyz);		verts[1].st[0] = 0;		verts[1].st[1] = 1;		verts[1].modulate[0] = 255;		verts[1].modulate[1] = 255;		verts[1].modulate[2] = 255;		verts[1].modulate[3] = (unsigned char)(j->alpha * 255.0);		VectorCopy(j->pos, p);		VectorMA(p, j->width * 2, vup, p);		VectorMA(p, j->width * 2, vright, p);		VectorCopy(p, verts[2].xyz);		verts[2].st[0] = 1;		verts[2].st[1] = 1;		verts[2].modulate[0] = 255;		verts[2].modulate[1] = 255;		verts[2].modulate[2] = 255;		verts[2].modulate[3] = (unsigned char)(j->alpha * 255.0);		VectorCopy(j->pos, p);		VectorMA(p,  j->width * 2, vup, p);		VectorMA(p, -j->width * 2, vright, p);		VectorCopy(p, verts[3].xyz);		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] = (unsigned char)(j->alpha * 255.0);		trap_R_AddPolyToScene(cgs.media.sparkFlareShader, 4, verts);	}//	if (trail->flags & TJFL_CROSSOVER && iteration < 1) {//		iteration = 1;//	}	if(!numJuncs)	{		// first count the number of juncs in the trail		j = trail;		numJuncs = 0;		sInc = 0;		while(j)		{			numJuncs++;			// check for a dead next junc			if(!j->inuse && j->nextJunc && !j->nextJunc->inuse)			{				CG_KillTrail(j);			}			else if(j->nextJunc && j->nextJunc->freed)			{				// not sure how this can happen, but it does, and causes infinite loops				j->nextJunc = NULL;			}			if(j->nextJunc)			{				sInc += VectorDistance(j->nextJunc->pos, j->pos);			}//.........这里部分代码省略.........
开发者ID:Diskutant,项目名称:RTCW-SP,代码行数:101,


示例29: CG_Spotlight

//.........这里部分代码省略.........	VectorSubtract( endCenter, endvec, coreverts[3].xyz );    // get a vector of the radius out at the end for the core to use	coreEndRadius = VectorLength( coreverts[3].xyz );#define CORESCALE 0.6f////	generate the flat beam 'core'//	if ( !( flags & SL_NOCORE ) ) {		VectorSubtract( start, cg.refdef.vieworg, v1 );		VectorNormalize( v1 );		VectorSubtract( traceEnd, cg.refdef.vieworg, v2 );		VectorNormalize( v2 );		CrossProduct( v1, v2, coreright );		VectorNormalize( coreright );		memset( &coreverts[0], 0, 4 * sizeof( polyVert_t ) );		VectorMA( start, startWidth * 0.5f, coreright, coreverts[0].xyz );		VectorMA( start, -startWidth * 0.5f, coreright, coreverts[1].xyz );		VectorMA( endCenter, -coreEndRadius * CORESCALE, coreright, coreverts[2].xyz );		VectorAdd( start, coreverts[2].xyz, coreverts[2].xyz );		VectorMA( endCenter, coreEndRadius * CORESCALE, coreright, coreverts[3].xyz );		VectorAdd( start, coreverts[3].xyz, coreverts[3].xyz );		for ( i = 0; i < 4; i++ ) {			coreverts[i].modulate[0] = color[0] * 200.0f;			coreverts[i].modulate[1] = color[1] * 200.0f;			coreverts[i].modulate[2] = color[2] * 200.0f;			coreverts[i].modulate[3] = color[3] * 200.0f;			if ( i > 1 ) {				coreverts[i].modulate[3] = 0;			}		}		trap_R_AddPolyToScene( cgs.media.spotLightBeamShader, 4, &coreverts[0] );	}//// generate the beam cylinder//	for ( i = 0; i <= segs; i++ ) {		RotatePointAroundVector( start_points[i], lightDir, startvec, ( 360.0f / (float)segs ) * i );		VectorAdd( start_points[i], start, start_points[i] );		RotatePointAroundVector( end_points[i], lightDir, endvec, ( 360.0f / (float)segs ) * i );		VectorAdd( end_points[i], start, end_points[i] );	}	for ( i = 0; i < segs; i++ ) {		j = ( i * 4 );		VectorCopy( start_points[i], verts[( i * 4 )].xyz );		verts[j].st[0]  = 0;		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;		j++;		VectorCopy( end_points[i], verts[j].xyz );		verts[j].st[0]  = 0;
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:67,



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


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