本文整理汇总了C++中CCoreDispInfo::GetPositionOnSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ CCoreDispInfo::GetPositionOnSurface方法的具体用法?C++ CCoreDispInfo::GetPositionOnSurface怎么用?C++ CCoreDispInfo::GetPositionOnSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCoreDispInfo
的用法示例。
在下文中一共展示了CCoreDispInfo::GetPositionOnSurface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmitDetailObjectsOnDisplacementFace
//-----------------------------------------------------------------------------
// Places Detail Objects on a face
//-----------------------------------------------------------------------------
static void EmitDetailObjectsOnDisplacementFace( dface_t* pFace,
DetailObject_t& detail, CCoreDispInfo& coreDispInfo )
{
assert(pFace->numedges == 4);
// We're going to pick a bunch of random points, and then probabilistically
// decide whether or not to plant a detail object there.
// Compute the area of the base face
float area = ComputeDisplacementFaceArea( pFace );
// Compute the number of samples to take
int numSamples = area * detail.m_Density * 0.000001;
// Now take a sample, and randomly place an object there
for (int i = 0; i < numSamples; ++i )
{
// Create a random sample...
float u = rand() / (float)RAND_MAX;
float v = rand() / (float)RAND_MAX;
// Compute alpha
float alpha;
Vector pt, normal;
coreDispInfo.GetPositionOnSurface( u, v, pt, &normal, &alpha );
alpha /= 255.0f;
// Select a group based on the alpha value
int group = SelectGroup( detail, alpha );
// Now that we've got a group, choose a detail
int model = SelectDetail( detail.m_Groups[group] );
if (model < 0)
continue;
// Got a detail! Place it on the surface...
PlaceDetail( detail.m_Groups[group].m_Models[model], pt, normal );
}
}