mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:13:11 +02:00
Changed version constants into a enum class, to fix macosx warnings.
This commit is contained in:
parent
568af7a072
commit
da319b9af6
1 changed files with 9 additions and 7 deletions
|
@ -2058,9 +2058,11 @@ static const QString JSON_AVATAR_ENTITIES = QStringLiteral("attachedEntities");
|
||||||
static const QString JSON_AVATAR_SCALE = QStringLiteral("scale");
|
static const QString JSON_AVATAR_SCALE = QStringLiteral("scale");
|
||||||
static const QString JSON_AVATAR_VERSION = QStringLiteral("version");
|
static const QString JSON_AVATAR_VERSION = QStringLiteral("version");
|
||||||
|
|
||||||
static const int JSON_AVATAR_JOINT_ROTATIONS_IN_RELATIVE_FRAME_VERSION = 0;
|
enum class JsonAvatarFrameVersion : int {
|
||||||
static const int JSON_AVATAR_JOINT_ROTATIONS_IN_ABSOLUTE_FRAME_VERSION = 1;
|
JointRotationsInRelativeFrame = 0,
|
||||||
static const int JSON_AVATAR_JOINT_DEFAULT_POSE_BITS_VERSION = 2;
|
JointRotationsInAbsoluteFrame,
|
||||||
|
JointDefaultPoseBits
|
||||||
|
};
|
||||||
|
|
||||||
QJsonValue toJsonValue(const JointData& joint) {
|
QJsonValue toJsonValue(const JointData& joint) {
|
||||||
QJsonArray result;
|
QJsonArray result;
|
||||||
|
@ -2077,7 +2079,7 @@ JointData jointDataFromJsonValue(int version, const QJsonValue& json) {
|
||||||
QJsonArray array = json.toArray();
|
QJsonArray array = json.toArray();
|
||||||
result.rotation = quatFromJsonValue(array[0]);
|
result.rotation = quatFromJsonValue(array[0]);
|
||||||
result.translation = vec3FromJsonValue(array[1]);
|
result.translation = vec3FromJsonValue(array[1]);
|
||||||
if (version >= JSON_AVATAR_JOINT_DEFAULT_POSE_BITS_VERSION) {
|
if (version >= (int)JsonAvatarFrameVersion::JointDefaultPoseBits) {
|
||||||
result.rotationIsDefaultPose = array[2].toBool();
|
result.rotationIsDefaultPose = array[2].toBool();
|
||||||
result.translationIsDefaultPose = array[3].toBool();
|
result.translationIsDefaultPose = array[3].toBool();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2091,7 +2093,7 @@ JointData jointDataFromJsonValue(int version, const QJsonValue& json) {
|
||||||
QJsonObject AvatarData::toJson() const {
|
QJsonObject AvatarData::toJson() const {
|
||||||
QJsonObject root;
|
QJsonObject root;
|
||||||
|
|
||||||
root[JSON_AVATAR_VERSION] = JSON_AVATAR_JOINT_DEFAULT_POSE_BITS_VERSION;
|
root[JSON_AVATAR_VERSION] = (int)JsonAvatarFrameVersion::JointDefaultPoseBits;
|
||||||
|
|
||||||
if (!getSkeletonModelURL().isEmpty()) {
|
if (!getSkeletonModelURL().isEmpty()) {
|
||||||
root[JSON_AVATAR_BODY_MODEL] = getSkeletonModelURL().toString();
|
root[JSON_AVATAR_BODY_MODEL] = getSkeletonModelURL().toString();
|
||||||
|
@ -2166,7 +2168,7 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
||||||
version = json[JSON_AVATAR_VERSION].toInt();
|
version = json[JSON_AVATAR_VERSION].toInt();
|
||||||
} else {
|
} else {
|
||||||
// initial data did not have a version field.
|
// initial data did not have a version field.
|
||||||
version = JSON_AVATAR_JOINT_ROTATIONS_IN_RELATIVE_FRAME_VERSION;
|
version = (int)JsonAvatarFrameVersion::JointRotationsInRelativeFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json.contains(JSON_AVATAR_BODY_MODEL)) {
|
if (json.contains(JSON_AVATAR_BODY_MODEL)) {
|
||||||
|
@ -2243,7 +2245,7 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (json.contains(JSON_AVATAR_JOINT_ARRAY)) {
|
if (json.contains(JSON_AVATAR_JOINT_ARRAY)) {
|
||||||
if (version == JSON_AVATAR_JOINT_ROTATIONS_IN_RELATIVE_FRAME_VERSION) {
|
if (version == (int)JsonAvatarFrameVersion::JointRotationsInRelativeFrame) {
|
||||||
// because we don't have the full joint hierarchy skeleton of the model,
|
// because we don't have the full joint hierarchy skeleton of the model,
|
||||||
// we can't properly convert from relative rotations into absolute rotations.
|
// we can't properly convert from relative rotations into absolute rotations.
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
|
|
Loading…
Reference in a new issue