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


C++ R_GetShaderByHandle函数代码示例

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


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

示例1: RE_AddDynamicLightToScene

/*
=====================
RE_AddDynamicLightToScene

=====================
*/
void RE_AddDynamicLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, int flags, qhandle_t hShader ) {
	dlight_t	*dl;

	// early out
	if ( !tr.registered || r_numdlights >= MAX_DLIGHTS || radius <= 0 || intensity <= 0 ) {
		return;
	}

	// RF, allow us to force some dlights under all circumstances
	if ( !( flags & REF_FORCE_DLIGHT ) ) {
		if ( r_dynamiclight->integer == 0 ) {
			return;
		}
	}

	// set up a new dlight
	dl = &backEndData->dlights[ r_numdlights++ ];
	VectorCopy( org, dl->origin );
	VectorCopy( org, dl->transformed );
	dl->radius = radius;
	dl->radiusInverseCubed = ( 1.0 / dl->radius );
	dl->radiusInverseCubed = dl->radiusInverseCubed * dl->radiusInverseCubed * dl->radiusInverseCubed;
	dl->intensity = intensity;
	dl->color[ 0 ] = r;
	dl->color[ 1 ] = g;
	dl->color[ 2 ] = b;
	dl->flags = flags;
	if ( hShader ) {
		dl->dlshader = R_GetShaderByHandle( hShader );
	} else {
		dl->dlshader = NULL;
	}
}
开发者ID:DaneTheory,项目名称:spearmint,代码行数:39,代码来源:tr_scene.c

示例2: RE_StretchPicGradient

/*
==============
RE_StretchPicGradient
==============
*/
void RE_StretchPicGradient( float x, float y, float w, float h,
                            float s1, float t1, float s2, float t2,
                            qhandle_t hShader, const Color::Color& gradientColor,
                            int gradientType )
{
	stretchPicCommand_t *cmd;

	cmd = (stretchPicCommand_t*) R_GetCommandBuffer( sizeof( *cmd ) );

	if ( !cmd )
	{
		return;
	}

	cmd->commandId = renderCommand_t::RC_STRETCH_PIC_GRADIENT;
	cmd->shader = R_GetShaderByHandle( hShader );
	cmd->x = x;
	cmd->y = y;
	cmd->w = w;
	cmd->h = h;
	cmd->s1 = s1;
	cmd->t1 = t1;
	cmd->s2 = s2;
	cmd->t2 = t2;

	cmd->gradientColor = gradientColor;
	cmd->gradientType = gradientType;
}
开发者ID:ChunHungLiu,项目名称:Unvanquished,代码行数:33,代码来源:tr_cmds.cpp

示例3: RE_2DPolyies

void RE_2DPolyies(polyVert_t *verts, int numverts, qhandle_t hShader)
{
#if 0
	poly2dCommand_t *cmd;

	if (r_numpolyverts + numverts > max_polyverts)
	{
		return;
	}

	cmd = R_GetCommandBuffer(sizeof(*cmd));
	if (!cmd)
	{
		return;
	}

	cmd->commandId = RC_2DPOLYS;
	cmd->verts     = &backEndData->polyVerts[r_numpolyverts];
	cmd->numverts  = numverts;
	memcpy(cmd->verts, verts, sizeof(polyVert_t) * numverts);
	cmd->shader = R_GetShaderByHandle(hShader);

	r_numpolyverts += numverts;
#endif
}
开发者ID:sxweet,项目名称:etlegacy,代码行数:25,代码来源:tr_cmds.c

示例4: RE_AddDynamicLightToSceneET

/*
=====================
RE_AddDynamicLightToScene

modified dlight system to support seperate radius and intensity
=====================
*/
void RE_AddDynamicLightToSceneET(const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags)
{
	trRefLight_t *light;

	if (!tr.registered)
	{
		return;
	}

	if (r_numLights >= MAX_REF_LIGHTS)
	{
		return;
	}

	if (intensity <= 0 || radius <= 0)
	{
		return;
	}

	light = &backEndData[tr.smpFrame]->lights[r_numLights++];

	light->l.rlType = RL_OMNI;
	//light->l.lightfx = 0;
	VectorCopy(org, light->l.origin);

	QuatClear(light->l.rotation);
	VectorClear(light->l.center);

	// HACK: this will tell the renderer backend to use tr.defaultLightShader
#if 0
	dl->shader = R_GetShaderByHandle(hShader);
	if (dl->shader == tr.defaultShader)
	{
		dl->shader = NULL;
	}
#endif
	light->l.attenuationShader = 0;

	light->l.radius[0] = radius;
	light->l.radius[1] = radius;
	light->l.radius[2] = radius;

	light->l.color[0] = r;
	light->l.color[1] = g;
	light->l.color[2] = b;

	light->l.noShadows      = r_dynamicLightCastShadows->integer ? qfalse : qtrue;
	light->l.inverseShadows = qfalse;

	light->isStatic = qfalse;
	light->additive = qtrue;

	light->l.scale = intensity;
#if 0
	if (light->l.scale <= r_lightScale->value)
	{
		light->l.scale = r_lightScale->value;
	}
#endif
}
开发者ID:Mailaender,项目名称:etlegacy,代码行数:67,代码来源:tr_scene.c

