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


C++ CBaseObject::GetChildren方法代码示例

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


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

示例1: ray_view


//.........这里部分代码省略.........
			// rough testing using bounding sphere
			if(pViewClippingObject->TestCollisionSphere(& (vViewCenter), fViewRadius,1) )
			{
				// further testing using bounding box
				CShapeOBB obb;
				pViewClippingObject->GetOBB(&obb);
				obb.mCenter-=vRenderOrigin;

				float fDist;
				if(rayCollider.Intersect(ray_view, obb, &fDist) && fDist<=fMaxDistance )
				{
					// add to collision list
					float fMinExtent = Math::MinVec3(obb.mExtents);
					bool bUseCurrent = false;

					if(lastObj.IsValid()==false)
						bUseCurrent = true;
					else
					{
						bool bDetermined = false;

						if(lastObj.m_pObj->GetMyType()>=_Biped && pObj->GetMyType()<_Biped)
						{
							// if the last object is a character and the current one is a non-physical mesh object,
							// we will give character a little priority over smaller mesh object by 
							//  (1) enlarging the character by its radius
							//  (2) always select the character if the camera to character distance is less than 4 times the character radius
							float fRadius = lastObj.m_pObj->GetRadius();
							if(fRadius>fabs(lastObj.m_fRayDist -fDist) 
								|| lastObj.m_fRayDist<fRadius*4)
							{
								// use last character
								bDetermined = true;
							}
						}
						if(!bDetermined)
						{
							if(lastObj.m_fRayDist<=fDist)
							{
								if( (lastObj.m_pObj->GetType() != CBaseObject::MeshPhysicsObject) || (((CMeshPhysicsObject*)lastObj.m_pObj)->GetStaticActorCount()==0) )
								{
									// if the last object's intersection point is in front of the current object's  
									if(lastObj.m_fMinObjExtent > fMinExtent && 
										(fDist-lastObj.m_fRayDist) <= lastObj.m_fMinObjExtent*2)
										// if the last object is NOT entirely in front of the current object, this is just an approximate
										// we will adopt the current one
										bUseCurrent = true;
								}
							}
							else
							{
								// if the last object's intersection point is behind the current object's  
								if(lastObj.m_fMinObjExtent < fMinExtent && 
									(lastObj.m_fRayDist-fDist) <= fMinExtent*2)
								{
									// if the last object is a smaller object
									// we will adopt the last object
								}
								else
									bUseCurrent = true;
							}
						}
					}
					if(bUseCurrent)
					{
						lastObj.m_pObj = pObj;
						lastObj.m_fMinObjExtent = fMinExtent;
						lastObj.m_fRayDist = fDist;
					}
				}
			}

			/// push its child objects to the queue
			for (auto pChild : pObj->GetChildren())
			{
				if (pChild->IsVisible())
					queueNodes.push(pChild);
			}
			
		} //while(!queueNodes.empty())
	}


	if(pTouchedObject!=0 )
	{
		if(lastObj.IsValid())
		{
			result = true;
			*pTouchedObject = lastObj.m_pObj;
		}
		else
			*pTouchedObject = NULL;
	}
	
	// restore render origin
	if(IsCameraEnabled())
		CGlobals::GetScene()->RegenerateRenderOrigin(vOldRenderOrigin);

	return result;
}
开发者ID:marxwolf,项目名称:NPLRuntime,代码行数:101,代码来源:MiniSceneGraph.cpp


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