sculpto
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
scl::mesh Class Reference

#include <mesh.h>

Public Member Functions

template<typename Ttopology >
 mesh (const Ttopology &TopologyObject, shared< material > Material)
 
template<typename Tvertex >
 mesh (const std::vector< submesh_props< Tvertex > > &SubmeshesProperties)
 
 ~mesh ()
 

Static Public Member Functions

template<typename Ttopology >
static shared< meshCreate (const Ttopology &TopologyObject, shared< material > Material)
 
template<typename Tvertex >
static shared< meshCreate (const std::vector< submesh_props< Tvertex > > &SubmeshesProperties)
 

Public Attributes

std::string FileName {}
 
std::vector< submesh_data > SubMeshes {}
 
bool IsDrawing = true
 
bool IsCastingShadow = true
 

Friends

class renderer
 

Detailed Description

Mesh class.

Definition at line 30 of file mesh.h.

Constructor & Destructor Documentation

◆ mesh() [1/2]

template<typename Ttopology >
scl::mesh::mesh ( const Ttopology &  TopologyObject,
shared< material Material 
)
inline

Flag, showing wheather mesh is submiter to render, during shadow caster shadom map generation (render pass).

  • Mesh constructor by topology object and material.
Parameters
TopologyObject- topology object to create vertex array from.
Material- mesh material.

Definition at line 59 of file mesh.h.

60 {
61 submesh_data new_sub_mesh {};
62 new_sub_mesh.VertexArray = vertex_array::Create(TopologyObject.GetType());
63 new_sub_mesh.VertexBuffer = vertex_buffer::Create(TopologyObject.GetVertices().data(),
64 (u32)TopologyObject.GetVertices().size(),
66 new_sub_mesh.IndexBuffer = index_buffer::Create((u32 *)TopologyObject.GetIndices().data(),
67 (u32)TopologyObject.GetIndices().size());
68 new_sub_mesh.VertexArray->SetIndexBuffer(new_sub_mesh.IndexBuffer);
69 new_sub_mesh.VertexArray->SetVertexBuffer(new_sub_mesh.VertexBuffer);
70
71 new_sub_mesh.Material = Material;
72 SubMeshes.push_back(new_sub_mesh);
73 FileName = typeid(Ttopology).name();
74
75 SCL_CORE_INFO("Mesh with 1 sub-mesh created.");
76 }
static shared< index_buffer > Create(u32 *Indices, u32 Count)
Definition: buffer.cpp:65
std::vector< submesh_data > SubMeshes
Definition: mesh.h:46
std::string FileName
Definition: mesh.h:45
static shared< vertex_array > Create(mesh_type Mesh_type)
static shared< vertex_buffer > Create(u32 Count, const vertex_layout &VertexLayout)
Definition: buffer.cpp:41
#define SCL_CORE_INFO(...)
Definition: log.h:41
uint32_t u32
Definition: math_common.h:21
static vertex_layout GetVertexLayout()
Definition: vertex.h:120

◆ mesh() [2/2]

template<typename Tvertex >
scl::mesh::mesh ( const std::vector< submesh_props< Tvertex > > &  SubmeshesProperties)
inline
  • Mesh constructor by submeshes properties array.
Parameters
SubmeshesProperties- array of sub meshes data (topology object + material).

Definition at line 84 of file mesh.h.

85 {
86 for (const auto &submesh_prop : SubmeshesProperties)
87 {
88 submesh_data new_sub_mesh {};
89 new_sub_mesh.VertexArray = vertex_array::Create(submesh_prop.Topology.GetType());
90 new_sub_mesh.VertexBuffer = vertex_buffer::Create(submesh_prop.Topology.GetVertices().data(),
91 (u32)submesh_prop.Topology.GetVertices().size(),
93 new_sub_mesh.IndexBuffer = index_buffer::Create((u32 *)submesh_prop.Topology.GetIndices().data(),
94 (u32)submesh_prop.Topology.GetIndices().size());
95 new_sub_mesh.VertexArray->SetIndexBuffer(new_sub_mesh.IndexBuffer);
96 new_sub_mesh.VertexArray->SetVertexBuffer(new_sub_mesh.VertexBuffer);
97
98 new_sub_mesh.Material = submesh_prop.Material;
99 SubMeshes.push_back(new_sub_mesh);
100 }
101
102 SCL_CORE_INFO("Mesh with {} sub-mesh(es) created.", SubmeshesProperties.size());
103 }

◆ ~mesh()

scl::mesh::~mesh ( )
inline

Mesh default destructor.

Definition at line 106 of file mesh.h.

107 {
108 SCL_CORE_INFO("Mesh with {} sub-mesh(es) freed.", SubMeshes.size());
109 }

Member Function Documentation

◆ Create() [1/2]

template<typename Tvertex >
static shared< mesh > scl::mesh::Create ( const std::vector< submesh_props< Tvertex > > &  SubmeshesProperties)
inlinestatic
  • Mesh constructor by submeshes properties array.
Parameters
SubmeshesProperties- array of sub meshes data (topology object + material).

Definition at line 129 of file mesh.h.

130 {
131 return CreateShared<mesh>(SubmeshesProperties);
132 }

◆ Create() [2/2]

template<typename Ttopology >
static shared< mesh > scl::mesh::Create ( const Ttopology &  TopologyObject,
shared< material Material 
)
inlinestatic
  • Mesh constructor by topology object and material.
Parameters
TopologyObject- topology object to create vertex array from.
Returns
created mesh pointer.

Definition at line 118 of file mesh.h.

119 {
120 return CreateShared<mesh>(TopologyObject, Material);
121 }

Friends And Related Function Documentation

◆ renderer

friend class renderer
friend

Definition at line 32 of file mesh.h.

Member Data Documentation

◆ FileName

std::string scl::mesh::FileName {}

Mesh data.

Definition at line 45 of file mesh.h.

◆ IsCastingShadow

bool scl::mesh::IsCastingShadow = true

Flag, showing wheather mesh is submited to render, during main geometry render pass.

Definition at line 50 of file mesh.h.

◆ IsDrawing

bool scl::mesh::IsDrawing = true

Mesh submesmeshes (primitives) list.

Mesh rendering flags.

Definition at line 49 of file mesh.h.

◆ SubMeshes

std::vector<submesh_data> scl::mesh::SubMeshes {}

File name file, from which model was loaded.

Definition at line 46 of file mesh.h.


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