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


C++ PointArray::addPoints方法代码示例

本文整理汇总了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 );
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:91,代码来源:ts_CelAnimMesh.cpp


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