本文整理汇总了C++中TriMesh::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TriMesh::clear方法的具体用法?C++ TriMesh::clear怎么用?C++ TriMesh::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriMesh
的用法示例。
在下文中一共展示了TriMesh::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void SimpleExampleApp::update()
{
// Update particles
float t = getElapsedSeconds();
mParticles.getPositionAt( 0 ).x = sin( t )*4.0f;
mParticles.getPositionAt( 1 ).x = cos( t )*4.0f;
mParticles.getPositionAt( 2 ).y = sin( t*2.0f )*4.0f;
// Polygonize
mTriMesh.clear();
mPolygonizer.polygonize( &mTriMesh );
}
示例2: generateTerrain
void TerrainApp::generateTerrain()
{
mTriMesh.clear();
for ( int y = 0; y < ySize; ++y )
{
for ( int x = 0; x < xSize; ++x )
{
addQuad( x, y );
}
}
}
示例3: generateQuad
BaseMeshRef SimpleMesh::generateQuad(Rectf dimensions,
Rectf uvCoords = Rectf(0.0f, 0.0f, 1.0f,
1.0f)) {
// cout << "SimpleMesh::GenerateQuad(); dims: " << dimensions
// << " uvCoords: " << uvCoords << endl;
TriMesh mesh;
mesh.clear();
// Vertexes
mesh.appendVertex(Vec3f(dimensions.x1, dimensions.y1, 0));
mesh.appendVertex(Vec3f(dimensions.x1, dimensions.y2, 0));
mesh.appendVertex(Vec3f(dimensions.x2, dimensions.y2, 0));
mesh.appendVertex(Vec3f(dimensions.x2, dimensions.y1, 0));
// Vertex Colors
mesh.appendColorRgb(Color(1.0f, 1.0f, 1.0f));
mesh.appendColorRgb(Color(1.0f, 1.0f, 1.0f));
mesh.appendColorRgb(Color(1.0f, 1.0f, 1.0f));
mesh.appendColorRgb(Color(1.0f, 1.0f, 1.0f));
// Tex coords
mesh.appendTexCoord(Vec2f(uvCoords.x1, uvCoords.y1));
mesh.appendTexCoord(Vec2f(uvCoords.x1, uvCoords.y2));
mesh.appendTexCoord(Vec2f(uvCoords.x2, uvCoords.y2));
mesh.appendTexCoord(Vec2f(uvCoords.x2, uvCoords.y1));
int vert0 = mesh.getNumVertices() - 4;
int vert1 = mesh.getNumVertices() - 1;
int vert2 = mesh.getNumVertices() - 2;
int vert3 = mesh.getNumVertices() - 3;
mesh.appendTriangle(vert0, vert1, vert3);
mesh.appendTriangle(vert3, vert1, vert2);
mesh.recalculateNormals();
SimpleMeshRef meshWrapper = make_shared<SimpleMesh>(mesh);
meshWrapper->_bounds = mesh.calcBoundingBox();
return dynamic_pointer_cast<BaseMesh>(meshWrapper);
}