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


C++ CAABBox::getCenter方法代码示例

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


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

示例1:

// ***************************************************************************
void		CQuadGridClipClusterQTreeNode::insertModel(const NLMISC::CAABBox &worldBBox, uint distSetup, CTransformShape *model)
{
	// if leaf node, insert the model in the list
	if( LeafNode )
	{
		if(Empty)
		{
			Empty= false;
			BBox= worldBBox;
		}
		else
		{
			// extend the bbox with 2 corners of the incoming bbox (sufficient for an AABBox).
			BBox.extend( worldBBox.getCenter() + worldBBox.getHalfSize() );
			BBox.extend( worldBBox.getCenter() - worldBBox.getHalfSize() );
		}

		// insert in list
		ListNode.insertModel(distSetup, model);
	}
	// else, recurs insert in branch
	else
	{
		// choose what son according to pivot.
		CQuadGridClipClusterQTreeNode	*selectSon;
		if( worldBBox.getCenter().y<PivotBBox.getCenter().y )
		{
			if( worldBBox.getCenter().x<PivotBBox.getCenter().x )
				selectSon= Sons[NL3D_QCC_LEFT_DOWN];
			else
				selectSon= Sons[NL3D_QCC_RIGHT_DOWN];
		}
		else
		{
			if( worldBBox.getCenter().x<PivotBBox.getCenter().x )
				selectSon= Sons[NL3D_QCC_LEFT_UP];
			else
				selectSon= Sons[NL3D_QCC_RIGHT_UP];
		}

		// insert in this cluster
		selectSon->insertModel(worldBBox, distSetup, model);

		// extend my boox according to this son cluster.
		if(Empty)
		{
			Empty= false;
			BBox= selectSon->BBox;
		}
		else
		{
			// extend the bbox with 2 corners of the son bbox (sufficient for an AABBox).
			BBox.extend( selectSon->BBox.getCenter() + selectSon->BBox.getHalfSize() );
			BBox.extend( selectSon->BBox.getCenter() - selectSon->BBox.getHalfSize() );
		}
	}

	// update bboxExt
	BBoxExt= BBox;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:61,代码来源:quad_grid_clip_cluster.cpp

示例2: if


//.........这里部分代码省略.........
					Class_ID  clid = obj->ClassID();
					// is the object a particle system ?					
					if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID)
					{
						// build the shape from the file name
						std::string objName = CExportNel::getNelObjectName(*pNode); 						
						if (!objName.empty())
						{											
							NL3D::CShapeStream ss;
							NLMISC::CIFile iF;
							if (iF.open(objName.c_str()))
							{
								try
								{								
									iF.serial(ss);
									NL3D::CParticleSystemShape *pss = dynamic_cast<NL3D::CParticleSystemShape *>(ss.getShapePointer());
									if (!pss)
									{
										nlwarning("ERROR: Node %s shape is not a FX", CExportNel::getName(*pNode).c_str());
									}
									else
									{									
										NLMISC::CAABBox bbox;
										pss->getAABBox(bbox);
										// transform in world
										Matrix3 xForm = pNode->GetNodeTM(tvTime);
										NLMISC::CMatrix nelXForm;
										CExportNel::convertMatrix(nelXForm, xForm);									
										bbox = NLMISC::CAABBox::transformAABBox(nelXForm, bbox);
										// store vertices of the bbox in the list
										FXVertices.reserve(8);
										for(uint k = 0; k < 8; ++k)
										{
											FXVertices.push_back(CVector(((k & 1) ? 1 : -1) * bbox.getHalfSize().x + bbox.getCenter().x,
																		 ((k & 2) ? 1 : -1) * bbox.getHalfSize().y + bbox.getCenter().y,
																		 ((k & 4) ? 1 : -1) * bbox.getHalfSize().z + bbox.getCenter().z));
										}
										//
										testVertices = &FXVertices;
										buildMeshBBox = false;
									}
									delete ss.getShapePointer();
								}
								catch (NLMISC::Exception &e)
								{
									nlwarning(e.what());									
								}
							}							
							if (buildMeshBBox)
							{
								nlwarning("ERROR: Can't get bbox of a particle system from its shape, using helper bbox instead");
							}
						}
					}
				}

				CMesh::CMeshBuild *pMB = NULL;
				CMeshBase::CMeshBaseBuild *pMBB = NULL;

				if (buildMeshBBox)
				{				
					pMB = createMeshBuild (*pNode, tvTime, pMBB);
					convertToWorldCoordinate( pMB, pMBB );
					testVertices = &pMB->Vertices;
				}
开发者ID:mixxit,项目名称:solinia,代码行数:66,代码来源:export_scene.cpp


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