8 #ifndef META_OCEAN_IO_MAPS_RENDERING_MESHER_H
9 #define META_OCEAN_IO_MAPS_RENDERING_MESHER_H
35 class OCEAN_IO_MAPS_RENDERING_EXPORT
Mesher
63 inline const Vectors3& vertices()
const;
69 inline const Vectors3& perVertexNormals()
const;
75 inline const Indices32& triangleFaces()
const;
81 inline bool isValid()
const;
289 vertices_(std::move(vertices)),
290 perVertexNormals_(std::move(perVertexNormals)),
291 triangleFaces_(std::move(triangleFaces))
304 return perVertexNormals_;
309 return triangleFaces_;
314 return !triangleFaces_.empty() && triangleFaces_.size() % 3 == 0;
This class implements a 2D pixel position with pixel precision.
Definition: PixelPosition.h:65
This class implements a building object.
Definition: Basemap.h:365
This class implements a land use object.
Definition: Basemap.h:551
This class implements a land use object.
Definition: Basemap.h:486
This class implements a road object.
Definition: Basemap.h:124
static RoadWidthMap defaultRoadWidthMap()
Returns the default map for road widths.
std::unordered_map< RoadType, float > RoadWidthMap
Definition of an unordered map mapping road types to road widths.
Definition: Basemap.h:209
This class implements a transit object.
Definition: Basemap.h:271
This class implements a water object.
Definition: Basemap.h:409
std::vector< SharedObject > SharedObjects
Definition of a vector holding shared objects.
Definition: Basemap.h:610
This class defines a mesh.
Definition: Mesher.h:43
bool isValid() const
Returns whether this mesh holds at least one valid triangle.
Definition: Mesher.h:312
Mesh()=default
Default constructor.
const Vectors3 & perVertexNormals() const
Returns the per-vertex normals of this mesh.
Definition: Mesher.h:302
const Indices32 & triangleFaces() const
Returns the triangle faces of this mesh.
Definition: Mesher.h:307
Vectors3 vertices_
The vertices of the mesh.
Definition: Mesher.h:86
Indices32 triangleFaces_
The triangle faces of the mesh, three consecutive indices define one triangle.
Definition: Mesher.h:92
Vectors3 perVertexNormals_
The per-vertex normals of the mesh.
Definition: Mesher.h:89
const Vectors3 & vertices() const
Returns the vertices of this mesh.
Definition: Mesher.h:297
This class implements functions to creates meshes from map objects.
Definition: Mesher.h:36
static Mesh createRoads(const Basemap::SharedObjects &objects, const double titleMetricExtent, const Scalar targetSize, const Scalar groundPlaneOffset=Scalar(0), const Basemap::Road::RoadWidthMap &roadWidthMap=Basemap::Road::defaultRoadWidthMap())
Creates a triangle object containing all roads of a tile.
static bool addLineString(const CV::PixelPositionI &origin, const CV::PixelPositionsI &lineString, const Scalar pixelPositionNormalization, const Scalar normalizedWidth, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar normalizedGroundPlaneOffset)
Adds vertices for a line string to form a flat band.
static bool addLandUse(const Basemap::LandUse &landUse, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar groundPlaneOffset=Scalar(0))
Adds vertices for a land use forming a flat geometry.
static bool addPolygon(const CV::PixelPositionI &origin, const CV::PixelPositionsI &outerPolygon, const Scalar pixelPositionNormalization, const Scalar normalizedHeight, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar normalizedGroundPlaneOffset)
Adds vertices for a polygon to form a 3D object.
static Mesh createTransits(const Basemap::SharedObjects &objects, const double titleMetricExtent, const Scalar targetSize, const Scalar groundPlaneOffset=Scalar(0))
Creates a triangle object containing all transits of a tile.
static bool addTransit(const Basemap::Transit &transit, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar groundPlaneOffset=Scalar(0))
Adds vertices for a transit forming a flat band.
static Mesh createBuilding(const Basemap::Building &building, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, const bool volumetric, const Scalar groundPlaneOffset=Scalar(0))
Creates a triangle object containing one building.
static Mesh createBuildings(const Basemap::SharedObjects &objects, const double titleMetricExtent, const Scalar targetSize, const bool volumetric, const Scalar groundPlaneOffset=Scalar(0))
Creates a triangle object containing all buildings of a tile.
static bool addBuilding(const Basemap::Building &building, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const bool volumetric, const Scalar groundPlaneOffset=Scalar(0))
Adds vertices for a building forming a 3D object.
static bool addLandCover(const Basemap::LandCover &landCover, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar groundPlaneOffset=Scalar(0))
Adds vertices for a land cover forming a flat geometry.
static bool addRoad(const Basemap::Road &road, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar groundPlaneOffset=Scalar(0), const Basemap::Road::RoadWidthMap &roadWidthMap=Basemap::Road::defaultRoadWidthMap())
Adds vertices for a road forming a flat band.
static Mesh createLandUses(const Basemap::SharedObjects &objects, const double titleMetricExtent, const Scalar targetSize, const Scalar groundPlaneOffset=Scalar(0))
Creates a triangle object containing all land uses of a tile.
static bool addWater(const Basemap::Water &water, const CV::PixelPositionI &origin, const Scalar pixelPositionNormalization, const Scalar metricNormalization, Vectors3 &vertices, Vectors3 &normals, Indices32 &triangleFaces, const Scalar groundPlaneOffset=Scalar(0))
Adds vertices for a water forming a flat geometry.
static Mesh createWaters(const Basemap::SharedObjects &objects, const double titleMetricExtent, const Scalar targetSize, const Scalar groundPlaneOffset=Scalar(0))
Creates a triangle object containing all waters of a tile.
static Mesh createLandCovers(const Basemap::SharedObjects &objects, const double titleMetricExtent, const Scalar targetSize, const Scalar groundPlaneOffset=Scalar(0))
Creates a triangle object containing all land covers of a tile.
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition: Base.h:96
std::vector< PixelPositionI > PixelPositionsI
Definition of a vector holding pixel positions (with positive and negative coordinate values).
Definition: PixelPosition.h:55
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15