• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ R_AddDrawSurf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: sizeof

/*
================
EmitSurface
================
*/
void idGuiModel::EmitSurface( guiModelSurface_t *surf, float modelMatrix[16], float modelViewMatrix[16], bool depthHack ) {
	srfTriangles_t	*tri;
	if( surf->numVerts == 0 ) {
		return;		// nothing in the surface
	}
	// copy verts and indexes
	tri = ( srfTriangles_t * )R_ClearedFrameAlloc( sizeof( *tri ) );
	tri->numIndexes = surf->numIndexes;
	tri->numVerts = surf->numVerts;
	tri->indexes = ( glIndex_t * )R_FrameAlloc( tri->numIndexes * sizeof( tri->indexes[0] ) );
	memcpy( tri->indexes, &indexes[surf->firstIndex], tri->numIndexes * sizeof( tri->indexes[0] ) );
	// we might be able to avoid copying these and just let them reference the list vars
	// but some things, like deforms and recursive
	// guis, need to access the verts in cpu space, not just through the vertex range
	tri->verts = ( idDrawVert * )R_FrameAlloc( tri->numVerts * sizeof( tri->verts[0] ) );
	memcpy( tri->verts, &verts[surf->firstVert], tri->numVerts * sizeof( tri->verts[0] ) );
	// move the verts to the vertex cache
	tri->ambientCache = vertexCache.AllocFrameTemp( tri->verts, tri->numVerts * sizeof( tri->verts[0] ) );
	// if we are out of vertex cache, don't create the surface
	if( !tri->ambientCache ) {
		return;
	}
	renderEntity_t renderEntity;
	memset( &renderEntity, 0, sizeof( renderEntity ) );
	memcpy( renderEntity.shaderParms, surf->color, sizeof( surf->color ) );
	viewEntity_t *guiSpace = ( viewEntity_t * )R_ClearedFrameAlloc( sizeof( *guiSpace ) );
	memcpy( guiSpace->modelMatrix, modelMatrix, sizeof( guiSpace->modelMatrix ) );
	memcpy( guiSpace->modelViewMatrix, modelViewMatrix, sizeof( guiSpace->modelViewMatrix ) );
	guiSpace->weaponDepthHack = depthHack;
	// add the surface, which might recursively create another gui
	R_AddDrawSurf( tri, guiSpace, &renderEntity, surf->material, tr.viewDef->scissor );
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:37,代码来源:GuiModel.cpp


示例2: AddDecalSurface

/*
AddDecalSurface()
    adds a decal surface to the scene
*/
void R_AddDecalSurface(decal_t *decal)
{
	int dlightMap;

	srfDecal_t   *srf;
	srfGeneric_t *gen;

	/* early outs */
	if (decal->shader == NULL || decal->parent->viewCount != tr.viewCount || r_firstSceneDecal + tr.refdef.numDecals >= MAX_DECALS)
	{
		return;
	}

	/* get decal surface */
	srf = &tr.refdef.decals[tr.refdef.numDecals];
	tr.refdef.numDecals++;

	/* set it up */
	srf->surfaceType = SF_DECAL;
	srf->numVerts    = decal->numVerts;
	Com_Memcpy(srf->verts, decal->verts, srf->numVerts * sizeof(*srf->verts));

	/* fade colors */
	if (decal->fadeStartTime < tr.refdef.time && decal->fadeStartTime < decal->fadeEndTime)
	{
		int   i;
		float fade = (float) (decal->fadeEndTime - tr.refdef.time) /
		             (float) (decal->fadeEndTime - decal->fadeStartTime);

		for (i = 0; i < decal->numVerts; i++)
		{
			decal->verts[i].modulate[0] *= fade;
			decal->verts[i].modulate[1] *= fade;
			decal->verts[i].modulate[2] *= fade;
			decal->verts[i].modulate[3] *= fade;
		}
	}

	/* dynamic lights? */
	if (decal->parent != NULL)
	{
		gen       = (srfGeneric_t *) decal->parent->data;
		dlightMap = (gen->dlightBits != 0);
	}
	else
	{
		dlightMap = 0;
	}

	/* add surface to scene */
	R_AddDrawSurf((void *) srf, decal->shader, decal->fogIndex, 0, dlightMap);
	tr.pc.c_decalSurfaces++;

	/* free temporary decal */
	if (decal->fadeEndTime <= tr.refdef.time)
	{
		decal->shader = NULL;
	}
}
开发者ID:winrid,项目名称:etlegacy,代码行数:63,代码来源:tr_decals.c


示例3: AddDecalSurface

/*
AddDecalSurface()
adds a decal surface to the scene
*/
void R_AddDecalSurface(decal_t *decal)
{
	int        i;     //, dlightMap;
	float      fade;
	srfDecal_t *srf;
	//srfGeneric_t   *gen;

	// early outs
	if (decal->shader == NULL || decal->parent->viewCount != tr.viewCountNoReset || tr.refdef.numDecals >= MAX_DECALS)
	{
		return;
	}

	// get decal surface
	srf = &tr.refdef.decals[tr.refdef.numDecals];
	tr.refdef.numDecals++;

	// set it up
	srf->surfaceType = SF_DECAL;
	srf->numVerts    = decal->numVerts;
	Com_Memcpy(srf->verts, decal->verts, srf->numVerts * sizeof(*srf->verts));

	// fade colors
	if (decal->fadeStartTime < tr.refdef.time && decal->fadeStartTime < decal->fadeEndTime)
	{
		fade = (float)(decal->fadeEndTime - tr.refdef.time) / (float)(decal->fadeEndTime - decal->fadeStartTime);
		for (i = 0; i < decal->numVerts; i++)
		{
			decal->verts[i].modulate[0] *= fade;
			decal->verts[i].modulate[1] *= fade;
			decal->verts[i].modulate[2] *= fade;
			decal->verts[i].modulate[3] *= fade;
		}
	}

	// dynamic lights?
	/*
	if(decal->parent != NULL)
	{
	    gen = (srfGeneric_t *) decal->parent->data;
	    dlightMap = (gen->dlightBits[tr.smpFrame] != 0);
	}
	else
	{
	    dlightMap = 0;
	}
	*/

	// add surface to scene
	//R_AddDrawSurf((void *)srf, decal->shader, decal->fogIndex, 0, dlightMap);
	R_AddDrawSurf((surfaceType_t *)srf, decal->shader, -1, decal->fogIndex);
	tr.pc.c_decalSurfaces++;

	// free temporary decal
	if (decal->fadeEndTime <= tr.refdef.time)
	{
		decal->shader = NULL;
	}
}
开发者ID:Mailaender,项目名称:etlegacy,代码行数:63,代码来源:tr_decals.c


示例4: 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


示例5: 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( ( surfaceType_t * )poly, sh, poly->fogIndex, qfalse ); // ***GREGS_VC9_PORT_MOD*** -- changed typecast; was void *
	}
}
开发者ID:mtrencseni,项目名称:quake3,代码行数:20,代码来源:tr_scene.c


示例6: 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


示例7: 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


示例8: R_AddPolygonBufferSurfaces

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

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

    tr.currentEntity = &tr.worldEntity;

    for (i = 0, polybuffer = tr.refdef.polybuffers; i < tr.refdef.numPolybuffers;
         i++, polybuffer++) {
        sh = R_GetShaderByHandle(polybuffer->pPolyBuffer->shader);

        R_AddDrawSurf((surfaceType_t*) polybuffer, sh, -1, polybuffer->fogIndex);
    }
}
开发者ID:Kangz,项目名称:Unvanquished,代码行数:21,代码来源:tr_scene.cpp


示例9: R_AddPolygonBufferSurfaces

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

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

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

	for ( i = 0, polybuffer = tr.refdef.polybuffers; i < tr.refdef.numPolyBuffers ; i++, polybuffer++ ) {
		sh = R_GetShaderByHandle( polybuffer->pPolyBuffer->shader );

		R_AddDrawSurf( ( void * )polybuffer, sh, R_PolyBufferFogNum( polybuffer ), qfalse );
	}
}
开发者ID:DaneTheory,项目名称:spearmint,代码行数:21,代码来源:tr_scene.c


示例10: 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;
	int		fogMask;

	tr.currentEntityNum = REFENTITYNUM_WORLD;
	tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;
	fogMask = -((tr.refdef.rdflags & RDF_NOFOG) == 0);

	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 & fogMask, qfalse, qfalse, 0 /*cubeMap*/  );
	}
}
开发者ID:brugal,项目名称:wolfcamql,代码行数:22,代码来源:tr_scene.c


示例11: R_AddPolygonSurfaces

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

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

    if (!r_drawpolies->integer) {
        return;
    }

    tr.currentEntity = &tr.worldEntity;

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


示例12: R_AddAnimSurfaces

/*
==============
R_AddAnimSurfaces
==============
*/
void R_AddAnimSurfaces( trRefEntity_t *ent ) {
	md4Header_t		*header;
	md4Surface_t	*surface;
	md4LOD_t		*lod;
	shader_t		*shader;
	int				i;

	header = tr.currentModel->md4;
	lod = (md4LOD_t *)( (byte *)header + header->ofsLODs );

	surface = (md4Surface_t *)( (byte *)lod + lod->ofsSurfaces );
	for ( i = 0 ; i < lod->numSurfaces ; i++ ) {
		shader = R_GetShaderByHandle( surface->shaderIndex );
		R_AddDrawSurf( (void *)surface, shader, 0 /*fogNum*/, qfalse );
		surface = (md4Surface_t *)( (byte *)surface + surface->ofsEnd );
	}
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:22,代码来源:tr_animation.c


示例13: R_AddDecalSurface

//	adds a decal surface to the scene
static void R_AddDecalSurface( mbrush46_decal_t* decal ) {
	//	early outs
	if ( decal->shader == NULL || decal->parent->viewCount != tr.viewCount || tr.refdef.numDecals >= MAX_DECALS ) {
		return;
	}

	//	get decal surface
	idSurfaceDecal* srf = &tr.refdef.decals[ tr.refdef.numDecals ];
	tr.refdef.numDecals++;

	//	set it up
	srf->surf.numVerts = decal->numVerts;
	Com_Memcpy( srf->surf.verts, decal->verts, srf->surf.numVerts * sizeof ( *srf->surf.verts ) );

	//	fade colors
	if ( decal->fadeStartTime < tr.refdef.time && decal->fadeStartTime < decal->fadeEndTime ) {
		float fade = ( float )( decal->fadeEndTime - tr.refdef.time ) /
					 ( float )( decal->fadeEndTime - decal->fadeStartTime );
		for ( int i = 0; i < decal->numVerts; i++ ) {
			decal->verts[ i ].modulate[ 0 ] *= fade;
			decal->verts[ i ].modulate[ 1 ] *= fade;
			decal->verts[ i ].modulate[ 2 ] *= fade;
			decal->verts[ i ].modulate[ 3 ] *= fade;
		}
	}

	//	dynamic lights?
	int dlightMap;
	if ( decal->parent != NULL ) {
		dlightMap = decal->parent->dlightBits[ tr.smpFrame ] != 0;
	} else {
		dlightMap = 0;
	}

	//	add surface to scene
	R_AddDrawSurf( srf, decal->shader, decal->fogIndex, dlightMap, 0, 0, 0 );
	tr.pc.c_decalSurfaces++;

	//	free temporary decal
	if ( decal->fadeEndTime <= tr.refdef.time ) {
		decal->shader = NULL;
	}
}
开发者ID:janisl,项目名称:jlquake,代码行数:44,代码来源:decals.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 );
//sortSL{
		// a hack to get the SprayLogo-"Level" into the Engine
		// without changing the vm-interface-functions
		if(poly->verts->st[0]>=10.0f)
			poly->lvl = ((int)poly->verts->st[0]/10);
		else
			poly->lvl = 0;
//sortSL}
		R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex, qfalse );
	}
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:28,代码来源:tr_scene.c


示例15: R_MDRAddAnimSurfaces


//.........这里部分代码省略.........
	// This will write directly into the entity structure, so
	// when the surfaces are rendered, they don't need to be
	// range checked again.
	//
	if ((ent->e.frame >= header->numFrames) 
		|| (ent->e.frame < 0)
		|| (ent->e.oldframe >= header->numFrames)
		|| (ent->e.oldframe < 0) )
	{
		ri->Printf( PRINT_DEVELOPER, "R_MDRAddAnimSurfaces: no such frame %d to %d for '%s'\n",
			   ent->e.oldframe, ent->e.frame, tr.currentModel->name );
		ent->e.frame = 0;
		ent->e.oldframe = 0;
	}

	//
	// cull the entire model if merged bounding box of both frames
	// is outside the view frustum.
	//
	cull = R_MDRCullModel (header, ent);
	if ( cull == CULL_OUT ) {
		return;
	}	

	// figure out the current LOD of the model we're rendering, and set the lod pointer respectively.
	lodnum = R_ComputeLOD(ent);
	// check whether this model has as that many LODs at all. If not, try the closest thing we got.
	if(header->numLODs <= 0)
		return;
	if(header->numLODs <= lodnum)
		lodnum = header->numLODs - 1;

	lod = (mdrLOD_t *)( (byte *)header + header->ofsLODs);
	for(i = 0; i < lodnum; i++)
	{
		lod = (mdrLOD_t *) ((byte *) lod + lod->ofsEnd);
	}
	
	// set up lighting
	if ( !personalModel || r_shadows->integer > 1 )
	{
		R_SetupEntityLighting( &tr.refdef, ent );
	}

	// fogNum?
	fogNum = R_MDRComputeFogNum( header, ent );

	surface = (mdrSurface_t *)( (byte *)lod + lod->ofsSurfaces );

	for ( i = 0 ; i < lod->numSurfaces ; i++ )
	{
		
		if(ent->e.customShader)
			shader = R_GetShaderByHandle(ent->e.customShader);
		else if(ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins)
		{
			skin = R_GetSkinByHandle(ent->e.customSkin);
			shader = tr.defaultShader;
			
			for(j = 0; j < skin->numSurfaces; j++)
			{
				if (!strcmp(skin->surfaces[j]->name, surface->name))
				{
					shader = skin->surfaces[j]->shader;
					break;
				}
			}
		}
		else if(surface->shaderIndex > 0)
			shader = R_GetShaderByHandle( surface->shaderIndex );
		else
			shader = tr.defaultShader;

		// we will add shadows even if the main object isn't visible in the view

		// stencil shadows can't do personal models unless I polyhedron clip
		if ( !personalModel
		        && r_shadows->integer == 2
			&& fogNum == 0
			&& !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) )
			&& shader->sort == SS_OPAQUE )
		{
			R_AddDrawSurf( (void *)surface, tr.shadowShader, 0, qfalse );
		}

		// projection shadows work fine with personal models
		if ( r_shadows->integer == 3
			&& fogNum == 0
			&& (ent->e.renderfx & RF_SHADOW_PLANE )
			&& shader->sort == SS_OPAQUE )
		{
			R_AddDrawSurf( (void *)surface, tr.projectionShadowShader, 0, qfalse );
		}

		if (!personalModel)
			R_AddDrawSurf( (void *)surface, shader, fogNum, qfalse );

		surface = (mdrSurface_t *)( (byte *)surface + surface->ofsEnd );
	}
}
开发者ID:Razish,项目名称:QtZ,代码行数:101,代码来源:tr_animation.c


示例16: R_AddIQMSurfaces


//.........这里部分代码省略.........
	personalModel = (ent->e.renderfx & RF_ONLY_MIRROR) && !tr.viewParms.isPortal;

	if ( ent->e.renderfx & RF_WRAP_FRAMES ) {
		ent->e.frame %= skeleton->num_frames;
		ent->e.oldframe %= oldSkeleton->num_frames;
	}

	//
	// Validate the frames so there is no chance of a crash.
	// This will write directly into the entity structure, so
	// when the surfaces are rendered, they don't need to be
	// range checked again.
	//
	if ( (ent->e.frame >= skeleton->num_frames) 
	     || (ent->e.frame < 0)
	     || (ent->e.oldframe >= oldSkeleton->num_frames)
	     || (ent->e.oldframe < 0) ) {
		ri.Printf( PRINT_DEVELOPER, "R_AddIQMSurfaces: no such frame %d to %d for '%s'\n",
			   ent->e.oldframe, ent->e.frame,
			   tr.currentModel->name );
		ent->e.frame = 0;
		ent->e.oldframe = 0;
	}

	//
	// cull the entire model if merged bounding box of both frames
	// is outside the view frustum.
	//
	cull = R_CullIQM ( skeleton, oldSkeleton, ent );
	if ( cull == CULL_OUT ) {
		return;
	}

	//
	// set up lighting now that we know we aren't culled
	//
	if ( !personalModel || r_shadows->integer > 1 ) {
		R_SetupEntityLighting( &tr.refdef, ent );
	}

	//
	// see if we are in a fog volume
	//
	fogNum = R_ComputeIQMFogNum( skeleton, ent );

	cubemapIndex = R_CubemapForPoint(ent->e.origin);

	for ( i = 0 ; i < data->num_surfaces ; i++ ) {
		if(ent->e.customShader)
			shader = R_GetShaderByHandle( ent->e.customShader );
		else if(ent->e.customSkin > 0 && ent->e.customSkin <= tr.refdef.numSkins)
		{
			skin = &tr.refdef.skins[ent->e.customSkin - 1];
			shader = tr.defaultShader;

			for(j = 0 ; j < skin->numSurfaces ; j++)
			{
				skinSurf = &tr.skinSurfaces[ skin->surfaces[ j ] ];

				if (!strcmp(skinSurf->name, surface->name))
				{
					shader = skinSurf->shader;
					break;
				}
			}

			if (shader == tr.nodrawShader) {
				surface++;
				continue;
			}
		} else {
			shader = surface->shader;
		}

		// we will add shadows even if the main object isn't visible in the view

		// stencil shadows can't do personal models unless I polyhedron clip
		if ( !personalModel
			&& r_shadows->integer == 2 
			&& fogNum == 0
			&& !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) ) 
			&& shader->sort == SS_OPAQUE ) {
			R_AddDrawSurf( (void *)surface, tr.shadowShader, 0, 0, 0, 0 );
		}

		// projection shadows work fine with personal models
		if ( r_shadows->integer == 3
			&& fogNum == 0
			&& (ent->e.renderfx & RF_SHADOW_PLANE )
			&& shader->sort == SS_OPAQUE ) {
			R_AddDrawSurf( (void *)surface, tr.projectionShadowShader, 0, 0, 0, 0 );
		}

		if( !personalModel ) {
			R_AddEntDrawSurf( ent, (void *)surface, shader, fogNum, 0, 0, cubemapIndex );
		}

		surface++;
	}
}
开发者ID:DaneTheory,项目名称:spearmint,代码行数:101,代码来源:tr_model_iqm.c


示例17: R_AddMD3Surfaces


//.........这里部分代码省略.........
		|| ( ent->e.oldframe < 0 ) ) {
		ri.Printf( PRINT_DEVELOPER, "R_AddMD3Surfaces: no such frame %d to %d for '%s'\n",
				   ent->e.oldframe, ent->e.frame,
				   tr.currentModel->name );
		ent->e.frame = 0;
		ent->e.oldframe = 0;
	}

	//
	// compute LOD
	//
	lod = R_ComputeLOD( ent );

	model = tr.currentModel->mdv[lod];

	//
	// cull the entire model if merged bounding box of both frames
	// is outside the view frustum.
	//
	cull = R_CullModel ( model, ent );
	if ( cull == CULL_OUT ) {
		return;
	}

	//
	// set up lighting now that we know we aren't culled
	//
	if ( !personalModel || r_shadows->integer > 1 ) {
		R_SetupEntityLighting( &tr.refdef, ent );
	}

	//
	// see if we are in a fog volume
	//
	fogNum = R_ComputeFogNum( model, ent );

	cubemapIndex = R_CubemapForPoint(ent->e.origin);

	//
	// draw all surfaces
	//
	surface = model->surfaces;
	for ( i = 0 ; i < model->numSurfaces ; i++ ) {
		int j;

//----(SA)	blink will change to be an overlay rather than replacing the head texture.
//		think of it like batman's mask.  the polygons that have eye texture are duplicated
//		and the 'lids' rendered with polygonoffset shader parm over the top of the open eyes.  this gives
//		minimal overdraw/alpha blending/texture use without breaking the model and causing seams
		if ( !Q_stricmp( surface->name, "h_blink" ) ) {
			if ( !( ent->e.renderfx & RF_BLINK ) ) {
				//surface = ( md3Surface_t * )( (byte *)surface + surface->ofsEnd );
				//surface++;
				continue;
			}
		}
//----(SA)	end

		if ( ent->e.customShader ) {
			shader = R_GetShaderByHandle( ent->e.customShader );
		} else if ( ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins ) {
			skin_t *skin;

			skin = R_GetSkinByHandle( ent->e.customSkin );

			// match the surface name to something in the skin file
			shader = tr.defaultShader;
			for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
				// the names have both been lowercased
				if ( !strcmp( skin->surfaces[j]->name, surface->name ) ) {
					shader = skin->surfaces[j]->shader;
					break;
				}
			}

			if ( shader == tr.defaultShader ) {
				ri.Printf( PRINT_DEVELOPER, "WARNING: no shader for surface %s in skin %s\n", surface->name, skin->name );
			} else if ( shader->defaultShader )     {
				ri.Printf( PRINT_DEVELOPER, "WARNING: shader %s in skin %s not found\n", shader->name, skin->name );
			}
		//} else if ( surface->numShaders <= 0 ) {
			//shader = tr.defaultShader;
		} else {
			//md3Shader = ( md3Shader_t * )( (byte *)surface + surface->ofsShaders );
			//md3Shader += ent->e.skinNum % surface->numShaders;
			shader = tr.shaders[ surface->shaderIndexes[ ent->e.skinNum % surface->numShaderIndexes ] ];
		}


		// don't add third_person objects if not viewing through a portal
		if ( !personalModel ) {
// GR - tessellate according to model capabilities
			srfVaoMdvMesh_t *vaoSurface = &model->vaoSurfaces[i];
			R_AddDrawSurf( (void *)vaoSurface, shader, fogNum, qfalse, qfalse, cubemapIndex, tr.currentModel->ATI_tess );
		}

		surface++;
	}

}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,代码来源:tr_mesh.c


示例18: R_AddMyGhoulSurfaces


//.........这里部分代码省略.........
		animated = 0;
	}
	
//	printf( "(GLM) myghoul model is " );
//	if(personalModel) printf( "personal model, " );
//	if(animated) printf( "animated." );

#if 0
	if( animated )
	{
		AnimStateAnimsPop( as, anims );
		MG_InheritQuats( anims, (mgQuat_t*)as->resframe->quat, 0 );
		if( !newQuatDeal ) MG_MatsPopulate( anims, (mgQuat_t*)as->resframe->quat, as->pose );
	}
#endif

	// compute LOD
	//lod = R_ComputeLOD( ent );
	// cull the entire model if merged bounding box of both frames
	// is outside the view frustum.
	/*cull = R_CullModel ( header, ent );
	if ( cull == CULL_OUT ) {
		return;
	}*/
	// set up lighting now that we know we aren't culled
	if ( !personalModel || r_shadows->integer > 1 ) {
		R_SetupEntityLighting( &tr.refdef, ent );
	}

	// see if we are in a fog volume
	//fogNum = R_ComputeFogNum( header, ent );

	//ri.Printf( PRINT_DEVELOPER, "(I) Adding this MG Model\n" );
	lod = (glmLOD_t *)( (byte *)header + header->ofsLODs );
	lod_surf_ofs = ( glmLODSurfOffset_t *) ((byte *)lod + 4 );
	surfh = (glmSurfHierarchy_t *) ( (byte *)header + header->ofsSurfHierarchy );
	surface = (glmSurface_t *)( (byte *)lod_surf_ofs + lod_surf_ofs->offsets[0] );
	for ( i = 0 ; i < header->numSurfaces ; i++ ) {
		if( surfh->name[0] != '*' && strcmp( "stupidtriangle_off", surfh->name ) )
		{
			if ( ent->e.customShader ) {
				shader = R_GetShaderByHandle( ent->e.customShader );
			} else if ( ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins ) {
				skin_t *skin;
				int		j;

				skin = R_GetSkinByHandle( ent->e.customSkin );
				// match the surface name to something in the skin file
				shader = tr.defaultShader;
				for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
					// the names have both been lowercased
					if ( !strcmp( skin->surfaces[j]->name, surfh->name ) ) {
						shader = skin->surfaces[j]->shader;
						break;
					}
				}
				if (shader == tr.defaultShader) {
					//ri.Printf( PRINT_DEVELOPER, "WARNING: no shader for surface %s in skin %s\n", surfh->name, skin->name);
				}
				else if (shader->defaultShader) {
					//ri.Printf( PRINT_DEVELOPER, "WARNING: shader %s in skin %s not found\n", shader->name, skin->name);
				}
			} else {
				shader = R_GetShaderByHandle( surfh->shaderIndex );
			}
			// we will add shadows even if the main object isn't visible in the view

			// stencil shadows can't do personal models unless I polyhedron clip
			if ( !personalModel ) {
				R_AddDrawSurf( (void *)surface, shader, 0, qfalse );
			}

			if ( !personalModel
				&& r_shadows->integer == 2
				&& fogNum == 0
				&& !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) )
				&& shader->sort == SS_OPAQUE ) {
				R_AddDrawSurf( (void *)surface, tr.shadowShader, 0, qfalse );
			}

			if ( r_shadows->integer == 4
				&& fogNum == 0
				&& !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) )
				&& shader->sort == SS_OPAQUE ) {
				R_AddDrawSurf( (void *)surface, tr.shadowShader, 0, qfalse );
			}

			// projection shadows work fine with personal models
			if ( r_shadows->integer == 3
				&& fogNum == 0
				&& (ent->e.renderfx & RF_SHADOW_PLANE )
				&& shader->sort == SS_OPAQUE ) {
				R_AddDrawSurf( (void *)surface, tr.projectionShadowShader, 0, qfalse );
			}
		}

		surface = (glmSurface_t *)( (byte *)surface + surface->ofsEnd );
		surfh = (glmSurfHierarchy_t *) ( (byte *)&surfh->childIndexes[surfh->numChildren] );
	}
}
开发者ID:Lrns123,项目名称:jkaq3,代码行数:101,代码来源:tr_model_ghoul2.c


示例19: R_AddMD5Surfaces

/*
==============
R_AddMD5Surfaces
==============
*/
void R_AddMD5Surfaces( trRefEntity_t *ent )
{
	md5Model_t   *model;
	md5Surface_t *surface;
	shader_t     *shader;
	int          i;
	qboolean     personalModel;
	int          fogNum;

	model = tr.currentModel->model.md5;

	// don't add third_person objects if not in a portal
	personalModel = ( ent->e.renderfx & RF_THIRD_PERSON ) && !tr.viewParms.isPortal;

	// cull the entire model if merged bounding box of both frames
	// is outside the view frustum
	if ( R_CullMD5( ent ) == CULL_OUT )
	{
		return;
	}

	// set up lighting now that we know we aren't culled
	if ( !personalModel || r_shadows->integer > SHADOWING_BLOB )
	{
		R_SetupEntityLighting( &tr.refdef, ent );
	}

	// see if we are in a fog volume

	fogNum = 0; //R_FogWorldBox(ent->worldBounds);

	// finally add surfaces
	for ( i = 0, surface = model->surfaces; i < model->numSurfaces; i++, surface++ )
	{
		if ( ent->e.customShader )
		{
			shader = R_GetShaderByHandle( ent->e.customShader );
		}
		else if ( ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins )
		{
			skin_t *skin;

			skin = R_GetSkinByHandle( ent->e.customSkin );

			// match the surface name to something in the skin file
			shader = tr.defaultShader;

			// FIXME: replace MD3_MAX_SURFACES for skin_t::surfaces
			if ( i >= 0 && i < skin->numSurfaces && skin->surfaces[ i ] )
			{
				shader = skin->surfaces[ i ]->shader;
			}

			if ( shader == tr.defaultShader )
			{
				ri.Printf( PRINT_DEVELOPER, "WARNING: no shader for surface %i in skin %s\n", i, skin->name );
			}
			else if ( shader->defaultShader )
			{
				ri.Printf( PRINT_DEVELOPER, "WARNING: shader %s in skin %s not found\n", shader->name, skin->name );
			}
		}
		else
		{
			shader = R_GetShaderByHandle( surface->shaderIndex );

			if ( ent->e.altShaderIndex > 0 && ent->e.altShaderIndex < MAX_ALTSHADERS &&
			     shader->altShader[ ent->e.altShaderIndex ].index )
			{
				shader = R_GetShaderByHandle( shader->altShader[ ent->e.altShaderIndex ].index );
			}
		}

		// we will add shadows even if the main object isn't visible in the view

		// don't add third_person objects if not viewing through a portal
		if ( !personalModel )
		{
			R_AddDrawSurf( ( surfaceType_t * ) surface, shader, fogNum, 0, 0 );
		}
	}
}
开发者ID:rjc862003,项目名称:Unvanquished,代码行数:87,代码来源:tr_animation.c


