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


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

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


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

示例1: startNormal

int OgreNodeHandler::startNormal(const X3DAttributes &attr)
{
	if(!_currentGeometry)
		throw std::runtime_error("Normal currently only supported for IndexedFaceSets");
	int index = attr.getAttributeIndex(ID::vector);
	if (index != -1)
		_currentGeometry->setNormals(attr.getMFVec3f(index));
	else
		throw std::runtime_error("No points given within Coordinate node");
	return 1;
}
开发者ID:151706061,项目名称:MEPP,代码行数:11,代码来源:OgreNodeHandler.cpp

示例2: 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


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