2#include <boost/container/vector.hpp>
3#include <halp/controls.hpp>
4#include <halp/geometry.hpp>
5#include <halp/meta.hpp>
6#include <ossia/detail/pod_vector.hpp>
16using float_vec = boost::container::vector<float, ossia::pod_allocator<float>>;
21 int64_t pos_offset{}, texcoord_offset{}, normal_offset{}, color_offset{};
28std::vector<mesh> ObjFromString(
29 std::string_view obj_data
30 , std::string_view mtl_data
33std::vector<mesh> ObjFromString(
34 std::string_view obj_data
37template <std::
size_t N>
38static void fromGL(
float (&from)[N],
auto& to)
40 memcpy(to.data(), from,
sizeof(
float[N]));
42template <std::
size_t N>
43static void toGL(
auto& from,
float (&to)[N])
45 memcpy(to, from.data(),
sizeof(
float[N]));
48inline void rebuild_transform(
auto& inputs,
auto& outputs)
51 auto& pos = inputs.position;
52 auto& rot = inputs.rotation;
53 auto& sc = inputs.scale;
55 model.translate(pos.value.x, pos.value.y, pos.value.z);
56 model.rotate(QQuaternion::fromEulerAngles(rot.value.x, rot.value.y, rot.value.z));
57 model.scale(sc.value.x, sc.value.y, sc.value.z);
59 toGL(model, outputs.geometry.transform);
60 outputs.geometry.dirty_transform =
true;
62struct PositionControl : halp::xyz_spinboxes_f32<"Position", halp::free_range_min<>>
64 void update(
auto& o) { rebuild_transform(o.inputs, o.outputs); }
67 : halp::xyz_spinboxes_f32<"Rotation", halp::range{0., 359.9999999, 0.}>
69 void update(
auto& o) { rebuild_transform(o.inputs, o.outputs); }
71struct ScaleControl : halp::xyz_spinboxes_f32<"Scale", halp::range{0.00001, 1000., 1.}>
73 void update(
auto& o) { rebuild_transform(o.inputs, o.outputs); }
78 void update(
auto& obj) { obj.update(); }
85 halp_meta(name,
"Geometry");
86 halp::position_normals_texcoords_geometry
mesh;
87 float transform[16]{};
88 bool dirty_mesh =
false;
89 bool dirty_transform =
false;
Definition TinyObj.hpp:63
Definition TinyObj.hpp:82
Definition TinyObj.hpp:68
Definition TinyObj.hpp:72
Definition TinyObj.hpp:77
Definition TinyObj.hpp:18