metaverse_messages 0.3.0

packet definitions for the open metaverse
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
use glam::Mat4;
use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumString};
use uuid::Uuid;

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
/// Definitions for the avatar's skeleton  
pub struct Skeleton {
    /// The joints that make up the skeleton
    pub joints: IndexMap<JointName, Joint>,
    /// The root bone
    /// this can contain many joints, if the object has a partial skeleton.
    pub root: Vec<JointName>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
/// Defines the joint that makes up the skeleton
pub struct Joint {
    /// The name of the joint
    pub name: JointName,
    /// The transforms applied to the joint
    pub transforms: Vec<Transform>,
    /// The transforms applied to the joint based on its parent and child relationship.
    pub local_transforms: Vec<Transform>,
    /// The position in the skeleton's vec of the joint's children
    pub children: Vec<JointName>,
    /// The position in the skeleton's vec of the joint's parent
    pub parent: Option<JointName>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
/// This stores the transform that each joint has
/// This is not just a vector of Mat4s to solve a very specific issue.
/// The default skeleton is generated based on the joint transforms of all of the objects in the
/// outfit. If I have a full body override that changes the scale and transform of some of the
/// joints, clothing should be applied based on that global sekeleton's transforms. However you can
/// also apply clothing that overrides the full body's jont transforms, creating a situation where
/// you have transforms from your body like you would expect, combined with transforms coming from
/// your shirt that you would not expect. This can cause nondeterministic behavior if you apply
/// clothes that don't share the same base skeleton. This will be used to allow users to select
/// which item they want to use for their skeleton deforms.
pub struct Transform {
    /// Name of the object that the transform is coming from
    pub name: String,
    /// ID of the object the transform is coming from
    pub id: Uuid,
    /// the transform associated with the object
    pub transform: Mat4,
    /// the number of outfit objects that contain this exact transform. The transform with the
    /// highest number of votes will be applied.
    pub rank: usize,
}

#[allow(missing_docs)]
#[derive(
    EnumString,
    Display,
    Debug,
    Hash,
    PartialEq,
    Eq,
    Clone,
    Default,
    Copy,
    Serialize,
    Deserialize,
    Ord,
    PartialOrd,
)]
/// This is used to convert all of the joint strings into a usable enum. This is to allow for
/// easier usage, potentially renaming joints on export, and avoid checking string equality
pub enum JointName {
    // Root
    #[strum(serialize = "BUTT")]
    Butt,
    #[strum(serialize = "PELVIS")]
    PelvisLegacy,
    #[default]
    #[strum(serialize = "mPelvis")]
    Pelvis,

    // Spine
    #[strum(serialize = "mSpine1")]
    Spine1,
    #[strum(serialize = "mSpine2")]
    Spine2,
    #[strum(serialize = "mSpine3")]
    Spine3,
    #[strum(serialize = "mSpine4")]
    Spine4,
    #[strum(serialize = "LOWER_BACK")]
    LowerBack,
    #[strum(serialize = "BELLY")]
    Belly,
    #[strum(serialize = "UPPER_BACK")]
    UpperBack,
    #[strum(serialize = "CHEST")]
    ChestLegacy,
    #[strum(serialize = "mChest")]
    Chest,
    #[strum(serialize = "mTorso")]
    Torso,
    #[strum(serialize = "mGroin")]
    Groin,

    #[strum(serialize = "LEFT_HANDLE")]
    HandleLeft,
    #[strum(serialize = "RIGHT_HANDLE")]
    HandleRight,
    // Neck & Head
    #[strum(serialize = "NECK")]
    NeckLegacy,
    #[strum(serialize = "HEAD")]
    HeadLegacy,
    #[strum(serialize = "mNeck")]
    Neck,
    #[strum(serialize = "mHead")]
    Head,
    #[strum(serialize = "mSkull")]
    Skull,

