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


C++ Float3::GetCross方法代码示例

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


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

示例1: Dice


//.........这里部分代码省略.........
			Color( h, h, h ),
		};
*/
		static int cnt;

		useColor = palette[ cnt++ & 15 ];
		useOpa	 = SlColor( 1, 1, 1 );
	}
	else
	{
		useColor = mpAttribs->mColor;
		useOpa	 = mpAttribs->mOpacity;
	}

	// build the UVs
	Float2_	locUV[ MP_GRID_MAX_SIZE_SIMD_BLKS ];
	Float2_	locDUDV[ MP_GRID_MAX_SIZE_SIMD_BLKS ];

	fillUVsArray( locUV, locDUDV, du, dv, g.mXDim, g.mYDim );

	//DASSERT( sampleIdx == g.mPointsN );

	size_t	blocksN = DMT_SIMD_BLOCKS( g.mPointsN );

	Float_	one( 1.0f );

	for (size_t blkIdx=0; blkIdx < blocksN; ++blkIdx)
	{
#if 1
		Float3_	dPdu;
		Float3_	dPdv;
		Float3_	posLS;

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

		if ( posLS[0][0] == 0 && posLS[0][1] == 0 && posLS[0][2] == 0 )
			continue;

		Float3_	norLS = dPdu.GetCross( dPdv ).GetNormalized();
		Float3_	posCS = V3__V3W1_Mul_M44<Float_>( posLS, g.mMtxLocalCamera );
		Float3_	norCS = V3__V3W1_Mul_M44<Float_>( norLS, mtxLocalCameraNorm ).GetNormalized();

		pP[blkIdx]		= posCS;

		pI[blkIdx]		= (posCS - -camPosCS);//.GetNormalized();
		pOODu[blkIdx]	= one / locDUDV[blkIdx][0];
		pOODv[blkIdx]	= one / locDUDV[blkIdx][1];

		pu[blkIdx]		= locUV[blkIdx][0];
		pv[blkIdx]		= locUV[blkIdx][1];

		pN[blkIdx]		= norCS;
		pNg[blkIdx]		= norCS;
		pOs[blkIdx]		= useOpa;
		pCs[blkIdx]		= useColor;

#else
		Float2_	&tmpvblk = locUV[ blkIdx ];

		for (size_t	itmIdx=0; itmIdx < DMT_SIMD_FLEN; ++itmIdx)
		{
			Float3	dPdu;
			Float3	dPdv;
			Float3	posLS;
			Eval_dPdu_dPdv(	locUV[ blkIdx ][0][ itmIdx ],
							locUV[ blkIdx ][1][ itmIdx ],
							posLS,
							&dPdu,
							&dPdv );

			Float3	norLS = dPdu.GetCross( dPdv ).GetNormalized();
			Float3	posWS = V3__V3W1_Mul_M44<float>( posLS, g.mMtxLocalWorld );
			Float3	posCS = V3__V3W1_Mul_M44<float>( posLS, g.mMtxLocalCamera );
			Float3	norCS = V3__V3W1_Mul_M44<float>( norLS, mtxLocalCameraNorm ).GetNormalized();

			// store in blocked SOA format

			pP[blkIdx][0][itmIdx] = posWS[0];
			pP[blkIdx][1][itmIdx] = posWS[1];
			pP[blkIdx][2][itmIdx] = posWS[2];

			Float3	tmpI = (posCS - -camPosCS).GetNormalized();
			pI[blkIdx][0][itmIdx] = tmpI[0];
			pI[blkIdx][1][itmIdx] = tmpI[1];
			pI[blkIdx][2][itmIdx] = tmpI[2];

			pN[blkIdx][0][itmIdx] = norCS[0];
			pN[blkIdx][1][itmIdx] = norCS[1];
			pN[blkIdx][2][itmIdx] = norCS[2];

			pNg[blkIdx][0][itmIdx] = norCS[0];
			pNg[blkIdx][1][itmIdx] = norCS[1];
			pNg[blkIdx][2][itmIdx] = norCS[2];
		}

		pOs[blkIdx]	= useOpa;
		pCs[blkIdx]	= useColor;
#endif
	}
}
开发者ID:UIKit0,项目名称:RibTools,代码行数:101,代码来源:RI_Primitive_Base.cpp


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