Saga
Saga Game Engine
Loading...
Searching...
No Matches
Saga::Mesh Struct Reference

A wrapper around a shared_ptr to a GraphicsEngine's shape. More...

#include <mesh.h>

Public Types

enum class  StandardType {
  Quad , Cone , Cube , Sphere ,
  Cylinder
}
 Different types of meshes loaded into the graphics engine. More...
 

Public Member Functions

 operator const std::shared_ptr< GraphicsEngine::Shape > & () const
 
 Mesh ()
 Construct a new Mesh object.
 
 Mesh (StandardType type)
 Construct a new Mesh object using a standard mesh type. These are default objects in the engine.
 
 Mesh (const std::string &filepath)
 Construct a new Mesh object loaded from the specific filename. Does not support instancing out of the gate.
 
 Mesh (std::vector< float > data, GraphicsEngine::VAOAttrib attributes)
 Construct a new Mesh object using the mesh data.
 
glm::vec3 getPos (int index)
 
int getTrianglesCnt ()
 

Static Public Member Functions

static auto id_value () -> uint64_t &
 Used for assigning new shape name in the graphics engine.
 
static int getVertexRange (GraphicsEngine::VAOAttrib attributes)
 Get the number of floats needed to store a vertex.
 

Public Attributes

GraphicsEngine::VAOAttrib attributes
 determines what data holds, whether it's position, normal, uv, or color, or any combination of them.
 
int vertexRange
 how many floats does it take to store 1 vertex. Varies depending on the attributes chosen. Should be equal to 3*(?pos + ?norm + ?color) + 2(?uv).
 
std::shared_ptr< GraphicsEngine::Shape > mesh
 
std::vector< float > data
 packed vertex data
 

Detailed Description

A wrapper around a shared_ptr to a GraphicsEngine's shape.

Member Enumeration Documentation

◆ StandardType

enum class Saga::Mesh::StandardType
strong

Different types of meshes loaded into the graphics engine.

Enumerator
Quad 
Cone 
Cube 
Sphere 
Cylinder 

Constructor & Destructor Documentation

◆ Mesh() [1/4]

Saga::Mesh::Mesh ( )

Construct a new Mesh object.

◆ Mesh() [2/4]

Saga::Mesh::Mesh ( StandardType  type)

Construct a new Mesh object using a standard mesh type. These are default objects in the engine.

See also
StandardType
Parameters
typethe type of the shape of the mesh.

◆ Mesh() [3/4]

Saga::Mesh::Mesh ( const std::string &  filepath)

Construct a new Mesh object loaded from the specific filename. Does not support instancing out of the gate.

Parameters
filepaththe filepath of the mesh to load. This must be an .obj file format, and the path is relative to the root of the project.
Here is the call graph for this function:

◆ Mesh() [4/4]

Saga::Mesh::Mesh ( std::vector< float >  data,
GraphicsEngine::VAOAttrib  attributes 
)

Construct a new Mesh object using the mesh data.

Parameters
datacoordinates of the mesh, in POS | NORMAL form.
Here is the call graph for this function:

Member Function Documentation

◆ getPos()

glm::vec3 Saga::Mesh::getPos ( int  index)

◆ getTrianglesCnt()

int Saga::Mesh::getTrianglesCnt ( )

◆ getVertexRange()

int Saga::Mesh::getVertexRange ( GraphicsEngine::VAOAttrib  attributes)
static

Get the number of floats needed to store a vertex.

Parameters
attributesthe attributes we need to store for a single vertex.
Returns
int number of floats used to store a vertex. Generally, position costs 3 floats, so does color and normal. uv coordinates costs two to store.

◆ id_value()

static auto Saga::Mesh::id_value ( ) -> uint64_t &
inlinestatic

Used for assigning new shape name in the graphics engine.

Returns
uint64_t& a new, unique integer.

◆ operator const std::shared_ptr< GraphicsEngine::Shape > &()

Saga::Mesh::operator const std::shared_ptr< GraphicsEngine::Shape > & ( ) const
inline

Member Data Documentation

◆ attributes

GraphicsEngine::VAOAttrib Saga::Mesh::attributes

determines what data holds, whether it's position, normal, uv, or color, or any combination of them.

◆ data

std::vector<float> Saga::Mesh::data

packed vertex data

◆ mesh

std::shared_ptr<GraphicsEngine::Shape> Saga::Mesh::mesh

◆ vertexRange

int Saga::Mesh::vertexRange

how many floats does it take to store 1 vertex. Varies depending on the attributes chosen. Should be equal to 3*(?pos + ?norm + ?color) + 2(?uv).


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