37 #include <hboost/asio.hpp>
41 using namespace HDK_Sample;
42 using namespace UT::Literal;
61 using hboost::asio::ip::udp;
62 using hboost::asio::ip::address;
71 hboost::asio::io_service io_service;
72 udp::socket socket(io_service, udp::endpoint(udp::v4(), options.
myPort));
78 int native_socket = socket.native_handle();
90 udp::endpoint remote_endpoint;
91 hboost::system::error_code
error;
103 state.
setError(
"Request timed out...");
108 size_t num_read = socket.receive_from(
110 remote_endpoint, 0, error);
115 if (error && error != hboost::asio::error::message_size)
123 size_t src_size = num_read;
124 size_t dst_size = uncompressed_buf.
size();
125 size_t decompress_result;
127 uncompressed_buf.
data(), dst_size, buf.
data(), src_size);
129 if (decompress_result == 0)
140 state.
setError(
"Could not decompress packet");
167 "leftUpLeg",
"leftLeg",
"leftFoot",
"leftToe",
"leftToeEnd",
168 "rightUpLeg",
"rightLeg",
"rightFoot",
"rightToe",
"rightToeEnd",
170 "leftShoulder",
"leftUpperArm",
"leftLowerArm",
"leftHand",
171 "leftIndexProximal",
"leftIndexMedial",
"leftIndexDistal",
"leftIndexTip",
172 "leftLittleProximal",
"leftLittleMedial",
"leftLittleDistal",
"leftLittleTip",
173 "leftMiddleProximal",
"leftMiddleMedial",
"leftMiddleDistal",
"leftMiddleTip",
174 "leftRingProximal",
"leftRingMedial",
"leftRingDistal",
"leftRingTip",
175 "leftThumbProximal",
"leftThumbMedial",
"leftThumbDistal",
"leftThumbTip",
177 "rightShoulder",
"rightUpperArm",
"rightLowerArm",
"rightHand",
178 "rightIndexProximal",
"rightIndexMedial",
"rightIndexDistal",
"rightIndexTip",
179 "rightLittleProximal",
"rightLittleMedial",
"rightLittleDistal",
"rightLittleTip",
180 "rightMiddleProximal",
"rightMiddleMedial",
"rightMiddleDistal",
"rightMiddleTip",
181 "rightRingProximal",
"rightRingMedial",
"rightRingDistal",
"rightRingTip",
182 "rightThumbProximal",
"rightThumbMedial",
"rightThumbDistal",
"rightThumbTip",
206 UT_Matrix4F(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0.9449999928474426, 0.02500000037252903, 1),
207 UT_Matrix4F(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0.08799999952316284, 0.9449999928474426, 0.02500000037252903, 1),
208 UT_Matrix4F(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0.08799999952316284, 0.4740000069141388, 0.02500000037252903, 1),
209 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0.08900000154972076, 0.002000000094994903, 0.02500000037252903, 1),
210 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0.08900000154972076, -0.06599999964237213, 0.1679999977350235, 1),
211 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0.08900000154972076, -0.07999999821186066, 0.2489999979734421, 1),
212 UT_Matrix4F(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -0.08900000154972076, 0.9449999928474426, 0.02500000037252903, 1),
213 UT_Matrix4F(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -0.08900000154972076, 0.4740000069141388, 0.02500000037252903, 1),
214 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -0.08900000154972076, 0.002000000094994903, 0.02500000037252903, 1),
215 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -0.08900000154972076, -0.06599999964237213, 0.1679999977350235, 1),
216 UT_Matrix4F(-1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -0.08900000154972076, -0.07999999821186066, 0.2489999979734421, 1),
217 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.036999940872192, -0.01799999922513962, 1),
218 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.202999949455261, -0.02099999971687794, 1),
219 UT_Matrix4F(0, 1, 0, 0, -0.9661348462104797, 0, 0.258037656545639, 0, 0.258037656545639, 0, 0.9661348462104797, 0, 0.07699999958276749, 1.478000044822693, 0, 1),
220 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.221000000834465, 1.478000044822693, -0.03799999877810478, 1),
221 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.5049999952316284, 1.478000044822693, -0.03799999877810478, 1),
222 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.8190000057220459, 1.478000044822693, -0.03799999877810478, 1),
223 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9070000052452087, 1.476999998092651, -0.009999999776482582, 1),
224 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9589999914169312, 1.476999998092651, -0.009999999776482582, 1),
225 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9900000095367432, 1.476999998092651, -0.009999999776482582, 1),
226 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1.021000027656555, 1.476999998092651, -0.009999999776482582, 1),
227 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.8960000276565552, 1.476999998092651, -0.07299999892711639, 1),
228 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9369999766349792, 1.476999998092651, -0.07299999892711639, 1),
229 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9639999866485596, 1.476999998092651, -0.07299999892711639, 1),
230 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9900000095367432, 1.476999998092651, -0.07299999892711639, 1),
231 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9079999923706055, 1.476999998092651, -0.03200000151991844, 1),
232 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9599999785423279, 1.476999998092651, -0.03200000151991844, 1),
233 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9950000047683716, 1.476999998092651, -0.03200000151991844, 1),
234 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1.027999997138977, 1.476999998092651, -0.03200000151991844, 1),
235 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9049999713897705, 1.476999998092651, -0.05400000140070915, 1),
236 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9539999961853027, 1.476999998092651, -0.05400000140070915, 1),
237 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0.9850000143051147, 1.476999998092651, -0.05400000140070915, 1),
238 UT_Matrix4F(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1.016000032424927, 1.476999998092651, -0.05400000140070915, 1),
239 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),
240 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),
241 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),
242 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),
243 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.564000010490417, -0.02099999971687794, 1),
244 UT_Matrix4F(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1.677999973297119, -0.02099999971687794, 1),
245 UT_Matrix4F(0, -1, 0, 0, 0.9661348462104797, 0, 0.258037656545639, 0, -0.258037656545639, 0, 0.9661348462104797, 0, -0.07599999755620956, 1.478000044822693, 0, 1),
246 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.2199999988079071, 1.478000044822693, -0.03799999877810478, 1),
247 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.5040000081062317, 1.478000044822693, -0.03799999877810478, 1),
248 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.8180000185966492, 1.478000044822693, -0.03799999877810478, 1),
249 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9070000052452087, 1.476999998092651, -0.009999999776482582, 1),
250 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9580000042915344, 1.476999998092651, -0.009999999776482582, 1),
251 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9890000224113464, 1.476999998092651, -0.009999999776482582, 1),
252 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1.019999980926514, 1.476999998092651, -0.009999999776482582, 1),
253 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.8949999809265137, 1.476999998092651, -0.07299999892711639, 1),
254 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9369999766349792, 1.476999998092651, -0.07299999892711639, 1),
255 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9629999995231628, 1.476999998092651, -0.07299999892711639, 1),
256 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9890000224113464, 1.476999998092651, -0.07299999892711639, 1),
257 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9079999923706055, 1.476999998092651, -0.03200000151991844, 1),
258 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9599999785423279, 1.476999998092651, -0.03200000151991844, 1),
259 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9940000176429749, 1.476999998092651, -0.03200000151991844, 1),
260 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1.026999950408936, 1.476999998092651, -0.03200000151991844, 1),
261 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.9039999842643738, 1.476999998092651, -0.05400000140070915, 1),
262 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.953000009059906, 1.476999998092651, -0.05400000140070915, 1),
263 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -0.984000027179718, 1.476999998092651, -0.05400000140070915, 1),
264 UT_Matrix4F(0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1.014999985694885, 1.476999998092651, -0.05400000140070915, 1),
265 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),
266 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),
267 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),
268 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),
280 bool &parse_incomplete)
295 version = version_val->
getF();
304 bool is_missing_joints =
false;
305 int num_actors = actors->
entries();
306 int num_joints = JOINTS.size();
307 for (
int i = 0; i < num_actors; i++)
315 const char *
name = actor_name->
getS();
322 bool has_left_glove =
true;
323 bool has_right_glove =
true;
324 bool has_body =
true;
325 bool has_face =
true;
327 if (version >= 3.0
f && meta)
331 const UT_JSONValue *has_right_glove_value = meta->
get(
"hasRightGlove");
335 bool has_gloves = (has_gloves_value && has_gloves_value->
getB());
336 has_left_glove = has_gloves && has_left_glove_value
337 && has_left_glove_value->
getB();
338 has_right_glove = has_gloves && has_right_glove_value
339 && has_right_glove_value->
getB();
340 has_body = has_body_value && has_body_value->
getB();
341 has_face = has_face_value && has_face_value->
getB();
345 Actor *skeleton = mySkeletons.findActor(name);
348 skeleton = mySkeletons.addActor(name);
349 skeleton->myPoints.setSize(num_joints);
351 skeleton->myIsDirty =
true;
353 for (
int j = 0;
j < num_joints;
j++)
355 ActorPoint &joint = skeleton->myPoints[
j];
364 joint_pos = joint_data->
getObject(
"position");
365 joint_rot = joint_data->
getObject(
"rotation");
366 if (joint_pos && joint_rot)
368 pos_x = joint_pos->
get(
"x");
369 pos_y = joint_pos->
get(
"y");
370 pos_z = joint_pos->
get(
"z");
372 rot_x = joint_rot->
get(
"x");
373 rot_y = joint_rot->
get(
"y");
374 rot_z = joint_rot->
get(
"z");
375 rot_w = joint_rot->
get(
"w");
379 if (!joint_data || !joint_pos || !joint_rot
380 || !pos_x || !pos_y || !pos_z
381 || !rot_x || !rot_y || !rot_z || !rot_w)
383 joint.myDidReceive =
false;
391 bool is_right_hand = joint_name.
fcontain(
"right");
392 is_missing_joints = (is_right_hand && has_right_glove)
393 || (!is_right_hand && has_left_glove);
397 is_missing_joints =
true;
408 rot.getRotationMatrix(rot_mat);
410 joint.myWorldXform = rot_mat;
411 joint.myWorldXform.setTranslates(pos);
413 joint.myDidReceive =
true;
418 if (face && has_face)
420 skeleton->myBlendShapes.
clear();
421 for (
const auto& item : *face)
428 skeleton->myBlendShapes[item.first] = val->
getF()/100.f;
434 if (is_missing_joints)
439 int num_props = props->
entries();
440 for (
int i = 0; i < num_props; i++)
447 const char *
name = prop_name->
getS();
451 if (!joint_pos || !joint_rot)
462 if (!pos_x || !pos_y || !pos_z
463 || !rot_x || !rot_y || !rot_z || !rot_w)
469 Actor *device_prop = myProps.findActor(name);
472 device_prop = myProps.addActor(name);
473 device_prop->myPoints.setSize(1);
481 rot.getRotationMatrix(rot_mat);
483 ActorPoint &point = device_prop->myPoints[0];
484 point.myWorldXform = rot_mat;
485 point.myWorldXform.setTranslates(pos);
487 point.myDidReceive =
true;
500 MocapStreamRokokoHDK::computeSkeletonTransforms()
502 int num_skeletons = mySkeletons.size();
503 int num_joints = JOINTS.size();
504 for (
int i = 0; i < num_skeletons; i++)
506 Actor &skeleton = mySkeletons(i);
507 if (!skeleton.myIsDirty)
510 skeleton.myIsDirty =
false;
511 if (skeleton.myPoints.size() != JOINTS.size())
514 bool received_all_points =
true;
517 for (
int j = 0;
j < num_joints;
j++)
522 ActorPoint &joint = skeleton.myPoints[
j];
523 if (!joint.myDidReceive)
525 received_all_points =
false;
531 joint.myLocalXform = joint.myWorldXform;
535 ActorPoint &parent = skeleton.myPoints[
PARENTS[
j]];
536 if (!parent.myDidReceive)
539 UT_Matrix4F parent_xform_inv = parent.myWorldXform;
540 parent_xform_inv.
invert();
542 joint.myLocalXform = joint.myWorldXform * parent_xform_inv;
545 if (received_all_points)
549 for (
int j = 0;
j < num_joints;
j++)
551 ActorPoint &joint = skeleton.myPoints[
j];
554 joint.myWorldXform = joint.myLocalXform;
558 ActorPoint &parent = skeleton.myPoints[
PARENTS[
j]];
559 joint.myWorldXform = joint.myLocalXform * parent.myWorldXform;
577 computeSkeletonTransforms();
580 mySkeletons.resetOccurances();
581 myProps.resetOccurances();
587 MocapStreamRokokoHDK::Actor *first_blendshapes_actor =
nullptr;
593 const auto& actor_name = actor_name_h.get(ptoff);
596 MocapStreamRokokoHDK::Actor *actor = mySkeletons.findActor(actor_name);
599 actor = myProps.findActor(actor_name);
600 else if (!first_blendshapes_actor && actor->myBlendShapes.size() > 0)
601 first_blendshapes_actor = actor;
608 int i = actor->myOccurances;
609 actor->myOccurances++;
610 if (i >= actor->myPoints.entries())
614 MocapStreamRokokoHDK::ActorPoint &point = actor->myPoints(i);
617 transform_h.set(ptoff, transform);
620 point.myWorldXform.getTranslates(pos);
624 transform_h.bumpDataId();
631 if (!first_blendshapes_actor)
633 for (
const auto &blendshape : prev_blendshapes)
639 prev_blendshapes.clear();
645 for (
const auto &blendshape : prev_blendshapes)
647 if (first_blendshapes_actor->myBlendShapes.contains(blendshape))
654 prev_blendshapes.clear();
658 for (
auto& item : first_blendshapes_actor->myBlendShapes)
669 prev_blendshapes.append(item.first);
679 if (mySkeletons.removeActor(name))
682 myProps.removeActor(name);
697 MocapStreamRokokoHDK::Actor *actor = myProps.findActor(name);
701 joint_name_h.set(ptoff, name);
702 actor_name_h.set(ptoff, name);
706 actor = mySkeletons.findActor(name);
713 int num_joints = JOINTS.size();
714 if (actor->myPoints.size() == num_joints)
716 for (
int i = 0; i < num_joints; i++)
721 auto& xform = rest_xforms[i];
722 MocapStreamRokokoHDK::ActorPoint &joint
723 = actor->myPoints[i];
724 MocapStreamRokokoHDK::ActorPoint &parent
730 xform.getTranslates(pt);
737 rest_xforms[
PARENTS[i]].getTranslates(new_origin);
738 if (joint.myDidReceive && parent.myDidReceive)
741 joint.myWorldXform.getTranslates(joint_pos);
742 parent.myWorldXform.getTranslates(parent_pos);
743 bone_length = (joint_pos - parent_pos).
length();
747 bone_length = (pt - old_origin).
length();
752 pt = new_origin + offset*bone_length/offset.
length();
753 xform.setTranslates(pt);
759 for (
int i = 0; i < num_joints; i++)
761 MocapStreamRokokoHDK::ActorPoint &joint
762 = actor->myPoints[i];
764 joint_name_h.set(ptoff+i, JOINTS[i]);
765 actor_name_h.set(ptoff+i, name);
766 rest_transform_h.set(ptoff+i,
UT_Matrix4F(rest_xforms[i]));
769 rest_xforms[i].getTranslates(pt);
781 parent_xform_inv.
invert();
782 joint.myLocalXform = rest_xforms[i] * parent_xform_inv;
787 joint.myLocalXform = rest_xforms[i];
803 void basicUdpReceiver(ServerState& state,
const ServerOptions& options,
806 using hboost::asio::ip::udp;
807 using hboost::asio::ip::address;
813 hboost::asio::io_service io_service;
814 udp::socket socket(io_service, udp::endpoint(udp::v4(), options.myPort));
817 int native_socket = socket.native_handle();
823 state.setPortOpened(
true);
827 while (!state.killed())
829 udp::endpoint remote_endpoint;
830 hboost::system::error_code
error;
842 state.setError(
"Request timed out...");
847 size_t num_read = socket.receive_from(
849 remote_endpoint, 0, error);
854 if (error && error != hboost::asio::error::message_size)
860 state.setConnected(
true);
878 void basicTcpClient(ServerState& state,
const ServerOptions& options,
883 options.myHostIP, options.myPort,
true);
888 state.setPortOpened(
true);
893 if (client->isValid())
897 while (!state.killed())
900 int cond = client->connect(500);
905 if (!state.connected())
908 state.setError(
"Could not connect");
913 while (state.connected() && !state.killed())
916 int status = client->read(
buf.data(),
buf.size(), &num_read, 200);
925 state.setError(
"Error receiving data");
927 state.setConnected(
false);
930 options.myHostIP, options.myPort,
true);
932 #if UT_ASSERT_LEVEL > 1
935 state.setError(
"No data received within 500ms");
943 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)