本文整理汇总了C++中PointArray::addPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ PointArray::addPoints方法的具体用法?C++ PointArray::addPoints怎么用?C++ PointArray::addPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointArray
的用法示例。
在下文中一共展示了PointArray::addPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void CelAnimMesh::render(RenderContext& rc,
const ShapeInstance* shapeInst,
MaterialList const& mats,
int frame,
int matFrameIndex,
int* matRemap ) const
{
if( !fFaces.size() )
return;
AssertFatal( fFrames.size() > 0, "Shape must have at least one frame." );
AssertFatal( frame >= 0 && frame < fFrames.size(),
"TS::CelAnimMesh: frame index out of range" );
// get the frame struct:
const Frame *frm = &fFrames[frame];
int FirstVert = frm->fFirstVert;
const Point3F *pScale = &frm->fScale;
const Point3F *pOrigin = &frm->fOrigin;
// unpack the min and max points for this frame:
Vertex minVert, maxVert;
minVert.set( fVerts[FirstVert], *pScale, *pOrigin );
maxVert.set( fVerts[FirstVert + 1], *pScale, *pOrigin );
// create bounding object and do vis test:
BoundingBox bb;
bb.setBox( minVert.fPoint,maxVert.fPoint );
int vis = bb.pushVisibility( rc ); // no longer need sphere for visibility check
if( vis != ClipNoneVis )
{
PointArray *pa = rc.getPointArray();
GFXSurface *srf = rc.getSurface();
// reset point array:
pa->reset();
// optimize lights and tell point array to use them:
bb.setSphere(); // need sphere for lighting
bb.prepareLights( rc );
// transform and project all points:
int first = pa->addPoints( fnVertsPerFrame,
&fVerts[FirstVert], *pScale, *pOrigin, &vis );
if( vis != ClipNoneVis )
{
AssertFatal(matFrameIndex*fnTextureVertsPerFrame<fTextureVerts.size(),
"TS::CelAnimMesh::render: texture verts index out of range");
pa->useTextures( &fTextureVerts[matFrameIndex*fnTextureVertsPerFrame] );
// set up some statics used by renderers
TSMaterial::prepareRender(fVerts.address(),first,*pScale,*pOrigin,srf,pa,shapeInst);
// render visible faces (lighting vertices as we go):
for( Vector<Face>::const_iterator pFace = fFaces.begin();
pFace != fFaces.end(); pFace++ )
{
#ifdef DEBUG
validateFace( mats, *pFace, matFrameIndex );
#endif
int faceVis = faceVisibility( pa, *pFace, first );
if( faceVis != ClipNoneVis )
{
// draw the face:
pa->setVisibility( faceVis );
if( faceVis != ClipAllVis )
pa->useBackFaceTest( TRUE );
if ( pFace->fMaterial != -1 )
{
int mat_id = matRemap? matRemap[ pFace->fMaterial ] :
pFace->fMaterial;
const Material& fmat = ShapeInstance::getAlwaysMat() ?
(*ShapeInstance::getAlwaysMat())[0] : mats[ mat_id ];
fmat.render((const char*)pFace);
}
if( faceVis != ClipAllVis )
pa->useBackFaceTest( FALSE );
}
}
}
}
bb.popVisibility( rc );
}