本文整理汇总了C++中Box3F::extend方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3F::extend方法的具体用法?C++ Box3F::extend怎么用?C++ Box3F::extend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box3F
的用法示例。
在下文中一共展示了Box3F::extend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeBounds
void AppMesh::computeBounds(Box3F& bounds)
{
bounds = Box3F::Invalid;
if ( isSkin() )
{
// Need to skin the mesh before we can compute the bounds
// Setup bone transforms
Vector<MatrixF> boneTransforms;
boneTransforms.setSize( nodeIndex.size() );
for (S32 iBone = 0; iBone < boneTransforms.size(); iBone++)
{
MatrixF nodeMat = bones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime );
TSShapeLoader::zapScale(nodeMat);
boneTransforms[iBone].mul( nodeMat, initialTransforms[iBone] );
}
// Multiply verts by weighted bone transforms
for (S32 iVert = 0; iVert < initialVerts.size(); iVert++)
points[iVert].set( Point3F::Zero );
for (S32 iWeight = 0; iWeight < vertexIndex.size(); iWeight++)
{
const S32& vertIndex = vertexIndex[iWeight];
const MatrixF& deltaTransform = boneTransforms[ boneIndex[iWeight] ];
Point3F v;
deltaTransform.mulP( initialVerts[vertIndex], &v );
v *= weight[iWeight];
points[vertIndex] += v;
}
// compute bounds for the skinned mesh
for (S32 iVert = 0; iVert < initialVerts.size(); iVert++)
bounds.extend( points[iVert] );
}
else
{
MatrixF transform = getMeshTransform(TSShapeLoader::DefaultTime);
TSShapeLoader::zapScale(transform);
for (S32 iVert = 0; iVert < points.size(); iVert++)
{
Point3F p;
transform.mulP(points[iVert], &p);
bounds.extend(p);
}
}
}
示例2: setDirtyObjectBox
void T3DSceneComponent::_ComputeObjectBox()
{
_objectBox->set(Box3F(10E30f, 10E30f, 10E30f, -10E30f, -10E30f, -10E30f));
bool gotone = false;
for (T3DSceneClient * walk = _sceneClientList; walk != NULL; walk = walk->getNextSceneClient())
{
ISolid3D * solid = dynamic_cast<ISolid3D*>(walk);
if (solid == NULL)
continue;
Box3F box = solid->getObjectBox();
if (solid->getTransform3D() != NULL)
{
MatrixF mat;
solid->getTransform3D()->getObjectMatrix(mat, true);
mat.mul(box);
}
box.extend(_objectBox->get().min);
box.extend(_objectBox->get().max);
_objectBox->set(box);
gotone = true;
}
if (!gotone)
_objectBox->set(Box3F());
setDirtyObjectBox(false);
setDirtyWorldBox(true);
}
示例3: AssertFatal
void T3DSceneComponent::AddSceneClient(T3DSceneClient * sceneClient)
{
AssertFatal(sceneClient,"Cannot add a NULL scene client");
// add to the front of the list
sceneClient->setNextSceneClient(_sceneClientList);
_sceneClientList = sceneClient;
// extend object box
ISolid3D * solid = dynamic_cast<ISolid3D*>(sceneClient);
if (solid != NULL)
{
if (isObjectBoxLocked())
setDirtyObjectBox(true);
else
{
Box3F box = solid->getObjectBox();
if (solid->getTransform3D() != NULL)
{
MatrixF mat;
solid->getTransform3D()->getObjectMatrix(mat, true);
mat.mul(box);
}
box.extend(_objectBox->get().min);
box.extend(_objectBox->get().max);
_objectBox->set(box);
}
// policy is that we become parent transform
if (solid->getTransform3D() != NULL && solid->getTransform3D()->isChildOf(_transform, true))
solid->getTransform3D()->setParentTransform(_transform);
}
}
示例4: _captureVerts
void DecalRoad::_captureVerts()
{
PROFILE_SCOPE( DecalRoad_captureVerts );
//Con::warnf( "%s - captureVerts", isServerObject() ? "server" : "client" );
if ( isServerObject() )
{
//Con::errorf( "DecalRoad::_captureVerts - called on the server side!" );
return;
}
if ( mEdges.size() == 0 )
return;
//
// Construct ClippedPolyList objects for each pair
// of roadEdges.
// Use them to capture Terrain verts.
//
SphereF sphere;
RoadEdge *edge = NULL;
RoadEdge *nextEdge = NULL;
mTriangleCount = 0;
mVertCount = 0;
Vector<ClippedPolyList> clipperList;
for ( U32 i = 0; i < mEdges.size() - 1; i++ )
{
Box3F box;
edge = &mEdges[i];
nextEdge = &mEdges[i+1];
box.minExtents = edge->p1;
box.maxExtents = edge->p1;
box.extend( edge->p0 );
box.extend( edge->p2 );
box.extend( nextEdge->p0 );
box.extend( nextEdge->p1 );
box.extend( nextEdge->p2 );
box.minExtents.z -= 5.0f;
box.maxExtents.z += 5.0f;
sphere.center = ( nextEdge->p1 + edge->p1 ) * 0.5f;
sphere.radius = 100.0f; // NOTE: no idea how to calculate this
ClippedPolyList clipper;
clipper.mNormal.set(0.0f, 0.0f, 0.0f);
VectorF n;
PlaneF plane0, plane1;
// Construct Back Plane
n = edge->p2 - edge->p0;
n.normalize();
n = mCross( n, edge->uvec );
plane0.set( edge->p0, n );
clipper.mPlaneList.push_back( plane0 );
// Construct Front Plane
n = nextEdge->p2 - nextEdge->p0;
n.normalize();
n = -mCross( edge->uvec, n );
plane1.set( nextEdge->p0, -n );
//clipper.mPlaneList.push_back( plane1 );
// Test if / where the planes intersect.
bool discardLeft = false;
bool discardRight = false;
Point3F iPos;
VectorF iDir;
if ( plane0.intersect( plane1, iPos, iDir ) )
{
Point2F iPos2F( iPos.x, iPos.y );
Point2F cPos2F( edge->p1.x, edge->p1.y );
Point2F rVec2F( edge->rvec.x, edge->rvec.y );
Point2F iVec2F = iPos2F - cPos2F;
F32 iLen = iVec2F.len();
iVec2F.normalize();
if ( iLen < edge->width * 0.5f )
{
F32 dot = mDot( rVec2F, iVec2F );
// The clipping planes intersected on the right side,
// discard the right side clipping plane.
if ( dot > 0.0f )
discardRight = true;
// The clipping planes intersected on the left side,
// discard the left side clipping plane.
else
discardLeft = true;
}
}
// Left Plane
if ( !discardLeft )
//.........这里部分代码省略.........