本文整理汇总了C++中HeightMap::getGround方法的典型用法代码示例。如果您正苦于以下问题:C++ HeightMap::getGround方法的具体用法?C++ HeightMap::getGround怎么用?C++ HeightMap::getGround使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeightMap
的用法示例。
在下文中一共展示了HeightMap::getGround方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMesh
Scene::Scene( const float level, const HeightMap &hmap )
{
m_level = level;
m_step = hmap.getCellSize();
m_ground = hmap.getGround();
std::set<Vector3D> vertexes;
std::set< std::shared_ptr<Poly> > triangles;
std::set<Vector3D> normals;
//! Генерация вершин, полигонов и нормалей
createMesh( hmap, vertexes, triangles, normals );
map< Vector3D*, shared_ptr<set<shared_ptr<Poly>>>> vecToPoly;
createLinkPolyes( triangles, vecToPoly );
//! Создание MeshObject и разделение мешей
while( !vecToPoly.empty() )
{
shared_ptr<MeshObject> curObj( new MeshObject( vecToPoly) );
objects.insert( curObj );
}
//! Создание MeshObject препятствий
vecToPoly.clear();
createLinkPolyes( triangles, vecToPoly );
while( !vecToPoly.empty() )
{
bool isObstacle = false;
shared_ptr<MeshObstacle> curObj( new MeshObstacle( vecToPoly, level, isObstacle ) );
if( isObstacle )
obstacles.insert( curObj );
}
vecToPoly.clear();
triangles.clear();
//! Создание поверхности воды
Vector3D *vec[4];
Vector2D tex[4] = { Vector2D( 0, 0 ), Vector2D( 0, 1 ), Vector2D( 1, 0 ), Vector2D( 1, 1 ) }; // Текстурные координаты одинаковы для всех полигонов ( пополигонный тайлинг)
auto v1 = vertexes.insert( Vector3D( hmap.getMin().x, level, hmap.getMin().y ) );
auto v2 = vertexes.insert( Vector3D( hmap.getMin().x, level, hmap.getMax().y + m_step ) );
auto v3 = vertexes.insert( Vector3D( hmap.getMax().x + m_step, level, hmap.getMax().y + m_step ) );
auto v4 = vertexes.insert( Vector3D( hmap.getMax().x + m_step, level, hmap.getMin().y ) );
vec[0] = const_cast<Vector3D*>( &(*v1.first) );
vec[1] = const_cast<Vector3D*>( &(*v2.first) );
vec[2] = const_cast<Vector3D*>( &(*v3.first) );
vec[3] = const_cast<Vector3D*>( &(*v4.first) );
Poly *tri = new Poly( vec, tex, 4, (new Vector3D(0, 1, 0)) );
triangles.insert( std::shared_ptr<Poly>( tri ) ); // (new Vector3D(0, 1, 0)) Нормаль
createLinkPolyes( triangles, vecToPoly );
waterMesh = shared_ptr<MeshObject>( new MeshObject( vecToPoly) );
vecToPoly.clear();
createLinkPolyes( triangles, vecToPoly );
waterObstacle = shared_ptr< MeshObstacle>( new MeshObstacle( vecToPoly ) );
}