示例5: RE_StretchPic

/*
=============
RE_StretchPic
=============
*/
void RE_StretchPic ( float x, float y, float w, float h, 
					  float s1, float t1, float s2, float t2, qhandle_t hShader ) {
	stretchPicCommand_t	*cmd;
	//void *p0 = __builtin_return_address(0);
	//printf("RE_StretchPic: %08x\n", p0);

  if (!tr.registered) {
    return;
  }

  //printf("RE_StretchPic %3.2f %3.2f %3.2f %3.2f\n%1.3f %1.3f %1.3f %1.3f\n",x,y,w,h,s1,t1,s2,t2);

	cmd = R_GetCommandBuffer( sizeof( *cmd ) );
	if ( !cmd ) {
		return;
	}
	cmd->commandId = RC_STRETCH_PIC;
	cmd->shader = R_GetShaderByHandle( hShader );
	cmd->x = x;
	cmd->y = y;
	cmd->w = w;
	cmd->h = h;
	cmd->s1 = s1;
	cmd->t1 = t1;
	cmd->s2 = s2;
	cmd->t2 = t2;
}
开发者ID:elhobbs,项目名称:quake3,代码行数:32,代码来源:tr_cmds.c

示例6: RE_StretchPic

/*
=============
RE_StretchPic
=============
*/
void RE_StretchPic ( float x, float y, float w, float h, 
					  float s1, float t1, float s2, float t2, qhandle_t hShader ) {
	stretchPicCommand_t	*cmd;

	if (!tr.registered) {
		return;
	}
	if (R_ClipRegion(&x, &y, &w, &h, &s1, &t1, &s2, &t2)) {
		return;
	}
	cmd = R_GetCommandBuffer( sizeof( *cmd ) );
	if ( !cmd ) {
		return;
	}
	cmd->commandId = RC_STRETCH_PIC;
	cmd->shader = R_GetShaderByHandle( hShader );
	cmd->x = x;
	cmd->y = y;
	cmd->w = w;
	cmd->h = h;
	cmd->s1 = s1;
	cmd->t1 = t1;
	cmd->s2 = s2;
	cmd->t2 = t2;
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:30,代码来源:tr_cmds.c

示例7: RE_2DPolyiesIndexed

void RE_2DPolyiesIndexed( polyVert_t *verts, int numverts, int *indexes, int numindexes, int trans_x, int trans_y, qhandle_t hShader )
{
	poly2dIndexedCommand_t *cmd;

	if ( r_numPolyVerts + numverts > r_maxPolyVerts->integer )
	{
		return;
	}

	if ( r_numPolyIndexes + numindexes > r_maxPolyVerts->integer )
	{
		return;
	}

	cmd = (poly2dIndexedCommand_t*) R_GetCommandBuffer( sizeof( *cmd ) );

	if ( !cmd )
	{
		return;
	}

	cmd->commandId = RC_2DPOLYSINDEXED;
	cmd->verts = &backEndData[ tr.smpFrame ]->polyVerts[ r_numPolyVerts ];
	cmd->numverts = numverts;
	memcpy( cmd->verts, verts, sizeof( polyVert_t ) * numverts );
	cmd->shader = R_GetShaderByHandle( hShader );
	cmd->indexes = &backEndData[ tr.smpFrame ]->polyIndexes[ r_numPolyIndexes ];
	memcpy( cmd->indexes, indexes, sizeof( int ) * numindexes );
	cmd->numIndexes = numindexes;
	cmd->translation[ 0 ] = trans_x;
	cmd->translation[ 1 ] = trans_y;

	r_numPolyVerts += numverts;
	r_numPolyIndexes += numindexes;
}
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:35,代码来源:tr_cmds.cpp

示例8: RE_RotatedPic

/*
=============
RE_RotatedPic
=============
*/
void RE_RotatedPic( float x, float y, float w, float h,
					float s1, float t1, float s2, float t2, qhandle_t hShader, float angle ) {
	stretchPicCommand_t *cmd;

	cmd = R_GetCommandBuffer( sizeof( *cmd ) );
	if ( !cmd ) {
		return;
	}
	cmd->commandId = RC_ROTATED_PIC;
	cmd->shader = R_GetShaderByHandle( hShader );
	cmd->x = x;
	cmd->y = y;
	cmd->w = w;
	cmd->h = h;

	// fixup
	cmd->w /= 2;
	cmd->h /= 2;
	cmd->x += cmd->w;
	cmd->y += cmd->h;
	cmd->w = sqrt( ( cmd->w * cmd->w ) + ( cmd->h * cmd->h ) );
	cmd->h = cmd->w;

	cmd->angle = angle;
	cmd->s1 = s1;
	cmd->t1 = t1;
	cmd->s2 = s2;
	cmd->t2 = t2;
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:34,代码来源:tr_cmds.c

示例9: RE_StretchPicGradient

/*
==============
RE_StretchPicGradient
==============
*/
void RE_StretchPicGradient( float x, float y, float w, float h,
							float s1, float t1, float s2, float t2, qhandle_t hShader, const float *gradientColor, int gradientType ) {
	stretchPicCommand_t *cmd;

	cmd = R_GetCommandBuffer( sizeof( *cmd ) );
	if ( !cmd ) {
		return;
	}
	cmd->commandId = RC_STRETCH_PIC_GRADIENT;
	cmd->shader = R_GetShaderByHandle( hShader );
	cmd->x = x;
	cmd->y = y;
	cmd->w = w;
	cmd->h = h;
	cmd->s1 = s1;
	cmd->t1 = t1;
	cmd->s2 = s2;
	cmd->t2 = t2;

	if ( !gradientColor ) {
		static float colorWhite[4] = { 1, 1, 1, 1 };

		gradientColor = colorWhite;
	}

	cmd->gradientColor[0] = gradientColor[0] * 255;
	cmd->gradientColor[1] = gradientColor[1] * 255;
	cmd->gradientColor[2] = gradientColor[2] * 255;
	cmd->gradientColor[3] = gradientColor[3] * 255;
	cmd->gradientType = gradientType;
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:36,代码来源:tr_cmds.c

示例10: RE_StretchPic

void Q_EXTERNAL_CALL RE_StretchPic( float x, float y, float w, float h, 
	float mat[2][3], float s1, float t1, float s2, float t2, qhandle_t hShader )
{
	stretchPicCommand_t	*cmd;

	if( !tr.registered )
		return;

	cmd = R_GetCommandBuffer( RB_StretchPic, sizeof( *cmd ) );
	if( !cmd )
		return;

	cmd->shader = R_GetShaderByHandle( hShader );

	cmd->x = x;
	cmd->y = y;
	cmd->w = w;
	cmd->h = h;
	cmd->s1 = s1;
	cmd->t1 = t1;
	cmd->s2 = s2;
	cmd->t2 = t2;

	if( mat )
		Com_Memcpy( cmd->mat, mat, sizeof( cmd->mat ) );
	else
	{
		cmd->mat[0][0] = 1.0F;	cmd->mat[0][1] = 0.0F;	cmd->mat[0][2] = 0.0F;
		cmd->mat[1][0] = 0.0F;	cmd->mat[1][1] = 1.0F;	cmd->mat[1][2] = 0.0F;
	}
}
开发者ID:ballju,项目名称:SpaceTrader-GPL-1.1.14,代码行数:31,代码来源:tr_backend.c

示例11: RE_AddLightToScene

/*
=====================
RE_AddLightToScene

=====================
*/
void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) {
	dlight_t    *dl;

	if ( !tr.registered ) {
		return;
	}
	if ( r_numdlights >= MAX_DLIGHTS ) {
		return;
	}
	if ( intensity <= 0 ) {
		return;
	}
	// these cards don't have the correct blend mode
	if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
		return;
	}
	// RF, allow us to force some dlights under all circumstances
	if ( !( overdraw & REF_FORCE_DLIGHT ) ) {
		if ( r_dynamiclight->integer == 0 ) {
			return;
		}
		if ( r_dynamiclight->integer == 2 && !( backEndData[tr.smpFrame]->dlights[r_numdlights].forced ) ) {
			return;
		}
	}

	overdraw &= ~REF_FORCE_DLIGHT;
	overdraw &= ~REF_JUNIOR_DLIGHT; //----(SA)	added

	dl = &backEndData[tr.smpFrame]->dlights[r_numdlights++];
	VectorCopy( org, dl->origin );
	dl->radius = intensity;
	dl->color[0] = r;
	dl->color[1] = g;
	dl->color[2] = b;
	dl->dlshader = NULL;
	dl->overdraw = 0;

	if ( overdraw == 10 ) { // sorry, hijacking 10 for a quick hack (SA)
		dl->dlshader = R_GetShaderByHandle( RE_RegisterShader( "negdlightshader" ) );
	} else if ( overdraw == 11 ) { // 11 is flames
		dl->dlshader = R_GetShaderByHandle( RE_RegisterShader( "flamedlightshader" ) );
	} else {
		dl->overdraw = overdraw;
	}
}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:52,代码来源:tr_scene.c

示例12: G2_TraceModels

void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, CCollisionRecord *collRecMap, int entNum, EG2_Collision eG2TraceType, int useLod, float fRadius)
{
	int				i, lod;
	skin_t			*skin;
	shader_t		*cust_shader;

	// walk each possible model for this entity and try tracing against it
	for (i=0; i<ghoul2.size(); i++)
	{
		// don't bother with models that we don't care about.
		if (!ghoul2[i].mValid)
		{
			continue;
		}
		assert(G2_MODEL_OK(&ghoul2[i]));
		// do we really want to collide with this object?
		if (ghoul2[i].mFlags & GHOUL2_NOCOLLIDE) 
		{
			continue;
		}
		
		if (ghoul2[i].mCustomShader)
		{
			cust_shader = R_GetShaderByHandle(ghoul2[i].mCustomShader );
		}
		else
		{
			cust_shader = NULL;
		}

		// figure out the custom skin thing
		if ( ghoul2[i].mSkin > 0 && ghoul2[i].mSkin < tr.numSkins ) 
		{
			skin = R_GetSkinByHandle( ghoul2[i].mSkin );
		}
		else
		{
			skin = NULL;
		}

		lod = G2_DecideTraceLod(ghoul2[i],useLod);

		//reset the quick surface override lookup
		G2_FindOverrideSurface(-1, ghoul2[i].mSlist); 

		CTraceSurface TS(ghoul2[i].mSurfaceRoot, ghoul2[i].mSlist,  ghoul2[i].currentModel, lod, rayStart, rayEnd, collRecMap, entNum, i, skin, cust_shader, ghoul2[i].mTransformedVertsArray, eG2TraceType, fRadius);
		// start the surface recursion loop
		G2_TraceSurfaces(TS);

		// if we've hit one surface on one model, don't bother doing the rest
		if (TS.hitOne)
		{
			break;
		}
	}
}
开发者ID:Ced2911,项目名称:massive-tyrion,代码行数:56,代码来源:g2_misc.cpp

