MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Serialize

Method Serialize

Source/Engine/Physics/Joints/D6Joint.cpp:203–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201#endif
202
203void D6Joint::Serialize(SerializeStream& stream, const void* otherObj)
204{
205 // Base
206 Joint::Serialize(stream, otherObj);
207
208 SERIALIZE_GET_OTHER_OBJ(D6Joint);
209
210 char motionLabel[8] = "Motion?";
211 for (int32 i = 0; i < 6; i++)
212 {
213 if (!other || _motion[i] != other->_motion[i])
214 {
215 motionLabel[6] = '0' + i;
216 stream.Key(motionLabel, ARRAY_COUNT(motionLabel) - 1);
217 stream.Enum(_motion[i]);
218 }
219 }
220 static_assert(ARRAY_COUNT(_motion) == 6, "Invalid motion array size");
221
222 //
223
224 char driveLabel_Stiffness[17] = "Drive?.Stiffness";
225 char driveLabel_Damping[17] = "Drive?.Damping";
226 char driveLabel_ForceLimit[18] = "Drive?.ForceLimit";
227 char driveLabel_Acceleration[20] = "Drive?.Acceleration";
228 for (int32 i = 0; i < 6; i++)
229 {
230 if (!other || _drive[i].Stiffness != other->_drive[i].Stiffness)
231 {
232 driveLabel_Stiffness[5] = '0' + i;
233 stream.Key(driveLabel_Stiffness, ARRAY_COUNT(driveLabel_Stiffness) - 1);
234 stream.Float(_drive[i].Stiffness);
235 }
236
237 if (!other || _drive[i].Damping != other->_drive[i].Damping)
238 {
239 driveLabel_Damping[5] = '0' + i;
240 stream.Key(driveLabel_Damping, ARRAY_COUNT(driveLabel_Damping) - 1);
241 stream.Float(_drive[i].Damping);
242 }
243
244 if (!other || _drive[i].ForceLimit != other->_drive[i].ForceLimit)
245 {
246 driveLabel_ForceLimit[5] = '0' + i;
247 stream.Key(driveLabel_ForceLimit, ARRAY_COUNT(driveLabel_ForceLimit) - 1);
248 stream.Float(_drive[i].ForceLimit);
249 }
250
251 if (!other || _drive[i].Acceleration != other->_drive[i].Acceleration)
252 {
253 driveLabel_Acceleration[5] = '0' + i;
254 stream.Key(driveLabel_Acceleration, ARRAY_COUNT(driveLabel_Acceleration) - 1);
255 stream.Bool(_drive[i].Acceleration);
256 }
257 }
258 static_assert(ARRAY_COUNT(_drive) == 6, "Invalid drive array size");
259
260 //

Callers

nothing calls this directly

Calls 5

SerializeFunction · 0.50
KeyMethod · 0.45
EnumMethod · 0.45
FloatMethod · 0.45
BoolMethod · 0.45

Tested by

no test coverage detected