16 halp_meta(name,
"Geometry Info")
17 halp_meta(category,
"Visuals/Utilities")
18 halp_meta(c_name,
"geometry_info")
19 halp_meta(description,
"Inspect a geometry's buffers, attributes and drawing metadata.")
20 halp_meta(manual_url,
"https://ossia.io/score-docs/processes/geometry-info.html")
21 halp_meta(uuid,
"c4deb797-8d5f-4ffb-b25b-b541f5c54099")
27 halp_meta(name,
"Geometry");
28 halp_flag(single_cable);
29 halp::dynamic_gpu_geometry
mesh;
30 float transform[16]{};
31 bool dirty_mesh =
false;
32 bool dirty_transform =
false;
38 halp::val_port<
"Vertices",
int> vertices;
39 halp::val_port<
"Indices",
int> indices;
40 halp::val_port<
"Instances",
int> instances;
43 halp::val_port<
"Attributes", std::vector<halp::geometry_attribute>> attributes;
44 halp::val_port<
"Bindings", std::vector<halp::geometry_binding>> bindings;
45 halp::val_port<
"Inputs", std::vector<halp::geometry_input>> inputs;
47 halp::val_port<
"Readable", std::string> readable;
51 static std::string_view semantic_name(ossia::attribute_semantic sem)
53 auto s =
static_cast<ossia::attribute_semantic
>(sem);
54 if(s != ossia::attribute_semantic::custom)
55 return ossia::semantic_to_name(s);
59 static std::string_view format_name(halp::attribute_format v)
63 case halp::attribute_format::float4:
65 case halp::attribute_format::float3:
67 case halp::attribute_format::float2:
69 case halp::attribute_format::float1:
71 case halp::attribute_format::unormbyte4:
73 case halp::attribute_format::unormbyte2:
75 case halp::attribute_format::unormbyte1:
77 case halp::attribute_format::uint4:
79 case halp::attribute_format::uint3:
81 case halp::attribute_format::uint2:
83 case halp::attribute_format::uint1:
85 case halp::attribute_format::sint4:
87 case halp::attribute_format::sint3:
89 case halp::attribute_format::sint2:
91 case halp::attribute_format::sint1:
93 case halp::attribute_format::half4:
95 case halp::attribute_format::half3:
97 case halp::attribute_format::half2:
99 case halp::attribute_format::half1:
101 case halp::attribute_format::ushort4:
103 case halp::attribute_format::ushort3:
105 case halp::attribute_format::ushort2:
107 case halp::attribute_format::ushort1:
109 case halp::attribute_format::sshort4:
111 case halp::attribute_format::sshort3:
113 case halp::attribute_format::sshort2:
115 case halp::attribute_format::sshort1:
122 static std::string_view classification_name(halp::binding_classification v)
126 case halp::binding_classification::per_vertex:
128 case halp::binding_classification::per_instance:
129 return "per_instance";
137 outputs.vertices.value = inputs.geometry.mesh.vertices;
138 outputs.indices.value = inputs.geometry.mesh.indices;
139 outputs.instances.value = inputs.geometry.mesh.instances;
141 outputs.attributes.value = inputs.geometry.mesh.attributes;
142 outputs.bindings.value = inputs.geometry.mesh.bindings;
143 outputs.inputs.value = inputs.geometry.mesh.input;
147 std::string& ret = outputs.readable.value;
150 std::back_inserter(ret),
"vertices: {}, indices: {}, instances: {}\n",
151 inputs.geometry.mesh.vertices, inputs.geometry.mesh.indices,
152 inputs.geometry.mesh.instances);
155 for(
auto& v : inputs.geometry.mesh.attributes)
158 std::back_inserter(ret),
159 "Attribute {}: semantic={}, binding={}, fmt={}, offset={}\n", i++,
160 semantic_name(
static_cast<ossia::attribute_semantic
>(v.semantic)), v.binding,
161 format_name(v.format), v.byte_offset);
165 for(
auto& v : inputs.geometry.mesh.bindings)
168 std::back_inserter(ret),
"Binding {}: stride={}, step={}, class={}\n", i++,
169 v.stride, v.step_rate, classification_name(v.classification));
173 for(
auto& v : inputs.geometry.mesh.input)
176 std::back_inserter(ret),
"Input {}: buffer_idx={}, offset={}\n", i++,
177 v.buffer, v.byte_offset);