Unravel Engine C++ Reference
Loading...
Searching...
No Matches
vertex_decl.h
Go to the documentation of this file.
1#pragma once
2
3#include <bgfx/bgfx.h>
4
5namespace gfx
6{
7
8using vertex_layout = bgfx::VertexLayout;
9using attribute = bgfx::Attrib::Enum;
10using attribute_type = bgfx::AttribType::Enum;
11
12template<typename T>
13struct vertex
14{
15 static auto get_layout() -> const vertex_layout&
16 {
17 static vertex_layout s_decl = []()
18 {
19 vertex_layout decl;
20 T::init(decl);
21 return decl;
22 }();
23 return s_decl;
24 }
25};
26
27struct screen_pos_vertex : vertex<screen_pos_vertex>
28{
29 float x = 0.0f;
30 float y = 0.0f;
31
32 static void init(vertex_layout& decl);
33};
34
35struct pos_vertex : vertex<pos_vertex>
36{
37 float x = 0.0f;
38 float y = 0.0f;
39 float z = 0.0f;
40
41 static void init(vertex_layout& decl);
42};
43
44struct pos_texcoord0_vertex : vertex<pos_texcoord0_vertex>
45{
46 float x = 0.0f;
47 float y = 0.0f;
48 float z = 0.0f;
49
50 float u = 0.0f;
51 float v = 0.0f;
52
53 static void init(vertex_layout& decl);
54};
55
56struct mesh_vertex : vertex<mesh_vertex>
57{
58 static void init(vertex_layout& decl);
59};
60
61struct pos_texcoord0_color0_vertex : vertex<pos_texcoord0_color0_vertex>
62{
63 static void init(vertex_layout& decl);
64};
65} // namespace gfx
bgfx::AttribType::Enum attribute_type
Definition vertex_decl.h:10
bgfx::VertexLayout vertex_layout
Definition vertex_decl.h:8
bgfx::Attrib::Enum attribute
Definition vertex_decl.h:9
static void init(vertex_layout &decl)
static void init(vertex_layout &decl)
static void init(vertex_layout &decl)
static void init(vertex_layout &decl)
static void init(vertex_layout &decl)
static auto get_layout() -> const vertex_layout &
Definition vertex_decl.h:15