NoJobEngine
2.0.7
Toggle main menu visibility
Loading...
Searching...
No Matches
Mesh.h
Go to the documentation of this file.
1
6
#pragma once
7
#include <cstdint>
8
#include <memory>
9
#include <vector>
10
#include <filesystem>
11
#include <glm/glm.hpp>
12
13
namespace
NoJob
14
{
15
class
VertexArray
;
16
class
VertexBuffer
;
17
class
IndexBuffer
;
18
19
struct
MeshVertex
20
{
21
glm::vec3
Position
{ 0.0f };
22
glm::vec3
Normal
{ 0.0f, 1.0f, 0.0f };
23
glm::vec2
TexCoord
{ 0.0f };
24
// Up to four skeletal influences. IDs are stored as floats to keep the
25
// current renderer vertex-layout API simple; shaders cast them to ints.
26
glm::vec4
BoneIDs
{ 0.0f };
27
glm::vec4
BoneWeights
{ 0.0f };
28
};
29
30
struct
Submesh
31
{
32
std::uint32_t
IndexOffset
= 0;
33
std::uint32_t
IndexCount
= 0;
34
std::uint32_t
MaterialIndex
= 0;
35
};
36
37
class
Mesh
38
{
39
public
:
40
Mesh
(
const
std::vector<MeshVertex>& vertices,
41
const
std::vector<std::uint32_t>& indices);
42
43
const
std::shared_ptr<VertexArray>&
GetVertexArray
()
const
44
{
45
return
m_VertexArray;
46
}
47
48
static
std::shared_ptr<Mesh>
CreateCube
();
49
static
std::shared_ptr<Mesh>
LoadOBJ
(
const
std::filesystem::path& path);
50
static
std::shared_ptr<Mesh>
LoadModel
(
const
std::filesystem::path& path);
51
52
const
std::vector<Submesh>&
GetSubmeshes
()
const
{
return
m_Submeshes; }
53
void
SetSubmeshes
(std::vector<Submesh> submeshes) { m_Submeshes = std::move(submeshes); }
54
bool
HasSkinning
()
const
{
return
m_HasSkinning; }
55
void
SetHasSkinning
(
bool
value) { m_HasSkinning = value; }
56
57
private
:
58
std::shared_ptr<VertexArray> m_VertexArray;
59
std::shared_ptr<VertexBuffer> m_VertexBuffer;
60
std::shared_ptr<IndexBuffer> m_IndexBuffer;
61
std::vector<Submesh> m_Submeshes;
62
bool
m_HasSkinning =
false
;
63
};
64
}
NoJob::IndexBuffer
Definition
Buffer.h:25
NoJob::Mesh::CreateCube
static std::shared_ptr< Mesh > CreateCube()
Definition
Mesh.cpp:167
NoJob::Mesh::GetVertexArray
const std::shared_ptr< VertexArray > & GetVertexArray() const
Definition
Mesh.h:43
NoJob::Mesh::LoadOBJ
static std::shared_ptr< Mesh > LoadOBJ(const std::filesystem::path &path)
Definition
Mesh.cpp:57
NoJob::Mesh::Mesh
Mesh(const std::vector< MeshVertex > &vertices, const std::vector< std::uint32_t > &indices)
Definition
Mesh.cpp:17
NoJob::Mesh::SetHasSkinning
void SetHasSkinning(bool value)
Definition
Mesh.h:55
NoJob::Mesh::LoadModel
static std::shared_ptr< Mesh > LoadModel(const std::filesystem::path &path)
Definition
Mesh.cpp:73
NoJob::Mesh::SetSubmeshes
void SetSubmeshes(std::vector< Submesh > submeshes)
Definition
Mesh.h:53
NoJob::Mesh::HasSkinning
bool HasSkinning() const
Definition
Mesh.h:54
NoJob::Mesh::GetSubmeshes
const std::vector< Submesh > & GetSubmeshes() const
Definition
Mesh.h:52
NoJob::VertexArray
Definition
VertexArray.h:18
NoJob::VertexBuffer
Definition
Buffer.h:13
NoJob
Definition
BTActionNode.h:13
NoJob::MeshVertex
Definition
Mesh.h:20
NoJob::MeshVertex::Normal
glm::vec3 Normal
Definition
Mesh.h:22
NoJob::MeshVertex::TexCoord
glm::vec2 TexCoord
Definition
Mesh.h:23
NoJob::MeshVertex::BoneIDs
glm::vec4 BoneIDs
Definition
Mesh.h:26
NoJob::MeshVertex::Position
glm::vec3 Position
Definition
Mesh.h:21
NoJob::MeshVertex::BoneWeights
glm::vec4 BoneWeights
Definition
Mesh.h:27
NoJob::Submesh
Definition
Mesh.h:31
NoJob::Submesh::IndexCount
std::uint32_t IndexCount
Definition
Mesh.h:33
NoJob::Submesh::MaterialIndex
std::uint32_t MaterialIndex
Definition
Mesh.h:34
NoJob::Submesh::IndexOffset
std::uint32_t IndexOffset
Definition
Mesh.h:32
Engine
Renderer
Mesh.h
Generated by
1.18.0