本文整理汇总了C++中Point3F::interpolate方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3F::interpolate方法的具体用法?C++ Point3F::interpolate怎么用?C++ Point3F::interpolate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3F
的用法示例。
在下文中一共展示了Point3F::interpolate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: interpolateTick
void PxSingleActor::interpolateTick( F32 delta )
{
Point3F interpPos;
QuatF interpRot;
// Interpolate the position based on the delta.
interpPos.interpolate( mNextPos, mLastPos, delta );
// Interpolate the rotation based on the delta.
interpRot.interpolate( mNextRot, mLastRot, delta );
// Set up the interpolated transform.
MatrixF interpMat;
// Set the interpolated position and rotation.
interpRot.setMatrix( &interpMat );
interpMat.setPosition( interpPos );
// Set the transform to the interpolated transform.
Parent::setTransform( interpMat );
}
示例2: castRay
bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *info )
{
if ( mPlanes.empty() )
return false;
const Vector< PlaneF > &planeList = mPlanes;
const U32 planeCount = planeList.size();
F32 t;
F32 tmin = F32_MAX;
S32 hitFace = -1;
Point3F hitPnt, pnt;
VectorF rayDir( end - start );
rayDir.normalizeSafe();
if ( false )
{
PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) );
Point3F sp( 0,0,-1 );
Point3F ep( 0,0,1 );
F32 t = plane.intersect( sp, ep );
Point3F hitPnt;
hitPnt.interpolate( sp, ep, t );
}
for ( S32 i = 0; i < planeCount; i++ )
{
// Don't hit the back-side of planes.
if ( mDot( rayDir, planeList[i] ) >= 0.0f )
continue;
t = planeList[i].intersect( start, end );
if ( t >= 0.0f && t <= 1.0f && t < tmin )
{
pnt.interpolate( start, end, t );
S32 j = 0;
for ( ; j < planeCount; j++ )
{
if ( i == j )
continue;
F32 dist = planeList[j].distToPlane( pnt );
if ( dist > 1.0e-004f )
break;
}
if ( j == planeCount )
{
tmin = t;
hitFace = i;
}
}
}
if ( hitFace == -1 )
return false;
info->face = hitFace;
info->material = mMaterialInst;
info->normal = planeList[ hitFace ];
info->object = this;
info->t = tmin;
//mObjToWorld.mulV( info->normal );
return true;
}
示例3: splitPoly
void ShadowVolumeBSP::splitPoly(SVPoly * poly, const PlaneF & plane, SVPoly ** front, SVPoly ** back)
{
PlaneF::Side sides[SVPoly::MaxWinding];
U32 i;
for(i = 0; i < poly->mWindingCount; i++)
sides[i] = plane.whichSide(poly->mWinding[i]);
// create the polys
(*front) = createPoly();
(*back) = createPoly();
// copy the info
(*front)->mWindingCount = (*back)->mWindingCount = 0;
(*front)->mPlane = (*back)->mPlane = poly->mPlane;
(*front)->mTarget = (*back)->mTarget = poly->mTarget;
(*front)->mSurfaceInfo = (*back)->mSurfaceInfo = poly->mSurfaceInfo;
(*front)->mShadowVolume = (*back)->mShadowVolume = poly->mShadowVolume;
//
for(i = 0; i < poly->mWindingCount; i++)
{
U32 j = (i+1) % poly->mWindingCount;
if(sides[i] == PlaneF::On)
{
(*front)->mWinding[(*front)->mWindingCount++] = poly->mWinding[i];
(*back)->mWinding[(*back)->mWindingCount++] = poly->mWinding[i];
}
else if(sides[i] == PlaneF::Front)
{
(*front)->mWinding[(*front)->mWindingCount++] = poly->mWinding[i];
if(sides[j] == PlaneF::Back)
{
const Point3F & a = poly->mWinding[i];
const Point3F & b = poly->mWinding[j];
F32 t = plane.intersect(a, b);
AssertFatal(t >=0 && t <= 1, "ShadowVolumeBSP::splitPoly - bad plane intersection");
Point3F pos;
pos.interpolate(a, b, t);
//
(*front)->mWinding[(*front)->mWindingCount++] =
(*back)->mWinding[(*back)->mWindingCount++] = pos;
}
}
else if(sides[i] == PlaneF::Back)
{
(*back)->mWinding[(*back)->mWindingCount++] = poly->mWinding[i];
if(sides[j] == PlaneF::Front)
{
const Point3F & a = poly->mWinding[i];
const Point3F & b = poly->mWinding[j];
F32 t = plane.intersect(a, b);
AssertFatal(t >=0 && t <= 1, "ShadowVolumeBSP::splitPoly - bad plane intersection");
Point3F pos;
pos.interpolate(a, b, t);
(*front)->mWinding[(*front)->mWindingCount++] =
(*back)->mWinding[(*back)->mWindingCount++] = pos;
}
}
}
AssertFatal((*front)->mWindingCount && (*back)->mWindingCount, "ShadowVolume::split - invalid split");
}