本文整理汇总了C++中PointSet::Reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::Reserve方法的具体用法?C++ PointSet::Reserve怎么用?C++ PointSet::Reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointSet
的用法示例。
在下文中一共展示了PointSet::Reserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Material
main(int argc, char *argv[])
{
PointSet *myPts = new PointSet;
LineCell *lCell = new LineCell;
LineCell *sCell = new LineCell;
PolygonCell *pCell = new PolygonCell;
Material *mat;
MaterialSet *matSet;
CellSet *dSet = new CellSet;
OGLRenderer *aren = new OGLRenderer;
float tmp[3];
float rgba[] = { 1.0, 1.0, 0.0, 1.0 };
mat = new Material(rgba);
matSet = new MaterialSet;
*matSet += mat;
myPts->Reserve(10);
tmp[0] = 0.0;tmp[1] = 0.0;tmp[2] = 0.0; *myPts += new PointType(tmp);
tmp[0] = 1.0;tmp[1] = 0.0;tmp[2] = 0.0; *myPts += new PointType(tmp);
tmp[0] = 1.0;tmp[1] = 1.0;tmp[2] = 0.0; *myPts += new PointType(tmp);
tmp[0] = 0.0;tmp[1] = 1.0;tmp[2] = 0.0; *myPts += new PointType(tmp);
tmp[0] = 0.0;tmp[1] = 0.0;tmp[2] = 1.0; *myPts += new PointType(tmp);
tmp[0] = 1.0;tmp[1] = 0.0;tmp[2] = 1.0; *myPts += new PointType(tmp);
tmp[0] = 1.0;tmp[1] = 1.0;tmp[2] = 1.0; *myPts += new PointType(tmp);
tmp[0] = 0.0;tmp[1] = 1.0;tmp[2] = 1.0; *myPts += new PointType(tmp);
tmp[0] = 0.5;tmp[1] = 0.5;tmp[2] = 0.5; *myPts += new PointType(tmp);
// Draw a Triangle with lines
*lCell += 0; *lCell += 1; *lCell += 1; *lCell+= 2; *lCell += 2; *lCell += 0;
lCell->SetPoints(myPts);
lCell->SetMaterials(matSet);
// Draw a Solid Triangle
*pCell += 0; *pCell += 1; *pCell+= 8; *pCell += 0;
pCell->SetPoints(myPts);
pCell->SetMaterials(matSet);
sleep(2);
// Draw a Square
*sCell += 4; *sCell += 5; *sCell += 5; *sCell += 6; *sCell += 6; *sCell += 7; *sCell +=7; *sCell += 4;
sCell->SetMaterials(matSet);
sCell->SetPoints(myPts);
// Add Cells to the CellSet
*dSet += lCell;
*dSet += pCell;
*dSet += sCell;
lCell->PrintSelf(cout);
pCell->PrintSelf(cout);
sCell->PrintSelf(cout);
// Initialize the Renderer, creates window and attaches OpenGL Visual
aren->Initialize(argc, argv);
// Add this CellSet to the Renderers collection.
aren->AddCellSet(dSet);
aren->AddCamera(new OGLCamera);
aren->AddLight(new OGLLight(0));
// Starts the Event loop.
aren->PrintSelf(cout);
aren->MainLoop();
return(0);
}