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


C++ X3DAttributes::getDEF方法代码示例

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


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

示例1: createUniqueName

std::string OgreNodeHandler::createUniqueName(const X3DAttributes &attr, const std::string& prefix)
{
	if (attr.isDEF())
		return attr.getDEF();

	string result;
	result.append(prefix);
	result.append(StringConverter::toString(++_objCount));
	return result;
}
开发者ID:151706061,项目名称:MEPP,代码行数:10,代码来源:OgreNodeHandler.cpp

示例2:

int X3DXIOTNodeHandler::startShape(const X3DAttributes &attr)
{
#ifdef _DEBUG
	std::cout << "Start Shape event" << std::endl;
	for (size_t i = 0; i < static_cast<int>(attr.getLength()); i++)
		std::cout << attr.getAttributeName(static_cast<int>(i)) << std::endl;
	if (attr.isDEF())
		std::cout << attr.getDEF() << std::endl;
#endif
	return CONTINUE;
}
开发者ID:imight,项目名称:trunk,代码行数:11,代码来源:X3DXIOTNodeHandler.cpp

示例3: startShape

int OgreNodeHandler::startShape(const X3DAttributes &attr) {
  std::cout << "Start Shape" << std::endl;
  if (attr.isUSE()) {
	  _currentEntity = _sceneManager->getEntity(attr.getUSE())->clone(createUniqueName(attr, "shapeUSE"));
  } else  {
	  // We can not create a entity yet, because Ogre does not
	  // allow an entity without a mesh. So we create the entity as
	  // soon as we have a mesh
	  _shapeName = attr.isDEF() ? attr.getDEF() : createUniqueName(attr, "shape");
  }

  return 1;
}
开发者ID:151706061,项目名称:MEPP,代码行数:13,代码来源:OgreNodeHandler.cpp

示例4: ccPointCloud

int X3DXIOTNodeHandler::startCoordinate(const X3DAttributes &attr)
{
	int index = attr.getAttributeIndex(ID::point);
	if (index == -1)
	{
		//TODO: warn user instead
		//throw std::runtime_error("No points given within Coordinate node");
		return SKIP_CHILDREN;
	}

	MFVec3f points;
	attr.getMFVec3f(index,points);

	unsigned count = points.size();
	if (count == 0)
		return SKIP_CHILDREN;

	ccPointCloud* cloud = new ccPointCloud(attr.isDEF() ? attr.getDEF().c_str() : 0);
	if (!cloud->reserve(count))
	{
		//not enough memory!
		delete cloud;
		return SKIP_CHILDREN;
	}

	for (MFVec3f::const_iterator it=points.begin(); it!=points.end(); ++it)
		cloud->addPoint(CCVector3(it->x,it->y,it->z));

	assert(m_currentLeaf);
	m_currentLeaf->addChild(cloud);

	//cloud = parent vertices?
	if (m_currentLeaf->isKindOf(CC_MESH))
	{
		ccGenericMesh* mesh = ccHObjectCaster::ToGenericMesh(m_currentLeaf);
		if (mesh->getAssociatedCloud()==0)
		{
			mesh->setAssociatedCloud(cloud);
			cloud->setVisible(false);
		}
	}

	m_currentLeaf = cloud;

	return CONTINUE;
}
开发者ID:markgenemei,项目名称:trunk,代码行数:46,代码来源:X3DXIOTNodeHandler.cpp

示例5: ccMesh

int X3DXIOTNodeHandler::startIndexedFaceSet(const X3DAttributes &attr)
{
	std::cout << "Start IndexedFaceSet" << std::endl;

	ccMesh* mesh = new ccMesh(0);
	unsigned realFaceNumber=0;

	if (attr.isDEF())
		mesh->setName(attr.getDEF().c_str());

	//Vertices indexes
	int vertIndex = attr.getAttributeIndex(ID::coordIndex);
	if (vertIndex != -1)
	{
		MFInt32 streamIndexes;
		attr.getMFInt32(vertIndex,streamIndexes);

		int triIndexes[3];
		int pos=0;
		for (MFInt32::const_iterator it = streamIndexes.begin(); it != streamIndexes.end(); ++it)
		{
			if (*it == -1) //end of polygon
			{
				if (pos<3)
				{
					//incomplete dataset?
					//TODO: warn user
				}
				pos = 0;
				++realFaceNumber;
			}
			else //new vertex index
			{
				if (pos<3)
				{
					triIndexes[pos]=*it;
				}
				else
				{
					//FIXME: simplistic fan triangulation (hum, hum)
					triIndexes[1]=triIndexes[2];
					triIndexes[2]=*it;
				}
				++pos;
			}

			//new face
			if (pos==3)
			{
				//we check that we are at the end of the polygon (we don't handle non triangular meshes yet!)
				if (it+1 == streamIndexes.end() || *(it+1)==-1)
				{
					//we must reserve some more space for storage!
					if (mesh->size() == mesh->maxSize())
					{
						if (!mesh->reserve(mesh->maxSize() + 100))
						{
							delete mesh;
							return ABORT; //not enough memory!
						}
					}
					mesh->addTriangle(triIndexes[0],triIndexes[1],triIndexes[2]);
				}
				else
				{
					//TODO: we don't handle non triangle faces yet!
				}
			}
		}

		if (mesh->size() < mesh->maxSize())
		{
			//unhandled type of mesh
			if (mesh->size()==0)
			{
				delete mesh;
				return SKIP_CHILDREN;
			}
			mesh->resize(mesh->size());
		}
	}

	//Normals (per face)
	int normIndex = attr.getAttributeIndex(ID::normalIndex);
	if (normIndex != -1)
	{
		//per-triangle normals!
		if (mesh->size() == realFaceNumber)
		{
			if (mesh->reservePerTriangleNormalIndexes())
			{
				MFInt32 perFaceNormIndexes;
				attr.getMFInt32(normIndex,perFaceNormIndexes);
				for (unsigned i=0;i<perFaceNormIndexes.size();++i)
					mesh->addTriangleNormalIndexes(i,i,i);

				mesh->showTriNorms(true);
			}
			else
			{
//.........这里部分代码省略.........
开发者ID:imight,项目名称:trunk,代码行数:101,代码来源:X3DXIOTNodeHandler.cpp


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