    // Face
    #[strum(serialize = "mFaceRoot")]
    FaceRoot,
    #[strum(serialize = "mFaceForeheadCenter")]
    FaceForeheadCenter,
    #[strum(serialize = "mFaceForeheadLeft")]
    FaceForeheadLeft,
    #[strum(serialize = "mFaceForeheadRight")]
    FaceForeheadRight,
    #[strum(serialize = "mFaceEyebrowOuterLeft")]
    FaceEyebrowOuterLeft,
    #[strum(serialize = "mFaceEyebrowCenterLeft")]
    FaceEyebrowCenterLeft,
    #[strum(serialize = "mFaceEyebrowInnerLeft")]
    FaceEyebrowInnerLeft,
    #[strum(serialize = "mFaceEyebrowOuterRight")]
    FaceEyebrowOuterRight,
    #[strum(serialize = "mFaceEyebrowCenterRight")]
    FaceEyebrowCenterRight,
    #[strum(serialize = "mFaceEyebrowInnerRight")]
    FaceEyebrowInnerRight,
    #[strum(serialize = "mFaceEyecornerInnerLeft")]
    FaceEyecornerInnerLeft,
    #[strum(serialize = "mFaceEyecornerInnerRight")]
    FaceEyecornerInnerRight,
    #[strum(serialize = "mFaceEyeLidUpperLeft")]
    FaceEyeLidUpperLeft,
    #[strum(serialize = "mFaceEyeLidLowerLeft")]
    FaceEyeLidLowerLeft,
    #[strum(serialize = "mFaceEyeLidUpperRight")]
    FaceEyeLidUpperRight,
    #[strum(serialize = "mFaceEyeLidLowerRight")]
    FaceEyeLidLowerRight,
    #[strum(serialize = "mFaceCheekUpperLeft")]
    FaceCheekUpperLeft,
    #[strum(serialize = "mFaceCheekLowerLeft")]
    FaceCheekLowerLeft,
    #[strum(serialize = "mFaceCheekUpperRight")]
    FaceCheekUpperRight,
    #[strum(serialize = "mFaceCheekLowerRight")]
    FaceCheekLowerRight,
    #[strum(serialize = "mFaceNoseBridge")]
    FaceNoseBridge,
    #[strum(serialize = "mFaceNoseCenter")]
    FaceNoseCenter,
    #[strum(serialize = "mFaceNoseBase")]
    FaceNoseBase,
    #[strum(serialize = "mFaceNoseLeft")]
    FaceNoseLeft,
    #[strum(serialize = "mFaceNoseRight")]
    FaceNoseRight,
    #[strum(serialize = "mFaceLipUpperCenter")]
    FaceLipUpperCenter,
    #[strum(serialize = "mFaceLipUpperLeft")]
    FaceLipUpperLeft,
    #[strum(serialize = "mFaceLipCornerLeft")]
    FaceLipCornerLeft,
    #[strum(serialize = "mFaceLipUpperRight")]
    FaceLipUpperRight,
    #[strum(serialize = "mFaceLipCornerRight")]
    FaceLipCornerRight,
    #[strum(serialize = "mFaceLipLowerCenter")]
    FaceLipLowerCenter,
    #[strum(serialize = "mFaceLipLowerLeft")]
    FaceLipLowerLeft,
    #[strum(serialize = "mFaceLipLowerRight")]
    FaceLipLowerRight,
    #[strum(serialize = "mFaceTongueBase")]
    FaceTongueBase,
    #[strum(serialize = "mFaceTongueTip")]
    FaceTongueTip,
    #[strum(serialize = "mFaceTeethUpper")]
    FaceTeethUpper,
    #[strum(serialize = "mFaceTeethLower")]
    FaceTeethLower,
    #[strum(serialize = "mFaceJaw")]
    FaceJaw,
    #[strum(serialize = "mFaceJawShaper")]
    FaceJawShaper,
    #[strum(serialize = "mFaceChin")]
    FaceChin,
    #[strum(serialize = "mFaceEar1Left")]
    FaceEar1Left,
    #[strum(serialize = "mFaceEar2Left")]
    FaceEar2Left,
    #[strum(serialize = "mFaceEar1Right")]
    FaceEar1Right,
    #[strum(serialize = "mFaceEar2Right")]
    FaceEar2Right,
    #[strum(serialize = "mFaceEyeAltLeft")]
    FaceEyeAltLeft,
    #[strum(serialize = "mFaceEyeAltRight")]
    FaceEyeAltRight,

    // Eyes
    #[strum(serialize = "mEyeLeft")]
    EyeLeft,
    #[strum(serialize = "mEyeRight")]
    EyeRight,

