171 bool normalized =
false;
193 object.toString(stream);
199 return lhs.semantic == rhs.semantic && lhs.type == rhs.type && lhs.componentType == rhs.componentType && lhs.normalized == rhs.normalized;
254 [[nodiscard]]
std::
size_t getSize() const noexcept;
262 [[nodiscard]]
String toString() const noexcept;
266 void toString(
std::ostream& stream) const noexcept;
270 object.toString(stream);
301 void toString(
std::ostream& stream) const noexcept;
305 object.toString(stream);
343 CE_ASSERT(data.size() >= getSize() * length);
346 if(element ==
nullptr) {
351 return make_strided_memory_view<T>(data, element->
offset, element->
stride);
359 return getElementView<T>(data.as<
Byte>(), semantic, index).template as<const T>();
376 [[nodiscard]] std::size_t
getSize() const noexcept;
379 [[nodiscard]]
std::
size_t getVertexSize() const noexcept;
386 return separated(declaration.elements, vertexCount);
393 return interleaved(declaration.
elements, vertexCount);
402 void toString(
std::ostream& stream) const noexcept;
406 object.toString(stream);
471 static inline constexpr VertexElementType type = VertexElementType::fromType<TMatrix<C, R, T>>();
491template<>
struct std::hash<
CeresEngine::VertexElementSemantic> {
496template<>
struct std::hash<
CeresEngine::VertexElementType> {
501template<>
struct std::hash<
CeresEngine::VertexElementComponentType> {
506template<>
struct std::hash<
CeresEngine::VertexElement> {
508 return CeresEngine::hash(
object.semantic,
object.type,
object.componentType,
object.normalized);
513template<>
struct std::hash<
CeresEngine::VertexDeclaration> {
#define CE_ASSERT(...)
Definition Macros.hpp:323
#define CE_STRUCT_ENUM_DECL(T)
Definition StructEnum.hpp:49
A memory view is a class which attaches to an chunk of memory and provides a view to it (optionally c...
Definition MemoryView.hpp:62
A memory view is a class which attaches to an chunk of memory and provides a view to it (optionally c...
Definition MemoryView.hpp:439
Definition StructEnum.hpp:18
UInt32 UnderlyingType
Definition StructEnum.hpp:20
Determines how a single element should be a vertex.
Definition VertexDeclaration.hpp:153
bool is() const noexcept
Checks if the vertex element type and component type matches the C++ type T.
Definition VertexDeclaration.hpp:480
VertexElementSemantic semantic
The semantic that is used for identifying the meaning of the element in a vertex buffer.
Definition VertexDeclaration.hpp:157
friend bool operator==(const VertexElement &lhs, const VertexElement &rhs) noexcept
Definition VertexDeclaration.hpp:198
friend bool operator!=(const VertexElement &lhs, const VertexElement &rhs) noexcept
Definition VertexDeclaration.hpp:201
std::size_t getSize() const noexcept
Returns the length, in bytes, of the vertex element.
Definition Application.hpp:19
Byte
Definition DataTypes.hpp:40
std::uint64_t UInt64
Definition DataTypes.hpp:26
std::int32_t Int32
Definition DataTypes.hpp:21
std::uint16_t UInt16
Definition DataTypes.hpp:20
std::uint8_t UInt8
Definition DataTypes.hpp:17
std::int64_t Int64
Definition DataTypes.hpp:24
sfl::small_vector< T, N, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > SmallVector
SmallVector is a sequence container similar to Vector.
Definition SmallVector.hpp:31
std::uint32_t UInt32
Definition DataTypes.hpp:23
tcb ::span< T, Extent > Span
Span describes an object that can refer to a contiguous sequence of objects with the first element of...
Definition Span.hpp:708
std::int8_t Int8
Definition DataTypes.hpp:15
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
std::int16_t Int16
Definition DataTypes.hpp:18
Determines how a single VertexElement is laid out on the vertex buffer.
Definition VertexDeclaration.hpp:283
UInt64 offset
The offset to where this vertex element starts.
Definition VertexDeclaration.hpp:289
friend bool operator!=(const VertexBufferLayoutElement &lhs, const VertexBufferLayoutElement &rhs) noexcept
friend bool operator==(const VertexBufferLayoutElement &lhs, const VertexBufferLayoutElement &rhs) noexcept
UInt64 stride
The stride, the amount of bytes to skip to reach the next vertex data.
Definition VertexDeclaration.hpp:293
VertexElement element
The vertex element description.
Definition VertexDeclaration.hpp:286
String toString() const noexcept
Gets a string representation of the VertexBufferLayoutElement.
Determines how a vertex buffer is laid out in memory.
Definition VertexDeclaration.hpp:318
void offsetBy(const Int64 offset) const
Offsets the vertex buffer by the given amount.
String toString() const noexcept
Gets a string representation of the VertexBufferLayout.
StridedMemoryView< const T > getElementView(const MemoryView< const Byte > &data, const VertexElementSemantic &semantic, const UInt32 index=0)
Definition VertexDeclaration.hpp:356
static VertexBufferLayout interleaved(const Span< const VertexElement > &elements, UInt64 vertexCount)
SmallVector< VertexBufferLayoutElement, 10 > elements
The elements on the vertex stream layout.
Definition VertexDeclaration.hpp:320
friend bool operator==(const VertexBufferLayout &lhs, const VertexBufferLayout &rhs) noexcept
static VertexBufferLayout interleaved(const VertexDeclaration &declaration, const UInt64 vertexCount)
Definition VertexDeclaration.hpp:392
const VertexBufferLayoutElement * getElement(const VertexElementSemantic &semantic, UInt32 index=0) const noexcept
Finds a VertexElement with the given semantic.
std::size_t getSize() const noexcept
Computes the size of a single vertex, in bytes.
friend bool operator!=(const VertexBufferLayout &lhs, const VertexBufferLayout &rhs) noexcept
void resize(UInt64 newVertexCount)
Resizes the vertex buffer layout to accommodate newVertexCount vertices.
UInt64 length
The total number of vertices in the vertex buffer.
Definition VertexDeclaration.hpp:323
Determines how vertices are laid-out on a vertex buffer or a mesh data.
Definition VertexDeclaration.hpp:205
friend bool operator!=(const VertexDeclaration &lhs, const VertexDeclaration &rhs) noexcept
VertexElement & addElement(const VertexElementSemantic &semantic, const VertexElementType &type, const VertexElementComponentType &componentType=VertexElementComponentType::Float32, bool normalized=false)
Adds a new element to the declaration.
friend bool operator==(const VertexDeclaration &lhs, const VertexDeclaration &rhs) noexcept
SmallVector< VertexElement, 10 > elements
Definition VertexDeclaration.hpp:206
const VertexElement * getElement(const VertexElementSemantic &semantic, UInt32 index=0) const noexcept
Finds a VertexElement with the given semantic.
Determines the data type used for the each component of a VertexElement.
Definition VertexDeclaration.hpp:103
StringView toString() const noexcept
Gets a string representation of VertexElementComponentType.
enum CeresEngine::VertexElementComponentType::@30 raw
The underlying raw value of VertexElementComponentType.
static constexpr VertexElementComponentType fromType() noexcept
Creates a new VertexElementComponentType from the C++ type T.
Definition VertexDeclaration.hpp:454
std::size_t getSize() const noexcept
Gets the size of a single component.
@ Float64
Each component of the element is a 64-bit floating point (double).
Definition VertexDeclaration.hpp:113
@ Int64
Each component of the element is a 64-bit signed integer.
Definition VertexDeclaration.hpp:134
@ Float32
Each component of the element is a 32-bit floating point (float).
Definition VertexDeclaration.hpp:110
@ UInt8
Each component of the element is a 8-bit unsigned integer.
Definition VertexDeclaration.hpp:119
@ Int32
Each component of the element is a 32-bit signed integer.
Definition VertexDeclaration.hpp:128
@ UInt16
Each component of the element is a 16-bit unsigned integer.
Definition VertexDeclaration.hpp:125
@ Int16
Each component of the element is a 16-bit signed integer.
Definition VertexDeclaration.hpp:122
@ Int8
Each component of the element is a 8-bit signed integer.
Definition VertexDeclaration.hpp:116
@ UInt64
Each component of the element is a 64-bit unsigned integer.
Definition VertexDeclaration.hpp:137
@ Float16
Each component of the element is a 16-bit floating point (half float).
Definition VertexDeclaration.hpp:107
@ Boolean
Each component of the element is a 32-bit boolean type.
Definition VertexDeclaration.hpp:140
@ UInt32
Each component of the element is a 32-bit unsigned integer.
Definition VertexDeclaration.hpp:131
Definition VertexDeclaration.hpp:431
Determines the semantic of a VertexElement.
Definition VertexDeclaration.hpp:24
enum CeresEngine::VertexElementSemantic::@28 raw
The underlying raw value of VertexElementSemantic.
@ Color
The vertex element represents a vertex color channel.
Definition VertexDeclaration.hpp:46
@ TexCoord
The vertex element represents the vertex texture coordinate.
Definition VertexDeclaration.hpp:37
@ Normal
The vertex element represents the vertex normal vector.
Definition VertexDeclaration.hpp:34
@ Position
The vertex element represents the vertex position.
Definition VertexDeclaration.hpp:31
@ Bitangent
The vertex element represents the vertex bi-tangent vector.
Definition VertexDeclaration.hpp:43
@ None
The vertex element should be ignored and don't represent anything.
Definition VertexDeclaration.hpp:28
@ Tangent
The vertex element represents the vertex tangent vector.
Definition VertexDeclaration.hpp:40
Definition VertexDeclaration.hpp:460
Enumeration that determines the type of a VertexElement.
Definition VertexDeclaration.hpp:52
@ Vector3
The vertex element is a 3-component vector.
Definition VertexDeclaration.hpp:66
@ Scalar
The vertex element is a scalar.
Definition VertexDeclaration.hpp:60
@ Vector2
The vertex element is a 2-component vector.
Definition VertexDeclaration.hpp:63
@ Vector4
The vertex element is a 4-component vector.
Definition VertexDeclaration.hpp:69
@ Matrix4
The vertex element is a 4x4 matrix.
Definition VertexDeclaration.hpp:78
@ Matrix2
The vertex element is a 2x2 matrix.
Definition VertexDeclaration.hpp:72
@ None
The vertex element has no type and thus no size.
Definition VertexDeclaration.hpp:57
@ Matrix3
The vertex element is a 3x3 matrix.
Definition VertexDeclaration.hpp:75
static constexpr VertexElementType fromType() noexcept
Creates a new VertexElementType from the C++ type T.
Definition VertexDeclaration.hpp:427
bool isMatrix() const noexcept
Returns true if the element type is a matrix type.
Definition VertexDeclaration.hpp:99
bool isScalar() const noexcept
Returns true if the element type is a vector type.
Definition VertexDeclaration.hpp:93
bool isNone() const noexcept
Returns true if the element type is a vector type.
Definition VertexDeclaration.hpp:90
bool isVector() const noexcept
Returns true if the element type is a vector type.
Definition VertexDeclaration.hpp:96
std::size_t getComponentCount() const noexcept
Gets the number of components on the type.
enum CeresEngine::VertexElementType::@29 raw
The underlying raw value of VertexElementType.
Definition VertexDeclaration.hpp:418