本文整理汇总了C++中MeshBuilder::addQuad方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshBuilder::addQuad方法的具体用法?C++ MeshBuilder::addQuad怎么用?C++ MeshBuilder::addQuad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshBuilder
的用法示例。
在下文中一共展示了MeshBuilder::addQuad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPlane
int Object::createPlane( Material* mat , float w , float h , float* color , float xTile , float yTile ,
Vector3 const& normal , Vector3 const& alignDir , Vector3 const& offset , bool invYDir )
{
Vector3 yLen = normal.cross( alignDir );
assert( yLen.length2() > 1e-4 );
yLen.normalize();
Vector3 xLen = yLen.cross( normal );
xLen *= 0.5f * w;
yLen *= 0.5f * h;
if ( invYDir )
yLen = -yLen;
Vector3 n = normal;
n.normalize();
int texLen = 2;
VertexType type = ( color ) ? CFVT_XYZ_N_CF1 : CFVT_XYZ_N;
//VertexType type = ( color ) ? CFVT_XYZ_CF1 : CFVT_XYZ;
MeshBuilder builder = MeshBuilder( type | CFVF_TEX1( 2 ) );
if ( color )
builder.setColor( color );
builder.setNormal( n );
builder.reserveVexterBuffer( 4 );
builder.reserveIndexBuffer( 12 );
builder.setPosition( offset - xLen - yLen );
builder.setTexCoord( 0 , 0 , 0 );
builder.addVertex();
builder.setPosition( offset + xLen - yLen );
builder.setTexCoord( 0 ,xTile, 0 );
builder.addVertex();
builder.setPosition( offset + xLen + yLen );
builder.setTexCoord( 0 , xTile , yTile );
builder.addVertex();
builder.setPosition( offset - xLen + yLen );
builder.setTexCoord( 0 , 0 , yTile );
builder.addVertex();
builder.addQuad( 0 , 1 , 2 , 3 );
return builder.createIndexTrangle( this , mat );
}