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


C++ ConvexBody::getPolygon方法代码示例

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


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

示例1: allocatePolygon

	//-----------------------------------------------------------------------
	ConvexBody::ConvexBody( const ConvexBody& cpy )
	{
		for ( size_t i = 0; i < cpy.getPolygonCount(); ++i )
		{
			Polygon *p = allocatePolygon();
			*p = cpy.getPolygon( i );
			mPolygons.push_back( p );
		}
	}
开发者ID:carriercomm,项目名称:gamekit,代码行数:10,代码来源:OgreConvexBody.cpp

示例2: getPolygonCount

	//-----------------------------------------------------------------------
	bool ConvexBody::operator == ( const ConvexBody& rhs ) const
	{
		if ( getPolygonCount() != rhs.getPolygonCount() )
			return false;

		// Compare the polygons. They may not be in correct order.
		// A correct convex body does not have identical polygons in its body.
		bool *bChecked = OGRE_ALLOC_T(bool, getPolygonCount(), MEMCATEGORY_SCENE_CONTROL);
		for ( size_t i=0; i<getPolygonCount(); ++i )
		{
			bChecked[ i ] = false;
		}

		for ( size_t i=0; i<getPolygonCount(); ++i )
		{
			bool bFound = false;

			for ( size_t j=0; j<getPolygonCount(); ++j )
			{
				const Polygon& pA = getPolygon( i );
				const Polygon& pB = rhs.getPolygon( j );

				if ( pA == pB )
				{
					bFound = true;
					bChecked[ i ] = true;
					break;
				}
			}

			if ( bFound == false )
			{
				OGRE_FREE(bChecked, MEMCATEGORY_SCENE_CONTROL);
				bChecked = 0;
				return false;
			}
		}

		for ( size_t i=0; i<getPolygonCount(); ++i )
		{
			if ( bChecked[ i ] != true )
			{
				OGRE_FREE(bChecked, MEMCATEGORY_SCENE_CONTROL);
				bChecked = 0;
				return false;
			}
		}

		OGRE_FREE(bChecked, MEMCATEGORY_SCENE_CONTROL);
		bChecked = 0;
		return true;
	}
开发者ID:carriercomm,项目名称:gamekit,代码行数:53,代码来源:OgreConvexBody.cpp

示例3: getPolygonCount

	//-----------------------------------------------------------------------
	bool ConvexBody::operator == ( const ConvexBody& rhs ) const
	{
		if ( getPolygonCount() != rhs.getPolygonCount() )
			return false;

		// Compare the polygons. They may not be in correct order.
		// A correct convex body does not have identical polygons in its body.
		bool *bChecked = new bool[ getPolygonCount() ];
		for ( size_t i=0; i<getPolygonCount(); ++i )
		{
			bChecked[ i ] = false;
		}

		for ( size_t i=0; i<getPolygonCount(); ++i )
		{
			bool bFound = false;

			for ( size_t j=0; j<getPolygonCount(); ++j )
			{
				const Polygon& pA = getPolygon( i );
				const Polygon& pB = rhs.getPolygon( j );

				if ( pA == pB )
				{
					bFound = true;
					bChecked[ i ] = true;
					break;
				}
			}

			if ( bFound == false )
			{
				OGRE_DELETE_ARRAY( bChecked );
				return false;
			}
		}

		for ( size_t i=0; i<getPolygonCount(); ++i )
		{
			if ( bChecked[ i ] != true )
			{
				OGRE_DELETE_ARRAY( bChecked );
				return false;
			}
		}

		OGRE_DELETE_ARRAY( bChecked );
		return true;
	}
开发者ID:andyhebear,项目名称:likeleon,代码行数:50,代码来源:OgreConvexBody.cpp

示例4: ray

	//-----------------------------------------------------------------------
	void FocusedShadowCameraSetup::PointListBody::buildAndIncludeDirection(
		const ConvexBody& body, Real extrudeDist, const Vector3& dir)
	{
		// reset point list
		this->reset();

		// intersect the rays formed by the points in the list with the given direction and
		// insert them into the list

		const size_t polyCount = body.getPolygonCount();
		for (size_t iPoly = 0; iPoly < polyCount; ++iPoly)
		{

			// store the old inserted point and plane info
			// if the currently processed point hits a different plane than the previous point an 
			// intersection point is calculated that lies on the two planes' intersection edge

			// fetch current polygon
			const Polygon& p = body.getPolygon(iPoly);

			size_t pointCount = p.getVertexCount();
			for (size_t iPoint = 0; iPoint < pointCount ; ++iPoint)
			{
				// base point
				const Vector3& pt = p.getVertex(iPoint);

				// add the base point
				this->addPoint(pt);

				// intersection ray
				Ray ray(pt, dir);

				const Vector3 ptIntersect = ray.getPoint(extrudeDist);
				this->addPoint(ptIntersect);

			} // for: polygon point iteration

		} // for: polygon iteration
	}
开发者ID:danyr,项目名称:gamekit,代码行数:40,代码来源:OgreShadowCameraSetupFocused.cpp

示例5: clip

	//-----------------------------------------------------------------------
	void ConvexBody::clip(const ConvexBody& body)
	{
		if ( this == &body )
			return;

		// for each polygon; clip 'this' with each plane of 'body'
		// front vertex representation is ccw

		Plane pl;

		for ( size_t iPoly = 0; iPoly < body.getPolygonCount(); ++iPoly )
		{
			const Polygon& p = body.getPolygon( iPoly );

			OgreAssert( p.getVertexCount() >= 3, "A valid polygon must contain at least three vertices." );

			// set up plane with first three vertices of the polygon (a polygon is always planar)
			pl.redefine( p.getVertex( 0 ), p.getVertex( 1 ), p.getVertex( 2 ) );

			clip(pl);
		}
	}
开发者ID:carriercomm,项目名称:gamekit,代码行数:23,代码来源:OgreConvexBody.cpp


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