Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
Mesh.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
7#pragma once
8
9#include "../core/Types.hpp"
10#include "../math/Math.hpp"
13#include "./Handle.hpp"
14
15#include <memory>
16#include <vector>
17
18namespace esengine {
19
32
45
61
76
85class Mesh {
86public:
89
94
96
106
116
119
124
127 bool hasNormals = false;
128
132 bool hasLightmapUV = false;
133
136 bool hasTangents = false;
137
141
143 glm::vec3 localMin{0.0f, 0.0f, 0.0f};
144 glm::vec3 localMax{0.0f, 0.0f, 0.0f};
145
148 std::vector<glm::mat4> inverseBind;
149
150 bool isSkinned() const { return !inverseBind.empty(); }
151
157 bool morphHasNormals = false;
161
162 bool isMorphable() const {
164 }
165
171 std::shared_ptr<const lod::ClusterHierarchy> clusters;
172
178 std::vector<MeshSkinChunk> skinChunks;
181 std::shared_ptr<const std::vector<u8>> skinSource;
183 std::shared_ptr<const std::vector<u32>> skinIndices;
185 std::vector<u16> skinChunkBones;
186 bool isChunked() const { return !skinChunks.empty(); }
187
190
197
198
199 bool isDrawable() const { return hasRealization() && indexCount > 0; }
200};
201
202} // namespace esengine
Which clusters of a mesh's hierarchy one eye draws.
Backend-agnostic graphics enumerations.
Type-safe resource handle system.
Math utilities and GLM configuration for ESEngine.
Core type definitions and utilities for ESEngine.
Buffers, the layout that describes them, and the bounds culling reads.
Definition Mesh.hpp:85
glm::vec3 localMin
Definition Mesh.hpp:143
bool isSkinned() const
Definition Mesh.hpp:150
std::vector< MeshSkinChunk > skinChunks
Definition Mesh.hpp:178
VertexLayoutHandle layout
Definition Mesh.hpp:93
MeshRecovery recovery
Definition Mesh.hpp:123
std::vector< glm::mat4 > inverseBind
Definition Mesh.hpp:148
u32 arenaFirstVertex
Definition Mesh.hpp:105
BufferHandle vertexBuffer
Definition Mesh.hpp:91
bool hasTangents
Definition Mesh.hpp:136
bool morphHasNormals
Definition Mesh.hpp:157
resource::VertexBufferHandle vertices
Definition Mesh.hpp:87
bool isChunked() const
Definition Mesh.hpp:186
resource::IndexBufferHandle edges
Definition Mesh.hpp:113
bool isMorphable() const
Definition Mesh.hpp:162
std::shared_ptr< const std::vector< u32 > > skinIndices
Definition Mesh.hpp:183
bool hasLightmapUV
Definition Mesh.hpp:132
glm::vec3 localMax
Definition Mesh.hpp:144
resource::IndexBufferHandle indices
Definition Mesh.hpp:88
std::shared_ptr< const lod::ClusterHierarchy > clusters
Definition Mesh.hpp:171
u32 indexCount
Definition Mesh.hpp:95
bool isDrawable() const
Definition Mesh.hpp:199
bool hasRealization() const
Definition Mesh.hpp:192
bool hasEdges() const
Definition Mesh.hpp:118
bool hasNormals
Definition Mesh.hpp:127
BufferHandle edgeIndexBuffer
Definition Mesh.hpp:114
u32 edgeIndexCount
Definition Mesh.hpp:115
MeshSkinLayout skinLayout
Definition Mesh.hpp:184
u32 vertexCount
Definition Mesh.hpp:160
std::shared_ptr< const std::vector< u8 > > skinSource
Definition Mesh.hpp:181
std::vector< u16 > skinChunkBones
Definition Mesh.hpp:185
u32 morphTargetCount
Definition Mesh.hpp:156
TextureHandle morphTexture
Definition Mesh.hpp:155
BufferHandle indexBuffer
Definition Mesh.hpp:92
Handle< esengine::IndexBuffer > IndexBufferHandle
Handle to an index buffer resource.
Definition Handle.hpp:223
Handle< esengine::VertexBuffer > VertexBufferHandle
Handle to a vertex buffer resource.
Definition Handle.hpp:220
std::int32_t i32
Signed 32-bit integer.
Definition Types.hpp:54
std::uint64_t u64
Unsigned 64-bit integer.
Definition Types.hpp:47
MeshRecovery
How a mesh's geometry comes back after a device generation ends.
Definition Mesh.hpp:28
@ SourceReplayable
Replayable from an asset the loader can load again.
Definition Mesh.hpp:29
@ HostOnly
Built in this process; the device keeps its bytes.
Definition Mesh.hpp:30
std::span< const T > ConstSpan
Definition Types.hpp:242
std::uint32_t u32
Unsigned 32-bit integer.
Definition Types.hpp:45
std::uint8_t u8
Unsigned 8-bit integer.
Definition Types.hpp:41
float f32
32-bit floating point
Definition Types.hpp:59
The shapes handed to a realization: the deltas, and how to read them.
Definition Mesh.hpp:39
ConstSpan< f32 > deltas
targetCount * vertexCount * (hasNormals ? 6 : 3) floats.
Definition Mesh.hpp:41
One piece a skinned mesh is drawn in, when its bones are more than one draw can carry.
Definition Mesh.hpp:68
Where a skinned mesh's vertex holds what the skin cache reads and writes: byte offsets in one vertex,...
Definition Mesh.hpp:51