38 #include <hboost/asio.hpp>
42 using namespace HDK_Sample;
43 using namespace UT::Literal;
62 using hboost::asio::ip::udp;
63 using hboost::asio::ip::address;
72 hboost::asio::io_service io_service;
73 udp::socket socket(io_service, udp::endpoint(udp::v4(), options.
myPort));
79 int native_socket = socket.native_handle();
91 udp::endpoint remote_endpoint;
92 hboost::system::error_code
error;
104 state.
setError(
"Request timed out...");
109 size_t num_read = socket.receive_from(
111 remote_endpoint, 0, error);
116 if (error && error != hboost::asio::error::message_size)
124 size_t src_size = num_read;
125 size_t dst_size = uncompressed_buf.
size();
126 size_t decompress_result;
128 uncompressed_buf.
data(), dst_size, buf.
data(), src_size);
130 if (decompress_result == 0)
141 state.
setError(
"Could not decompress packet");
168 "leftUpLeg",
"leftLeg",
"leftFoot",
"leftToe",
"leftToeEnd",
169 "rightUpLeg",
"rightLeg",
"rightFoot",
"rightToe",
"rightToeEnd",
171 "leftShoulder",
"leftUpperArm",
"leftLowerArm",
"leftHand",
172 "leftIndexProximal",
"leftIndexMedial",
"leftIndexDistal",
"leftIndexTip",
173 "leftLittleProximal",
"leftLittleMedial",
"leftLittleDistal",
"leftLittleTip",
174 "leftMiddleProximal",
"leftMiddleMedial",
"leftMiddleDistal",
"leftMiddleTip",
175 "leftRingProximal",
"leftRingMedial",
"leftRingDistal",
"leftRingTip",
176 "leftThumbProximal",
"leftThumbMedial",
"leftThumbDistal",
"leftThumbTip",
178 "rightShoulder",
"rightUpperArm",
"rightLowerArm",
"rightHand",
179 "rightIndexProximal",
"rightIndexMedial",
"rightIndexDistal",
"rightIndexTip",
180 "rightLittleProximal",
"rightLittleMedial",
"rightLittleDistal",
"rightLittleTip",
181 "rightMiddleProximal",
"rightMiddleMedial",
"rightMiddleDistal",
"rightMiddleTip",
182 "rightRingProximal",
"rightRingMedial",
"rightRingDistal",
"rightRingTip",
183 "rightThumbProximal",
"rightThumbMedial",
"rightThumbDistal",
"rightThumbTip",
207 UT_Matrix4F(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0.9449999928474426, 0.02500000037252903, 1),
208 UT_Matrix4F(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0.08799999952316284, 0.9449999928474426, 0.02500000037252903, 1),
209 UT_Matrix4F(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0.08799999952316284, 0.4740000069141388, 0.02500000037252903, 1),
210 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0.08900000154972076, 0.002000000094994903, 0.02500000037252903, 1),
211 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0.08900000154972076, -0.06599999964237213, 0.1679999977350235, 1),
212 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0.08900000154972076, -0.07999999821186066, 0.2489999979734421, 1),
213 UT_Matrix4F(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -0.08900000154972076, 0.9449999928474426, 0.02500000037252903, 1),
214 UT_Matrix4F(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -0.08900000154972076, 0.4740000069141388, 0.02500000037252903, 1),
215 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -0.08900000154972076, 0.002000000094994903, 0.02500000037252903, 1),
216 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -0.08900000154972076, -0.06599999964237213, 0.1679999977350235, 1),
217 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -0.08900000154972076, -0.07999999821186066, 0.2489999979734421, 1),
218 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.036999940872192, -0.01799999922513962, 1),
219 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.202999949455261, -0.02099999971687794, 1),
220 UT_Matrix4F(0, 1, 0, 0, -0.9661348462104797, 0, 0.258037656545639, 0, 0.258037656545639, 0, 0.9661348462104797, 0, 0.07699999958276749, 1.478000044822693, 0, 1),
221 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.221000000834465, 1.478000044822693, -0.03799999877810478, 1),
222 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.5049999952316284, 1.478000044822693, -0.03799999877810478, 1),
223 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.8190000057220459, 1.478000044822693, -0.03799999877810478, 1),
224 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9070000052452087, 1.476999998092651, -0.009999999776482582, 1),
225 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9589999914169312, 1.476999998092651, -0.009999999776482582, 1),
226 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9900000095367432, 1.476999998092651, -0.009999999776482582, 1),
227 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1.021000027656555, 1.476999998092651, -0.009999999776482582, 1),
228 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.8960000276565552, 1.476999998092651, -0.07299999892711639, 1),
229 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9369999766349792, 1.476999998092651, -0.07299999892711639, 1),
230 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9639999866485596, 1.476999998092651, -0.07299999892711639, 1),
231 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9900000095367432, 1.476999998092651, -0.07299999892711639, 1),
232 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9079999923706055, 1.476999998092651, -0.03200000151991844, 1),
233 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9599999785423279, 1.476999998092651, -0.03200000151991844, 1),
234 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9950000047683716, 1.476999998092651, -0.03200000151991844, 1),
235 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1.027999997138977, 1.476999998092651, -0.03200000151991844, 1),
236 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9049999713897705, 1.476999998092651, -0.05400000140070915, 1),
237 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9539999961853027, 1.476999998092651, -0.05400000140070915, 1),
238 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9850000143051147, 1.476999998092651, -0.05400000140070915, 1),
239 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1.016000032424927, 1.476999998092651, -0.05400000140070915, 1),
240 UT_Matrix4F(-0.3532975912094116, -0.7077658176422119, 0.6117584705352783, 0, -0.8660871982574463, 0.0002441254764562473, -0.4998929500579834, 0, 0.3536577820777893, -0.7064471244812012, -0.6130731105804443, 0, 0.8420000076293945, 1.476999998092651, -0.00800000037997961, 1),
241 UT_Matrix4F(0, -0.7061478495597839, 0.7080644369125366, 0, -1, 0, 0, 0, 0, -0.7080644369125366, -0.7061478495597839, 0, 0.8790000081062317, 1.476999998092651, 0.01400000043213367, 1),
242 UT_Matrix4F(0, -0.7061478495597839, 0.7080644369125366, 0, -1, 0, 0, 0, 0, -0.7080644369125366, -0.7061478495597839, 0, 0.9120000004768372, 1.476999998092651, 0.01400000043213367, 1),
243 UT_Matrix4F(0, -0.7061478495597839, 0.7080644369125366, 0, -1, 0, 0, 0, 0, -0.7080644369125366, -0.7061478495597839, 0, 0.949999988079071, 1.476999998092651, 0.01400000043213367, 1),
244 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.564000010490417, -0.02099999971687794, 1),
245 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.677999973297119, -0.02099999971687794, 1),
246 UT_Matrix4F(0, -1, 0, 0, 0.9661348462104797, 0, 0.258037656545639, 0, -0.258037656545639, 0, 0.9661348462104797, 0, -0.07599999755620956, 1.478000044822693, 0, 1),
247 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.2199999988079071, 1.478000044822693, -0.03799999877810478, 1),
248 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.5040000081062317, 1.478000044822693, -0.03799999877810478, 1),
249 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.8180000185966492, 1.478000044822693, -0.03799999877810478, 1),
250 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9070000052452087, 1.476999998092651, -0.009999999776482582, 1),
251 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9580000042915344, 1.476999998092651, -0.009999999776482582, 1),
252 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9890000224113464, 1.476999998092651, -0.009999999776482582, 1),
253 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1.019999980926514, 1.476999998092651, -0.009999999776482582, 1),
254 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.8949999809265137, 1.476999998092651, -0.07299999892711639, 1),
255 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9369999766349792, 1.476999998092651, -0.07299999892711639, 1),
256 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9629999995231628, 1.476999998092651, -0.07299999892711639, 1),
257 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9890000224113464, 1.476999998092651, -0.07299999892711639, 1),
258 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9079999923706055, 1.476999998092651, -0.03200000151991844, 1),
259 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9599999785423279, 1.476999998092651, -0.03200000151991844, 1),
260 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9940000176429749, 1.476999998092651, -0.03200000151991844, 1),
261 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1.026999950408936, 1.476999998092651, -0.03200000151991844, 1),
262 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9039999842643738, 1.476999998092651, -0.05400000140070915, 1),
263 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.953000009059906, 1.476999998092651, -0.05400000140070915, 1),
264 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.984000027179718, 1.476999998092651, -0.05400000140070915, 1),
265 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1.014999985694885, 1.476999998092651, -0.05400000140070915, 1),
266 UT_Matrix4F(-0.3532975912094116, 0.7077658176422119, -0.6117584705352783, 0, 0.8660871982574463, 0.0002441254764562473, -0.4998929500579834, 0, -0.3536577820777893, -0.7064471244812012, -0.6130731105804443, 0, -0.8410000205039978, 1.476999998092651, -0.00800000037997961, 1),
267 UT_Matrix4F(0, 0.7061478495597839, -0.7080644369125366, 0, 1, 0, 0, 0, 0, -0.7080644369125366, -0.7061478495597839, 0, -0.878000020980835, 1.476999998092651, 0.01400000043213367, 1),
268 UT_Matrix4F(0, 0.7061478495597839, -0.7080644369125366, 0, 1, 0, 0, 0, 0, -0.7080644369125366, -0.7061478495597839, 0, -0.9120000004768372, 1.476999998092651, 0.01400000043213367, 1),
269 UT_Matrix4F(0, 0.7061478495597839, -0.7080644369125366, 0, 1, 0, 0, 0, 0, -0.7080644369125366, -0.7061478495597839, 0, -0.9490000009536743, 1.476999998092651, 0.01400000043213367, 1),
281 bool &parse_incomplete)
296 version = version_val->
getF();
305 bool is_missing_joints =
false;
306 int num_actors = actors->
entries();
307 int num_joints = JOINTS.size();
308 for (
int i = 0; i < num_actors; i++)
316 const char *
name = actor_name->
getS();
323 bool has_left_glove =
true;
324 bool has_right_glove =
true;
325 bool has_body =
true;
326 bool has_face =
true;
328 if (version >= 3.0
f && meta)
332 const UT_JSONValue *has_right_glove_value = meta->
get(
"hasRightGlove");
336 bool has_gloves = (has_gloves_value && has_gloves_value->
getB());
337 has_left_glove = has_gloves && has_left_glove_value
338 && has_left_glove_value->
getB();
339 has_right_glove = has_gloves && has_right_glove_value
340 && has_right_glove_value->
getB();
341 has_body = has_body_value && has_body_value->
getB();
342 has_face = has_face_value && has_face_value->
getB();
346 Actor *skeleton = mySkeletons.findActor(name);
349 skeleton = mySkeletons.addActor(name);
350 skeleton->myPoints.setSize(num_joints);
352 skeleton->myIsDirty =
true;
354 for (
int j = 0;
j < num_joints;
j++)
356 ActorPoint &joint = skeleton->myPoints[
j];
365 joint_pos = joint_data->
getObject(
"position");
366 joint_rot = joint_data->
getObject(
"rotation");
367 if (joint_pos && joint_rot)
369 pos_x = joint_pos->
get(
"x");
370 pos_y = joint_pos->
get(
"y");
371 pos_z = joint_pos->
get(
"z");
373 rot_x = joint_rot->
get(
"x");
374 rot_y = joint_rot->
get(
"y");
375 rot_z = joint_rot->
get(
"z");
376 rot_w = joint_rot->
get(
"w");
380 if (!joint_data || !joint_pos || !joint_rot
381 || !pos_x || !pos_y || !pos_z
382 || !rot_x || !rot_y || !rot_z || !rot_w)
384 joint.myDidReceive =
false;
392 bool is_right_hand = joint_name.
fcontain(
"right");
393 is_missing_joints = (is_right_hand && has_right_glove)
394 || (!is_right_hand && has_left_glove);
398 is_missing_joints =
true;
409 rot.getRotationMatrix(rot_mat);
411 joint.myWorldXform = rot_mat;
412 joint.myWorldXform.setTranslates(pos);
414 joint.myDidReceive =
true;
419 if (face && has_face)
421 skeleton->myBlendShapes.
clear();
422 for (
const auto& item : *face)
429 skeleton->myBlendShapes[item.first] = val->
getF()/100.f;
435 if (is_missing_joints)
440 int num_props = props->
entries();
441 for (
int i = 0; i < num_props; i++)
448 const char *
name = prop_name->
getS();
452 if (!joint_pos || !joint_rot)
463 if (!pos_x || !pos_y || !pos_z
464 || !rot_x || !rot_y || !rot_z || !rot_w)
470 Actor *device_prop = myProps.findActor(name);
473 device_prop = myProps.addActor(name);
474 device_prop->myPoints.setSize(1);
482 rot.getRotationMatrix(rot_mat);
484 ActorPoint &point = device_prop->myPoints[0];
485 point.myWorldXform = rot_mat;
486 point.myWorldXform.setTranslates(pos);
488 point.myDidReceive =
true;
501 MocapStreamRokokoHDK::computeSkeletonTransforms()
503 int num_skeletons = mySkeletons.size();
504 int num_joints = JOINTS.size();
505 for (
int i = 0; i < num_skeletons; i++)
507 Actor &skeleton = mySkeletons(i);
508 if (!skeleton.myIsDirty)
511 skeleton.myIsDirty =
false;
512 if (skeleton.myPoints.size() != JOINTS.size())
515 bool received_all_points =
true;
518 for (
int j = 0;
j < num_joints;
j++)
523 ActorPoint &joint = skeleton.myPoints[
j];
524 if (!joint.myDidReceive)
526 received_all_points =
false;
532 joint.myLocalXform = joint.myWorldXform;
536 ActorPoint &parent = skeleton.myPoints[
PARENTS[
j]];
537 if (!parent.myDidReceive)
540 UT_Matrix4F parent_xform_inv = parent.myWorldXform;
541 parent_xform_inv.
invert();
543 joint.myLocalXform = joint.myWorldXform * parent_xform_inv;
546 if (received_all_points)
550 for (
int j = 0;
j < num_joints;
j++)
552 ActorPoint &joint = skeleton.myPoints[
j];
555 joint.myWorldXform = joint.myLocalXform;
559 ActorPoint &parent = skeleton.myPoints[
PARENTS[
j]];
560 joint.myWorldXform = joint.myLocalXform * parent.myWorldXform;
578 computeSkeletonTransforms();
581 mySkeletons.resetOccurances();
582 myProps.resetOccurances();
588 MocapStreamRokokoHDK::Actor *first_blendshapes_actor =
nullptr;
594 const auto& actor_name = actor_name_h.get(ptoff);
597 MocapStreamRokokoHDK::Actor *actor = mySkeletons.findActor(actor_name);
600 actor = myProps.findActor(actor_name);
601 else if (!first_blendshapes_actor && actor->myBlendShapes.size() > 0)
602 first_blendshapes_actor = actor;
609 int i = actor->myOccurances;
610 actor->myOccurances++;
611 if (i >= actor->myPoints.entries())
615 MocapStreamRokokoHDK::ActorPoint &point = actor->myPoints(i);
618 transform_h.set(ptoff, transform);
621 point.myWorldXform.getTranslates(pos);
625 transform_h.bumpDataId();
632 if (!first_blendshapes_actor)
634 for (
const auto &blendshape : prev_blendshapes)
640 prev_blendshapes.clear();
646 for (
const auto &blendshape : prev_blendshapes)
648 if (first_blendshapes_actor->myBlendShapes.contains(blendshape))
655 prev_blendshapes.clear();
659 for (
auto& item : first_blendshapes_actor->myBlendShapes)
670 prev_blendshapes.append(item.first);
680 if (mySkeletons.removeActor(name))
683 myProps.removeActor(name);
698 MocapStreamRokokoHDK::Actor *actor = myProps.findActor(name);
702 joint_name_h.set(ptoff, name);
703 actor_name_h.set(ptoff, name);
707 actor = mySkeletons.findActor(name);
714 int num_joints = JOINTS.size();
715 if (actor->myPoints.size() == num_joints)
717 for (
int i = 0; i < num_joints; i++)
722 auto& xform = rest_xforms[i];
723 MocapStreamRokokoHDK::ActorPoint &joint
724 = actor->myPoints[i];
725 MocapStreamRokokoHDK::ActorPoint &parent
731 xform.getTranslates(pt);
738 rest_xforms[
PARENTS[i]].getTranslates(new_origin);
739 if (joint.myDidReceive && parent.myDidReceive)
742 joint.myWorldXform.getTranslates(joint_pos);
743 parent.myWorldXform.getTranslates(parent_pos);
744 bone_length = (joint_pos - parent_pos).
length();
748 bone_length = (pt - old_origin).
length();
753 pt = new_origin + offset*bone_length/offset.
length();
754 xform.setTranslates(pt);
760 for (
int i = 0; i < num_joints; i++)
762 MocapStreamRokokoHDK::ActorPoint &joint
763 = actor->myPoints[i];
765 joint_name_h.set(ptoff+i, JOINTS[i]);
766 actor_name_h.set(ptoff+i, name);
767 rest_transform_h.set(ptoff+i,
UT_Matrix4F(rest_xforms[i]));
770 rest_xforms[i].getTranslates(pt);
782 parent_xform_inv.
invert();
783 joint.myLocalXform = rest_xforms[i] * parent_xform_inv;
788 joint.myLocalXform = rest_xforms[i];
804 void basicUdpReceiver(ServerState& state,
const ServerOptions& options,
807 using hboost::asio::ip::udp;
808 using hboost::asio::ip::address;
814 hboost::asio::io_service io_service;
815 udp::socket socket(io_service, udp::endpoint(udp::v4(), options.myPort));
818 int native_socket = socket.native_handle();
824 state.setPortOpened(
true);
828 while (!state.killed())
830 udp::endpoint remote_endpoint;
831 hboost::system::error_code
error;
843 state.setError(
"Request timed out...");
848 size_t num_read = socket.receive_from(
850 remote_endpoint, 0, error);
855 if (error && error != hboost::asio::error::message_size)
861 state.setConnected(
true);
879 void basicTcpClient(ServerState& state,
const ServerOptions& options,
884 options.myHostIP, options.myPort,
true);
889 state.setPortOpened(
true);
894 if (client->isValid())
898 while (!state.killed())
901 int cond = client->connect(500);
906 if (!state.connected())
909 state.setError(
"Could not connect");
914 while (state.connected() && !state.killed())
917 int status = client->read(
buf.data(),
buf.size(), &num_read, 200);
926 state.setError(
"Error receiving data");
928 state.setConnected(
false);
931 options.myHostIP, options.myPort,
true);
933 #if UT_ASSERT_LEVEL > 1
936 state.setError(
"No data received within 500ms");
944 state.setError(
"Invalid request");
void setPacketTime(fpreal64 time)
SYS_FORCE_INLINE void bumpDataId()
GLenum GLuint GLenum GLsizei const GLchar * buf
const char * fcontain(const char *pattern, bool case_sensitive=true) const
SYS_NO_DISCARD_RESULT const UT_JSONValueMap * getObject(const UT_StringRef &k) const
UT_StringHolder myNodePath
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
GA_RWHandleM3D createTransform3(GEO_Detail &detail, GA_AttributeOwner owner=GA_ATTRIB_POINT)
bool parseValue(UT_JSONParser &parser, UT_IStream *is=0, bool record_source_offsets=false)
#define SYS_PRAGMA_PUSH_WARN()
void setError(const char *msg)
Abstracts the socket file descriptor set for select() or poll() calls.
UT_Array< UT_Matrix4F > REST_XFORMS
bool parsePacket(UT_StringHolder &packet, fpreal packet_time, bool &parse_incomplete) override
size_t decompress(char *dst_buf, size_t dst_size, char *src_buf, size_t src_size)
#define SYS_PRAGMA_DISABLE_OVERLOADED_VIRTUAL()
GA_Attribute * addFloatTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_REAL32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
SYS_NO_DISCARD_RESULT const UT_JSONValue * get(int64 i) const
Access a const entry by index.
UT_JSONValueArray stores a list of UT_JSONValue objects.
GA_API const UT_StringHolder rot
void clear()
Clear the entries in the map.
SYS_NO_DISCARD_RESULT const UT_JSONValueMap * getObject(int64 i) const
Access a const object by index.
GA_Attribute * getP()
Convenience method to access the P attribute.
const UT_StringHolder theActorAttribName
GLuint GLsizei GLsizei * length
UT_StringHolder updateAttribName(GU_Detail *gdp, const UT_StringHolder &base_name, const UT_StringHolder &rename_pattern, const UT_StringHolder &prev_rename_pattern)
constexpr SYS_FORCE_INLINE T length() const noexcept
SYS_NO_DISCARD_RESULT const char * getS() const
Get the string value (may return a NULL pointer)
Standard user attribute level.
bool killed()
Whether the connection has been killed.
void receivedSkeleton(const UT_StringHolder &name)
void setVertexPoint(GA_Offset vertex, GA_Offset ptoff)
Given a vertex, set the corresponding point offset.
int substitute(const char *find, const char *replacement, int count=-1)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GA_API const UT_StringHolder name
void gotPacket(UT_StringHolder &&packet)
SYS_FORCE_INLINE GA_Offset appendPointBlock(GA_Size npoints)
Append new points, returning the first offset of the contiguous block.
void setConnected(bool connected)
SYS_NO_DISCARD_RESULT UT_JSONValueMap * getMap() const
Get the map value (may return a NULL pointer)
SYS_FORCE_INLINE GA_Offset appendPoint()
Append a new point, returning its new data offset.
UT_Matrix4T< fpreal32 > UT_Matrix4F
UT_Matrix3T< fpreal32 > UT_Matrix3F
#define SYS_PRAGMA_POP_WARN()
GLuint const GLchar * name
SYS_NO_DISCARD_RESULT bool getB() const
Get the bool value. Interprets integer/float as bool.
#define GA_FOR_ALL_PTOFF(gdp, ptoff)
GA_API const UT_StringHolder transform
void removeSkeleton(const UT_StringHolder &name) override
Removes the stored data for a skeleton.
SYS_NO_DISCARD_RESULT fpreal64 getF() const
Get the real value. Interprets bool/int as reals.
void addParseWarning(const char *fmt, Args &&...args)
Call this to report a warning when parsing.
static UT_UniquePtr< UT_NetSocket > newSocketFromAddr(const char *address, int port, bool blocking=false, int localport=-1)
void newMocapStreamDevice(void *)
SYS_FORCE_INLINE int64 entries() const
Return the number of entries in the array.
GT_API const UT_StringHolder version
void buildSkeleton(GU_Detail *gdp, UT_StringHolder name) override
int checkEvents(int timeout_ms) const
void updateJoints(GU_Detail *gdp, const MC_MocapStreamCookParms &cookparms, const MC_MocapStreamCookParms &prev_cookparms) override
SYS_FORCE_INLINE void setPos3(GA_Offset ptoff, const UT_Vector3 &pos)
Set P from a UT_Vector3.
void resetError()
Resets the error state.
void setPortOpened(bool port_opened)
bool setDetailAttributeF(const UT_StringHolder &aname, float v)
UT_StringHolder myFacialAttribs
SYS_NO_DISCARD_RESULT Type getType() const
Get the type of data stored in the object.
Class to store JSON objects as C++ objects.
bool add(int fd, UT_NetFDEvent event)
void rokokoServer(MC_MocapStreamImpl::ServerState &state, const MC_MocapStreamImpl::ServerOptions &options, MC_MocapStreamImpl *data)
SYS_NO_DISCARD_RESULT const UT_JSONValueArray * getArray(const UT_StringRef &k) const
void destroyAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name, const GA_AttributeFilter *filter=0)
void bumpDataIdsForAddOrRemove(bool added_or_removed_points, bool added_or_removed_vertices, bool added_or_removed_primitives)
~MocapStreamRokokoHDK() override
UT_StringArray JOINTS UT_Array< exint > PARENTS
GLenum GLuint GLsizei const GLenum * props
static void handleBoostError(hboost::system::error_code e, ServerState &state)
Adds an error message to the log corresponding to an hboost error code.
GA_Attribute * addStringTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, int tuple_size, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
GA_Offset appendPrimitivesAndVertices(const GA_PrimitiveTypeId &type, GA_Size nprimitives, GA_Size nvertices_each, GA_Offset &vertex_block_start, bool closed_flag=false)