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


C++ AABB3::GetCenterPosition方法代码示例

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


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

示例1: SetLightsFromLightSourceFaces

void CBSPMapData::SetLightsFromLightSourceFaces()
{
	vector<CMapFace> vecTempLightSourceFace;	// temporary buffer to hold light source faces
	size_t i,j;
	size_t iNumInteriorFaces = m_aInteriorFace.size();

	for(i=0; i<iNumInteriorFaces; i++)
	{	// set all the flags of light source faces to false
		m_aInteriorFace[i].m_bFlag = false;
	}

	// cluster light source faces	
	for(i=0; i<iNumInteriorFaces; i++)
	{
		vecTempLightSourceFace.clear();
		CMapFace& rFace1 = m_aInteriorFace[i];

		if( !rFace1.ReadTypeFlag(CMapFace::TYPE_LIGHTSOURCE) )
			continue;	// doesn't emit light by itself

		if( rFace1.m_bFlag == true )
			continue;	// already registered as a light source face

		rFace1.m_bFlag = true;
		vecTempLightSourceFace.push_back( rFace1 );

		// adjacent light source faces are converted into one point light
		SearchAdjacentLightSourceFaces_r( &vecTempLightSourceFace, rFace1, &m_aInteriorFace );

		// convert each cluster of light source faces into a point light
		AABB3 aabb;
		aabb.Nullify();
		for(j=0; j<vecTempLightSourceFace.size(); j++)
			vecTempLightSourceFace[j].AddToAABB( aabb );

		SPointLightDesc light = FindPointLightDesc( rFace1.m_acSurfaceName );
		CPointLight* pPointLight = new CPointLight;
		pPointLight->vPosition = aabb.GetCenterPosition();
		pPointLight->Color.fRed   = light.fRed;
		pPointLight->Color.fGreen = light.fGreen;
		pPointLight->Color.fBlue  = light.fBlue;
		pPointLight->fIntensity   = light.fIntensity;
		pPointLight->fAttenuation0 = light.fAttenuation[0];
		pPointLight->fAttenuation1 = light.fAttenuation[1];
		pPointLight->fAttenuation2 = light.fAttenuation[2];
		m_vecpLight.push_back( pPointLight );
	}
}
开发者ID:HermanHGF,项目名称:amorphous,代码行数:48,代码来源:BSPMapData.cpp

示例2: ViewFrustumIntersectsWith

inline bool Camera::ViewFrustumIntersectsWith( const AABB3& raabb ) const
{
	int i;
	float d;

	Vector3 vCenter, vExtents;
	vCenter = raabb.GetCenterPosition();
	vExtents = raabb.GetExtents();

	for( i=0; i<6; i++ )
	{
		const SPlane& rPlane = m_WorldBSPTree[i].plane;

		d = Vec3Dot( rPlane.normal, vCenter ) - rPlane.dist - raabb.GetRadiusForPlane(rPlane);

		if(0 < d)
			return false;
	}
	return true;
}
开发者ID:HermanHGF,项目名称:amorphous,代码行数:20,代码来源:Camera.hpp


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