MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / partTransformation

Method partTransformation

source/game/StarNetworkedAnimator.cpp:344–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344Mat3F NetworkedAnimator::partTransformation(String const& partName) const {
345 auto const& part = m_animatedParts.activePart(partName);
346 Mat3F transformation = Mat3F::identity();
347
348 if (auto offset = part.properties.value("offset").opt().apply(jsonToVec2F))
349 transformation = Mat3F::translation(*offset) * transformation;
350
351 auto transformationGroups = jsonToStringList(part.properties.value("transformationGroups", JsonArray()));
352 transformation = groupTransformation(transformationGroups) * transformation;
353
354 if (auto rotationGroupName = part.properties.value("rotationGroup").optString()) {
355 auto const& rotationGroup = m_rotationGroups.get(*rotationGroupName);
356 Vec2F rotationCenter = part.properties.value("rotationCenter").opt().apply(jsonToVec2F).value(rotationGroup.rotationCenter);
357 transformation = Mat3F::rotation(rotationGroup.currentAngle, rotationCenter) * transformation;
358 }
359
360 if (auto anchorPart = part.properties.ptr("anchorPart"))
361 transformation = partTransformation(anchorPart->toString()) * transformation;
362
363 return transformation;
364}
365
366Mat3F NetworkedAnimator::finalPartTransformation(String const& partName) const {
367 return globalTransformation() * partTransformation(partName);

Callers 3

damageSourcesMethod · 0.80

Calls 9

identityClass · 0.85
jsonToStringListFunction · 0.85
optStringMethod · 0.80
applyMethod · 0.45
optMethod · 0.45
valueMethod · 0.45
getMethod · 0.45
ptrMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected