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


C++ GLRenderer::addPass方法代码示例

本文整理汇总了C++中GLRenderer::addPass方法的典型用法代码示例。如果您正苦于以下问题:C++ GLRenderer::addPass方法的具体用法?C++ GLRenderer::addPass怎么用?C++ GLRenderer::addPass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLRenderer的用法示例。


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

示例1: sizeof

void	GL_RenderScene(camera_t *camera, vec3_t userpos, unsigned int sceneRenderFlags)
{
	if (!world.cl_loaded || !gfx_render.integer)
	{
		//GL_2dMode();
		return;
	}
	
	static float lasttime=0;
	camera_t sunCam;
	Pass basePass;
	worldLight_t rimLight;
	float lerp;
	float ambBoost = (vid_realbright.integer && gfx_GLSLQuality.integer<=1) ? vid_realbrightMult.value : 1.0f;
	
	basePass.setViewer(camera);
	scene_cam = camera;
	
	sunLight.origin[0] = -wr_sun_x.value;
	sunLight.origin[1] = -wr_sun_y.value;
	sunLight.origin[2] = -wr_sun_z.value;
	
	memset(&rimLight, 0, sizeof(worldLight_t));
	
	M_MultVec3(sunLight.origin, -1, rimLight.origin);
	rimLight.type = LIGHT_DIRECTIONAL;
	
	//// SHADOW MAP RENDER ////
	//shadow pass, render to texture
	if(gfx_shadow.integer && gfx_shadowQuality.integer >= 1 && gfx_GLSLQuality.integer>1)
	{
		vec3_t wmin, wmax, sunLook;

		
			
			World_GetBounds(wmin, wmax);
			//SET_VEC3(sunLook, (wmax[0]-wmin[0])*.5f, (wmax[1]-wmin[1])*.5f, 0 * .5f);
			M_MultVec3(camera->viewaxis[AXIS_FORWARD], camera->farclip*0.05, sunLook);
			M_AddVec2(sunLook, camera->origin, sunLook);
			
			Cam_DefaultCamera(&sunCam, gfx_shadowSize.integer, gfx_shadowSize.integer, 2, 8192);
		if(wr_sun_z.value < 0) {
			SET_VEC3(sunCam.origin, -wr_sun_x.value, -wr_sun_y.value, -wr_sun_z.value);
		} else {
			SET_VEC3(sunCam.origin, wr_sun_x.value, wr_sun_y.value, wr_sun_z.value);
		}
			M_Normalize(sunCam.origin);
			M_MultVec3(sunCam.origin, wmax[0], sunCam.origin);
			sunCam.origin[0]+=sunLook[0];
			sunCam.origin[1]+=sunLook[1];
			M_SubVec3(sunLook, sunCam.origin, sunCam.viewaxis[AXIS_FORWARD]);
		
			M_GetAxisFromForwardVec(sunCam.viewaxis[AXIS_FORWARD], sunCam.viewaxis);
			sunCam.fovy = 50;
			sunCam.time = camera->time;
			sunCam.fog_far=100000;
			sunCam.fog_near=99999;
			sunCam.flags |= CAM_NO_SKY;
			
			//CSM setup
			if(gfx_shadowQuality.integer >= 2) {
				shadowSplit=0;
				for(int i=0;i<gfx_shadowQuality.integer;i++) {
					cascadedPass[i].setViewer(&sunCam);
					renderer.addPass(&cascadedPass[i]);
				}
			} else {
				shadowPass.setViewer(&sunCam);
				renderer.addPass(&shadowPass);
			}
		
		
	} else if( gfx_GLSLQuality.integer > 1 ) {
		renderer.addPass(&shadowPass);
	}
	
	if(gfx_postProcEnabled.integer && gfx_GLSLQuality.integer>1 && (gfx_depthNormalPass.integer || gfx_postSSAO.integer)) {
		zPass->setViewer(camera);
		renderer.addPass(zPass);
	}
	
	basePass.setDepthFunc(GL_LEQUAL);
	basePass.setDepthMask(true);
	basePass.clearDepth(true);
	
	if(gfx_GLSLQuality.integer>1 && gfx_postProcessing.integer)
		basePass.setTarget(screenPostTarget);
	else
		basePass.setTarget(glScreen);
	
	renderer.addPass(&basePass);
	
	//// BUILD RENDER LIST ////
	
	// sun/moon
	
	if(wr_sun_z.value < 0) {
		lerp = CLAMP(fabs(-1 - cos(wr_sun_phi.value)), 0, 1);
		
		//Console_Printf("phi %f lerp %f\n", wr_sun_phi.value, lerp);
//.........这里部分代码省略.........
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:101,代码来源:gl_renderer.cpp


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