示例13: R_AddPolygonSurfaces

void R_AddPolygonSurfaces()
{
    tr.currentEntityNum = ENTITYNUM_WORLD;
    tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT;

    const srfPoly_t* poly = tr.refdef.polys;
    for (int i = 0; i < tr.refdef.numPolys; ++i, ++poly) {
        R_AddDrawSurf( (const surfaceType_t*)poly, R_GetShaderByHandle( poly->hShader ), poly->fogIndex );
    }
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:10,代码来源:tr_scene.cpp

示例14: R_AddPolygonSurfaces

/*
=====================
R_AddPolygonSurfaces

Adds all the scene's polys into this view's drawsurf list
=====================
*/
void R_AddPolygonSurfaces( void ) {
	int			i;
	shader_t	*sh;
	srfPoly_t	*poly;

	tr.currentEntityNum = ENTITYNUM_WORLD;
	tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT;

	for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) {
		sh = R_GetShaderByHandle( poly->hShader );
		R_AddDrawSurf( reinterpret_cast<surfaceType_t*>(poly), sh, poly->fogIndex, false );
	}
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:20,代码来源:tr_scene.c

示例15: R_AddPolygonSurfaces

/*
=====================
R_AddPolygonSurfaces

Adds all the scene's polys into this view's drawsurf list
=====================
*/
void R_AddPolygonSurfaces( void ) {
	int			i;
	shader_t	*sh;
	srfPoly_t	*poly;

	tr.currentEntityNum = REFENTITYNUM_WORLD;
	tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;

	for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) {
		sh = R_GetShaderByHandle( poly->hShader );
		R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex, qfalse );
	}
}
开发者ID:OpenArena,项目名称:engine,代码行数:20,代码来源:tr_scene.c


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