    // Shoulders
    #[strum(serialize = "L_CLAVICLE")]
    ClavicleLeft,
    #[strum(serialize = "R_CLAVICLE")]
    ClavicleRight,
    #[strum(serialize = "SHOULDER_LEFT")]
    ShoulderLeftLegacy,
    #[strum(serialize = "SHOULDER_RIGHT")]
    ShoulderRightLegacy,
    #[strum(serialize = "mShoulderLeft")]
    ShoulderLeft,
    #[strum(serialize = "mShoulderRight")]
    ShoulderRight,
    #[strum(serialize = "mCollarLeft")]
    CollarLeft,
    #[strum(serialize = "mCollarRight")]
    CollarRight,

    // Arms
    #[strum(serialize = "LEFT_PEC")]
    PecLeft,
    #[strum(serialize = "RIGHT_PEC")]
    PecRight,
    #[strum(serialize = "L_UPPER_ARM")]
    UpperArmLeft,
    #[strum(serialize = "L_LOWER_ARM")]
    LowerArmLeft,
    #[strum(serialize = "R_UPPER_ARM")]
    UpperArmRight,
    #[strum(serialize = "R_LOWER_ARM")]
    LowerArmRight,
    #[strum(serialize = "mArmLeft")]
    ArmLeft,
    #[strum(serialize = "mArmRight")]
    ArmRight,
    #[strum(serialize = "mElbowLeft")]
    ElbowLeft,
    #[strum(serialize = "mElbowRight")]
    ElbowRight,
    #[strum(serialize = "mForearmLeft")]
    ForearmLeft,
    #[strum(serialize = "mForearmRight")]
    ForearmRight,
    #[strum(serialize = "mWristLeft")]
    WristLeft,
    #[strum(serialize = "mWristRight")]
    WristRight,

    // Wings
    #[strum(serialize = "mWingsRoot")]
    WingsRoot,
    #[strum(serialize = "mWing1Left")]
    Wing1Left,
    #[strum(serialize = "mWing2Left")]
    Wing2Left,
    #[strum(serialize = "mWing3Left")]
    Wing3Left,
    #[strum(serialize = "mWing4Left")]
    Wing4Left,
    #[strum(serialize = "mWing4FanLeft")]
    Wing4FanLeft,
    #[strum(serialize = "mWing1Right")]
    Wing1Right,
    #[strum(serialize = "mWing2Right")]
    Wing2Right,
    #[strum(serialize = "mWing3Right")]
    Wing3Right,
    #[strum(serialize = "mWing4Right")]
    Wing4Right,
    #[strum(serialize = "mWing4FanRight")]
    Wing4FanRight,

    // Hands and fingers
    #[strum(serialize = "L_HAND")]
    HandLeftLegacy,
    #[strum(serialize = "R_HAND")]
    HandRightLegacy,
    #[strum(serialize = "mHandLeft")]
    HandLeft,
    #[strum(serialize = "mHandRight")]
    HandRight,

    #[strum(serialize = "mHandIndex1Left")]
    HandIndex1Left,
    #[strum(serialize = "mHandIndex2Left")]
    HandIndex2Left,
    #[strum(serialize = "mHandIndex3Left")]
    HandIndex3Left,

    #[strum(serialize = "mHandMiddle1Left")]
    HandMiddle1Left,
    #[strum(serialize = "mHandMiddle2Left")]
    HandMiddle2Left,
    #[strum(serialize = "mHandMiddle3Left")]
    HandMiddle3Left,

    #[strum(serialize = "mHandRing1Left")]
    HandRing1Left,
    #[strum(serialize = "mHandRing2Left")]
    HandRing2Left,
    #[strum(serialize = "mHandRing3Left")]
    HandRing3Left,

    #[strum(serialize = "mHandPinky1Left")]
    HandPinky1Left,
    #[strum(serialize = "mHandPinky2Left")]
    HandPinky2Left,
    #[strum(serialize = "mHandPinky3Left")]
    HandPinky3Left,

    #[strum(serialize = "mHandIndex1Right")]
    HandIndex1Right,
    #[strum(serialize = "mHandIndex2Right")]
    HandIndex2Right,
    #[strum(serialize = "mHandIndex3Right")]
    HandIndex3Right,

    #[strum(serialize = "mHandMiddle1Right")]
    HandMiddle1Right,
    #[strum(serialize = "mHandMiddle2Right")]
    HandMiddle2Right,
    #[strum(serialize = "mHandMiddle3Right")]
    HandMiddle3Right,

    #[strum(serialize = "mHandRing1Right")]
    HandRing1Right,
    #[strum(serialize = "mHandRing2Right")]
    HandRing2Right,
    #[strum(serialize = "mHandRing3Right")]
    HandRing3Right,

