Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::scene::Mesh< VertexType, IndexType, MeshSettingsType > Struct Template Reference
+ Inheritance diagram for oe::scene::Mesh< VertexType, IndexType, MeshSettingsType >:

Classes

struct  MikkTSpaceUserData
 Struct used to convert data to generate tangents from MikkTSpace. More...
 

Public Types

using vertex_type = VertexType
 
using index_type = IndexType
 
using VertexContainerType = MeshSettingsType::VertexContainerType
 
using IndexContainerType = MeshSettingsType::IndexContainerType
 

Public Member Functions

constexpr AABB getPrimitiveBoundingBox (size_t primitive) const noexcept
 Generate bounding box for the specified primitive.
 
template<typename F >
constexpr AABB getPrimitiveBoundingBox (size_t primitive, F &&predicate) const noexcept
 Generate bounding box for the specified primitive containing vertices matching a predicate.
 
constexpr AABB getBoundingBox () const noexcept
 Generate englobing mesh bounding box.
 
constexpr void flipFaces ()
 
constexpr const std::vector< glm::uvec3 > getTriangles () const
 Get groups of 3 indices that form triangles.
 
constexpr void generateNormals ()
 Generate mesh normals from vertices positions.
 
constexpr void generateTangents ()
 Compute Tangents using mikkTSpace.
 

Static Public Member Functions

template<typename PrimitiveType >
static Mesh generateFromPrimitives (std::span< const PrimitiveType > primitives)
 Generate a mesh from primitives.
 

Public Attributes

VertexContainerType vertices
 
IndexContainerType indices
 
MeshSettingsType::PrimitivesContainerType primitives = {}
 

Member Function Documentation

◆ generateFromPrimitives()

template<typename VertexType = Vertex, typename IndexType = uint32_t, typename MeshSettingsType = DefaultMeshSettings<VertexType, IndexType>>
template<typename PrimitiveType >
static Mesh oe::scene::Mesh< VertexType, IndexType, MeshSettingsType >::generateFromPrimitives ( std::span< const PrimitiveType >  primitives)
inlinestatic

Generate a mesh from primitives.

Concatenate all vertices / indices and generate the primitives list

Todo:
make another function (mergeVertices()) to merge equal vertices used across different primitive (using VertexType::operator= for comparison)

◆ getPrimitiveBoundingBox()

template<typename VertexType = Vertex, typename IndexType = uint32_t, typename MeshSettingsType = DefaultMeshSettings<VertexType, IndexType>>
template<typename F >
constexpr AABB oe::scene::Mesh< VertexType, IndexType, MeshSettingsType >::getPrimitiveBoundingBox ( size_t  primitive,
F &&  predicate 
) const
inlineconstexprnoexcept

Generate bounding box for the specified primitive containing vertices matching a predicate.

Parameters
predicateA function with a vertex as parameter that should return true if the vertex should be considered in the bbox

The documentation for this struct was generated from the following file: