本文整理汇总了C++中TriangleBuffer::EstimateVertexCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TriangleBuffer::EstimateVertexCount方法的具体用法?C++ TriangleBuffer::EstimateVertexCount怎么用?C++ TriangleBuffer::EstimateVertexCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriangleBuffer
的用法示例。
在下文中一共展示了TriangleBuffer::EstimateVertexCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToTriangleBuffer
void TorusGenerator::AddToTriangleBuffer(TriangleBuffer& Buffer) const
{
Buffer.RebaseOffset();
Buffer.EstimateVertexCount( ( this->NumPoloidalSeg + 1 ) * ( this->NumToroidalSeg + 1 ) );
Buffer.EstimateIndexCount( ( this->NumPoloidalSeg ) * ( this->NumToroidalSeg + 1 ) * 6 );
Real deltaSection = ( MathTools::GetTwoPi() / this->NumToroidalSeg );
Real deltaCircle = ( MathTools::GetTwoPi() / this->NumPoloidalSeg );
Integer Offset = 0;
for( Whole i = 0 ; i <= this->NumPoloidalSeg ; i++ )
{
for( Whole j = 0 ; j<= this->NumToroidalSeg ; j++ )
{
Vector3 c0( this->TorusPoloidalRadius, 0.0, 0.0 );
Vector3 v0( this->TorusPoloidalRadius + this->TorusToroidalRadius * cosf( j * deltaSection ), this->TorusToroidalRadius * sinf( j * deltaSection ), 0.0 );
Quaternion q( i * deltaCircle, Vector3::Unit_Y() );
Vector3 v = q * v0;
Vector3 c = q * c0;
this->AddPoint( Buffer, v,
( v - c ).GetNormal(),
Vector2( i / (Real)this->NumPoloidalSeg, j / (Real)this->NumToroidalSeg ) );
if( i != this->NumPoloidalSeg ) {
Buffer.AddIndex( Offset + this->NumToroidalSeg + 1 );
Buffer.AddIndex( Offset );
Buffer.AddIndex( Offset + this->NumToroidalSeg );
Buffer.AddIndex( Offset + this->NumToroidalSeg + 1 );
Buffer.AddIndex( Offset + 1 );
Buffer.AddIndex( Offset );
}
Offset++;
}
}
}