Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernthedev committed Aug 20, 2022
1 parent 797870c commit 700dc9e
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/Animation/AnimationHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ constexpr std::optional<T> operator*(std::optional<T> const& a, std::optional<T>
std::optional<NEVector::Vector3> AnimationHelper::GetDefinitePositionOffset(const AnimationObjectData& animationData, std::span<Track *> tracks, float time) {
PointDefinition *localDefinitePosition = animationData.definitePosition;

std::span<Track const*> tracksConst = reinterpret_cast<std::span<Track const *> const &>(tracks);

[[maybe_unused]] bool last;
std::optional<Vector3> pathDefinitePosition =
localDefinitePosition ? std::optional(localDefinitePosition->Interpolate(time, last)) : std::nullopt;
Expand All @@ -62,7 +64,7 @@ std::optional<NEVector::Vector3> AnimationHelper::GetDefinitePositionOffset(cons
Track *track = tracks.front();
pathDefinitePosition = getPathPropertyNullable<Vector3>(track, track->pathProperties.definitePosition.value, time);
} else {
pathDefinitePosition = MSumTrackPathProps(tracks, Vector3::zero(), definitePosition, time);
pathDefinitePosition = MSumTrackPathProps(tracksConst, Vector3::zero(), definitePosition, time);
}
}

Expand All @@ -84,10 +86,10 @@ std::optional<NEVector::Vector3> AnimationHelper::GetDefinitePositionOffset(cons

trackPosition = getPropertyNullable<Vector3>(track, track->properties.position);
} else {
trackPosition = MSumTrackProps(tracks, Vector3::zero(), position);
trackPosition = MSumTrackProps(tracksConst, Vector3::zero(), position);

if (!pathPosition)
pathPosition = MSumTrackPathProps(tracks, Vector3::zero(), position, time);
pathPosition = MSumTrackPathProps(tracksConst, Vector3::zero(), position, time);
}

positionOffset = pathPosition + trackPosition;
Expand All @@ -110,6 +112,8 @@ std::optional<NEVector::Vector3> AnimationHelper::GetDefinitePositionOffset(cons
ObjectOffset AnimationHelper::GetObjectOffset(const AnimationObjectData& animationData, std::span<Track *> tracks, float time) {
ObjectOffset offset;

std::span<Track const*> tracksConst = reinterpret_cast<std::span<Track const *> const &>(tracks);

[[maybe_unused]] bool last;

PointDefinition *position = animationData.position;
Expand Down Expand Up @@ -165,21 +169,21 @@ offset.offsetName = path##name op getPropertyNullable<type>(track, track->proper
if (!path##name) \
path##name = func;

multiPathProp(position, MSumTrackPathProps(tracks, Vector3::zero(), position, time))
multiPathProp(rotation, MMultTrackPathProps(tracks, Quaternion::identity(), rotation, time))
multiPathProp(scale, MMultTrackPathProps(tracks, Vector3::one(), scale, time))
multiPathProp(localRotation, MMultTrackPathProps(tracks, Quaternion::identity(), localRotation, time))
multiPathProp(dissolve, MMultTrackPathProps(tracks, 1.0f, dissolve, time))
multiPathProp(dissolveArrow, MMultTrackPathProps(tracks, 1.0f, dissolveArrow, time))
multiPathProp(cuttable, MMultTrackPathProps(tracks, 1.0f, cuttable, time))

offset.positionOffset = pathposition + MSumTrackProps(tracks, Vector3::zero(), position);
offset.rotationOffset = pathrotation * MMultTrackProps(tracks, Quaternion::identity(), rotation);
offset.scaleOffset = pathscale * MMultTrackProps(tracks, Vector3::one(), scale);
offset.localRotationOffset = pathlocalRotation * MMultTrackProps(tracks, Quaternion::identity(), localRotation);
offset.dissolve = pathdissolve * MMultTrackProps(tracks, 1.0f, dissolve);
offset.dissolveArrow = pathdissolveArrow * MMultTrackProps(tracks, 1.0f, dissolveArrow);
offset.cuttable = pathcuttable * MMultTrackProps(tracks, 1.0f, cuttable);
multiPathProp(position, MSumTrackPathProps(tracksConst, Vector3::zero(), position, time))
multiPathProp(rotation, MMultTrackPathProps(tracksConst, Quaternion::identity(), rotation, time))
multiPathProp(scale, MMultTrackPathProps(tracksConst, Vector3::one(), scale, time))
multiPathProp(localRotation, MMultTrackPathProps(tracksConst, Quaternion::identity(), localRotation, time))
multiPathProp(dissolve, MMultTrackPathProps(tracksConst, 1.0f, dissolve, time))
multiPathProp(dissolveArrow, MMultTrackPathProps(tracksConst, 1.0f, dissolveArrow, time))
multiPathProp(cuttable, MMultTrackPathProps(tracksConst, 1.0f, cuttable, time))

offset.positionOffset = pathposition + MSumTrackProps(tracksConst, Vector3::zero(), position);
offset.rotationOffset = pathrotation * MMultTrackProps(tracksConst, Quaternion::identity(), rotation);
offset.scaleOffset = pathscale * MMultTrackProps(tracksConst, Vector3::one(), scale);
offset.localRotationOffset = pathlocalRotation * MMultTrackProps(tracksConst, Quaternion::identity(), localRotation);
offset.dissolve = pathdissolve * MMultTrackProps(tracksConst, 1.0f, dissolve);
offset.dissolveArrow = pathdissolveArrow * MMultTrackProps(tracksConst, 1.0f, dissolveArrow);
offset.cuttable = pathcuttable * MMultTrackProps(tracksConst, 1.0f, cuttable);
}
} else {
offset.positionOffset = pathposition;
Expand Down

0 comments on commit 700dc9e

Please sign in to comment.