diff --git a/interface/src/scripting/SelectionScriptingInterface.cpp b/interface/src/scripting/SelectionScriptingInterface.cpp
index 44e67191ee..748583b639 100644
--- a/interface/src/scripting/SelectionScriptingInterface.cpp
+++ b/interface/src/scripting/SelectionScriptingInterface.cpp
@@ -482,10 +482,10 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
/**jsdoc
* @typedef {object} Selection.HighlightStyle
- * @property {Vec3Color} outlineUnoccludedColor - Color of the specified highlight region.
- * @property {Vec3Color} outlineOccludedColor - ""
- * @property {Vec3Color} fillUnoccludedColor- ""
- * @property {Vec3Color} fillOccludedColor- ""
+ * @property {Color} outlineUnoccludedColor - Color of the specified highlight region.
+ * @property {Color} outlineOccludedColor - ""
+ * @property {Color} fillUnoccludedColor- ""
+ * @property {Color} fillOccludedColor- ""
* @property {number} outlineUnoccludedAlpha - Alpha value ranging from 0.0
(not visible) to 1.0
* (fully opaque) for the specified highlight region.
* @property {number} outlineOccludedAlpha - ""
diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp
index 3bac00d118..121d3d1e0d 100644
--- a/interface/src/ui/overlays/Circle3DOverlay.cpp
+++ b/interface/src/ui/overlays/Circle3DOverlay.cpp
@@ -406,20 +406,20 @@ void Circle3DOverlay::setProperties(const QVariantMap& properties) {
* @property {number} endAt=360 - The counter-clockwise angle from the overlay's x-axis that drawing ends at, in degrees.
* @property {number} outerRadius=1 - The outer radius of the overlay, in meters. Synonym: radius
.
* @property {number} innerRadius=0 - The inner radius of the overlay, in meters.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay. Setting this value also sets the values of
+ * @property {Color} color=255,255,255 - The color of the overlay. Setting this value also sets the values of
* innerStartColor
, innerEndColor
, outerStartColor
, and outerEndColor
.
- * @property {Vec3Color} startColor - Sets the values of innerStartColor
and outerStartColor
.
+ * @property {Color} startColor - Sets the values of innerStartColor
and outerStartColor
.
* Write-only.
- * @property {Vec3Color} endColor - Sets the values of innerEndColor
and outerEndColor
.
+ * @property {Color} endColor - Sets the values of innerEndColor
and outerEndColor
.
* Write-only.
- * @property {Vec3Color} innerColor - Sets the values of innerStartColor
and innerEndColor
.
+ * @property {Color} innerColor - Sets the values of innerStartColor
and innerEndColor
.
* Write-only.
- * @property {Vec3Color} outerColor - Sets the values of outerStartColor
and outerEndColor
.
+ * @property {Color} outerColor - Sets the values of outerStartColor
and outerEndColor
.
* Write-only.
- * @property {Vec3Color} innerStartcolor - The color at the inner start point of the overlay.
- * @property {Vec3Color} innerEndColor - The color at the inner end point of the overlay.
- * @property {Vec3Color} outerStartColor - The color at the outer start point of the overlay.
- * @property {Vec3Color} outerEndColor - The color at the outer end point of the overlay.
+ * @property {Color} innerStartcolor - The color at the inner start point of the overlay.
+ * @property {Color} innerEndColor - The color at the inner end point of the overlay.
+ * @property {Color} outerStartColor - The color at the outer start point of the overlay.
+ * @property {Color} outerEndColor - The color at the outer end point of the overlay.
* @property {number} alpha=0.5 - The opacity of the overlay, 0.0
- 1.0
. Setting this value also sets
* the values of innerStartAlpha
, innerEndAlpha
, outerStartAlpha
, and
* outerEndAlpha
. Synonym: Alpha
; write-only.
@@ -443,8 +443,8 @@ void Circle3DOverlay::setProperties(const QVariantMap& properties) {
* outwards from the inner radius; a negative value draws tick marks inwards from the outer radius.
* @property {number} minorTickMarksLength=0 - The length of the minor tick marks, in meters. A positive value draws tick marks
* outwards from the inner radius; a negative value draws tick marks inwards from the outer radius.
- * @property {Vec3Color} majorTickMarksColor=0,0,0 - The color of the major tick marks.
- * @property {Vec3Color} minorTickMarksColor=0,0,0 - The color of the minor tick marks.
+ * @property {Color} majorTickMarksColor=0,0,0 - The color of the major tick marks.
+ * @property {Color} minorTickMarksColor=0,0,0 - The color of the minor tick marks.
*/
QVariant Circle3DOverlay::getProperty(const QString& property) {
if (property == "startAt") {
diff --git a/interface/src/ui/overlays/Cube3DOverlay.cpp b/interface/src/ui/overlays/Cube3DOverlay.cpp
index 64e719df68..581db672a3 100644
--- a/interface/src/ui/overlays/Cube3DOverlay.cpp
+++ b/interface/src/ui/overlays/Cube3DOverlay.cpp
@@ -129,7 +129,7 @@ void Cube3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.CubeProperties
*
* @property {string} type=cube - Has the value "cube"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/Grid3DOverlay.cpp b/interface/src/ui/overlays/Grid3DOverlay.cpp
index daf0831f27..87ab0fb2e8 100644
--- a/interface/src/ui/overlays/Grid3DOverlay.cpp
+++ b/interface/src/ui/overlays/Grid3DOverlay.cpp
@@ -115,7 +115,7 @@ void Grid3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.GridProperties
*
* @property {string} type=grid - Has the value "grid"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/Image3DOverlay.cpp b/interface/src/ui/overlays/Image3DOverlay.cpp
index 5480a611b3..18da15f019 100644
--- a/interface/src/ui/overlays/Image3DOverlay.cpp
+++ b/interface/src/ui/overlays/Image3DOverlay.cpp
@@ -187,7 +187,7 @@ void Image3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.Image3DProperties
*
* @property {string} type=image3d - Has the value "image3d"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/ImageOverlay.cpp b/interface/src/ui/overlays/ImageOverlay.cpp
index 3c04de8568..19f32511f6 100644
--- a/interface/src/ui/overlays/ImageOverlay.cpp
+++ b/interface/src/ui/overlays/ImageOverlay.cpp
@@ -35,7 +35,7 @@ QUrl const ImageOverlay::URL(QString("hifi/overlays/ImageOverlay.qml"));
* Write-only.
* @property {Vec2} subImage=0,0 - Integer coordinates of the top left pixel to start using image content from.
* Write-only.
- * @property {Vec3Color} color=0,0,0 - The color to apply over the top of the image to colorize it. Write-only.
+ * @property {Color} color=0,0,0 - The color to apply over the top of the image to colorize it. Write-only.
* @property {number} alpha=0.0 - The opacity of the color applied over the top of the image, 0.0
-
* 1.0
. Write-only.
* @property {boolean} visible=true - If true
, the overlay is rendered, otherwise it is not rendered.
diff --git a/interface/src/ui/overlays/Line3DOverlay.cpp b/interface/src/ui/overlays/Line3DOverlay.cpp
index 4019c8d084..e6546686b0 100644
--- a/interface/src/ui/overlays/Line3DOverlay.cpp
+++ b/interface/src/ui/overlays/Line3DOverlay.cpp
@@ -259,7 +259,7 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
* @typedef {object} Overlays.Line3DProperties
*
* @property {string} type=line3d - Has the value "line3d"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp
index 6ebda067a2..eee8222051 100644
--- a/interface/src/ui/overlays/ModelOverlay.cpp
+++ b/interface/src/ui/overlays/ModelOverlay.cpp
@@ -353,7 +353,7 @@ vectorType ModelOverlay::mapJoints(mapFunction function) const {
* @typedef {object} Overlays.ModelProperties
*
* @property {string} type=sphere - Has the value "model"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/Overlay.cpp b/interface/src/ui/overlays/Overlay.cpp
index b2f08b57bb..ac720ea90b 100644
--- a/interface/src/ui/overlays/Overlay.cpp
+++ b/interface/src/ui/overlays/Overlay.cpp
@@ -95,7 +95,7 @@ void Overlay::setProperties(const QVariantMap& properties) {
// JSDoc for copying to @typedefs of overlay types that inherit Overlay.
/**jsdoc
* @property {string} type=TODO - Has the value "TODO"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp
index 5c6598dd88..e05c44c264 100644
--- a/interface/src/ui/overlays/Overlays.cpp
+++ b/interface/src/ui/overlays/Overlays.cpp
@@ -629,9 +629,9 @@ QScriptValue RayToOverlayIntersectionResultToScriptValue(QScriptEngine* engine,
obj.setProperty("distance", value.distance);
obj.setProperty("face", boxFaceToString(value.face));
- QScriptValue intersection = vec3FloatToScriptValue(engine, value.intersection);
+ QScriptValue intersection = vec3ToScriptValue(engine, value.intersection);
obj.setProperty("intersection", intersection);
- QScriptValue surfaceNormal = vec3FloatToScriptValue(engine, value.surfaceNormal);
+ QScriptValue surfaceNormal = vec3ToScriptValue(engine, value.surfaceNormal);
obj.setProperty("surfaceNormal", surfaceNormal);
obj.setProperty("extraInfo", engine->toScriptValue(value.extraInfo));
return obj;
@@ -646,11 +646,11 @@ void RayToOverlayIntersectionResultFromScriptValue(const QScriptValue& object, R
QScriptValue intersection = object.property("intersection");
if (intersection.isValid()) {
- vec3FloatFromScriptValue(intersection, value.intersection);
+ vec3FromScriptValue(intersection, value.intersection);
}
QScriptValue surfaceNormal = object.property("surfaceNormal");
if (surfaceNormal.isValid()) {
- vec3FloatFromScriptValue(surfaceNormal, value.surfaceNormal);
+ vec3FromScriptValue(surfaceNormal, value.surfaceNormal);
}
value.extraInfo = object.property("extraInfo").toVariant().toMap();
}
diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.cpp b/interface/src/ui/overlays/Rectangle3DOverlay.cpp
index 8f62b53453..73606c0467 100644
--- a/interface/src/ui/overlays/Rectangle3DOverlay.cpp
+++ b/interface/src/ui/overlays/Rectangle3DOverlay.cpp
@@ -111,7 +111,7 @@ const render::ShapeKey Rectangle3DOverlay::getShapeKey() {
* @typedef {object} Overlays.Rectangle3DProperties
*
* @property {string} type=rectangle3d - Has the value "rectangle3d"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/RectangleOverlay.cpp b/interface/src/ui/overlays/RectangleOverlay.cpp
index 356457a50f..af37a4ac02 100644
--- a/interface/src/ui/overlays/RectangleOverlay.cpp
+++ b/interface/src/ui/overlays/RectangleOverlay.cpp
@@ -22,12 +22,12 @@ QUrl const RectangleOverlay::URL(QString("hifi/overlays/RectangleOverlay.qml"));
* @property {number} width - Integer width of the rectangle = bounds.width
. Write-only.
* @property {number} height - Integer height of the rectangle = bounds.height
. Write-only.
*
- * @property {Vec3Color} color=0,0,0 - The color of the overlay. Write-only.
+ * @property {Color} color=0,0,0 - The color of the overlay. Write-only.
* @property {number} alpha=1.0 - The opacity of the overlay, 0.0
- 1.0
. Write-only.
* @property {number} borderWidth=1 - Integer width of the border, in pixels. The border is drawn within the rectangle's bounds.
* It is not drawn unless either borderColor
or borderAlpha
are specified. Write-only.
* @property {number} radius=0 - Integer corner radius, in pixels. Write-only.
- * @property {Vec3Color} borderColor=0,0,0 - The color of the border. Write-only.
+ * @property {Color} borderColor=0,0,0 - The color of the border. Write-only.
* @property {number} borderAlpha=1.0 - The opacity of the border, 0.0
- 1.0
.
* Write-only.
* @property {boolean} visible=true - If true
, the overlay is rendered, otherwise it is not rendered.
diff --git a/interface/src/ui/overlays/Shape3DOverlay.cpp b/interface/src/ui/overlays/Shape3DOverlay.cpp
index fd33cd6c5d..b424424369 100644
--- a/interface/src/ui/overlays/Shape3DOverlay.cpp
+++ b/interface/src/ui/overlays/Shape3DOverlay.cpp
@@ -131,7 +131,7 @@ void Shape3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.ShapeProperties
*
* @property {string} type=shape - Has the value "shape"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/Sphere3DOverlay.cpp b/interface/src/ui/overlays/Sphere3DOverlay.cpp
index 6cc9aad9e7..97294ae871 100644
--- a/interface/src/ui/overlays/Sphere3DOverlay.cpp
+++ b/interface/src/ui/overlays/Sphere3DOverlay.cpp
@@ -32,7 +32,7 @@ Sphere3DOverlay::Sphere3DOverlay(const Sphere3DOverlay* Sphere3DOverlay) :
* @typedef {object} Overlays.SphereProperties
*
* @property {string} type=sphere - Has the value "sphere"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/interface/src/ui/overlays/Text3DOverlay.cpp b/interface/src/ui/overlays/Text3DOverlay.cpp
index ec3f9eba34..1418c94ae8 100644
--- a/interface/src/ui/overlays/Text3DOverlay.cpp
+++ b/interface/src/ui/overlays/Text3DOverlay.cpp
@@ -198,7 +198,7 @@ void Text3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.Text3DProperties
*
* @property {string} type=text3d - Has the value "text3d"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
@@ -241,7 +241,7 @@ void Text3DOverlay::setProperties(const QVariantMap& properties) {
*
* @property {string} text="" - The text to display. Text does not automatically wrap; use \n
for a line break.
* @property {number} textAlpha=1 - The text alpha value.
- * @property {Vec3Color} backgroundColor=0,0,0 - The background color.
+ * @property {Color} backgroundColor=0,0,0 - The background color.
* @property {number} backgroundAlpha=0.7 - The background alpha value.
* @property {number} lineHeight=1 - The height of a line of text in meters.
* @property {number} leftMargin=0.1 - The left margin, in meters.
diff --git a/interface/src/ui/overlays/TextOverlay.cpp b/interface/src/ui/overlays/TextOverlay.cpp
index 5e7f648320..e7641ab2c2 100644
--- a/interface/src/ui/overlays/TextOverlay.cpp
+++ b/interface/src/ui/overlays/TextOverlay.cpp
@@ -48,9 +48,9 @@ QUrl const TextOverlay::URL(QString("hifi/overlays/TextOverlay.qml"));
* is clipped to the bounds
. Write-only.
* @property {number} font.size=18 - The size of the text, in pixels. Write-only.
* @property {number} lineHeight=18 - The height of a line of text, in pixels. Write-only.
- * @property {Vec3Color} color=255,255,255 - The color of the text. Synonym: textColor
. Write-only.
+ * @property {Color} color=255,255,255 - The color of the text. Synonym: textColor
. Write-only.
* @property {number} alpha=1.0 - The opacity of the overlay, 0.0
- 1.0
. Write-only.
- * @property {Vec3Color} backgroundColor=0,0,0 - The color of the background rectangle. Write-only.
+ * @property {Color} backgroundColor=0,0,0 - The color of the background rectangle. Write-only.
* @property {number} backgroundAlpha=0.7 - The opacity of the background rectangle. Write-only.
* @property {boolean} visible=true - If true
, the overlay is rendered, otherwise it is not rendered.
* Write-only.
diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp
index 3df26735f0..c16b4c016d 100644
--- a/interface/src/ui/overlays/Web3DOverlay.cpp
+++ b/interface/src/ui/overlays/Web3DOverlay.cpp
@@ -517,7 +517,7 @@ void Web3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.Web3DProperties
*
* @property {string} type=web3d - Has the value "web3d"
. Read-only.
- * @property {Vec3Color} color=255,255,255 - The color of the overlay.
+ * @property {Color} color=255,255,255 - The color of the overlay.
* @property {number} alpha=0.7 - The opacity of the overlay, 0.0
- 1.0
.
* @property {number} pulseMax=0 - The maximum value of the pulse multiplier.
* @property {number} pulseMin=0 - The minimum value of the pulse multiplier.
diff --git a/libraries/animation/src/AnimVariant.cpp b/libraries/animation/src/AnimVariant.cpp
index 4c0d15f06b..a9294aa00f 100644
--- a/libraries/animation/src/AnimVariant.cpp
+++ b/libraries/animation/src/AnimVariant.cpp
@@ -40,7 +40,7 @@ QScriptValue AnimVariantMap::animVariantMapToScriptValue(QScriptEngine* engine,
target.setProperty(name, value.getString());
break;
case AnimVariant::Type::Vec3:
- target.setProperty(name, vec3FloatToScriptValue(engine, value.getVec3()));
+ target.setProperty(name, vec3ToScriptValue(engine, value.getVec3()));
break;
case AnimVariant::Type::Quat:
target.setProperty(name, quatToScriptValue(engine, value.getQuat()));
diff --git a/libraries/audio/src/AudioInjectorOptions.cpp b/libraries/audio/src/AudioInjectorOptions.cpp
index 296b7b7f8f..295da1506e 100644
--- a/libraries/audio/src/AudioInjectorOptions.cpp
+++ b/libraries/audio/src/AudioInjectorOptions.cpp
@@ -34,7 +34,7 @@ AudioInjectorOptions::AudioInjectorOptions() :
QScriptValue injectorOptionsToScriptValue(QScriptEngine* engine, const AudioInjectorOptions& injectorOptions) {
QScriptValue obj = engine->newObject();
- obj.setProperty("position", vec3FloatToScriptValue(engine, injectorOptions.position));
+ obj.setProperty("position", vec3ToScriptValue(engine, injectorOptions.position));
obj.setProperty("volume", injectorOptions.volume);
obj.setProperty("loop", injectorOptions.loop);
obj.setProperty("orientation", quatToScriptValue(engine, injectorOptions.orientation));
@@ -73,7 +73,7 @@ void injectorOptionsFromScriptValue(const QScriptValue& object, AudioInjectorOpt
it.next();
if (it.name() == "position") {
- vec3FloatFromScriptValue(object.property("position"), injectorOptions.position);
+ vec3FromScriptValue(object.property("position"), injectorOptions.position);
} else if (it.name() == "orientation") {
quatFromScriptValue(object.property("orientation"), injectorOptions.orientation);
} else if (it.name() == "volume") {
diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp
index 90a735fe17..c326284fc6 100644
--- a/libraries/avatars/src/AvatarData.cpp
+++ b/libraries/avatars/src/AvatarData.cpp
@@ -2825,10 +2825,10 @@ QScriptValue RayToAvatarIntersectionResultToScriptValue(QScriptEngine* engine, c
obj.setProperty("avatarID", avatarIDValue);
obj.setProperty("distance", value.distance);
obj.setProperty("face", boxFaceToString(value.face));
- QScriptValue intersection = vec3FloatToScriptValue(engine, value.intersection);
+ QScriptValue intersection = vec3ToScriptValue(engine, value.intersection);
obj.setProperty("intersection", intersection);
- QScriptValue surfaceNormal = vec3FloatToScriptValue(engine, value.surfaceNormal);
+ QScriptValue surfaceNormal = vec3ToScriptValue(engine, value.surfaceNormal);
obj.setProperty("surfaceNormal", surfaceNormal);
obj.setProperty("extraInfo", engine->toScriptValue(value.extraInfo));
return obj;
@@ -2843,11 +2843,11 @@ void RayToAvatarIntersectionResultFromScriptValue(const QScriptValue& object, Ra
QScriptValue intersection = object.property("intersection");
if (intersection.isValid()) {
- vec3FloatFromScriptValue(intersection, value.intersection);
+ vec3FromScriptValue(intersection, value.intersection);
}
QScriptValue surfaceNormal = object.property("surfaceNormal");
if (surfaceNormal.isValid()) {
- vec3FloatFromScriptValue(surfaceNormal, value.surfaceNormal);
+ vec3FromScriptValue(surfaceNormal, value.surfaceNormal);
}
value.extraInfo = object.property("extraInfo").toVariant().toMap();
}
diff --git a/libraries/controllers/src/controllers/Pose.cpp b/libraries/controllers/src/controllers/Pose.cpp
index abe76ea38e..6df4b4af81 100644
--- a/libraries/controllers/src/controllers/Pose.cpp
+++ b/libraries/controllers/src/controllers/Pose.cpp
@@ -41,10 +41,10 @@ namespace controller {
*/
QScriptValue Pose::toScriptValue(QScriptEngine* engine, const Pose& pose) {
QScriptValue obj = engine->newObject();
- obj.setProperty("translation", vec3FloatToScriptValue(engine, pose.translation));
+ obj.setProperty("translation", vec3ToScriptValue(engine, pose.translation));
obj.setProperty("rotation", quatToScriptValue(engine, pose.rotation));
- obj.setProperty("velocity", vec3FloatToScriptValue(engine, pose.velocity));
- obj.setProperty("angularVelocity", vec3FloatToScriptValue(engine, pose.angularVelocity));
+ obj.setProperty("velocity", vec3ToScriptValue(engine, pose.velocity));
+ obj.setProperty("angularVelocity", vec3ToScriptValue(engine, pose.angularVelocity));
obj.setProperty("valid", pose.valid);
return obj;
}
@@ -58,10 +58,10 @@ namespace controller {
rotation.isValid() &&
velocity.isValid() &&
angularVelocity.isValid()) {
- vec3FloatFromScriptValue(translation, pose.translation);
+ vec3FromScriptValue(translation, pose.translation);
quatFromScriptValue(rotation, pose.rotation);
- vec3FloatFromScriptValue(velocity, pose.velocity);
- vec3FloatFromScriptValue(angularVelocity, pose.angularVelocity);
+ vec3FromScriptValue(velocity, pose.velocity);
+ vec3FromScriptValue(angularVelocity, pose.angularVelocity);
pose.valid = true;
} else {
pose.valid = false;
diff --git a/libraries/entities/src/EntityEditFilters.cpp b/libraries/entities/src/EntityEditFilters.cpp
index 3396e91452..6f7e012bc4 100644
--- a/libraries/entities/src/EntityEditFilters.cpp
+++ b/libraries/entities/src/EntityEditFilters.cpp
@@ -104,10 +104,10 @@ bool EntityEditFilters::filter(glm::vec3& position, EntityItemProperties& proper
AABox aaBox = zoneEntity->getAABox(success);
if (success) {
QScriptValue boundingBox = filterData.engine->newObject();
- QScriptValue bottomRightNear = vec3FloatToScriptValue(filterData.engine, aaBox.getCorner());
- QScriptValue topFarLeft = vec3FloatToScriptValue(filterData.engine, aaBox.calcTopFarLeft());
- QScriptValue center = vec3FloatToScriptValue(filterData.engine, aaBox.calcCenter());
- QScriptValue boundingBoxDimensions = vec3FloatToScriptValue(filterData.engine, aaBox.getDimensions());
+ QScriptValue bottomRightNear = vec3ToScriptValue(filterData.engine, aaBox.getCorner());
+ QScriptValue topFarLeft = vec3ToScriptValue(filterData.engine, aaBox.calcTopFarLeft());
+ QScriptValue center = vec3ToScriptValue(filterData.engine, aaBox.calcCenter());
+ QScriptValue boundingBoxDimensions = vec3ToScriptValue(filterData.engine, aaBox.getDimensions());
boundingBox.setProperty("brn", bottomRightNear);
boundingBox.setProperty("tfl", topFarLeft);
boundingBox.setProperty("center", center);
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp
index 66b2963add..feaf4a9a81 100644
--- a/libraries/entities/src/EntityItemProperties.cpp
+++ b/libraries/entities/src/EntityItemProperties.cpp
@@ -675,7 +675,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @typedef {object} Entities.EntityProperties-Light
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. Entity surface outside these dimensions are not lit
* by the light.
- * @property {Vec3Color} color=255,255,255 - The color of the light emitted.
+ * @property {Color} color=255,255,255 - The color of the light emitted.
* @property {number} intensity=1 - The brightness of the light.
* @property {number} falloffRadius=0.1 - The distance from the light's center at which intensity is reduced by 25%.
* @property {boolean} isSpotlight=false - If true
then the light is directional, emitting along the entity's
@@ -708,7 +708,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* position. A maximum of 70 points can be specified. The property's value is set only if all the linePoints
* lie within the entity's dimensions
.
* @property {number} lineWidth=2 - Currently not used.
- * @property {Vec3Color} color=255,255,255 - The color of the line.
+ * @property {Color} color=255,255,255 - The color of the line.
* @example Draw lines in a "V".
* var entity = Entities.addEntity({
* type: "Line",
@@ -789,7 +789,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. When adding an entity, if no dimensions
* value is specified then the model is automatically sized to its
* {@link Entities.EntityProperties|naturalDimensions}
.
- * @property {Vec3Color} color=255,255,255 - Currently not used.
+ * @property {Color} color=255,255,255 - Currently not used.
* @property {string} modelURL="" - The URL of the FBX of OBJ model. Baked FBX models' URLs end in ".baked.fbx".
* Note: If the name ends with "default-image-model.fbx"
then the entity is considered to be an "Image"
* entity, in which case the textures
property should be set per the example.
@@ -915,12 +915,12 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @property {number} radiusSpread=0 - The spread in radius that each particle is given. If particleRadius == 0.5
* and radiusSpread == 0.25
, each particle will have a radius in the range 0.25
–
* 0.75
.
- * @property {Vec3Color} color=255,255,255 - The color of each particle at the middle of its life.
- * @property {Vec3Color} colorStart={} - The color of each particle at the start of its life. If any of the component values are
+ * @property {Color} color=255,255,255 - The color of each particle at the middle of its life.
+ * @property {ColorFloat} colorStart={} - The color of each particle at the start of its life. If any of the component values are
* undefined, the color
value is used.
- * @property {Vec3Color} colorFinish={} - The color of each particle at the end of its life. If any of the component values are
+ * @property {ColorFloat} colorFinish={} - The color of each particle at the end of its life. If any of the component values are
* undefined, the color
value is used.
- * @property {Vec3Color} colorSpread=0,0,0 - The spread in color that each particle is given. If
+ * @property {Color} colorSpread=0,0,0 - The spread in color that each particle is given. If
* color == {red: 100, green: 100, blue: 100}
and colorSpread ==
* {red: 10, green: 25, blue: 50}
, each particle will have a color in the range
* {red: 90, green: 75, blue: 50}
– {red: 110, green: 125, blue: 150}
.
@@ -977,7 +977,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* order for the entity to render.
* @property {number} lineWidth=2 - Currently not used.
* @property {Vec3[]} strokeColors=[]] - Currently not used.
- * @property {Vec3Color} color=255,255,255 - The base color of the line, which is multiplied with the color of the texture for
+ * @property {Color} color=255,255,255 - The base color of the line, which is multiplied with the color of the texture for
* rendering.
* @property {string} textures="" - The URL of a JPG or PNG texture to use for the lines. If you want transparency, use PNG
* format.
@@ -1066,7 +1066,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @typedef {object} Entities.EntityProperties-Shape
* @property {Entities.Shape} shape="Sphere" - The shape of the entity.
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity.
- * @property {Vec3Color} color=255,255,255 - The color of the entity.
+ * @property {Color} color=255,255,255 - The color of the entity.
* @example Create a cylinder.
* var shape = Entities.addEntity({
* type: "Shape",
@@ -1094,8 +1094,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @property {string} text="" - The text to display on the face of the entity. Text wraps if necessary to fit. New lines can be
* created using \n
. Overflowing lines are not displayed.
* @property {number} lineHeight=0.1 - The height of each line of text (thus determining the font size).
- * @property {Vec3Color} textColor=255,255,255 - The color of the text.
- * @property {Vec3Color} backgroundColor=0,0,0 - The color of the background rectangle.
+ * @property {Color} textColor=255,255,255 - The color of the text.
+ * @property {Color} backgroundColor=0,0,0 - The color of the background rectangle.
* @property {boolean} faceCamera=false - If true
, the entity is oriented to face each user's camera (i.e., it
* differs for each user present).
* @example Create a text entity.
@@ -1320,10 +1320,10 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RADIUS_SPREAD, radiusSpread);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RADIUS_START, radiusStart);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RADIUS_FINISH, radiusFinish);
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR, color);
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR_SPREAD, colorSpread);
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR_START, colorStart);
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR_FINISH, colorFinish);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR_SPREAD, colorSpread, u8vec3Color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR_START, colorStart, vec3Color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR_FINISH, colorFinish, vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA_SPREAD, alphaSpread);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA_START, alphaStart);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ALPHA_FINISH, alphaFinish);
@@ -1344,7 +1344,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS, jointTranslations);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RELAY_PARENT_JOINTS, relayParentJoints);
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR, color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
}
if (_type == EntityTypes::Model || _type == EntityTypes::Zone || _type == EntityTypes::ParticleEffect) {
@@ -1361,7 +1361,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
if (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) {
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape);
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR, color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
}
// FIXME - it seems like ParticleEffect should also support this
@@ -1376,7 +1376,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
// Lights only
if (_type == EntityTypes::Light) {
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR, color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_SPOTLIGHT, isSpotlight);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_INTENSITY, intensity);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FALLOFF_RADIUS, falloffRadius);
@@ -1388,8 +1388,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
if (_type == EntityTypes::Text) {
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXT, text);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_HEIGHT, lineHeight);
- COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_TEXT_COLOR, textColor, getTextColor());
- COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BACKGROUND_COLOR, backgroundColor, getBackgroundColor());
+ COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_TYPED(PROP_TEXT_COLOR, textColor, getTextColor(), u8vec3Color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_TYPED(PROP_BACKGROUND_COLOR, backgroundColor, getBackgroundColor(), u8vec3Color);
}
// Zones only
@@ -1440,11 +1440,11 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
// Lines & PolyLines
if (_type == EntityTypes::Line || _type == EntityTypes::PolyLine) {
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR, color);
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_COLOR, color, u8vec3Color);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_WIDTH, lineWidth);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_POINTS, linePoints);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NORMALS, normals); // Polyline only.
- COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_COLORS, strokeColors); // Polyline only.
+ COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_STROKE_COLORS, strokeColors, qVectorVec3Color); // Polyline only.
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_WIDTHS, strokeWidths); // Polyline only.
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); // Polyline only.
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch); // Polyline only.
@@ -1473,10 +1473,10 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
if (!skipDefaults && !strictSemantics) {
AABox aaBox = getAABox();
QScriptValue boundingBox = engine->newObject();
- QScriptValue bottomRightNear = vec3FloatToScriptValue(engine, aaBox.getCorner());
- QScriptValue topFarLeft = vec3FloatToScriptValue(engine, aaBox.calcTopFarLeft());
- QScriptValue center = vec3FloatToScriptValue(engine, aaBox.calcCenter());
- QScriptValue boundingBoxDimensions = vec3FloatToScriptValue(engine, aaBox.getDimensions());
+ QScriptValue bottomRightNear = vec3ToScriptValue(engine, aaBox.getCorner());
+ QScriptValue topFarLeft = vec3ToScriptValue(engine, aaBox.calcTopFarLeft());
+ QScriptValue center = vec3ToScriptValue(engine, aaBox.calcCenter());
+ QScriptValue boundingBoxDimensions = vec3ToScriptValue(engine, aaBox.getDimensions());
boundingBox.setProperty("brn", bottomRightNear);
boundingBox.setProperty("tfl", topFarLeft);
boundingBox.setProperty("center", center);
@@ -1572,10 +1572,10 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(angularDamping, float, setAngularDamping);
COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible);
COPY_PROPERTY_FROM_QSCRIPTVALUE(canCastShadow, bool, setCanCastShadow);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(color, u8vec3, setColor);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(colorSpread, u8vec3, setColorSpread);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(colorStart, vec3, setColorStart);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(colorFinish, vec3, setColorFinish);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(color, u8vec3Color, setColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(colorSpread, u8vec3Color, setColorSpread);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(colorStart, vec3Color, setColorStart);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(colorFinish, vec3Color, setColorFinish);
COPY_PROPERTY_FROM_QSCRIPTVALUE(alpha, float, setAlpha);
COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaSpread, float, setAlphaSpread);
COPY_PROPERTY_FROM_QSCRIPTVALUE(alphaStart, float, setAlphaStart);
@@ -1600,8 +1600,8 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(userData, QString, setUserData);
COPY_PROPERTY_FROM_QSCRIPTVALUE(text, QString, setText);
COPY_PROPERTY_FROM_QSCRIPTVALUE(lineHeight, float, setLineHeight);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, u8vec3, setTextColor);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundColor, u8vec3, setBackgroundColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, u8vec3Color, setTextColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundColor, u8vec3Color, setBackgroundColor);
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(shapeType, ShapeType);
COPY_PROPERTY_FROM_QSCRIPTVALUE(maxParticles, quint32, setMaxParticles);
COPY_PROPERTY_FROM_QSCRIPTVALUE(lifespan, float, setLifespan);
@@ -1962,10 +1962,10 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
ADD_PROPERTY_TO_MAP(PROP_SCRIPT_TIMESTAMP, ScriptTimestamp, scriptTimestamp, quint64);
ADD_PROPERTY_TO_MAP(PROP_SERVER_SCRIPTS, ServerScripts, serverScripts, QString);
ADD_PROPERTY_TO_MAP(PROP_COLLISION_SOUND_URL, CollisionSoundURL, collisionSoundURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_COLOR, Color, color, u8vec3);
- ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, ColorSpread, colorSpread, u8vec3);
- ADD_PROPERTY_TO_MAP(PROP_COLOR_START, ColorStart, colorStart, vec3);
- ADD_PROPERTY_TO_MAP(PROP_COLOR_FINISH, ColorFinish, colorFinish, vec3);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR, Color, color, u8vec3Color);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, ColorSpread, colorSpread, u8vec3Color);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR_START, ColorStart, colorStart, vec3Color);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR_FINISH, ColorFinish, colorFinish, vec3Color);
ADD_PROPERTY_TO_MAP(PROP_ALPHA, Alpha, alpha, float);
ADD_PROPERTY_TO_MAP(PROP_ALPHA_SPREAD, AlphaSpread, alphaSpread, float);
ADD_PROPERTY_TO_MAP(PROP_ALPHA_START, AlphaStart, alphaStart, float);
@@ -1993,8 +1993,8 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
ADD_PROPERTY_TO_MAP(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner);
ADD_PROPERTY_TO_MAP(PROP_TEXT, Text, text, QString);
ADD_PROPERTY_TO_MAP(PROP_LINE_HEIGHT, LineHeight, lineHeight, float);
- ADD_PROPERTY_TO_MAP(PROP_TEXT_COLOR, TextColor, textColor, u8vec3);
- ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, u8vec3);
+ ADD_PROPERTY_TO_MAP(PROP_TEXT_COLOR, TextColor, textColor, u8vec3Color);
+ ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, u8vec3Color);
ADD_PROPERTY_TO_MAP(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType);
ADD_PROPERTY_TO_MAP(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32);
ADD_PROPERTY_TO_MAP(PROP_LIFESPAN, Lifespan, lifespan, float);
@@ -2046,7 +2046,7 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
ADD_PROPERTY_TO_MAP(PROP_CERTIFICATE_ID, CertificateID, certificateID, QString);
ADD_PROPERTY_TO_MAP(PROP_STATIC_CERTIFICATE_VERSION, StaticCertificateVersion, staticCertificateVersion, quint32);
- ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLightColor, keyLightColor, u8vec3);
+ ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLightColor, keyLightColor, u8vec3Color);
ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, KeyLightIntensity, keyLightIntensity, float);
ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, KeyLightDirection, keyLightDirection, vec3);
ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, KeyLightCastShadows, keyLightCastShadows, bool);
@@ -2696,8 +2696,8 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
if (properties.getType() == EntityTypes::Text) {
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT, QString, setText);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_HEIGHT, float, setLineHeight);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_COLOR, u8vec3, setTextColor);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, u8vec3, setBackgroundColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_COLOR, u8vec3Color, setTextColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, u8vec3Color, setBackgroundColor);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FACE_CAMERA, bool, setFaceCamera);
}
@@ -2706,7 +2706,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXTURES, QString, setTextures);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor);
properties.getAnimation().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);
@@ -2719,7 +2719,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
if (properties.getType() == EntityTypes::Light) {
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_SPOTLIGHT, bool, setIsSpotlight);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INTENSITY, float, setIntensity);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FALLOFF_RADIUS, float, setFalloffRadius);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EXPONENT, float, setExponent);
@@ -2747,10 +2747,10 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RADIUS_SPREAD, float, setRadiusSpread);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RADIUS_START, float, setRadiusStart);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RADIUS_FINISH, float, setRadiusFinish);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3, setColor);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_SPREAD, u8vec3, setColorSpread);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_START, vec3, setColorStart);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_FINISH, vec3, setColorFinish);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_SPREAD, u8vec3Color, setColorSpread);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_START, vec3Color, setColorStart);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_FINISH, vec3Color, setColorFinish);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_SPREAD, float, setAlphaSpread);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_START, float, setAlphaStart);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_FINISH, float, setAlphaFinish);
@@ -2801,14 +2801,14 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
}
if (properties.getType() == EntityTypes::Line) {
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector, setLinePoints);
}
if (properties.getType() == EntityTypes::PolyLine) {
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector, setLinePoints);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_NORMALS, QByteArray, setPackedNormals);
@@ -2824,7 +2824,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
properties.getType() == EntityTypes::Box ||
properties.getType() == EntityTypes::Sphere) {
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE, QString, setShape);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, u8vec3Color, setColor);
}
// Materials
diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h
index abe0cf6e51..d503ee2e2d 100644
--- a/libraries/entities/src/EntityItemProperties.h
+++ b/libraries/entities/src/EntityItemProperties.h
@@ -57,6 +57,9 @@ const std::array COMPONENT_MODES = { {
ComponentPair { COMPONENT_MODE_ENABLED, { "enabled" } }
} };
+using vec3Color = glm::vec3;
+using u8vec3Color = glm::u8vec3;
+
/// A collection of properties of an entity item used in the scripting API. Translates between the actual properties of an
/// entity and a JavaScript style hash/QScriptValue storing a set of properties. Used in scripting to set/get the complete
/// set of entity item properties via JavaScript hashes/QScriptValues
@@ -135,8 +138,8 @@ public:
DEFINE_PROPERTY_REF(PROP_SCRIPT, Script, script, QString, ENTITY_ITEM_DEFAULT_SCRIPT);
DEFINE_PROPERTY(PROP_SCRIPT_TIMESTAMP, ScriptTimestamp, scriptTimestamp, quint64, ENTITY_ITEM_DEFAULT_SCRIPT_TIMESTAMP);
DEFINE_PROPERTY_REF(PROP_COLLISION_SOUND_URL, CollisionSoundURL, collisionSoundURL, QString, ENTITY_ITEM_DEFAULT_COLLISION_SOUND_URL);
- DEFINE_PROPERTY_REF(PROP_COLOR, Color, color, glm::u8vec3, particle::DEFAULT_COLOR);
- DEFINE_PROPERTY_REF(PROP_COLOR_SPREAD, ColorSpread, colorSpread, glm::u8vec3, particle::DEFAULT_COLOR_SPREAD);
+ DEFINE_PROPERTY_REF(PROP_COLOR, Color, color, u8vec3Color, particle::DEFAULT_COLOR);
+ DEFINE_PROPERTY_REF(PROP_COLOR_SPREAD, ColorSpread, colorSpread, u8vec3Color, particle::DEFAULT_COLOR_SPREAD);
DEFINE_PROPERTY_REF(PROP_COLOR_START, ColorStart, colorStart, glm::vec3, particle::DEFAULT_COLOR_UNINITIALIZED);
DEFINE_PROPERTY_REF(PROP_COLOR_FINISH, ColorFinish, colorFinish, glm::vec3, particle::DEFAULT_COLOR_UNINITIALIZED);
DEFINE_PROPERTY(PROP_ALPHA, Alpha, alpha, float, particle::DEFAULT_ALPHA);
@@ -162,8 +165,8 @@ public:
DEFINE_PROPERTY_REF(PROP_SIMULATION_OWNER, SimulationOwner, simulationOwner, SimulationOwner, SimulationOwner());
DEFINE_PROPERTY_REF(PROP_TEXT, Text, text, QString, TextEntityItem::DEFAULT_TEXT);
DEFINE_PROPERTY(PROP_LINE_HEIGHT, LineHeight, lineHeight, float, TextEntityItem::DEFAULT_LINE_HEIGHT);
- DEFINE_PROPERTY_REF(PROP_TEXT_COLOR, TextColor, textColor, glm::u8vec3, TextEntityItem::DEFAULT_TEXT_COLOR);
- DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, glm::u8vec3, TextEntityItem::DEFAULT_BACKGROUND_COLOR);
+ DEFINE_PROPERTY_REF(PROP_TEXT_COLOR, TextColor, textColor, u8vec3Color, TextEntityItem::DEFAULT_TEXT_COLOR);
+ DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, u8vec3Color, TextEntityItem::DEFAULT_BACKGROUND_COLOR);
DEFINE_PROPERTY_REF_ENUM(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType, SHAPE_TYPE_NONE);
DEFINE_PROPERTY(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32, particle::DEFAULT_MAX_PARTICLES);
DEFINE_PROPERTY(PROP_LIFESPAN, Lifespan, lifespan, float, particle::DEFAULT_LIFESPAN);
diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h
index 6becd133e6..30ed4ad4c2 100644
--- a/libraries/entities/src/EntityItemPropertiesMacros.h
+++ b/libraries/entities/src/EntityItemPropertiesMacros.h
@@ -101,9 +101,11 @@
changedProperties += P; \
}
-inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::vec2& v) { return vec2FloatToScriptValue(e, v); }
-inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::vec3& v) { return vec3FloatToScriptValue(e, v); }
-inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::u8vec3& v) { return vec3UCharToScriptValue(e, v); }
+inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::vec2& v) { return vec2ToScriptValue(e, v); }
+inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::vec3& v) { return vec3ToScriptValue(e, v); }
+inline QScriptValue vec3Color_convertScriptValue(QScriptEngine* e, const glm::vec3& v) { return vec3ColorToScriptValue(e, v); }
+inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::u8vec3& v) { return u8vec3ToScriptValue(e, v); }
+inline QScriptValue u8vec3Color_convertScriptValue(QScriptEngine* e, const glm::u8vec3& v) { return u8vec3ColorToScriptValue(e, v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, float v) { return QScriptValue(v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, int v) { return QScriptValue(v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, bool v) { return QScriptValue(v); }
@@ -114,7 +116,8 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, const QString& v) { ret
inline QScriptValue convertScriptValue(QScriptEngine* e, const glm::quat& v) { return quatToScriptValue(e, v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, const QScriptValue& v) { return v; }
-inline QScriptValue convertScriptValue(QScriptEngine* e, const QVector& v) {return qVectorVec3FloatToScriptValue(e, v); }
+inline QScriptValue convertScriptValue(QScriptEngine* e, const QVector& v) {return qVectorVec3ToScriptValue(e, v); }
+inline QScriptValue qVectorVec3Color_convertScriptValue(QScriptEngine* e, const QVector& v) {return qVectorVec3ColorToScriptValue(e, v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, const QVector& v) {return qVectorQuatToScriptValue(e, v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, const QVector& v) {return qVectorBoolToScriptValue(e, v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, const QVector& v) { return qVectorFloatToScriptValue(e, v); }
@@ -128,8 +131,6 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, const EntityItemID& v)
inline QScriptValue convertScriptValue(QScriptEngine* e, const AACube& v) { return aaCubeToScriptValue(e, v); }
-
-
#define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(X,G,g,P,p) \
if ((desiredProperties.isEmpty() || desiredProperties.getHasProperty(X)) && \
(!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
@@ -142,6 +143,18 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, const AACube& v) { retu
properties.setProperty(#g, groupProperties); \
}
+#define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(X,G,g,P,p,T) \
+ if ((desiredProperties.isEmpty() || desiredProperties.getHasProperty(X)) && \
+ (!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
+ QScriptValue groupProperties = properties.property(#g); \
+ if (!groupProperties.isValid()) { \
+ groupProperties = engine->newObject(); \
+ } \
+ QScriptValue V = T##_convertScriptValue(engine, get##P()); \
+ groupProperties.setProperty(#p, V); \
+ properties.setProperty(#g, groupProperties); \
+ }
+
#define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_GETTER(X,G,g,P,p,M) \
if ((desiredProperties.isEmpty() || desiredProperties.getHasProperty(X)) && \
(!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
@@ -161,6 +174,13 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, const AACube& v) { retu
properties.setProperty(#P, V); \
}
+#define COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(p,P,T) \
+ if ((_desiredProperties.isEmpty() || _desiredProperties.getHasProperty(p)) && \
+ (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
+ QScriptValue V = T##_convertScriptValue(engine, _##P); \
+ properties.setProperty(#P, V); \
+ }
+
#define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(P, G) \
properties.setProperty(#P, G);
@@ -171,6 +191,13 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, const AACube& v) { retu
properties.setProperty(#P, V); \
}
+#define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_TYPED(p, P, G, T) \
+ if ((_desiredProperties.isEmpty() || _desiredProperties.getHasProperty(p)) && \
+ (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
+ QScriptValue V = T##_convertScriptValue(engine, G); \
+ properties.setProperty(#P, V); \
+ }
+
// same as COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER but uses #X instead of #P in the setProperty() step
#define COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(p, P, X, G) \
if ((_desiredProperties.isEmpty() || _desiredProperties.getHasProperty(p)) && \
@@ -205,7 +232,6 @@ inline QUuid QUuid_convertFromScriptValue(const QScriptValue& v, bool& isValid)
inline EntityItemID EntityItemID_convertFromScriptValue(const QScriptValue& v, bool& isValid) { isValid = true; return v.toVariant().toUuid(); }
-
inline QDateTime QDateTime_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
auto result = QDateTime::fromString(v.toVariant().toString().trimmed(), Qt::ISODate);
@@ -213,8 +239,6 @@ inline QDateTime QDateTime_convertFromScriptValue(const QScriptValue& v, bool& i
return result;
}
-
-
inline QByteArray QByteArray_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
QString b64 = v.toVariant().toString().trimmed();
@@ -224,21 +248,28 @@ inline QByteArray QByteArray_convertFromScriptValue(const QScriptValue& v, bool&
inline glm::vec2 vec2_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
glm::vec2 vec2;
- vec2FloatFromScriptValue(v, vec2);
+ vec2FromScriptValue(v, vec2);
return vec2;
}
inline glm::vec3 vec3_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
glm::vec3 vec3;
- vec3FloatFromScriptValue(v, vec3);
+ vec3FromScriptValue(v, vec3);
return vec3;
}
-inline glm::u8vec3 u8vec3_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
+inline glm::vec3 vec3Color_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
+ isValid = true;
+ glm::vec3 vec3;
+ vec3FromScriptValue(v, vec3);
+ return vec3;
+}
+
+inline glm::u8vec3 u8vec3Color_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
glm::u8vec3 vec3;
- vec3UCharFromScriptValue(v, vec3);
+ u8vec3FromScriptValue(v, vec3);
return vec3;
}
@@ -256,7 +287,7 @@ inline qVectorFloat qVectorFloat_convertFromScriptValue(const QScriptValue& v, b
inline qVectorVec3 qVectorVec3_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
- return qVectorVec3FloatFromScriptValue(v);
+ return qVectorVec3FromScriptValue(v);
}
inline qVectorQuat qVectorQuat_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp
index 7d9ac1d591..c3e1b74626 100644
--- a/libraries/entities/src/EntityScriptingInterface.cpp
+++ b/libraries/entities/src/EntityScriptingInterface.cpp
@@ -1066,9 +1066,9 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c
obj.setProperty("distance", value.distance);
obj.setProperty("face", boxFaceToString(value.face));
- QScriptValue intersection = vec3FloatToScriptValue(engine, value.intersection);
+ QScriptValue intersection = vec3ToScriptValue(engine, value.intersection);
obj.setProperty("intersection", intersection);
- QScriptValue surfaceNormal = vec3FloatToScriptValue(engine, value.surfaceNormal);
+ QScriptValue surfaceNormal = vec3ToScriptValue(engine, value.surfaceNormal);
obj.setProperty("surfaceNormal", surfaceNormal);
obj.setProperty("extraInfo", engine->toScriptValue(value.extraInfo));
return obj;
@@ -1084,11 +1084,11 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra
QScriptValue intersection = object.property("intersection");
if (intersection.isValid()) {
- vec3FloatFromScriptValue(intersection, value.intersection);
+ vec3FromScriptValue(intersection, value.intersection);
}
QScriptValue surfaceNormal = object.property("surfaceNormal");
if (surfaceNormal.isValid()) {
- vec3FloatFromScriptValue(surfaceNormal, value.surfaceNormal);
+ vec3FromScriptValue(surfaceNormal, value.surfaceNormal);
}
value.extraInfo = object.property("extraInfo").toVariant().toMap();
}
diff --git a/libraries/entities/src/HazePropertyGroup.cpp b/libraries/entities/src/HazePropertyGroup.cpp
index 9f9830e7d9..632f73ced6 100644
--- a/libraries/entities/src/HazePropertyGroup.cpp
+++ b/libraries/entities/src/HazePropertyGroup.cpp
@@ -18,8 +18,8 @@
void HazePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const {
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange);
- COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor);
- COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor);
+ COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor, u8vec3Color);
+ COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor, u8vec3Color);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_ENABLE_GLARE, Haze, haze, HazeEnableGlare, hazeEnableGlare);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_GLARE_ANGLE, Haze, haze, HazeGlareAngle, hazeGlareAngle);
@@ -36,8 +36,8 @@ void HazePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProp
void HazePropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) {
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeRange, float, setHazeRange);
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeColor, u8vec3, setHazeColor);
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeGlareColor, u8vec3, setHazeGlareColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeColor, u8vec3Color, setHazeColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeGlareColor, u8vec3Color, setHazeGlareColor);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeEnableGlare, bool, setHazeEnableGlare);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeGlareAngle, float, setHazeGlareAngle);
@@ -167,8 +167,8 @@ bool HazePropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFlags,
bool somethingChanged = false;
READ_ENTITY_PROPERTY(PROP_HAZE_RANGE, float, setHazeRange);
- READ_ENTITY_PROPERTY(PROP_HAZE_COLOR, glm::u8vec3, setHazeColor);
- READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, glm::u8vec3, setHazeGlareColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_COLOR, u8vec3Color, setHazeColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, u8vec3Color, setHazeGlareColor);
READ_ENTITY_PROPERTY(PROP_HAZE_ENABLE_GLARE, bool, setHazeEnableGlare);
READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_ANGLE, float, setHazeGlareAngle);
@@ -343,8 +343,8 @@ int HazePropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* dat
const unsigned char* dataAt = data;
READ_ENTITY_PROPERTY(PROP_HAZE_RANGE, float, setHazeRange);
- READ_ENTITY_PROPERTY(PROP_HAZE_COLOR, glm::u8vec3, setHazeColor);
- READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, glm::u8vec3, setHazeGlareColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_COLOR, u8vec3Color, setHazeColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, u8vec3Color, setHazeGlareColor);
READ_ENTITY_PROPERTY(PROP_HAZE_ENABLE_GLARE, bool, setHazeEnableGlare);
READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_ANGLE, float, setHazeGlareAngle);
diff --git a/libraries/entities/src/HazePropertyGroup.h b/libraries/entities/src/HazePropertyGroup.h
index ab54e8483b..595dbeaf51 100644
--- a/libraries/entities/src/HazePropertyGroup.h
+++ b/libraries/entities/src/HazePropertyGroup.h
@@ -48,10 +48,10 @@ static const float INITIAL_KEY_LIGHT_ALTITUDE{ 200.0f };
*
* @property {number} hazeRange=1000 - The horizontal distance at which visibility is reduced to 95%; i.e., 95% of each pixel's
* color is haze.
- * @property {Vec3Color} hazeColor=128,154,179 - The color of the haze when looking away from the key light.
+ * @property {Color} hazeColor=128,154,179 - The color of the haze when looking away from the key light.
* @property {boolean} hazeEnableGlare=false - If true
then the haze is colored with glare from the key light;
* hazeGlareColor
and hazeGlareAngle
are used.
- * @property {Vec3Color} hazeGlareColor=255,299,179 - The color of the haze when looking towards the key light.
+ * @property {Color} hazeGlareColor=255,299,179 - The color of the haze when looking towards the key light.
* @property {number} hazeGlareAngle=20 - The angle in degrees across the circle around the key light that the glare color and
* haze color are blended 50/50.
*
diff --git a/libraries/entities/src/KeyLightPropertyGroup.cpp b/libraries/entities/src/KeyLightPropertyGroup.cpp
index ac744948f0..f0ad2965ce 100644
--- a/libraries/entities/src/KeyLightPropertyGroup.cpp
+++ b/libraries/entities/src/KeyLightPropertyGroup.cpp
@@ -26,20 +26,20 @@ const bool KeyLightPropertyGroup::DEFAULT_KEYLIGHT_CAST_SHADOWS { false };
void KeyLightPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties,
QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const {
- COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color);
+ COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_KEYLIGHT_COLOR, KeyLight, keyLight, Color, color, u8vec3Color);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_KEYLIGHT_INTENSITY, KeyLight, keyLight, Intensity, intensity);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_KEYLIGHT_DIRECTION, KeyLight, keyLight, Direction, direction);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_KEYLIGHT_CAST_SHADOW, KeyLight, keyLight, CastShadows, castShadows);
}
void KeyLightPropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) {
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, color, u8vec3, setColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, color, u8vec3Color, setColor);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, intensity, float, setIntensity);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, direction, vec3, setDirection);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, castShadows, bool, setCastShadows);
// legacy property support
- COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightColor, u8vec3, setColor, getColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightColor, u8vec3Color, setColor, getColor);
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightIntensity, float, setIntensity, getIntensity);
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightDirection, vec3, setDirection, getDirection);
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightCastShadows, bool, setCastShadows, getCastShadows);
@@ -99,7 +99,7 @@ bool KeyLightPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFl
bool overwriteLocalData = true;
bool somethingChanged = false;
- READ_ENTITY_PROPERTY(PROP_KEYLIGHT_COLOR, glm::u8vec3, setColor);
+ READ_ENTITY_PROPERTY(PROP_KEYLIGHT_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_INTENSITY, float, setIntensity);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_DIRECTION, glm::vec3, setDirection);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_CAST_SHADOW, bool, setCastShadows);
@@ -187,7 +187,7 @@ int KeyLightPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char*
int bytesRead = 0;
const unsigned char* dataAt = data;
- READ_ENTITY_PROPERTY(PROP_KEYLIGHT_COLOR, glm::u8vec3, setColor);
+ READ_ENTITY_PROPERTY(PROP_KEYLIGHT_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_INTENSITY, float, setIntensity);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_DIRECTION, glm::vec3, setDirection);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_CAST_SHADOW, bool, setCastShadows);
diff --git a/libraries/entities/src/KeyLightPropertyGroup.h b/libraries/entities/src/KeyLightPropertyGroup.h
index 8144bf2a6e..d7fa75a32e 100644
--- a/libraries/entities/src/KeyLightPropertyGroup.h
+++ b/libraries/entities/src/KeyLightPropertyGroup.h
@@ -30,7 +30,7 @@ class ReadBitstreamToTreeParams;
/**jsdoc
* A key light is defined by the following properties.
* @typedef {object} Entities.KeyLight
- * @property {Vec3Color} color=255,255,255 - The color of the light.
+ * @property {Color} color=255,255,255 - The color of the light.
* @property {number} intensity=1 - The intensity of the light.
* @property {Vec3} direction=0,-1,0 - The direction the light is shining.
* @property {boolean} castShadows=false - If true
then shadows are cast. Shadows are cast by avatars, plus
diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp
index d9e8ef0414..9b32c7d487 100644
--- a/libraries/entities/src/ParticleEffectEntityItem.cpp
+++ b/libraries/entities/src/ParticleEffectEntityItem.cpp
@@ -512,7 +512,7 @@ int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned ch
int bytesRead = 0;
const unsigned char* dataAt = data;
- READ_ENTITY_PROPERTY(PROP_COLOR, glm::u8vec3, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY(PROP_EMITTING_PARTICLES, bool, setIsEmitting);
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, setShapeType);
READ_ENTITY_PROPERTY(PROP_MAX_PARTICLES, quint32, setMaxParticles);
@@ -528,9 +528,9 @@ int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned ch
READ_ENTITY_PROPERTY(PROP_RADIUS_START, float, setRadiusStart);
READ_ENTITY_PROPERTY(PROP_RADIUS_FINISH, float, setRadiusFinish);
- READ_ENTITY_PROPERTY(PROP_COLOR_SPREAD, glm::u8vec3, setColorSpread);
- READ_ENTITY_PROPERTY(PROP_COLOR_START, glm::vec3, setColorStart);
- READ_ENTITY_PROPERTY(PROP_COLOR_FINISH, glm::vec3, setColorFinish);
+ READ_ENTITY_PROPERTY(PROP_COLOR_SPREAD, u8vec3Color, setColorSpread);
+ READ_ENTITY_PROPERTY(PROP_COLOR_START, vec3Color, setColorStart);
+ READ_ENTITY_PROPERTY(PROP_COLOR_FINISH, vec3Color, setColorFinish);
READ_ENTITY_PROPERTY(PROP_ALPHA, float, setAlpha);
READ_ENTITY_PROPERTY(PROP_ALPHA_SPREAD, float, setAlphaSpread);
READ_ENTITY_PROPERTY(PROP_ALPHA_START, float, setAlphaStart);
diff --git a/libraries/entities/src/SkyboxPropertyGroup.cpp b/libraries/entities/src/SkyboxPropertyGroup.cpp
index 16bb5c1ccd..89ffa95dbe 100644
--- a/libraries/entities/src/SkyboxPropertyGroup.cpp
+++ b/libraries/entities/src/SkyboxPropertyGroup.cpp
@@ -19,12 +19,12 @@
const glm::u8vec3 SkyboxPropertyGroup::DEFAULT_COLOR = { 0, 0, 0 };
void SkyboxPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const {
- COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color);
+ COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color, u8vec3Color);
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_SKYBOX_URL, Skybox, skybox, URL, url);
}
void SkyboxPropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) {
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(skybox, color, u8vec3, setColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(skybox, color, u8vec3Color, setColor);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(skybox, url, QString, setURL);
}
@@ -71,7 +71,7 @@ bool SkyboxPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFlag
bool overwriteLocalData = true;
bool somethingChanged = false;
- READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, glm::u8vec3, setColor);
+ READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY(PROP_SKYBOX_URL, QString, setURL);
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_SKYBOX_COLOR, Color);
@@ -143,7 +143,7 @@ int SkyboxPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* d
int bytesRead = 0;
const unsigned char* dataAt = data;
- READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, glm::u8vec3, setColor);
+ READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, u8vec3Color, setColor);
READ_ENTITY_PROPERTY(PROP_SKYBOX_URL, QString, setURL);
return bytesRead;
diff --git a/libraries/entities/src/SkyboxPropertyGroup.h b/libraries/entities/src/SkyboxPropertyGroup.h
index 6370dacba2..c3f9b421f4 100644
--- a/libraries/entities/src/SkyboxPropertyGroup.h
+++ b/libraries/entities/src/SkyboxPropertyGroup.h
@@ -32,7 +32,7 @@ class ReadBitstreamToTreeParams;
/**jsdoc
* A skybox is defined by the following properties.
* @typedef {object} Entities.Skybox
- * @property {Vec3Color} color=0,0,0 - Sets the color of the sky if url
is ""
, otherwise modifies the
+ * @property {Color} color=0,0,0 - Sets the color of the sky if url
is ""
, otherwise modifies the
* color of the cube map image.
* @property {string} url="" - A cube map image that is used to render the sky.
*/
diff --git a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp
index 2a84d8c9d6..c859842a79 100644
--- a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp
+++ b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp
@@ -367,8 +367,8 @@ namespace scriptable {
obj.setProperty("metallic", material.metallic);
obj.setProperty("scattering", material.scattering);
obj.setProperty("unlit", material.unlit);
- obj.setProperty("emissive", vec3FloatToScriptValue(engine, material.emissive));
- obj.setProperty("albedo", vec3FloatToScriptValue(engine, material.albedo));
+ obj.setProperty("emissive", vec3ColorToScriptValue(engine, material.emissive));
+ obj.setProperty("albedo", vec3ColorToScriptValue(engine, material.albedo));
obj.setProperty("emissiveMap", material.emissiveMap);
obj.setProperty("albedoMap", material.albedoMap);
obj.setProperty("opacityMap", material.opacityMap);
diff --git a/libraries/model-networking/src/model-networking/MaterialCache.cpp b/libraries/model-networking/src/model-networking/MaterialCache.cpp
index 823602d939..e6e3b0e812 100644
--- a/libraries/model-networking/src/model-networking/MaterialCache.cpp
+++ b/libraries/model-networking/src/model-networking/MaterialCache.cpp
@@ -113,11 +113,11 @@ NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMater
* @typedef {object} Material
* @property {string} name="" - A name for the material.
* @property {string} model="hifi_pbr" - Currently not used.
- * @property {Vec3Color|RGBS} emissive - The emissive color, i.e., the color that the material emits. A {@link Vec3Color} value
+ * @property {Color|RGBS} emissive - The emissive color, i.e., the color that the material emits. A {@link Color} value
* is treated as sRGB. A {@link RGBS} value can be either RGB or sRGB.
* @property {number} opacity=1.0 - The opacity, 0.0
– 1.0
.
* @property {boolean} unlit=false - If true
, the material is not lit.
- * @property {Vec3Color|RGBS} albedo - The albedo color. A {@link Vec3Color} value is treated as sRGB. A {@link RGBS} value can
+ * @property {Color|RGBS} albedo - The albedo color. A {@link Color} value is treated as sRGB. A {@link RGBS} value can
* be either RGB or sRGB.
* @property {number} roughness - The roughness, 0.0
– 1.0
.
* @property {number} metallic - The metallicness, 0.0
– 1.0
.
diff --git a/libraries/script-engine/src/ModelScriptingInterface.cpp b/libraries/script-engine/src/ModelScriptingInterface.cpp
index ff0328367a..1716ea72ff 100644
--- a/libraries/script-engine/src/ModelScriptingInterface.cpp
+++ b/libraries/script-engine/src/ModelScriptingInterface.cpp
@@ -192,7 +192,7 @@ QScriptValue ModelScriptingInterface::getVertex(MeshProxy* meshProxy, int vertex
}
glm::vec3 pos = vertexBufferView.get(vertexIndex);
- return vec3FloatToScriptValue(_modelScriptEngine, pos);
+ return vec3ToScriptValue(_modelScriptEngine, pos);
}
diff --git a/libraries/script-engine/src/SpatialEvent.cpp b/libraries/script-engine/src/SpatialEvent.cpp
index 33a261c087..8520c0c485 100644
--- a/libraries/script-engine/src/SpatialEvent.cpp
+++ b/libraries/script-engine/src/SpatialEvent.cpp
@@ -33,9 +33,9 @@ SpatialEvent::SpatialEvent(const SpatialEvent& event) {
QScriptValue SpatialEvent::toScriptValue(QScriptEngine* engine, const SpatialEvent& event) {
QScriptValue obj = engine->newObject();
- obj.setProperty("locTranslation", vec3FloatToScriptValue(engine, event.locTranslation) );
+ obj.setProperty("locTranslation", vec3ToScriptValue(engine, event.locTranslation) );
obj.setProperty("locRotation", quatToScriptValue(engine, event.locRotation) );
- obj.setProperty("absTranslation", vec3FloatToScriptValue(engine, event.absTranslation) );
+ obj.setProperty("absTranslation", vec3ToScriptValue(engine, event.absTranslation) );
obj.setProperty("absRotation", quatToScriptValue(engine, event.absRotation) );
return obj;
diff --git a/libraries/script-engine/src/TouchEvent.cpp b/libraries/script-engine/src/TouchEvent.cpp
index 82b584c3ca..58ac9ec8c1 100644
--- a/libraries/script-engine/src/TouchEvent.cpp
+++ b/libraries/script-engine/src/TouchEvent.cpp
@@ -221,7 +221,7 @@ QScriptValue TouchEvent::toScriptValue(QScriptEngine* engine, const TouchEvent&
QScriptValue pointsObj = engine->newArray();
int index = 0;
foreach (glm::vec2 point, event.points) {
- QScriptValue thisPoint = vec2FloatToScriptValue(engine, point);
+ QScriptValue thisPoint = vec2ToScriptValue(engine, point);
pointsObj.setProperty(index, thisPoint);
index++;
}
diff --git a/libraries/shared/src/PointerEvent.cpp b/libraries/shared/src/PointerEvent.cpp
index d406c0f92a..fb855922c2 100644
--- a/libraries/shared/src/PointerEvent.cpp
+++ b/libraries/shared/src/PointerEvent.cpp
@@ -230,16 +230,16 @@ void PointerEvent::fromScriptValue(const QScriptValue& object, PointerEvent& eve
event._id = id.isNumber() ? (uint32_t)id.toNumber() : 0;
glm::vec2 pos2D;
- vec2FloatFromScriptValue(object.property("pos2D"), event._pos2D);
+ vec2FromScriptValue(object.property("pos2D"), event._pos2D);
glm::vec3 pos3D;
- vec3FloatFromScriptValue(object.property("pos3D"), event._pos3D);
+ vec3FromScriptValue(object.property("pos3D"), event._pos3D);
glm::vec3 normal;
- vec3FloatFromScriptValue(object.property("normal"), event._normal);
+ vec3FromScriptValue(object.property("normal"), event._normal);
glm::vec3 direction;
- vec3FloatFromScriptValue(object.property("direction"), event._direction);
+ vec3FromScriptValue(object.property("direction"), event._direction);
QScriptValue button = object.property("button");
QString buttonStr = type.isString() ? button.toString() : "NoButtons";
diff --git a/libraries/shared/src/RegisteredMetaTypes.cpp b/libraries/shared/src/RegisteredMetaTypes.cpp
index 5894671171..e47d14adef 100644
--- a/libraries/shared/src/RegisteredMetaTypes.cpp
+++ b/libraries/shared/src/RegisteredMetaTypes.cpp
@@ -25,9 +25,9 @@
#include
#include
-int vec2FloatMetaTypeId = qRegisterMetaType();
-int vec3FloatMetaTypeId = qRegisterMetaType();
-int vec3UintMetaTypeId = qRegisterMetaType();
+int vec2MetaTypeId = qRegisterMetaType();
+int u8vec3MetaTypeId = qRegisterMetaType();
+int vec3MetaTypeId = qRegisterMetaType();
int vec4MetaTypeId = qRegisterMetaType();
int qVectorVec3MetaTypeId = qRegisterMetaType>();
int qVectorQuatMetaTypeId = qRegisterMetaType>();
@@ -41,14 +41,14 @@ int voidLambdaType = qRegisterMetaType>();
int variantLambdaType = qRegisterMetaType>();
void registerMetaTypes(QScriptEngine* engine) {
- qScriptRegisterMetaType(engine, vec2FloatToScriptValue, vec2FloatFromScriptValue);
- qScriptRegisterMetaType(engine, vec3FloatToScriptValue, vec3FloatFromScriptValue);
- qScriptRegisterMetaType(engine, vec3UCharToScriptValue, vec3UCharFromScriptValue);
+ qScriptRegisterMetaType(engine, vec2ToScriptValue, vec2FromScriptValue);
+ qScriptRegisterMetaType(engine, vec3ToScriptValue, vec3FromScriptValue);
+ qScriptRegisterMetaType(engine, u8vec3ToScriptValue, u8vec3FromScriptValue);
qScriptRegisterMetaType(engine, vec4toScriptValue, vec4FromScriptValue);
qScriptRegisterMetaType(engine, quatToScriptValue, quatFromScriptValue);
qScriptRegisterMetaType(engine, mat4toScriptValue, mat4FromScriptValue);
- qScriptRegisterMetaType(engine, qVectorVec3FloatToScriptValue, qVectorVec3FloatFromScriptValue);
+ qScriptRegisterMetaType(engine, qVectorVec3ToScriptValue, qVectorVec3FromScriptValue);
qScriptRegisterMetaType(engine, qVectorQuatToScriptValue, qVectorQuatFromScriptValue);
qScriptRegisterMetaType(engine, qVectorBoolToScriptValue, qVectorBoolFromScriptValue);
qScriptRegisterMetaType(engine, qVectorFloatToScriptValue, qVectorFloatFromScriptValue);
@@ -65,11 +65,11 @@ void registerMetaTypes(QScriptEngine* engine) {
qScriptRegisterMetaType(engine, aaCubeToScriptValue, aaCubeFromScriptValue);
}
-QScriptValue vec2FloatToScriptValue(QScriptEngine* engine, const glm::vec2& vec2) {
- auto prototype = engine->globalObject().property("__hifi_vec2_float__");
+QScriptValue vec2ToScriptValue(QScriptEngine* engine, const glm::vec2& vec2) {
+ auto prototype = engine->globalObject().property("__hifi_vec2__");
if (!prototype.property("defined").toBool()) {
prototype = engine->evaluate(
- "__hifi_vec2_float__ = Object.defineProperties({}, { "
+ "__hifi_vec2__ = Object.defineProperties({}, { "
"defined: { value: true },"
"0: { set: function(nv) { return this.x = nv; }, get: function() { return this.x; } },"
"1: { set: function(nv) { return this.y = nv; }, get: function() { return this.y; } },"
@@ -87,25 +87,33 @@ QScriptValue vec2FloatToScriptValue(QScriptEngine* engine, const glm::vec2& vec2
return value;
}
-void vec2FloatFromScriptValue(const QScriptValue& object, glm::vec2& vec2) {
- QScriptValue x = object.property("x");
- if (!x.isValid()) {
- x = object.property("u");
- }
- if (!x.isValid()) {
- x = object.property("width");
- }
+void vec2FromScriptValue(const QScriptValue& object, glm::vec2& vec2) {
+ if (object.isArray()) {
+ QVariantList list = object.toVariant().toList();
+ if (list.length() == 2) {
+ vec2.x = list[0].toFloat();
+ vec2.y = list[1].toFloat();
+ }
+ } else {
+ QScriptValue x = object.property("x");
+ if (!x.isValid()) {
+ x = object.property("u");
+ }
+ if (!x.isValid()) {
+ x = object.property("width");
+ }
- QScriptValue y = object.property("y");
- if (!y.isValid()) {
- y = object.property("v");
- }
- if (!y.isValid()) {
- y = object.property("height");
- }
+ QScriptValue y = object.property("y");
+ if (!y.isValid()) {
+ y = object.property("v");
+ }
+ if (!y.isValid()) {
+ y = object.property("height");
+ }
- vec2.x = x.toVariant().toFloat();
- vec2.y = y.toVariant().toFloat();
+ vec2.x = x.toVariant().toFloat();
+ vec2.y = y.toVariant().toFloat();
+ }
}
QVariant vec2ToVariant(const glm::vec2 &vec2) {
@@ -161,11 +169,11 @@ glm::vec2 vec2FromVariant(const QVariant &object) {
return vec2FromVariant(object, valid);
}
-QScriptValue vec3FloatToScriptValue(QScriptEngine* engine, const glm::vec3& vec3) {
- auto prototype = engine->globalObject().property("__hifi_vec3_float__");
+QScriptValue vec3ToScriptValue(QScriptEngine* engine, const glm::vec3& vec3) {
+ auto prototype = engine->globalObject().property("__hifi_vec3__");
if (!prototype.property("defined").toBool()) {
prototype = engine->evaluate(
- "__hifi_vec3_float__ = Object.defineProperties({}, { "
+ "__hifi_vec3__ = Object.defineProperties({}, { "
"defined: { value: true },"
"0: { set: function(nv) { return this.x = nv; }, get: function() { return this.x; } },"
"1: { set: function(nv) { return this.y = nv; }, get: function() { return this.y; } },"
@@ -190,14 +198,49 @@ QScriptValue vec3FloatToScriptValue(QScriptEngine* engine, const glm::vec3& vec3
return value;
}
-void vec3FloatFromScriptValue(const QScriptValue& object, glm::vec3& vec3) {
+QScriptValue vec3ColorToScriptValue(QScriptEngine* engine, const glm::vec3& vec3) {
+ auto prototype = engine->globalObject().property("__hifi_vec3_color__");
+ if (!prototype.property("defined").toBool()) {
+ prototype = engine->evaluate(
+ "__hifi_vec3_color__ = Object.defineProperties({}, { "
+ "defined: { value: true },"
+ "0: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "1: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "2: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } },"
+ "r: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "g: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "b: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } },"
+ "x: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "y: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "z: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } },"
+ "width: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "height: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "depth: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } }"
+ "})"
+ );
+ }
+ QScriptValue value = engine->newObject();
+ value.setProperty("red", vec3.x);
+ value.setProperty("green", vec3.y);
+ value.setProperty("blue", vec3.z);
+ value.setPrototype(prototype);
+ return value;
+}
+
+void vec3FromScriptValue(const QScriptValue& object, glm::vec3& vec3) {
if (object.isString()) {
QColor qColor(object.toString());
if (qColor.isValid()) {
vec3.x = qColor.red();
vec3.y = qColor.green();
vec3.z = qColor.blue();
- return;
+ }
+ } else if (object.isArray()) {
+ QVariantList list = object.toVariant().toList();
+ if (list.length() == 3) {
+ vec3.x = list[0].toFloat();
+ vec3.y = list[1].toFloat();
+ vec3.z = list[2].toFloat();
}
} else {
QScriptValue x = object.property("x");
@@ -236,15 +279,14 @@ void vec3FloatFromScriptValue(const QScriptValue& object, glm::vec3& vec3) {
vec3.x = x.toVariant().toFloat();
vec3.y = y.toVariant().toFloat();
vec3.z = z.toVariant().toFloat();
- return;
}
}
-QScriptValue vec3UCharToScriptValue(QScriptEngine* engine, const glm::u8vec3& vec3) {
- auto prototype = engine->globalObject().property("__hifi_vec3_uchar__");
+QScriptValue u8vec3ToScriptValue(QScriptEngine* engine, const glm::u8vec3& vec3) {
+ auto prototype = engine->globalObject().property("__hifi_u8vec3__");
if (!prototype.property("defined").toBool()) {
prototype = engine->evaluate(
- "__hifi_vec3_uchar__ = Object.defineProperties({}, { "
+ "__hifi_u8vec3__ = Object.defineProperties({}, { "
"defined: { value: true },"
"0: { set: function(nv) { return this.x = nv; }, get: function() { return this.x; } },"
"1: { set: function(nv) { return this.y = nv; }, get: function() { return this.y; } },"
@@ -269,14 +311,49 @@ QScriptValue vec3UCharToScriptValue(QScriptEngine* engine, const glm::u8vec3& ve
return value;
}
-void vec3UCharFromScriptValue(const QScriptValue& object, glm::u8vec3& vec3) {
+QScriptValue u8vec3ColorToScriptValue(QScriptEngine* engine, const glm::u8vec3& vec3) {
+ auto prototype = engine->globalObject().property("__hifi_u8vec3_color__");
+ if (!prototype.property("defined").toBool()) {
+ prototype = engine->evaluate(
+ "__hifi_u8vec3_color__ = Object.defineProperties({}, { "
+ "defined: { value: true },"
+ "0: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "1: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "2: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } },"
+ "r: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "g: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "b: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } },"
+ "x: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "y: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "z: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } },"
+ "width: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
+ "height: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"
+ "depth: { set: function(nv) { return this.blue = nv; }, get: function() { return this.blue; } }"
+ "})"
+ );
+ }
+ QScriptValue value = engine->newObject();
+ value.setProperty("red", vec3.x);
+ value.setProperty("green", vec3.y);
+ value.setProperty("blue", vec3.z);
+ value.setPrototype(prototype);
+ return value;
+}
+
+void u8vec3FromScriptValue(const QScriptValue& object, glm::u8vec3& vec3) {
if (object.isString()) {
QColor qColor(object.toString());
if (qColor.isValid()) {
vec3.x = (uint8_t)qColor.red();
vec3.y = (uint8_t)qColor.green();
vec3.z = (uint8_t)qColor.blue();
- return;
+ }
+ } else if (object.isArray()) {
+ QVariantList list = object.toVariant().toList();
+ if (list.length() == 3) {
+ vec3.x = list[0].toUInt();
+ vec3.y = list[1].toUInt();
+ vec3.z = list[2].toUInt();
}
} else {
QScriptValue x = object.property("x");
@@ -315,7 +392,6 @@ void vec3UCharFromScriptValue(const QScriptValue& object, glm::u8vec3& vec3) {
vec3.x = x.toVariant().toUInt();
vec3.y = y.toVariant().toUInt();
vec3.z = z.toVariant().toUInt();
- return;
}
}
@@ -515,32 +591,40 @@ void mat4FromScriptValue(const QScriptValue& object, glm::mat4& mat4) {
mat4[3][3] = object.property("r3c3").toVariant().toFloat();
}
-QScriptValue qVectorVec3FloatToScriptValue(QScriptEngine* engine, const QVector& vector) {
+QScriptValue qVectorVec3ColorToScriptValue(QScriptEngine* engine, const QVector& vector) {
QScriptValue array = engine->newArray();
for (int i = 0; i < vector.size(); i++) {
- array.setProperty(i, vec3FloatToScriptValue(engine, vector.at(i)));
+ array.setProperty(i, vec3ColorToScriptValue(engine, vector.at(i)));
}
return array;
}
-QVector qVectorVec3FloatFromScriptValue(const QScriptValue& array) {
+QScriptValue qVectorVec3ToScriptValue(QScriptEngine* engine, const QVector& vector) {
+ QScriptValue array = engine->newArray();
+ for (int i = 0; i < vector.size(); i++) {
+ array.setProperty(i, vec3ToScriptValue(engine, vector.at(i)));
+ }
+ return array;
+}
+
+QVector qVectorVec3FromScriptValue(const QScriptValue& array) {
QVector newVector;
int length = array.property("length").toInteger();
for (int i = 0; i < length; i++) {
glm::vec3 newVec3 = glm::vec3();
- vec3FloatFromScriptValue(array.property(i), newVec3);
+ vec3FromScriptValue(array.property(i), newVec3);
newVector << newVec3;
}
return newVector;
}
-void qVectorVec3FloatFromScriptValue(const QScriptValue& array, QVector& vector) {
+void qVectorVec3FromScriptValue(const QScriptValue& array, QVector& vector) {
int length = array.property("length").toInteger();
for (int i = 0; i < length; i++) {
glm::vec3 newVec3 = glm::vec3();
- vec3FloatFromScriptValue(array.property(i), newVec3);
+ vec3FromScriptValue(array.property(i), newVec3);
vector << newVec3;
}
}
@@ -868,9 +952,9 @@ void qURLFromScriptValue(const QScriptValue& object, QUrl& url) {
QScriptValue pickRayToScriptValue(QScriptEngine* engine, const PickRay& pickRay) {
QScriptValue obj = engine->newObject();
- QScriptValue origin = vec3FloatToScriptValue(engine, pickRay.origin);
+ QScriptValue origin = vec3ToScriptValue(engine, pickRay.origin);
obj.setProperty("origin", origin);
- QScriptValue direction = vec3FloatToScriptValue(engine, pickRay.direction);
+ QScriptValue direction = vec3ToScriptValue(engine, pickRay.direction);
obj.setProperty("direction", direction);
return obj;
}
@@ -914,9 +998,9 @@ QScriptValue collisionToScriptValue(QScriptEngine* engine, const Collision& coll
obj.setProperty("type", collision.type);
obj.setProperty("idA", quuidToScriptValue(engine, collision.idA));
obj.setProperty("idB", quuidToScriptValue(engine, collision.idB));
- obj.setProperty("penetration", vec3FloatToScriptValue(engine, collision.penetration));
- obj.setProperty("contactPoint", vec3FloatToScriptValue(engine, collision.contactPoint));
- obj.setProperty("velocityChange", vec3FloatToScriptValue(engine, collision.velocityChange));
+ obj.setProperty("penetration", vec3ToScriptValue(engine, collision.penetration));
+ obj.setProperty("contactPoint", vec3ToScriptValue(engine, collision.contactPoint));
+ obj.setProperty("velocityChange", vec3ToScriptValue(engine, collision.velocityChange));
return obj;
}
diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h
index 413624aa34..1576bcaf6d 100644
--- a/libraries/shared/src/RegisteredMetaTypes.h
+++ b/libraries/shared/src/RegisteredMetaTypes.h
@@ -52,8 +52,8 @@ void mat4FromScriptValue(const QScriptValue& object, glm::mat4& mat4);
* @property {number} x - X-coordinate of the vector. Synonyms: u
and width
.
* @property {number} y - Y-coordinate of the vector. Synonyms: v
and height
.
*/
-QScriptValue vec2FloatToScriptValue(QScriptEngine* engine, const glm::vec2& vec2);
-void vec2FloatFromScriptValue(const QScriptValue& object, glm::vec2& vec2);
+QScriptValue vec2ToScriptValue(QScriptEngine* engine, const glm::vec2& vec2);
+void vec2FromScriptValue(const QScriptValue& object, glm::vec2& vec2);
QVariant vec2ToVariant(const glm::vec2& vec2);
glm::vec2 vec2FromVariant(const QVariant& object, bool& valid);
@@ -67,19 +67,29 @@ glm::vec2 vec2FromVariant(const QVariant& object);
* @property {number} y - Y-coordinate of the vector. Synonyms: g
, green
, and height
.
* @property {number} z - Z-coordinate of the vector. Synonyms: b
, blue
, and depth
.
*/
-QScriptValue vec3FloatToScriptValue(QScriptEngine* engine, const glm::vec3& vec3);
-void vec3FloatFromScriptValue(const QScriptValue& object, glm::vec3& vec3);
+QScriptValue vec3ToScriptValue(QScriptEngine* engine, const glm::vec3& vec3);
+QScriptValue vec3ColorToScriptValue(QScriptEngine* engine, const glm::vec3& vec3);
+void vec3FromScriptValue(const QScriptValue& object, glm::vec3& vec3);
/**jsdoc
* A color vector. See also the {@link Vec3(0)|Vec3} object.
*
-* @typedef {object} Vec3Color
-* @property {number} x - Red component value. Integer in the range 0
- 255
. Synonyms: r
, red
, and width
.
-* @property {number} y - Green component value. Integer in the range 0
- 255
. Synonyms: g
, green
, and height
.
-* @property {number} z - Blue component value. Integer in the range 0
- 255
. Synonyms: b
, blue
, and depth
.
+* @typedef {object} Color
+* @property {number} red - Red component value. Integer in the range 0
- 255
. Synonyms: r
, x
, and width
.
+* @property {number} green - Green component value. Integer in the range 0
- 255
. Synonyms: g
, y
, and height
.
+* @property {number} blue - Blue component value. Integer in the range 0
- 255
. Synonyms: b
, z
, and depth
.
*/
-QScriptValue vec3UCharToScriptValue(QScriptEngine* engine, const glm::u8vec3& vec3);
-void vec3UCharFromScriptValue(const QScriptValue& object, glm::u8vec3& vec3);
+/**jsdoc
+* A color vector. See also the {@link Vec3(0)|Vec3} object.
+*
+* @typedef {object} ColorFloat
+* @property {number} red - Red component value. Float in the range 0
- 255
. Synonyms: r
, x
, and width
.
+* @property {number} green - Green component value. Float in the range 0
- 255
. Synonyms: g
, y
, and height
.
+* @property {number} blue - Blue component value. Float in the range 0
- 255
. Synonyms: b
, z
, and depth
.
+*/
+QScriptValue u8vec3ToScriptValue(QScriptEngine* engine, const glm::u8vec3& vec3);
+QScriptValue u8vec3ColorToScriptValue(QScriptEngine* engine, const glm::u8vec3& vec3);
+void u8vec3FromScriptValue(const QScriptValue& object, glm::u8vec3& vec3);
QVariant vec3toVariant(const glm::vec3& vec3);
glm::vec3 vec3FromVariant(const QVariant &object, bool& valid);
@@ -124,9 +134,10 @@ void qURLFromScriptValue(const QScriptValue& object, QUrl& url);
// vector
Q_DECLARE_METATYPE(QVector)
-QScriptValue qVectorVec3FloatToScriptValue(QScriptEngine* engine, const QVector& vector);
-void qVectorVec3FloatFromScriptValue(const QScriptValue& array, QVector& vector);
-QVector qVectorVec3FloatFromScriptValue(const QScriptValue& array);
+QScriptValue qVectorVec3ToScriptValue(QScriptEngine* engine, const QVector& vector);
+QScriptValue qVectorVec3ColorToScriptValue(QScriptEngine* engine, const QVector& vector);
+void qVectorVec3FromScriptValue(const QScriptValue& array, QVector& vector);
+QVector qVectorVec3FromScriptValue(const QScriptValue& array);
// vector
Q_DECLARE_METATYPE(QVector)