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


C++ Bound::Reset方法代码示例

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


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

示例1: MakeBound

void Sphere::MakeBound( Bound &out_bound ) const
{
	float	tuMin = mThetamaxRad * mURange[0];
	float	tuMax = mThetamaxRad * mURange[1];

	float	alphaMin = DASin( mZMin / mRadius );
	float	alphaMax = DASin( mZMax / mRadius );

	float	aVMin = DMix( alphaMin, alphaMax, mVRange[0] );
	float	aVMax = DMix( alphaMin, alphaMax, mVRange[1] );

	float	rVMin = DCos( aVMin ) * mRadius;
	float	rVMax = DCos( aVMax ) * mRadius;
	float	rMin = DMIN( rVMin, rVMax );
	
	float	rMax;
	
	if ( aVMin < 0 && aVMax > 0 )
		rMax = mRadius;
	else
		rMax = DMAX( rVMin, rVMax );
	
	out_bound.Reset();
	bounds2DSweepL( out_bound, rMin, rMax, tuMin, tuMax );

	out_bound.mBox[0].z() = DSin( aVMin ) * mRadius;
	out_bound.mBox[1].z() = DSin( aVMax ) * mRadius;
}
开发者ID:UIKit0,项目名称:RibTools,代码行数:28,代码来源:RI_Primitive_Quadric.cpp

示例2: avg_dPdu_s

//==================================================================
SimplePrimitiveBase::CheckSplitRes
	SimplePrimitiveBase::CheckForSplit(
							const Hider &hider,
							int			out_bound2d[4],
							bool		&out_uSplit,
							bool		&out_vSplit )
{
	const Matrix44 &mtxLocalWorld = mpTransform->GetMatrix();

	DASSERT( mDiceGridWd == -1 && mDiceGridHe == -1 );

	Float3_	testDicePo[ MAX_MAKE_BOUND_OUT_SIZE ];

	Bound	bound;
	bound.Reset();

	MakeBound( bound, testDicePo );

	float pixelArea = hider.RasterEstimate( bound, mtxLocalWorld, out_bound2d );
	
	if ( pixelArea <= MP_GRID_MAX_SIZE )
	{
		if ( pixelArea < RI_EPSILON )
		{
			return CHECKSPLITRES_CULL;
		}

		float	dim = DSqrt( pixelArea );

		mDiceGridWd = DMT_SIMD_PADSIZE( (int)ceilf( dim ) );
		mDiceGridHe = (int)ceilf( dim );

		out_uSplit = false;
		out_vSplit = false;

		return CHECKSPLITRES_DICE;	// will dice
	}
	else
	{
#if 0
		SlVec2	locUV[ TEST_DICE_SIMD_BLOCKS ];
		// set last item to 0 to be safe when using the AddReduce() later on
		locUV[ TEST_DICE_SIMD_BLOCKS - 1 ] = SlVec2( 0.f, 0.f );

		fillUVsArray(
				locUV,
				1.0f / (TEST_DICE_LEN - 1),
				1.0f / (TEST_DICE_LEN - 1),
				TEST_DICE_LEN,
				TEST_DICE_LEN );

		//Float3_	avg_dPdu( 0.f, 0.f, 0.f );
		//Float3_	avg_dPdv( 0.f, 0.f, 0.f );
		SlScalar	avg_dPdu( 0.f );
		SlScalar	avg_dPdv( 0.f );
		for (u_int i=0; i < TEST_DICE_SIMD_BLOCKS; ++i)
		{
			SlVec3	posLS;
			SlVec3	dPdu;
			SlVec3	dPdv;

			Eval_dPdu_dPdv( locUV[ i ], posLS, &dPdu, &dPdv );

			avg_dPdu += dPdu.GetLengthSqr();
			avg_dPdv += dPdv.GetLengthSqr();
		}

		// divide by the total number of elements 
		//avg_dPdu /= (float)TEST_DICE_SIMD_BLOCKS * DMT_SIMD_FLEN;
		//avg_dPdv /= (float)TEST_DICE_SIMD_BLOCKS * DMT_SIMD_FLEN;
/*

		Float3 avg_dPdu_s(
				avg_dPdu.x().AddReduce(),	// avg_dPdu.x()[0] + avg_dPdu.x()[1] ...
				avg_dPdu.y().AddReduce(),
				avg_dPdu.z().AddReduce() );

		Float3 avg_dPdv_s(
				avg_dPdv.x().AddReduce(),	// avg_dPdv.x()[0] + avg_dPdv.x()[1] ...
				avg_dPdv.y().AddReduce(),
				avg_dPdv.z().AddReduce() );
*/

		float lenU = avg_dPdu.AddReduce();
		float lenV = avg_dPdv.AddReduce();

		if ( lenU < lenV )
		{
			out_uSplit = false;
			out_vSplit = true;
		}
		else
		{
			out_uSplit = true;
			out_vSplit = false;
		}

#else
		out_uSplit = true;
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:RibTools,代码行数:101,代码来源:RI_Primitive_Base.cpp


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