SpiecsEngine
 
Loading...
Searching...
No Matches
Vertex.cpp
Go to the documentation of this file.
1/**
2* @file Vertex.cpp.
3* @brief The Vertex Class Implementation.
4* @author Spices.
5*/
6
7#include "Pchheader.h"
8#include "Vertex.h"
9
10namespace Spices {
11
12 std::vector<VkVertexInputBindingDescription> InputAssembly::GetBindingDescriptions()
13 {
15
16 std::vector<VkVertexInputBindingDescription> bindingDescriptions(1);
17
18 bindingDescriptions[0].binding = 0;
19 bindingDescriptions[0].stride = sizeof(glm::vec3);
20 bindingDescriptions[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
21
22 return std::move(bindingDescriptions);
23 }
24
25 std::vector<VkVertexInputAttributeDescription> InputAssembly::GetAttributeDescriptions()
26 {
28
29 std::vector<VkVertexInputAttributeDescription> attributeDescriptions(1);
30
31 attributeDescriptions[0].binding = 0;
32 attributeDescriptions[0].location = 0;
33 attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT;
34 attributeDescriptions[0].offset = 0;
35
36 return std::move(attributeDescriptions);
37 }
38
39 std::vector<VkVertexInputBindingDescription> InputAssembly::GetSlateBindingDescriptions()
40 {
42
43 std::vector<VkVertexInputBindingDescription> bindingDescriptions(3);
44
45 bindingDescriptions[0].binding = 0;
46 bindingDescriptions[0].stride = sizeof(glm::vec2);
47 bindingDescriptions[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
48
49 bindingDescriptions[1].binding = 1;
50 bindingDescriptions[1].stride = sizeof(glm::vec2);
51 bindingDescriptions[1].inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
52
53 bindingDescriptions[2].binding = 2;
54 bindingDescriptions[2].stride = sizeof(float);
55 bindingDescriptions[2].inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
56
57 return std::move(bindingDescriptions);
58 }
59
60 std::vector<VkVertexInputAttributeDescription> InputAssembly::GetSlateAttributeDescriptions()
61 {
63
64 std::vector<VkVertexInputAttributeDescription> attributeDescriptions(3);
65
66 attributeDescriptions[0].binding = 0;
67 attributeDescriptions[0].location = 0;
68 attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
69 attributeDescriptions[0].offset = 0;
70
71 attributeDescriptions[1].binding = 1;
72 attributeDescriptions[1].location = 1;
73 attributeDescriptions[1].format = VK_FORMAT_R32G32_SFLOAT;
74 attributeDescriptions[1].offset = 0;
75
76 attributeDescriptions[2].binding = 2;
77 attributeDescriptions[2].location = 2;
78 attributeDescriptions[2].format = VK_FORMAT_R8G8B8A8_UNORM;
79 attributeDescriptions[2].offset = 0;
80
81 return std::move(attributeDescriptions);
82 }
83
84
85 void Meshlet::FromMeshopt(const meshopt_Meshlet& m, const meshopt_Bounds& bounds)
86 {
88
89 vertexOffset = m.vertex_offset;
90 primitiveOffset = 0; /* @brief Need more work here. */
91 nVertices = m.vertex_count;
92 nPrimitives = m.triangle_count;
93
94 lod = 0;
95
96 boundSphere.c.x = bounds.center[0];
97 boundSphere.c.y = bounds.center[1];
98 boundSphere.c.z = bounds.center[2];
99 boundSphere.r = bounds.radius;
100
101 clusterBoundSphere.c = glm::vec3(0.0f);
102 clusterBoundSphere.r = 0.0f;
103
104 coneApex.x = bounds.cone_apex[0];
105 coneApex.y = bounds.cone_apex[1];
106 coneApex.z = bounds.cone_apex[2];
107
108 coneAxis.x = bounds.cone_axis[0];
109 coneAxis.y = bounds.cone_axis[1];
110 coneAxis.z = bounds.cone_axis[2];
111
112 coneCutoff = bounds.cone_cutoff;
113 }
114}
#define SPICES_PROFILE_ZONE
void FromMeshopt(const meshopt_Meshlet &m, const meshopt_Bounds &bounds)
Destructor Function. @attemtion Why Destructor causes bug here.
Definition Vertex.cpp:85
Meshlet Class. This class defines what Meshlet data.
Definition Vertex.h:58