OSSIA
Open Scenario System for Interactive Application
geometry_port.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 
4 #include <ossia/detail/small_vector.hpp>
5 
6 #include <memory>
7 
8 namespace ossia
9 {
10 struct geometry
11 {
12  struct buffer
13  {
14  std::shared_ptr<void> data{};
15  int64_t size{};
16  bool dirty{};
17  };
18 
19  struct binding
20  {
21  uint32_t stride{};
22  enum
23  {
24  per_vertex,
25  per_instance
26  } classification{};
27  int step_rate{};
28  };
29 
30  struct attribute
31  {
32  int binding = 0;
33  int location = 0;
34 
35  enum
36  {
37  fp4,
38  fp3,
39  fp2,
40  fp1,
41  unsigned4,
42  unsigned2,
43  unsigned1
44  } format
45  = fp4;
46 
47  uint32_t offset = 0;
48  };
49 
50  struct input
51  {
52  int buffer{};
53  int64_t offset{};
54  };
55 
56  ossia::small_vector<buffer, 2> buffers;
57  ossia::small_vector<binding, 2> bindings;
58  ossia::small_vector<attribute, 2> attributes;
59  ossia::small_vector<input, 2> input;
60 
61  int vertices{}, indices{};
62  enum
63  {
64  triangles,
65  triangle_strip,
66  triangle_fan,
67  lines,
68  line_strip,
69  points
70  } topology;
71  enum
72  {
73  none,
74  front,
75  back
76  } cull_mode;
77  enum
78  {
79  counter_clockwise,
80  clockwise
81  } front_face;
82 
83  struct
84  {
85  int buffer{-1};
86  int64_t offset{};
87  enum
88  {
89  uint16,
90  uint32
91  } format{};
92  } index;
93 };
94 
95 struct mesh_list
96 {
97  std::vector<geometry> meshes;
98  int64_t dirty_index{};
99 };
100 using mesh_list_ptr = std::shared_ptr<mesh_list>;
101 struct transform3d
102 {
103  float matrix[16]{
104  1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1.,
105  };
106 };
107 
108 struct OSSIA_EXPORT geometry_port
109 {
110  static const constexpr int which = 4;
111  enum dirt_flags
112  {
113  dirty_transform = 0x1,
114  dirty_meshes = 0x2
115  };
116 
117  void clear();
118 
119  mesh_list_ptr meshes;
120  transform3d transform;
121  uint8_t flags{};
122 };
123 
124 struct geometry_delay_line
125 {
126  std::vector<mesh_list_ptr> meshes;
127 };
128 
129 }
Definition: git_info.h:7