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


C++ ManualObject::setVisible方法代码示例

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


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

示例1: UpdateTerrain

// Given a scene node for a terrain, find the manual object on that scene node and
// update the manual object with the heightmap passed. If  there is no manual object on
// the scene node, remove all it's attachments and add the manual object.
// The heightmap is passed in a 1D array ordered by width rows (for(width) {for(length) {hm[w,l]}})
// This must be called between frames since it touches the scene graph
// BETWEEN FRAME OPERATION
void Region::UpdateTerrain(const int hmWidth, const int hmLength, const float* hm) {
	Ogre::SceneNode* node = this->TerrainSceneNode;
	LG::Log("Region::UpdateTerrain: updating terrain for region %s", this->Name.c_str());

	if (node == NULL) {
		LG::Log("Region::UpdateTerrain: terrain scene node doesn't exist. Not updating terrain.");
		return;
	}

	// Find the movable object attached to the scene node. If not found remove all.
	if (node->numAttachedObjects() > 0) {
		Ogre::MovableObject* attached = node->getAttachedObject(0);
		if (attached->getMovableType() != "ManualObject") {
            // don't know why this would ever happen but clean out the odd stuff
            LG::Log("Found extra stuff on terrain scene node");
			node->detachAllObjects();
		}
	}
	// if there is not a manual object on the node, create a new one
	if (node->numAttachedObjects() == 0) {
		LG::Log("Region::UpdateTerrain: creating terrain ManualObject for region %s", this->Name.c_str());
        // if no attached objects, we add our dynamic ManualObject
		Ogre::ManualObject* mob = LG::RendererOgre::Instance()->m_sceneMgr->createManualObject("ManualObject/" + node->getName());
		mob->addQueryFlags(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
		mob->setDynamic(true);
		mob->setCastShadows(true);
		mob->setVisible(true);
		node->attachObject(mob);
		// m_visCalc->RecalculateVisibility();
	}

	Ogre::ManualObject* mo = (Ogre::ManualObject*)node->getAttachedObject(0);

	// stuff our heightmap information into the dynamic manual object
	mo->estimateVertexCount(hmWidth * hmLength);
	mo->estimateIndexCount(hmWidth * hmLength * 6);

	if (mo->getNumSections() == 0) {
		// if first time
		mo->begin(LG::GetParameter("Renderer.Ogre.DefaultTerrainMaterial"));
	}
	else {
		mo->beginUpdate(0);					// we've been here before
	}

	int loc = 0;
	for (int xx = 0; xx < hmWidth; xx++) {
		for (int yy = 0; yy < hmLength; yy++) {
			mo->position((Ogre::Real)xx, (Ogre::Real)yy, hm[loc++]);
			mo->textureCoord((float)xx / (float)hmWidth, (float)yy / (float)hmLength);
			mo->normal(0.0, 1.0, 0.0);	// always up (for the moment)
		}
	}

	for (int px = 0; px < hmLength-1; px++) {
		for (int py = 0; py < hmWidth-1; py++) {
			mo->quad(px      + py       * hmWidth,
					 px      + (py + 1) * hmWidth,
					(px + 1) + (py + 1) * hmWidth,
					(px + 1) + py       * hmWidth
					 );
		}
	}

	mo->end();

	return;
}
开发者ID:Misterblue,项目名称:LookingGlass-Viewer,代码行数:74,代码来源:Region.cpp

示例2: decals


//.........这里部分代码省略.........
						projectedPointIter->uvCoord.y = u;
						projectedPointIter->uvCoord.x = (1 - v);
                    
					}
				}
            
			}
		}
    

		/// All of the final UV coords have been generated. Now it's rendering time. 
		/// What are you waiting for? Let's make that manual object that you've been dreaming about.
       
		std::vector<UniquePoint>::iterator uniqueIter;
    
		/// Debug drawing stuff
		if (DEBUG_ENABLED)
		{
			Ogre::ManualObject* moDebug = sceneMgr->createManualObject();
        
			moDebug->begin("debug_draw", Ogre::RenderOperation::OT_TRIANGLE_LIST);
        
			int indexOffset = 0;
        
			for (uniqueIter = uniquePoints.begin(); uniqueIter != uniquePoints.end(); ++uniqueIter)
			{
				createCubeMesh( sceneMgr, uniqueIter->p, 0.25, Ogre::ColourValue::Red, moDebug, indexOffset);
				indexOffset += 8;
			}
        
			moDebug->end();
        
			if (!mDebugVisible)
				moDebug->setVisible( false );
        
			mDebugNode->attachObject( moDebug );
		}
  

		/// "lines" is used for debug drawing triangles
		Ogre::ManualObject* lines = 0;

		if (DEBUG_ENABLED)
		{
			lines = sceneMgr->createManualObject();
			lines->begin("debug_draw", Ogre::RenderOperation::OT_LINE_LIST);
		}
    
		/// Create a new manual object if this one doesn't exist
		if (!decalObject)
		{
			decalObject = sceneMgr->createManualObject();
		}
		else
		{
			/// Make sure the decal object can be dynmically updated
			if (!decalObject->getDynamic())
				decalObject->setDynamic( true );
		}
    
		Ogre::String material = materialName;
    
		if (decalObject->getDynamic() && decalObject->getNumSections() > 0)
		{
			 /// Update the existng decal instead of starting a new one
			 decalObject->beginUpdate( 0 );
开发者ID:franaisa,项目名称:Gloom,代码行数:67,代码来源:OgreDecal.cpp


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