evan 2026.1.4
Evan
Loading...
Searching...
No Matches
evan::GPUVertex Struct Reference

GPUVertex structure. More...

#include <headers/evan/GPUVertex.hpp>

Public Member Functions

bool operator== (const GPUVertex &other) const
 Equality operator for GPUVertex.
 

Static Public Member Functions

static VkVertexInputBindingDescription getBindingDescription ()
 Get the binding description for the vertex.
 
static std::array< VkVertexInputAttributeDescription, 3 > getAttributeDescriptions ()
 Get the attribute descriptions for the vertex.
 
static VkVertexInputBindingDescription getInstanceBindingDescription ()
 Get the binding description for per-instance data.
 
static std::array< VkVertexInputAttributeDescription, 4 > getInstanceAttributeDescriptions ()
 Get the attribute descriptions for per-instance data.
 
static GPUVertex createFromVertex (const utility::graphic::VertexF &vertex)
 Create a GPUVertex from a utility::graphic::Vertex object.
 

Public Attributes

glm::vec3 pos
 Position of the vertex.
 
glm::vec3 color
 
glm::vec2 texCoord
 Texture coordinates of the vertex.
 

Detailed Description

GPUVertex structure.

This structure represents a vertex in the 3D space. It contains the position, color, and texture coordinates of the vertex. It is used to define the vertex data for rendering.

Definition at line 38 of file GPUVertex.hpp.

Member Function Documentation

◆ createFromVertex()

static GPUVertex evan::GPUVertex::createFromVertex ( const utility::graphic::VertexF &  vertex)
inlinestatic

Create a GPUVertex from a utility::graphic::Vertex object.

This static function takes a utility::graphic::Vertex object as input and converts it into a GPUVertex object. It extracts the position, color, and texture coordinates from the Vertex object and maps them to the corresponding attributes of the GPUVertex. The color is converted from a Color32Bit format (with components in the range [0, 255]) to a normalized RGB format (with components in the range [0.0, 1.0]) suitable for use in shaders.

Parameters
vertexThe utility::graphic::VertexF object to convert.
Returns
GPUVertex The resulting GPUVertex object with the converted attributes.

Definition at line 182 of file GPUVertex.hpp.

◆ getAttributeDescriptions()

static std::array< VkVertexInputAttributeDescription, 3 > evan::GPUVertex::getAttributeDescriptions ( )
inlinestatic

Get the attribute descriptions for the vertex.

This function returns an array of attribute descriptions for the vertex, which specify the format and offset of each attribute in the vertex data.

Returns
std::array<VkVertexInputAttributeDescription, 3> The attribute descriptions for the vertex.

Definition at line 80 of file GPUVertex.hpp.

◆ getBindingDescription()

static VkVertexInputBindingDescription evan::GPUVertex::getBindingDescription ( )
inlinestatic

Get the binding description for the vertex.

This function returns the binding description for the vertex, which specifies how the vertex data is laid out in memory.

Returns
VkVertexInputBindingDescription The binding description for the vertex.

Definition at line 58 of file GPUVertex.hpp.

◆ getInstanceAttributeDescriptions()

static std::array< VkVertexInputAttributeDescription, 4 > evan::GPUVertex::getInstanceAttributeDescriptions ( )
inlinestatic

Get the attribute descriptions for per-instance data.

The instance model matrix is exposed as four consecutive vec4 attributes (locations 3 to 6), one per column of the matrix.

Returns
std::array<VkVertexInputAttributeDescription, 4> The instance attribute descriptions.

Definition at line 132 of file GPUVertex.hpp.

◆ getInstanceBindingDescription()

static VkVertexInputBindingDescription evan::GPUVertex::getInstanceBindingDescription ( )
inlinestatic

Get the binding description for per-instance data.

Binding 1 carries one 4x4 model matrix per instance at an instance input rate, so identical meshes can be drawn with a single vkCmdDrawIndexed(instanceCount = N).

Returns
VkVertexInputBindingDescription for the instance data.

Definition at line 112 of file GPUVertex.hpp.

◆ operator==()

bool evan::GPUVertex::operator== ( const GPUVertex &  other) const
inline

Equality operator for GPUVertex.

This operator checks if two GPUVertex instances are equal by comparing their position, color, and texture coordinates. It returns true if all attributes are equal, and false otherwise.

Parameters
otherThe other GPUVertex instance to compare with.
Returns
true if the two GPUVertex instances are equal, false otherwise.

Definition at line 160 of file GPUVertex.hpp.

Member Data Documentation

◆ color

glm::vec3 evan::GPUVertex::color

Color of the vertex (TODO: change to vec4 for alpha)

Definition at line 40 of file GPUVertex.hpp.

◆ pos

glm::vec3 evan::GPUVertex::pos

Position of the vertex.

Definition at line 39 of file GPUVertex.hpp.

◆ texCoord

glm::vec2 evan::GPUVertex::texCoord

Texture coordinates of the vertex.

Definition at line 46 of file GPUVertex.hpp.


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