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


C++ Portal::render方法代码示例

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


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

示例1: render

void Sector::render(Portal *portal) {
	
	if(frame == Engine::frame) return;
	frame = Engine::frame;
	
	this->portal = portal;
	Bsp::visible_sectors[Bsp::num_visible_sectors++] = this;
	
	num_visible_objects = 0;
	
	root->render();
	
	for(int i = 0; i < num_objects; i++) {
		Object *o = objects[i];
		if(o->frame == Engine::frame) continue;
		if(Engine::frustum->inside(o->pos + o->getCenter(),o->getRadius())) {
			Engine::num_triangles += o->render(Object::RENDER_OPACITY);
			visible_objects[num_visible_objects++] = o;
		}
	}
	
	for(int i = 0; i < num_portals; i++) {
		Portal *p = &Bsp::portals[portals[i]];
		if(p->frame == Engine::frame) continue;
		p->frame = Engine::frame;
		if(Engine::frustum->inside(p->center,p->radius)) {
			float dist = (Engine::camera - p->center).length();
			
			if(Engine::have_occlusion && dist > p->radius) {
				
				if(Material::old_material) Material::old_material->disable();
				
				glDisable(GL_CULL_FACE);
				glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
				glDepthMask(GL_FALSE);
				glBeginQueryARB(GL_SAMPLES_PASSED_ARB,Engine::query_id);
				p->render();
				glEndQueryARB(GL_SAMPLES_PASSED_ARB);
				glDepthMask(GL_TRUE);
				glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
				glEnable(GL_CULL_FACE);
					
				GLuint samples;
				glGetQueryObjectuivARB(Engine::query_id,GL_QUERY_RESULT_ARB,&samples);
				if(samples == 0) continue;
			}
			
			if(dist > p->radius) Engine::frustum->addPortal(Engine::camera,p->points);
			for(int j = 0; j < p->num_sectors; j++) {
				Bsp::sectors[p->sectors[j]].render(dist > p->radius ? p : NULL);
			}
			if(dist > p->radius) Engine::frustum->removePortal();
		}
	}
}
开发者ID:4DA,项目名称:Unigine-legacy,代码行数:55,代码来源:bsp.cpp

示例2: render

void render(Game *g)
{        
	g->mouseThrustOn=false;    
	glClear(GL_COLOR_BUFFER_BIT);
	if(intro < 1) {
		char screen;
		if (selected_screen == LEFT){
			screen = 'L';
		}
		else{
			screen = 'R';
		}
		if (hud->isShowWelcome() == true){
			hud->showIntro(screen,introTexture, bgTexture1, bgTexture2);
			if (hud->getAI() == true){
				hud->selectAI();
			}
			else{
				hud->selectHuman();
			}
			return;
		}
		else if (hud->isShowHelpMenu() == true){
			hud->showHelpMenu(helpMenuTexture);
			return;
		}
		return;
	}
	else{
		renderTexture(bgTexture, xres, yres);
	}

	if (is_gameover){
		renderTexture(gameOverTexture, xres, yres);
		high_score = setHighScore(ball.getPlayer1Score(), ball.getPlayer2Score());
		//cout << "Final Score : " << high_score << "\n";
		hud->showGameOver(high_score,ball.getPlayer1Score(), ball.getPlayer2Score());
		return;
	}

	hud->showScore(ball.getPlayer1Score(), ball.getPlayer2Score());
	hud->showHealth(hud->getPlayer1Health(), hud->getPlayer2Health());
	hud->showCourtYard();

	//DRAW BOMB:
	if (level == 1){

		GLuint which_bomb_texture = bombTexture;
		if ((bombBegin + 2) > time(NULL)){
			which_bomb_texture = explodeTexture;
		}
		else{
			which_bomb_texture = bombTexture;
		}

		portal0.render(portalTexture0);
		portal1.render(portalTexture1);


		hud->renderBomb(which_bomb_texture,bomb_posx,bomb_posy,bomb_width,bomb_height);
	}

	//Draw the paddle
	glColor3f(0.0, 0.5, 0.5);
	paddle1.render();
	glColor3f(0.7, 0.5, 0.0);
	paddle2.render();
	glEnd();
	//Draw the ball
	ball.render();

	//If option 2 is selected i.e. ninja_robot.ppm is the background
	//Level 2 selected
	//Draw some obstacles to showcase a difference between level 1 and level2
	if(level == 2) {
		obstacle->render();
	}
	hud->showTimer(getTimer());
	if (hud->isPaused()){
		hud->showPaused(pausedTexture);
	}
}
开发者ID:jacobfrench,项目名称:cs335_battlepong,代码行数:82,代码来源:battlepong.cpp


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