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


C++ CBlock::isRoom方法代码示例

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


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

示例1: init

		bool CRoomManager::init()
		{
			// register to console: TODO register some usefull stuff
			CV_GAME_MANAGER->getConsole()->registerClass(this,"ROOM MANAGER");
			CV_GAME_MANAGER->getConsole()->addParam(RLROOM,"() Reloads the rooms.");
			CV_GAME_MANAGER->getConsole()->addParam(RC,"() Prints room count.");
			CV_GAME_MANAGER->getConsole()->addParam(RC,"() Prints room count.");
			CV_GAME_MANAGER->getConsole()->addParam(SRA,"() Shows room area.");

			// construct new rooms
			CLevelManager *lManager = CV_GAME_MANAGER->getLevelManager();
			for (GLuint y=0; y<CV_LEVEL_MAP_SIZE; y++)
			{
				for (GLuint x=0; x<CV_LEVEL_MAP_SIZE; x++)
				{
					CBlock *block = lManager->getBlock(x,y);
					if (block->isRoom() && !block->isInRoom())
					{
						if(block->getType() == CV_BLOCK_TYPE_HEART_ID && block->getOwner() == CV_PLAYER_0)
						{
							cml::vector3f position = block->getRealPosition();
							CV_GAME_MANAGER->getControlManager()->getCamera()->setPosition(cml::vector3f(position[0]+0.3, CV_CAMERA_INITIAL_HEIGHT, position[2]+1));
						}
						// we found a room tile that isn't in a room yet. we create a new room.
						CRoom *newRoom = new CRoom();
						newRoom->init(block);
						allRooms[newRoom->getIndex()] = newRoom;
						roomColors[newRoom->getIndex()] = vector3f((GLfloat)(rand()%101)/100.0f,(GLfloat)(rand()%101)/100.0f,(GLfloat)(rand()%101)/100.0f);
					}
				}
			}

			return true;
		}
开发者ID:Captnoord,项目名称:NBK,代码行数:34,代码来源:RoomManager.cpp

示例2: update


//.........这里部分代码省略.........
					if (block)
					{
						//block->getBoundingBox()->draw(); // just for testing
						if (frustum->containsBBOX(block->getBoundingBox()))
						{
							blockVisible++;

							block->updateTexture(delta);

							lavaWater = (block->isLava() || block->isWater());

							if (lavaWater)
							{
								atManager->updateBlock(block);
							}

							renderedBlocks.push_back(block);

							// draw block objects
							if (block->getBlockObjects()->size()>0)
							{
								for (std::vector<CBlockObject*>::iterator rmIter = block->getBlockObjects()->begin(); rmIter != block->getBlockObjects()->end(); rmIter++)
								{
									CBlockObject *bObj = *rmIter;

									bObj->moveTo();
									glRotatef(bObj->getRotateY(),0.0f,1.0f,0.0f);
									bObj->drawModel(delta);
									glRotatef(-bObj->getRotateY(),0.0f,1.0f,0.0f);
									bObj->moveBack();
								}
							}

							bool isRoom = block->isRoom();

							if (isRoom)
							{
								std::vector<GLuint> *dls = block->getDisplayLists();
								if (dls->size()!=0)
								{			
									glEnable(GL_TEXTURE_2D);
									glBindTexture(GL_TEXTURE_2D,textureAtlasColor);
									glBegin(GL_QUADS);
									{
										for (std::vector<GLuint>::iterator dlIter = dls->begin(); dlIter != dls->end(); dlIter++)
										{
											glCallList(*dlIter);									
										}
									}
									glEnd();
									glDisable(GL_TEXTURE_2D);									
								}
							}							

							for (GLint f=CBlock::BFS_FRONT; f<=CBlock::BFS_CEILING; f++)
							{
								if ((!isFPS && f==CBlock::BFS_CEILING) || (isFPS && f==CBlock::BFS_TOP) || (isRoom && f!=CBlock::BFS_CEILING))
								{
									continue;
								}

								if (block->isFaceVisible((CBlock::BLOCK_FACE_SELECTOR)f))
								{		
									verts = block->getVertices();
									texCoords = block->getTextureCoordinates((CBlock::BLOCK_FACE_SELECTOR)f);
开发者ID:Captnoord,项目名称:NBK,代码行数:66,代码来源:RenderManager.cpp


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