    #[strum(serialize = "mHandPinky1Right")]
    HandPinky1Right,
    #[strum(serialize = "mHandPinky2Right")]
    HandPinky2Right,
    #[strum(serialize = "mHandPinky3Right")]
    HandPinky3Right,

    #[strum(serialize = "mHandThumb1Left")]
    HandThumb1Left,
    #[strum(serialize = "mHandThumb2Left")]
    HandThumb2Left,
    #[strum(serialize = "mHandThumb3Left")]
    HandThumb3Left,
    #[strum(serialize = "mHandThumb1Right")]
    HandThumb1Right,
    #[strum(serialize = "mHandThumb2Right")]
    HandThumb2Right,
    #[strum(serialize = "mHandThumb3Right")]
    HandThumb3Right,

    // Tail
    #[strum(serialize = "mTail1")]
    Tail1,
    #[strum(serialize = "mTail2")]
    Tail2,
    #[strum(serialize = "mTail3")]
    Tail3,
    #[strum(serialize = "mTail4")]
    Tail4,
    #[strum(serialize = "mTail5")]
    Tail5,
    #[strum(serialize = "mTail6")]
    Tail6,

    // Hind Limbs
    #[strum(serialize = "mHindLimbsRoot")]
    HindLimbsRoot,
    #[strum(serialize = "mHindLimb1Left")]
    HindLimb1Left,
    #[strum(serialize = "mHindLimb2Left")]
    HindLimb2Left,
    #[strum(serialize = "mHindLimb3Left")]
    HindLimb3Left,
    #[strum(serialize = "mHindLimb4Left")]
    HindLimb4Left,
    #[strum(serialize = "mHindLimb1Right")]
    HindLimb1Right,
    #[strum(serialize = "mHindLimb2Right")]
    HindLimb2Right,
    #[strum(serialize = "mHindLimb3Right")]
    HindLimb3Right,
    #[strum(serialize = "mHindLimb4Right")]
    HindLimb4Right,

    // Legs
    #[strum(serialize = "L_UPPER_LEG")]
    UpperLegLeft,
    #[strum(serialize = "L_LOWER_LEG")]
    LowerLegLeft,
    #[strum(serialize = "R_UPPER_LEG")]
    UpperLegRight,
    #[strum(serialize = "R_LOWER_LEG")]
    LowerLegRight,
    #[strum(serialize = "HIP_LEFT")]
    HipLeftLegacy,
    #[strum(serialize = "HIP_RIGHT")]
    HipRightLegacy,
    #[strum(serialize = "mHipLeft")]
    HipLeft,
    #[strum(serialize = "mHipRight")]
    HipRight,
    #[strum(serialize = "mThighLeft")]
    ThighLeft,
    #[strum(serialize = "mThighRight")]
    ThighRight,
    #[strum(serialize = "mKneeLeft")]
    KneeLeft,
    #[strum(serialize = "mKneeRight")]
    KneeRight,
    #[strum(serialize = "mShinLeft")]
    ShinLeft,
    #[strum(serialize = "mShinRight")]
    ShinRight,
    #[strum(serialize = "KNEE_LEFT")]
    UpperKneeLeft,
    #[strum(serialize = "KNEE_RIGHT")]
    UpperKneeRight,

    // Feet
    #[strum(serialize = "ANKLE_LEFT")]
    AnkleLeftLegacy,
    #[strum(serialize = "ANKLE_RIGHT")]
    AnkleRightLegacy,
    #[strum(serialize = "mAnkleLeft")]
    AnkleLeft,
    #[strum(serialize = "mAnkleRight")]
    AnkleRight,
    #[strum(serialize = "L_FOOT")]
    FootLeftLegacy,
    #[strum(serialize = "R_FOOT")]
    FootRightLegacy2,
    #[strum(serialize = "FOOT_LEFT")]
    FootLeftLegacy2,
    #[strum(serialize = "FOOT_RIGHT")]
    FootRightLegacy,
    #[strum(serialize = "mFootLeft")]
    FootLeft,
    #[strum(serialize = "mFootRight")]
    FootRight,
    #[strum(serialize = "mHeelLeft")]
    HeelLeft,
    #[strum(serialize = "mHeelRight")]
    HeelRight,
    #[strum(serialize = "mToeLeft")]
    ToeLeft,
    #[strum(serialize = "mToeRight")]
    ToeRight,
}