示例20: R_AddAnimSurfaces


//.........这里部分代码省略.........
	mdsSurface_t *surface;
	shader_t     *shader = 0;
	int          i, fogNum, cull;
	qboolean     personalModel = (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal; // don't add third_person objects if not in a portal

	// cull the entire model if merged bounding box of both frames
	// is outside the view frustum.
	cull = R_CullModel(header, ent);
	if (cull == CULL_OUT)
	{
		return;
	}

	// set up lighting now that we know we aren't culled
	if (!personalModel || r_shadows->integer > 1)
	{
		R_SetupEntityLighting(&tr.refdef, ent);
	}

	// see if we are in a fog volume
	fogNum = R_ComputeFogNum(header, ent);

	surface = ( mdsSurface_t * )((byte *)header + header->ofsSurfaces);
	for (i = 0 ; i < header->numSurfaces ; i++)
	{

		if (ent->e.customShader)
		{
			shader = R_GetShaderByHandle(ent->e.customShader);
		}
		else if (ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins)
		{
			skin_t *skin;
			int    hash;
			int    j;

			skin = R_GetSkinByHandle(ent->e.customSkin);

			// match the surface name to something in the skin file
			shader = tr.defaultShader;

			if (ent->e.renderfx & RF_BLINK)
			{
				char *s = va("%s_b", surface->name);   // append '_b' for 'blink'
				hash = Com_HashKey(s, strlen(s));
				for (j = 0 ; j < skin->numSurfaces ; j++)
				{
					if (hash != skin->surfaces[j]->hash)
					{
						continue;
					}
					if (!strcmp(skin->surfaces[j]->name, s))
					{
						shader = skin->surfaces[j]->shader;
						break;
					}
				}
			}

			if (shader == tr.defaultShader)        // blink reference in skin was not found
			{
				hash = Com_HashKey(surface->name, sizeof(surface->name));
				for (j = 0 ; j < skin->numSurfaces ; j++)
				{
					// the names have both been lowercased
					if (hash != skin->surfaces[j]->hash)
					{
						continue;
					}
					if (!strcmp(skin->surfaces[j]->name, surface->name))
					{
						shader = skin->surfaces[j]->shader;
						break;
					}
				}
			}

			if (shader == tr.defaultShader)
			{
				Ren_Developer("WARNING: no shader for surface %s in skin %s\n", surface->name, skin->name);
			}
			else if (shader->defaultShader)
			{
				Ren_Developer("WARNING: shader %s in skin %s not found\n", shader->name, skin->name);
			}
		}
		else
		{
			shader = R_GetShaderByHandle(surface->shaderIndex);
		}

		// don't add third_person objects if not viewing through a portal
		if (!personalModel)
		{
			R_AddDrawSurf((void *)surface, shader, fogNum, 0, 0);
		}

		surface = ( mdsSurface_t * )((byte *)surface + surface->ofsEnd);
	}
}
开发者ID:Ododo,项目名称:etlegacy,代码行数:101,代码来源:tr_animation_mds.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ R_BindAnimatedImage函数代码示例发布时间:2022-05-30
下一篇:
C++ R_ASSERT3函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap