2#include <ossia/detail/config.hpp>
4#include <ossia/detail/small_vector.hpp>
5#include <ossia/detail/variant.hpp>
18enum class attribute_semantic : uint16_t
28 texcoord1 = texcoord0 + 1,
29 texcoord2 = texcoord0 + 2,
30 texcoord3 = texcoord0 + 3,
31 texcoord4 = texcoord0 + 4,
32 texcoord5 = texcoord0 + 5,
33 texcoord6 = texcoord0 + 6,
34 texcoord7 = texcoord0 + 7,
43 joints1 = joints0 + 1,
46 weights1 = weights0 + 1,
50 morph_normal = morph_position + 1,
51 morph_tangent = morph_position + 2,
52 morph_texcoord = morph_position + 3,
53 morph_color = morph_position + 4,
57 rotation_extra = morph_position + 1,
58 scale = morph_position + 2,
59 uniform_scale = morph_position + 3,
60 up = morph_position + 4,
61 pivot = morph_position + 5,
62 transform_matrix = morph_position + 6,
63 translation = morph_position + 7,
67 acceleration = velocity + 1,
71 lifetime = velocity + 5,
72 birth_time = velocity + 6,
73 particle_id = velocity + 7,
75 angular_velocity = velocity + 9,
76 previous_position = velocity + 10,
77 rest_position = velocity + 11,
78 target_position = velocity + 12,
79 previous_velocity = velocity + 13,
80 state = velocity + 14,
81 collision_count = velocity + 15,
82 collision_normal = velocity + 16,
83 sleep = velocity + 17,
87 sprite_rotation = sprite_size + 1,
88 sprite_facing = sprite_size + 2,
89 sprite_index = sprite_size + 3,
90 width = sprite_size + 4,
91 opacity = sprite_size + 5,
92 emissive = sprite_size + 6,
93 emissive_strength = sprite_size + 7,
97 metallic = roughness + 1,
98 ambient_occlusion = roughness + 2,
99 specular = roughness + 3,
100 subsurface = roughness + 4,
101 clearcoat = roughness + 5,
102 clearcoat_roughness = roughness + 6,
103 anisotropy = roughness + 7,
104 anisotropy_direction = roughness + 8,
106 transmission = roughness + 10,
107 thickness = roughness + 11,
108 material_id = roughness + 22,
112 sh_coeffs = sh_dc + 1,
113 covariance_3d = sh_dc + 2,
114 sh_degree = sh_dc + 3,
118 temperature = density + 1,
120 pressure = density + 3,
121 divergence = density + 4,
122 sdf_distance = density + 5,
123 voxel_color = density + 6,
131 group_mask = name + 5,
132 instance_id = name + 6,
152OSSIA_EXPORT std::string_view semantic_to_name(attribute_semantic s)
noexcept;
155OSSIA_EXPORT attribute_semantic name_to_semantic(std::string_view name)
noexcept;
161 std::shared_ptr<void> raw_data;
173 ossia::variant<cpu_buffer, gpu_buffer> data;
175 int64_t active_element_count{-1};
180 uint32_t byte_stride{};
226 uint32_t byte_offset = 0;
231 attribute_semantic semantic = attribute_semantic::custom;
238 int64_t byte_offset{};
241 ossia::small_vector<buffer, 2> buffers;
242 ossia::small_vector<binding, 2> bindings;
243 ossia::small_vector<attribute, 2> attributes;
244 ossia::small_vector<input, 2> input;
246 int vertices{}, indices{}, instances{1};
271 int64_t byte_offset{};
288 gpu_buffer indirect_count;
296 struct auxiliary_buffer
300 int64_t byte_offset{};
303 ossia::small_vector<auxiliary_buffer, 1> auxiliary;
306 const auxiliary_buffer* find_auxiliary(std::string_view name)
const noexcept
308 for(
auto& a : auxiliary)
315 const attribute* find(attribute_semantic sem)
const noexcept
317 for(
auto& a : attributes)
318 if(a.semantic == sem)
324 const attribute* find(std::string_view attr_name)
const noexcept
326 for(
auto& a : attributes)
327 if(a.semantic == attribute_semantic::custom && a.name == attr_name)
333 static std::string_view display_name(
const attribute& a)
noexcept
335 if(a.semantic != attribute_semantic::custom)
336 return semantic_to_name(a.semantic);
343 std::vector<geometry> meshes;
344 int64_t dirty_index{};
346using mesh_list_ptr = std::shared_ptr<mesh_list>;
350 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1.,
354struct geometry_filter
372 int64_t dirty_index{};
375struct geometry_filter_list
377 std::vector<geometry_filter> filters;
378 int64_t dirty_index{};
380using geometry_filter_list_ptr = std::shared_ptr<geometry_filter_list>;
384 mesh_list_ptr meshes;
385 geometry_filter_list_ptr filters;
387 operator bool() const noexcept {
return meshes && filters; }
388 bool operator==(
const geometry_spec&)
const noexcept =
default;
389 bool operator<(
const geometry_spec& rhs)
const noexcept
391 return (meshes < rhs.meshes) || (meshes == rhs.meshes && filters < rhs.filters);
395struct OSSIA_EXPORT geometry_port
397 static const constexpr int which = 4;
400 dirty_transform = 0x1,
406 geometry_spec geometry;
407 transform3d transform;
411struct geometry_delay_line
413 std::vector<geometry_spec> geometries;
OSSIA_INLINE constexpr auto min(const T a, const U b) noexcept -> typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type
min function tailored for values
Definition math.hpp:125
OSSIA_INLINE constexpr auto max(const T a, const U b) noexcept -> typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type
max function tailored for values
Definition math.hpp:96