diff --git a/interface/src/scripting/SelectionScriptingInterface.cpp b/interface/src/scripting/SelectionScriptingInterface.cpp
index 9716b7e665..64e570dd42 100644
--- a/interface/src/scripting/SelectionScriptingInterface.cpp
+++ b/interface/src/scripting/SelectionScriptingInterface.cpp
@@ -421,7 +421,7 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
auto colorVariant = properties["outlineUnoccludedColor"];
if (colorVariant.isValid()) {
bool isValid;
- auto color = xColorFromVariant(colorVariant, isValid);
+ auto color = vec3FromVariant(colorVariant, isValid);
if (isValid) {
_style._outlineUnoccluded.color = toGlm(color);
}
@@ -429,7 +429,7 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
colorVariant = properties["outlineOccludedColor"];
if (colorVariant.isValid()) {
bool isValid;
- auto color = xColorFromVariant(colorVariant, isValid);
+ auto color = vec3FromVariant(colorVariant, isValid);
if (isValid) {
_style._outlineOccluded.color = toGlm(color);
}
@@ -437,7 +437,7 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
colorVariant = properties["fillUnoccludedColor"];
if (colorVariant.isValid()) {
bool isValid;
- auto color = xColorFromVariant(colorVariant, isValid);
+ auto color = vec3FromVariant(colorVariant, isValid);
if (isValid) {
_style._fillUnoccluded.color = toGlm(color);
}
@@ -445,7 +445,7 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
colorVariant = properties["fillOccludedColor"];
if (colorVariant.isValid()) {
bool isValid;
- auto color = xColorFromVariant(colorVariant, isValid);
+ auto color = vec3FromVariant(colorVariant, isValid);
if (isValid) {
_style._fillOccluded.color = toGlm(color);
}
@@ -482,10 +482,10 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
/**jsdoc
* @typedef {object} Selection.HighlightStyle
- * @property {Color} outlineUnoccludedColor - Color of the specified highlight region.
- * @property {Color} outlineOccludedColor - ""
- * @property {Color} fillUnoccludedColor- ""
- * @property {Color} fillOccludedColor- ""
+ * @property {Vec3Color} outlineUnoccludedColor - Color of the specified highlight region.
+ * @property {Vec3Color} outlineOccludedColor - ""
+ * @property {Vec3Color} fillUnoccludedColor- ""
+ * @property {Vec3Color} 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 - ""
@@ -497,10 +497,11 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
QVariantMap SelectionHighlightStyle::toVariantMap() const {
QVariantMap properties;
- properties["outlineUnoccludedColor"] = xColorToVariant(xColorFromGlm(_style._outlineUnoccluded.color));
- properties["outlineOccludedColor"] = xColorToVariant(xColorFromGlm(_style._outlineOccluded.color));
- properties["fillUnoccludedColor"] = xColorToVariant(xColorFromGlm(_style._fillUnoccluded.color));
- properties["fillOccludedColor"] = xColorToVariant(xColorFromGlm(_style._fillOccluded.color));
+ const float MAX_COLOR = 255.0f;
+ properties["outlineUnoccludedColor"] = vec3ToVariant(_style._outlineUnoccluded.color * MAX_COLOR);
+ properties["outlineOccludedColor"] = vec3ToVariant(_style._outlineOccluded.color * MAX_COLOR);
+ properties["fillUnoccludedColor"] = vec3ToVariant(_style._fillUnoccluded.color * MAX_COLOR);
+ properties["fillOccludedColor"] = vec3ToVariant(_style._fillOccluded.color * MAX_COLOR);
properties["outlineUnoccludedAlpha"] = _style._outlineUnoccluded.alpha;
properties["outlineOccludedAlpha"] = _style._outlineOccluded.alpha;
diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp
index 8b04f17269..f54f1427e8 100644
--- a/interface/src/ui/overlays/Circle3DOverlay.cpp
+++ b/interface/src/ui/overlays/Circle3DOverlay.cpp
@@ -237,20 +237,15 @@ void Circle3DOverlay::render(RenderArgs* args) {
angle += tickMarkAngle;
}
}
-
- xColor majorColorX = getMajorTickMarksColor();
- glm::vec4 majorColor(majorColorX.red / MAX_COLOR, majorColorX.green / MAX_COLOR, majorColorX.blue / MAX_COLOR, alpha);
-
+
+ glm::vec4 majorColor(toGlm(getMajorTickMarksColor()), alpha);
geometryCache->updateVertices(_majorTicksVerticesID, majorPoints, majorColor);
-
- xColor minorColorX = getMinorTickMarksColor();
- glm::vec4 minorColor(minorColorX.red / MAX_COLOR, minorColorX.green / MAX_COLOR, minorColorX.blue / MAX_COLOR, alpha);
-
+ glm::vec4 minorColor(toGlm(getMinorTickMarksColor()), alpha);
geometryCache->updateVertices(_minorTicksVerticesID, minorPoints, minorColor);
}
-
+
geometryCache->renderVertices(batch, gpu::LINES, _majorTicksVerticesID);
-
+
geometryCache->renderVertices(batch, gpu::LINES, _minorTicksVerticesID);
}
}
@@ -271,8 +266,8 @@ template T fromVariant(const QVariant& v, bool& valid) {
return qvariant_cast(v);
}
-template<> xColor fromVariant(const QVariant& v, bool& valid) {
- return xColorFromVariant(v, valid);
+template<> ScriptVec3UChar fromVariant(const QVariant& v, bool& valid) {
+ return vec3FromVariant(v, valid);
}
template
@@ -335,11 +330,11 @@ void Circle3DOverlay::setProperties(const QVariantMap& properties) {
_dirty |= updateIfValid(properties, "outerStartAlpha", _outerStartAlpha);
_dirty |= updateIfValid(properties, "outerEndAlpha", _outerEndAlpha);
- _dirty |= updateIfValid(properties, "color", { _innerStartColor, _innerEndColor, _outerStartColor, _outerEndColor });
- _dirty |= updateIfValid(properties, "startColor", { _innerStartColor, _outerStartColor } );
- _dirty |= updateIfValid(properties, "endColor", { _innerEndColor, _outerEndColor } );
- _dirty |= updateIfValid(properties, "innerColor", { _innerStartColor, _innerEndColor } );
- _dirty |= updateIfValid(properties, "outerColor", { _outerStartColor, _outerEndColor } );
+ _dirty |= updateIfValid(properties, "color", { _innerStartColor, _innerEndColor, _outerStartColor, _outerEndColor });
+ _dirty |= updateIfValid(properties, "startColor", { _innerStartColor, _outerStartColor } );
+ _dirty |= updateIfValid(properties, "endColor", { _innerEndColor, _outerEndColor } );
+ _dirty |= updateIfValid(properties, "innerColor", { _innerStartColor, _innerEndColor } );
+ _dirty |= updateIfValid(properties, "outerColor", { _outerStartColor, _outerEndColor } );
_dirty |= updateIfValid(properties, "innerStartColor", _innerStartColor);
_dirty |= updateIfValid(properties, "innerEndColor", _innerEndColor);
_dirty |= updateIfValid(properties, "outerStartColor", _outerStartColor);
@@ -413,20 +408,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 {Color} color=255,255,255 - The color of the overlay. Setting this value also sets the values of
+ * @property {Vec3Color} color=255,255,255 - The color of the overlay. Setting this value also sets the values of
* innerStartColor
, innerEndColor
, outerStartColor
, and outerEndColor
.
- * @property {Color} startColor - Sets the values of innerStartColor
and outerStartColor
.
+ * @property {Vec3Color} startColor - Sets the values of innerStartColor
and outerStartColor
.
* Write-only.
- * @property {Color} endColor - Sets the values of innerEndColor
and outerEndColor
.
+ * @property {Vec3Color} endColor - Sets the values of innerEndColor
and outerEndColor
.
* Write-only.
- * @property {Color} innerColor - Sets the values of innerStartColor
and innerEndColor
.
+ * @property {Vec3Color} innerColor - Sets the values of innerStartColor
and innerEndColor
.
* Write-only.
- * @property {Color} outerColor - Sets the values of outerStartColor
and outerEndColor
.
+ * @property {Vec3Color} outerColor - Sets the values of outerStartColor
and outerEndColor
.
* Write-only.
- * @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 {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 {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.
@@ -450,8 +445,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 {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.
+ * @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.
*/
QVariant Circle3DOverlay::getProperty(const QString& property) {
if (property == "startAt") {
@@ -470,16 +465,16 @@ QVariant Circle3DOverlay::getProperty(const QString& property) {
return _innerRadius;
}
if (property == "innerStartColor") {
- return xColorToVariant(_innerStartColor);
+ return vec3ToVariant(_innerStartColor.toGlm());
}
if (property == "innerEndColor") {
- return xColorToVariant(_innerEndColor);
+ return vec3ToVariant(_innerEndColor.toGlm());
}
if (property == "outerStartColor") {
- return xColorToVariant(_outerStartColor);
+ return vec3ToVariant(_outerStartColor.toGlm());
}
if (property == "outerEndColor") {
- return xColorToVariant(_outerEndColor);
+ return vec3ToVariant(_outerEndColor.toGlm());
}
if (property == "innerStartAlpha") {
return _innerStartAlpha;
@@ -509,10 +504,10 @@ QVariant Circle3DOverlay::getProperty(const QString& property) {
return _minorTickMarksLength;
}
if (property == "majorTickMarksColor") {
- return xColorToVariant(_majorTickMarksColor);
+ return vec3ToVariant(_majorTickMarksColor.toGlm());
}
if (property == "minorTickMarksColor") {
- return xColorToVariant(_minorTickMarksColor);
+ return vec3ToVariant(_minorTickMarksColor.toGlm());
}
return Planar3DOverlay::getProperty(property);
diff --git a/interface/src/ui/overlays/Circle3DOverlay.h b/interface/src/ui/overlays/Circle3DOverlay.h
index 0dc0f8b138..31f496f90a 100644
--- a/interface/src/ui/overlays/Circle3DOverlay.h
+++ b/interface/src/ui/overlays/Circle3DOverlay.h
@@ -39,8 +39,8 @@ public:
float getMinorTickMarksAngle() const { return _minorTickMarksAngle; }
float getMajorTickMarksLength() const { return _majorTickMarksLength; }
float getMinorTickMarksLength() const { return _minorTickMarksLength; }
- xColor getMajorTickMarksColor() const { return _majorTickMarksColor; }
- xColor getMinorTickMarksColor() const { return _minorTickMarksColor; }
+ ScriptVec3UChar getMajorTickMarksColor() const { return _majorTickMarksColor; }
+ ScriptVec3UChar getMinorTickMarksColor() const { return _minorTickMarksColor; }
void setStartAt(float value) { _startAt = value; }
void setEndAt(float value) { _endAt = value; }
@@ -51,8 +51,8 @@ public:
void setMinorTickMarksAngle(float value) { _minorTickMarksAngle = value; }
void setMajorTickMarksLength(float value) { _majorTickMarksLength = value; }
void setMinorTickMarksLength(float value) { _minorTickMarksLength = value; }
- void setMajorTickMarksColor(const xColor& value) { _majorTickMarksColor = value; }
- void setMinorTickMarksColor(const xColor& value) { _minorTickMarksColor = value; }
+ void setMajorTickMarksColor(const ScriptVec3UChar& value) { _majorTickMarksColor = value; }
+ void setMinorTickMarksColor(const ScriptVec3UChar& value) { _minorTickMarksColor = value; }
virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance,
BoxFace& face, glm::vec3& surfaceNormal, bool precisionPicking = false) override;
@@ -65,10 +65,10 @@ protected:
float _outerRadius { 1 };
float _innerRadius { 0 };
- xColor _innerStartColor { DEFAULT_OVERLAY_COLOR };
- xColor _innerEndColor { DEFAULT_OVERLAY_COLOR };
- xColor _outerStartColor { DEFAULT_OVERLAY_COLOR };
- xColor _outerEndColor { DEFAULT_OVERLAY_COLOR };
+ ScriptVec3UChar _innerStartColor { DEFAULT_OVERLAY_COLOR };
+ ScriptVec3UChar _innerEndColor { DEFAULT_OVERLAY_COLOR };
+ ScriptVec3UChar _outerStartColor { DEFAULT_OVERLAY_COLOR };
+ ScriptVec3UChar _outerEndColor { DEFAULT_OVERLAY_COLOR };
float _innerStartAlpha { DEFAULT_ALPHA };
float _innerEndAlpha { DEFAULT_ALPHA };
float _outerStartAlpha { DEFAULT_ALPHA };
@@ -79,8 +79,8 @@ protected:
float _minorTickMarksAngle { 0 };
float _majorTickMarksLength { 0 };
float _minorTickMarksLength { 0 };
- xColor _majorTickMarksColor { DEFAULT_OVERLAY_COLOR };
- xColor _minorTickMarksColor { DEFAULT_OVERLAY_COLOR };
+ ScriptVec3UChar _majorTickMarksColor { DEFAULT_OVERLAY_COLOR };
+ ScriptVec3UChar _minorTickMarksColor { DEFAULT_OVERLAY_COLOR };
gpu::Primitive _solidPrimitive { gpu::TRIANGLE_FAN };
int _quadVerticesID { 0 };
int _lineVerticesID { 0 };
diff --git a/interface/src/ui/overlays/ContextOverlayInterface.cpp b/interface/src/ui/overlays/ContextOverlayInterface.cpp
index 139d76a966..52aaa7f64c 100644
--- a/interface/src/ui/overlays/ContextOverlayInterface.cpp
+++ b/interface/src/ui/overlays/ContextOverlayInterface.cpp
@@ -83,7 +83,7 @@ ContextOverlayInterface::ContextOverlayInterface() {
_challengeOwnershipTimeoutTimer.setSingleShot(true);
}
-static const xColor CONTEXT_OVERLAY_COLOR = { 255, 255, 255 };
+static const ScriptVec3UChar CONTEXT_OVERLAY_COLOR = { 255, 255, 255 };
static const float CONTEXT_OVERLAY_INSIDE_DISTANCE = 1.0f; // in meters
static const float CONTEXT_OVERLAY_SIZE = 0.09f; // in meters, same x and y dims
static const float CONTEXT_OVERLAY_OFFSET_DISTANCE = 0.1f;
diff --git a/interface/src/ui/overlays/Cube3DOverlay.cpp b/interface/src/ui/overlays/Cube3DOverlay.cpp
index c98d9330df..85f4360d49 100644
--- a/interface/src/ui/overlays/Cube3DOverlay.cpp
+++ b/interface/src/ui/overlays/Cube3DOverlay.cpp
@@ -49,11 +49,8 @@ void Cube3DOverlay::render(RenderArgs* args) {
}
float alpha = getAlpha();
- xColor color = getColor();
- const float MAX_COLOR = 255.0f;
- glm::vec4 cubeColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
-
-
+ ScriptVec3UChar color = getColor();
+ glm::vec4 cubeColor(toGlm(color), alpha);
auto batch = args->_batch;
if (batch) {
@@ -132,7 +129,7 @@ void Cube3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.CubeProperties
*
* @property {string} type=cube - Has the value "cube"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 621c19944b..ec3efe1155 100644
--- a/interface/src/ui/overlays/Grid3DOverlay.cpp
+++ b/interface/src/ui/overlays/Grid3DOverlay.cpp
@@ -60,8 +60,8 @@ void Grid3DOverlay::render(RenderArgs* args) {
const float MAX_COLOR = 255.0f;
float alpha = getAlpha();
- xColor color = getColor();
- glm::vec4 gridColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
+ ScriptVec3UChar color = getColor();
+ glm::vec4 gridColor(toGlm(color), alpha);
auto batch = args->_batch;
@@ -117,7 +117,7 @@ void Grid3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.GridProperties
*
* @property {string} type=grid - Has the value "grid"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 d901f20c20..f9a83ac21f 100644
--- a/interface/src/ui/overlays/Image3DOverlay.cpp
+++ b/interface/src/ui/overlays/Image3DOverlay.cpp
@@ -107,17 +107,16 @@ void Image3DOverlay::render(RenderArgs* args) {
glm::vec2 texCoordBottomRight((fromImage.x() + fromImage.width() - 0.5f) / imageWidth,
(fromImage.y() + fromImage.height() - 0.5f) / imageHeight);
- const float MAX_COLOR = 255.0f;
- xColor color = getColor();
float alpha = getAlpha();
+ ScriptVec3UChar color = getColor();
+ glm::vec4 imageColor(toGlm(color), alpha);
batch->setModelTransform(getRenderTransform());
batch->setResourceTexture(0, _texture->getGPUTexture());
DependencyManager::get()->renderQuad(
*batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
- glm::vec4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha),
- _geometryId
+ imageColor, _geometryId
);
batch->setResourceTexture(0, nullptr); // restore default white color after me
@@ -188,7 +187,7 @@ void Image3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.Image3DProperties
*
* @property {string} type=image3d - Has the value "image3d"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 19f32511f6..3c04de8568 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 {Color} color=0,0,0 - The color to apply over the top of the image to colorize it. Write-only.
+ * @property {Vec3Color} 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 627b6d6577..e12736b280 100644
--- a/interface/src/ui/overlays/Line3DOverlay.cpp
+++ b/interface/src/ui/overlays/Line3DOverlay.cpp
@@ -128,9 +128,8 @@ void Line3DOverlay::render(RenderArgs* args) {
}
float alpha = getAlpha();
- xColor color = getColor();
- const float MAX_COLOR = 255.0f;
- glm::vec4 colorv4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
+ ScriptVec3UChar color = getColor();
+ glm::vec4 colorv4(toGlm(color), alpha);
auto batch = args->_batch;
if (batch) {
batch->setModelTransform(Transform());
@@ -260,7 +259,7 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
* @typedef {object} Overlays.Line3DProperties
*
* @property {string} type=line3d - Has the value "line3d"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 2ffef6a233..ca0ed7282b 100644
--- a/interface/src/ui/overlays/ModelOverlay.cpp
+++ b/interface/src/ui/overlays/ModelOverlay.cpp
@@ -345,7 +345,7 @@ vectorType ModelOverlay::mapJoints(mapFunction function) const {
* @typedef {object} Overlays.ModelProperties
*
* @property {string} type=sphere - Has the value "model"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 faa15ee2b4..6f46fc7dde 100644
--- a/interface/src/ui/overlays/Overlay.cpp
+++ b/interface/src/ui/overlays/Overlay.cpp
@@ -15,7 +15,7 @@
#include "Application.h"
-const xColor Overlay::DEFAULT_OVERLAY_COLOR = { 255, 255, 255 };
+const ScriptVec3UChar Overlay::DEFAULT_OVERLAY_COLOR = { 255, 255, 255 };
const float Overlay::DEFAULT_ALPHA = 0.7f;
Overlay::Overlay() :
@@ -57,7 +57,7 @@ Overlay::~Overlay() {
void Overlay::setProperties(const QVariantMap& properties) {
bool valid;
- auto color = xColorFromVariant(properties["color"], valid);
+ auto color = vec3FromVariant(properties["color"], valid);
if (valid) {
_color = color;
}
@@ -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 {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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.
@@ -116,7 +116,7 @@ QVariant Overlay::getProperty(const QString& property) {
return QVariant(getType());
}
if (property == "color") {
- return xColorToVariant(_color);
+ return vec3ToVariant(_color.toGlm());
}
if (property == "alpha") {
return _alpha;
@@ -143,21 +143,21 @@ QVariant Overlay::getProperty(const QString& property) {
return QVariant();
}
-xColor Overlay::getColor() {
+ScriptVec3UChar Overlay::getColor() {
if (_colorPulse == 0.0f) {
return _color;
}
float pulseLevel = updatePulse();
- xColor result = _color;
+ ScriptVec3UChar result = _color;
if (_colorPulse < 0.0f) {
- result.red *= (1.0f - pulseLevel);
- result.green *= (1.0f - pulseLevel);
- result.blue *= (1.0f - pulseLevel);
+ result.x *= (1.0f - pulseLevel);
+ result.y *= (1.0f - pulseLevel);
+ result.z *= (1.0f - pulseLevel);
} else {
- result.red *= pulseLevel;
- result.green *= pulseLevel;
- result.blue *= pulseLevel;
+ result.x *= pulseLevel;
+ result.y *= pulseLevel;
+ result.z *= pulseLevel;
}
return result;
}
diff --git a/interface/src/ui/overlays/Overlay.h b/interface/src/ui/overlays/Overlay.h
index 45fc77a452..8b9118cecd 100644
--- a/interface/src/ui/overlays/Overlay.h
+++ b/interface/src/ui/overlays/Overlay.h
@@ -11,8 +11,6 @@
#ifndef hifi_Overlay_h
#define hifi_Overlay_h
-// include this before QGLWidget, which includes an earlier version of OpenGL
-#include // for xColor
#include
class OverlayID : public QUuid {
@@ -59,7 +57,7 @@ public:
virtual bool isTransparent() { return getAlphaPulse() != 0.0f || getAlpha() != 1.0f; };
virtual bool getIsVisibleInSecondaryCamera() const { return false; }
- xColor getColor();
+ ScriptVec3UChar getColor();
float getAlpha();
float getPulseMax() const { return _pulseMax; }
@@ -73,7 +71,7 @@ public:
// setters
virtual void setVisible(bool visible) { _visible = visible; }
void setDrawHUDLayer(bool drawHUDLayer);
- void setColor(const xColor& color) { _color = color; }
+ void setColor(const ScriptVec3UChar& color) { _color = color; }
void setAlpha(float alpha) { _alpha = alpha; }
void setPulseMax(float value) { _pulseMax = value; }
@@ -115,12 +113,12 @@ protected:
float _alphaPulse; // ratio of the pulse to the alpha
float _colorPulse; // ratio of the pulse to the color
- xColor _color;
+ ScriptVec3UChar _color;
bool _visible; // should the overlay be drawn at all
unsigned int _stackOrder { 0 };
- static const xColor DEFAULT_OVERLAY_COLOR;
+ static const ScriptVec3UChar DEFAULT_OVERLAY_COLOR;
static const float DEFAULT_ALPHA;
std::unordered_map _materials;
diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.cpp b/interface/src/ui/overlays/Rectangle3DOverlay.cpp
index 54d29df516..bce90c60c9 100644
--- a/interface/src/ui/overlays/Rectangle3DOverlay.cpp
+++ b/interface/src/ui/overlays/Rectangle3DOverlay.cpp
@@ -51,9 +51,8 @@ void Rectangle3DOverlay::render(RenderArgs* args) {
}
float alpha = getAlpha();
- xColor color = getColor();
- const float MAX_COLOR = 255.0f;
- glm::vec4 rectangleColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
+ ScriptVec3UChar color = getColor();
+ glm::vec4 rectangleColor(toGlm(color), alpha);
auto batch = args->_batch;
if (batch) {
@@ -112,7 +111,7 @@ const render::ShapeKey Rectangle3DOverlay::getShapeKey() {
* @typedef {object} Overlays.Rectangle3DProperties
*
* @property {string} type=rectangle3d - Has the value "rectangle3d"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 af37a4ac02..356457a50f 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 {Color} color=0,0,0 - The color of the overlay. Write-only.
+ * @property {Vec3Color} 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 {Color} borderColor=0,0,0 - The color of the border. Write-only.
+ * @property {Vec3Color} 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 c27faf6f0f..9a955ad956 100644
--- a/interface/src/ui/overlays/Shape3DOverlay.cpp
+++ b/interface/src/ui/overlays/Shape3DOverlay.cpp
@@ -30,9 +30,8 @@ void Shape3DOverlay::render(RenderArgs* args) {
}
float alpha = getAlpha();
- xColor color = getColor();
- const float MAX_COLOR = 255.0f;
- glm::vec4 cubeColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
+ ScriptVec3UChar color = getColor();
+ glm::vec4 shapeColor(toGlm(color), alpha);
auto batch = args->_batch;
if (batch) {
@@ -44,9 +43,9 @@ void Shape3DOverlay::render(RenderArgs* args) {
batch->setModelTransform(getRenderTransform());
if (_isSolid) {
- geometryCache->renderSolidShapeInstance(args, *batch, _shape, cubeColor, shapePipeline);
+ geometryCache->renderSolidShapeInstance(args, *batch, _shape, shapeColor, shapePipeline);
} else {
- geometryCache->renderWireShapeInstance(args, *batch, _shape, cubeColor, shapePipeline);
+ geometryCache->renderWireShapeInstance(args, *batch, _shape, shapeColor, shapePipeline);
}
}
}
@@ -132,7 +131,7 @@ void Shape3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.ShapeProperties
*
* @property {string} type=shape - Has the value "shape"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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 4743e1ed3a..0e30fa7032 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 {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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.
@@ -78,9 +78,8 @@ void Sphere3DOverlay::render(RenderArgs* args) {
}
float alpha = getAlpha();
- xColor color = getColor();
- const float MAX_COLOR = 255.0f;
- glm::vec4 sphereColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
+ ScriptVec3UChar color = getColor();
+ glm::vec4 sphereColor(toGlm(color), alpha);
auto batch = args->_batch;
diff --git a/interface/src/ui/overlays/Text3DOverlay.cpp b/interface/src/ui/overlays/Text3DOverlay.cpp
index b128ce7df7..1c84affa56 100644
--- a/interface/src/ui/overlays/Text3DOverlay.cpp
+++ b/interface/src/ui/overlays/Text3DOverlay.cpp
@@ -64,21 +64,21 @@ void Text3DOverlay::setText(const QString& text) {
_text = text;
}
-xColor Text3DOverlay::getBackgroundColor() {
+ScriptVec3UChar Text3DOverlay::getBackgroundColor() {
if (_colorPulse == 0.0f) {
return _backgroundColor;
}
float pulseLevel = updatePulse();
- xColor result = _backgroundColor;
+ ScriptVec3UChar result = _backgroundColor;
if (_colorPulse < 0.0f) {
- result.red *= (1.0f - pulseLevel);
- result.green *= (1.0f - pulseLevel);
- result.blue *= (1.0f - pulseLevel);
+ result.x *= (1.0f - pulseLevel);
+ result.y *= (1.0f - pulseLevel);
+ result.z *= (1.0f - pulseLevel);
} else {
- result.red *= pulseLevel;
- result.green *= pulseLevel;
- result.blue *= pulseLevel;
+ result.x *= pulseLevel;
+ result.y *= pulseLevel;
+ result.z *= pulseLevel;
}
return result;
}
@@ -94,10 +94,8 @@ void Text3DOverlay::render(RenderArgs* args) {
auto transform = getRenderTransform();
batch.setModelTransform(transform);
- const float MAX_COLOR = 255.0f;
- xColor backgroundColor = getBackgroundColor();
- glm::vec4 quadColor(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR,
- backgroundColor.blue / MAX_COLOR, getBackgroundAlpha());
+ ScriptVec3UChar backgroundColor = getBackgroundColor();
+ glm::vec4 quadColor(toGlm(backgroundColor), getBackgroundAlpha());
glm::vec2 dimensions = getDimensions();
glm::vec2 halfDimensions = dimensions * 0.5f;
@@ -123,8 +121,7 @@ void Text3DOverlay::render(RenderArgs* args) {
transform.setScale(scaleFactor);
batch.setModelTransform(transform);
- glm::vec4 textColor = { _color.red / MAX_COLOR, _color.green / MAX_COLOR,
- _color.blue / MAX_COLOR, getTextAlpha() };
+ glm::vec4 textColor = { toGlm(_color), getTextAlpha() };
// FIXME: Factor out textRenderer so that Text3DOverlay overlay parts can be grouped by pipeline for a gpu performance increase.
_textRenderer->draw(batch, 0, 0, getText(), textColor, glm::vec2(-1.0f), true);
@@ -165,7 +162,7 @@ void Text3DOverlay::setProperties(const QVariantMap& properties) {
bool valid;
auto backgroundColor = properties["backgroundColor"];
if (backgroundColor.isValid()) {
- auto color = xColorFromVariant(backgroundColor, valid);
+ auto color = vec3FromVariant(backgroundColor, valid);
if (valid) {
_backgroundColor = color;
}
@@ -201,7 +198,7 @@ void Text3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.Text3DProperties
*
* @property {string} type=text3d - Has the value "text3d"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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.
@@ -245,7 +242,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 {Color} backgroundColor=0,0,0 - The background color.
+ * @property {Vec3Color} 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.
@@ -262,7 +259,7 @@ QVariant Text3DOverlay::getProperty(const QString& property) {
return _textAlpha;
}
if (property == "backgroundColor") {
- return xColorToVariant(_backgroundColor);
+ return vec3ToVariant(_backgroundColor.toGlm());
}
if (property == "backgroundAlpha") {
return Billboard3DOverlay::getProperty("alpha");
diff --git a/interface/src/ui/overlays/Text3DOverlay.h b/interface/src/ui/overlays/Text3DOverlay.h
index 21163101d0..5c3c8e7381 100644
--- a/interface/src/ui/overlays/Text3DOverlay.h
+++ b/interface/src/ui/overlays/Text3DOverlay.h
@@ -39,7 +39,7 @@ public:
float getTopMargin() const { return _topMargin; }
float getRightMargin() const { return _rightMargin; }
float getBottomMargin() const { return _bottomMargin; }
- xColor getBackgroundColor();
+ ScriptVec3UChar getBackgroundColor();
float getTextAlpha() { return _textAlpha; }
float getBackgroundAlpha() { return getAlpha(); }
bool isTransparent() override { return Overlay::isTransparent() || _textAlpha < 1.0f; }
@@ -65,7 +65,7 @@ private:
QString _text;
mutable QMutex _mutex; // used to make get/setText threadsafe, mutable so can be used in const functions
- xColor _backgroundColor = xColor { 0, 0, 0 };
+ ScriptVec3UChar _backgroundColor { 0, 0, 0 };
float _textAlpha { 1.0f };
float _lineHeight { 1.0f };
float _leftMargin { 0.1f };
diff --git a/interface/src/ui/overlays/TextOverlay.cpp b/interface/src/ui/overlays/TextOverlay.cpp
index e7641ab2c2..5e7f648320 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 {Color} color=255,255,255 - The color of the text. Synonym: textColor
. Write-only.
+ * @property {Vec3Color} 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 {Color} backgroundColor=0,0,0 - The color of the background rectangle. Write-only.
+ * @property {Vec3Color} 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 148fe2d49d..1f5dba177d 100644
--- a/interface/src/ui/overlays/Web3DOverlay.cpp
+++ b/interface/src/ui/overlays/Web3DOverlay.cpp
@@ -513,7 +513,7 @@ void Web3DOverlay::setProperties(const QVariantMap& properties) {
* @typedef {object} Overlays.Web3DProperties
*
* @property {string} type=web3d - Has the value "web3d"
. Read-only.
- * @property {Color} color=255,255,255 - The color of the overlay.
+ * @property {Vec3Color} 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/entities-renderer/src/RenderableLightEntityItem.cpp b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp
index 4ea293a3da..d746ec1ea9 100644
--- a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp
@@ -41,7 +41,7 @@ void LightEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint
float largestDiameter = glm::compMax(dimensions);
light->setMaximumRadius(largestDiameter / 2.0f);
- light->setColor(toGlm(entity->getXColor()));
+ light->setColor(toGlm(entity->getColor()));
float intensity = entity->getIntensity();//* entity->getFadingRatio();
light->setIntensity(intensity);
diff --git a/libraries/entities-renderer/src/RenderableLineEntityItem.cpp b/libraries/entities-renderer/src/RenderableLineEntityItem.cpp
index 9ac7e9921f..6a472cab1e 100644
--- a/libraries/entities-renderer/src/RenderableLineEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableLineEntityItem.cpp
@@ -37,7 +37,7 @@ void LineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointe
if (_lineVerticesID == GeometryCache::UNKNOWN_ID) {
_lineVerticesID = geometryCache->allocateID();
}
- glm::vec4 lineColor(toGlm(entity->getXColor()), entity->getLocalRenderAlpha());
+ glm::vec4 lineColor(toGlm(entity->getColor()), entity->getLocalRenderAlpha());
geometryCache->updateVertices(_lineVerticesID, _linePoints, lineColor);
}
diff --git a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp
index ae98ccb07a..f8ee27615e 100644
--- a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp
@@ -149,7 +149,7 @@ void PolyLineEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer&
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
PolyLineUniforms uniforms;
- uniforms.color = toGlm(entity->getXColor());
+ uniforms.color = toGlm(entity->getColor());
memcpy(&_uniformBuffer.edit(), &uniforms, sizeof(PolyLineUniforms));
auto pointsChanged = entity->pointsChanged();
auto strokeWidthsChanged = entity->strokeWidthsChanged();
@@ -175,7 +175,7 @@ void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
}
if (strokeColorsChanged) {
_lastStrokeColors = entity->getStrokeColors();
- _lastStrokeColors = _lastNormals.size() == _lastStrokeColors.size() ? _lastStrokeColors : QVector({ toGlm(entity->getXColor()) });
+ _lastStrokeColors = _lastNormals.size() == _lastStrokeColors.size() ? _lastStrokeColors : QVector({ toGlm(entity->getColor()) });
}
if (pointsChanged || strokeWidthsChanged || normalsChanged || strokeColorsChanged) {
_empty = std::min(_lastPoints.size(), std::min(_lastNormals.size(), _lastStrokeWidths.size())) < 2;
diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp
index ce4b6d9175..b7c94ed834 100644
--- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp
@@ -47,11 +47,11 @@ bool TextEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoint
return true;
}
- if (_textColor != toGlm(entity->getTextColorX())) {
+ if (_textColor != toGlm(entity->getTextColor())) {
return true;
}
- if (_backgroundColor != toGlm(entity->getBackgroundColorX())) {
+ if (_backgroundColor != toGlm(entity->getBackgroundColor())) {
return true;
}
@@ -77,8 +77,8 @@ void TextEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
}
void TextEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
- _textColor = toGlm(entity->getTextColorX());
- _backgroundColor = toGlm(entity->getBackgroundColorX());
+ _textColor = toGlm(entity->getTextColor());
+ _backgroundColor = toGlm(entity->getBackgroundColor());
_faceCamera = entity->getFaceCamera();
_lineHeight = entity->getLineHeight();
_text = entity->getText();
diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp
index 7cd7849ef9..137f256de2 100644
--- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp
+++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp
@@ -368,10 +368,10 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity)
haze->setAltitudeBased(_hazeProperties.getHazeAltitudeEffect());
haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange()));
- xColor hazeColor = _hazeProperties.getHazeColor();
- haze->setHazeColor(glm::vec3(hazeColor.red / 255.0, hazeColor.green / 255.0, hazeColor.blue / 255.0));
- xColor hazeGlareColor = _hazeProperties.getHazeGlareColor();
- haze->setHazeGlareColor(glm::vec3(hazeGlareColor.red / 255.0, hazeGlareColor.green / 255.0, hazeGlareColor.blue / 255.0));
+ ScriptVec3UChar hazeColor = _hazeProperties.getHazeColor();
+ haze->setHazeColor(toGlm(hazeColor));
+ ScriptVec3UChar hazeGlareColor = _hazeProperties.getHazeGlareColor();
+ haze->setHazeGlareColor(toGlm(hazeGlareColor));
haze->setHazeEnableGlare(_hazeProperties.getHazeEnableGlare());
haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle()));
@@ -392,7 +392,7 @@ void ZoneEntityRenderer::updateKeyBackgroundFromEntity(const TypedEntityPointer&
setSkyboxMode((ComponentMode)entity->getSkyboxMode());
editBackground();
- setSkyboxColor(_skyboxProperties.getColorVec3());
+ setSkyboxColor(toGlm(_skyboxProperties.getColor()));
setProceduralUserData(entity->getUserData());
setSkyboxURL(_skyboxProperties.getURL());
}
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp
index 716e33b0c8..1f79afcd29 100644
--- a/libraries/entities/src/EntityItemProperties.cpp
+++ b/libraries/entities/src/EntityItemProperties.cpp
@@ -653,7 +653,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 {Color} color=255,255,255 - The color of the light emitted.
+ * @property {Vec3Color} 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
@@ -686,7 +686,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 {Color} color=255,255,255 - The color of the line.
+ * @property {Vec3Color} color=255,255,255 - The color of the line.
* @example Draw lines in a "V".
* var entity = Entities.addEntity({
* type: "Line",
@@ -767,7 +767,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 {Color} color=255,255,255 - Currently not used.
+ * @property {Vec3Color} 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.
@@ -892,12 +892,12 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* particleRadius
value is used.
* @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 {Color} color=255,255,255 - The color of each particle at the middle of its life.
- * @property {Color} colorStart=NAN,NAN,NAN - The color of each particle at the start of its life. If any of the values are NAN, the
+ * @property {Vec3Color} color=255,255,255 - The color of each particle at the middle of its life.
+ * @property {Vec3Color} colorStart=NAN,NAN,NAN - The color of each particle at the start of its life. If any of the values are NAN, the
* color
value is used.
- * @property {Color} colorFinish=NAN,NAN,NAN - The color of each particle at the end of its life. If any of the values are NAN, the
+ * @property {Vec3Color} colorFinish=NAN,NAN,NAN - The color of each particle at the end of its life. If any of the values are NAN, the
* color
value is used.
- * @property {Color} colorSpread=0,0,0 - The spread in color that each particle is given. If
+ * @property {Vec3Color} 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 an acceleration in the range {red: 90, green: 75, blue: 50}
* – {red: 110, green: 125, blue: 150}
.
@@ -944,7 +944,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 {Color} color=255,255,255 - The base color of the line, which is multiplied with the color of the texture for
+ * @property {Vec3Color} 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.
@@ -1033,7 +1033,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 {Color} color=255,255,255 - The color of the entity.
+ * @property {Vec3Color} color=255,255,255 - The color of the entity.
* @example Create a cylinder.
* var shape = Entities.addEntity({
* type: "Shape",
@@ -1061,8 +1061,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 {Color} textColor=255,255,255 - The color of the text.
- * @property {Color} backgroundColor=0,0,0 - The color of the background rectangle.
+ * @property {Vec3Color} textColor=255,255,255 - The color of the text.
+ * @property {Vec3Color} 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.
@@ -1523,8 +1523,8 @@ 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, xColor, setColor);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(colorSpread, xColor, setColorSpread);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(color, ScriptVec3UChar, setColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(colorSpread, ScriptVec3UChar, setColorSpread);
COPY_PROPERTY_FROM_QSCRIPTVALUE(colorStart, ScriptVec3Float, setColorStart);
COPY_PROPERTY_FROM_QSCRIPTVALUE(colorFinish, ScriptVec3Float, setColorFinish);
COPY_PROPERTY_FROM_QSCRIPTVALUE(alpha, float, setAlpha);
@@ -1551,8 +1551,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, xColor, setTextColor);
- COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundColor, xColor, setBackgroundColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, ScriptVec3UChar, setTextColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(backgroundColor, ScriptVec3UChar, setBackgroundColor);
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(shapeType, ShapeType);
COPY_PROPERTY_FROM_QSCRIPTVALUE(maxParticles, quint32, setMaxParticles);
COPY_PROPERTY_FROM_QSCRIPTVALUE(lifespan, float, setLifespan);
@@ -1882,198 +1882,198 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
static std::once_flag initMap;
std::call_once(initMap, [](){
- ADD_PROPERTY_TO_MAP(PROP_VISIBLE, Visible, visible, bool);
- ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool);
- ADD_PROPERTY_TO_MAP(PROP_POSITION, Position, position, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_DIMENSIONS, Dimensions, dimensions, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_ROTATION, Rotation, rotation, glm::quat);
- ADD_PROPERTY_TO_MAP(PROP_DENSITY, Density, density, float);
- ADD_PROPERTY_TO_MAP(PROP_VELOCITY, Velocity, velocity, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_GRAVITY, Gravity, gravity, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_ACCELERATION, Acceleration, acceleration, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_DAMPING, Damping, damping, float);
- ADD_PROPERTY_TO_MAP(PROP_RESTITUTION, Restitution, restitution, float);
- ADD_PROPERTY_TO_MAP(PROP_FRICTION, Friction, friction, float);
- ADD_PROPERTY_TO_MAP(PROP_LIFETIME, Lifetime, lifetime, float);
- ADD_PROPERTY_TO_MAP(PROP_SCRIPT, Script, script, QString);
- 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, xColor);
- ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, ColorSpread, colorSpread, xColor);
- 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_ALPHA, Alpha, alpha, float);
- ADD_PROPERTY_TO_MAP(PROP_ALPHA_SPREAD, AlphaSpread, alphaSpread, float);
- ADD_PROPERTY_TO_MAP(PROP_ALPHA_START, AlphaStart, alphaStart, float);
- ADD_PROPERTY_TO_MAP(PROP_ALPHA_FINISH, AlphaFinish, alphaFinish, float);
- ADD_PROPERTY_TO_MAP(PROP_EMITTER_SHOULD_TRAIL, EmitterShouldTrail, emitterShouldTrail, bool);
- ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_COMPOUND_SHAPE_URL, CompoundShapeURL, compoundShapeURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_ANGULAR_VELOCITY, AngularVelocity, angularVelocity, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float);
- ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, Collisionless, collisionless, bool);
- ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, unused, ignoreForCollisions, unused); // legacy support
- ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collisionMask, unused);
- ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collidesWith, unused);
- ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, collisionsWillMove, unused); // legacy support
- ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, dynamic, unused);
- ADD_PROPERTY_TO_MAP(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool);
- ADD_PROPERTY_TO_MAP(PROP_INTENSITY, Intensity, intensity, float);
- ADD_PROPERTY_TO_MAP(PROP_FALLOFF_RADIUS, FalloffRadius, falloffRadius, float);
- ADD_PROPERTY_TO_MAP(PROP_EXPONENT, Exponent, exponent, float);
- ADD_PROPERTY_TO_MAP(PROP_CUTOFF, Cutoff, cutoff, float);
- ADD_PROPERTY_TO_MAP(PROP_LOCKED, Locked, locked, bool);
- ADD_PROPERTY_TO_MAP(PROP_TEXTURES, Textures, textures, QString);
- ADD_PROPERTY_TO_MAP(PROP_USER_DATA, UserData, userData, QString);
- 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, xColor);
- ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, xColor);
- 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);
- ADD_PROPERTY_TO_MAP(PROP_EMITTING_PARTICLES, IsEmitting, isEmitting, bool);
- ADD_PROPERTY_TO_MAP(PROP_EMIT_RATE, EmitRate, emitRate, float);
- ADD_PROPERTY_TO_MAP(PROP_EMIT_SPEED, EmitSpeed, emitSpeed, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_SPEED_SPREAD, SpeedSpread, speedSpread, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_EMIT_ORIENTATION, EmitOrientation, emitOrientation, glm::quat);
- ADD_PROPERTY_TO_MAP(PROP_EMIT_DIMENSIONS, EmitDimensions, emitDimensions, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_EMIT_RADIUS_START, EmitRadiusStart, emitRadiusStart, float);
- ADD_PROPERTY_TO_MAP(PROP_POLAR_START, EmitPolarStart, polarStart, float);
- ADD_PROPERTY_TO_MAP(PROP_POLAR_FINISH, EmitPolarFinish, polarFinish, float);
- ADD_PROPERTY_TO_MAP(PROP_AZIMUTH_START, EmitAzimuthStart, azimuthStart, float);
- ADD_PROPERTY_TO_MAP(PROP_AZIMUTH_FINISH, EmitAzimuthFinish, azimuthFinish, float);
- ADD_PROPERTY_TO_MAP(PROP_EMIT_ACCELERATION, EmitAcceleration, emitAcceleration, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_ACCELERATION_SPREAD, AccelerationSpread, accelerationSpread, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_PARTICLE_RADIUS, ParticleRadius, particleRadius, float);
- ADD_PROPERTY_TO_MAP(PROP_RADIUS_SPREAD, RadiusSpread, radiusSpread, float);
- ADD_PROPERTY_TO_MAP(PROP_RADIUS_START, RadiusStart, radiusStart, float);
- ADD_PROPERTY_TO_MAP(PROP_RADIUS_FINISH, RadiusFinish, radiusFinish, float);
+ ADD_PROPERTY_TO_MAP(PROP_VISIBLE, visible);
+ ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, canCastShadow);
+ ADD_PROPERTY_TO_MAP(PROP_POSITION, position);
+ ADD_PROPERTY_TO_MAP(PROP_DIMENSIONS, dimensions);
+ ADD_PROPERTY_TO_MAP(PROP_ROTATION, rotation);
+ ADD_PROPERTY_TO_MAP(PROP_DENSITY, density);
+ ADD_PROPERTY_TO_MAP(PROP_VELOCITY, velocity);
+ ADD_PROPERTY_TO_MAP(PROP_GRAVITY, gravity);
+ ADD_PROPERTY_TO_MAP(PROP_ACCELERATION, acceleration);
+ ADD_PROPERTY_TO_MAP(PROP_DAMPING, damping);
+ ADD_PROPERTY_TO_MAP(PROP_RESTITUTION, restitution);
+ ADD_PROPERTY_TO_MAP(PROP_FRICTION, friction);
+ ADD_PROPERTY_TO_MAP(PROP_LIFETIME, lifetime);
+ ADD_PROPERTY_TO_MAP(PROP_SCRIPT, script);
+ ADD_PROPERTY_TO_MAP(PROP_SCRIPT_TIMESTAMP, scriptTimestamp);
+ ADD_PROPERTY_TO_MAP(PROP_SERVER_SCRIPTS, serverScripts);
+ ADD_PROPERTY_TO_MAP(PROP_COLLISION_SOUND_URL, collisionSoundURL);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR, color);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR_SPREAD, colorSpread);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR_START, colorStart);
+ ADD_PROPERTY_TO_MAP(PROP_COLOR_FINISH, colorFinish);
+ ADD_PROPERTY_TO_MAP(PROP_ALPHA, alpha);
+ ADD_PROPERTY_TO_MAP(PROP_ALPHA_SPREAD, alphaSpread);
+ ADD_PROPERTY_TO_MAP(PROP_ALPHA_START, alphaStart);
+ ADD_PROPERTY_TO_MAP(PROP_ALPHA_FINISH, alphaFinish);
+ ADD_PROPERTY_TO_MAP(PROP_EMITTER_SHOULD_TRAIL, emitterShouldTrail);
+ ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, modelURL);
+ ADD_PROPERTY_TO_MAP(PROP_COMPOUND_SHAPE_URL, compoundShapeURL);
+ ADD_PROPERTY_TO_MAP(PROP_REGISTRATION_POINT, registrationPoint);
+ ADD_PROPERTY_TO_MAP(PROP_ANGULAR_VELOCITY, angularVelocity);
+ ADD_PROPERTY_TO_MAP(PROP_ANGULAR_DAMPING, angularDamping);
+ ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, collisionless);
+ ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, ignoreForCollisions); // legacy support
+ ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, collisionMask);
+ ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, collidesWith);
+ ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, collisionsWillMove); // legacy support
+ ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, dynamic);
+ ADD_PROPERTY_TO_MAP(PROP_IS_SPOTLIGHT, isSpotlight);
+ ADD_PROPERTY_TO_MAP(PROP_INTENSITY, intensity);
+ ADD_PROPERTY_TO_MAP(PROP_FALLOFF_RADIUS, falloffRadius);
+ ADD_PROPERTY_TO_MAP(PROP_EXPONENT, exponent);
+ ADD_PROPERTY_TO_MAP(PROP_CUTOFF, cutoff);
+ ADD_PROPERTY_TO_MAP(PROP_LOCKED, locked);
+ ADD_PROPERTY_TO_MAP(PROP_TEXTURES, textures);
+ ADD_PROPERTY_TO_MAP(PROP_USER_DATA, userData);
+ ADD_PROPERTY_TO_MAP(PROP_SIMULATION_OWNER, simulationOwner);
+ ADD_PROPERTY_TO_MAP(PROP_TEXT, text);
+ ADD_PROPERTY_TO_MAP(PROP_LINE_HEIGHT, lineHeight);
+ ADD_PROPERTY_TO_MAP(PROP_TEXT_COLOR, textColor);
+ ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_COLOR, backgroundColor);
+ ADD_PROPERTY_TO_MAP(PROP_SHAPE_TYPE, shapeType);
+ ADD_PROPERTY_TO_MAP(PROP_MAX_PARTICLES, maxParticles);
+ ADD_PROPERTY_TO_MAP(PROP_LIFESPAN, lifespan);
+ ADD_PROPERTY_TO_MAP(PROP_EMITTING_PARTICLES, isEmitting);
+ ADD_PROPERTY_TO_MAP(PROP_EMIT_RATE, emitRate);
+ ADD_PROPERTY_TO_MAP(PROP_EMIT_SPEED, emitSpeed);
+ ADD_PROPERTY_TO_MAP(PROP_SPEED_SPREAD, speedSpread);
+ ADD_PROPERTY_TO_MAP(PROP_EMIT_ORIENTATION, emitOrientation);
+ ADD_PROPERTY_TO_MAP(PROP_EMIT_DIMENSIONS, emitDimensions);
+ ADD_PROPERTY_TO_MAP(PROP_EMIT_RADIUS_START, emitRadiusStart);
+ ADD_PROPERTY_TO_MAP(PROP_POLAR_START, polarStart);
+ ADD_PROPERTY_TO_MAP(PROP_POLAR_FINISH, polarFinish);
+ ADD_PROPERTY_TO_MAP(PROP_AZIMUTH_START, azimuthStart);
+ ADD_PROPERTY_TO_MAP(PROP_AZIMUTH_FINISH, azimuthFinish);
+ ADD_PROPERTY_TO_MAP(PROP_EMIT_ACCELERATION, emitAcceleration);
+ ADD_PROPERTY_TO_MAP(PROP_ACCELERATION_SPREAD, accelerationSpread);
+ ADD_PROPERTY_TO_MAP(PROP_PARTICLE_RADIUS, particleRadius);
+ ADD_PROPERTY_TO_MAP(PROP_RADIUS_SPREAD, radiusSpread);
+ ADD_PROPERTY_TO_MAP(PROP_RADIUS_START, radiusStart);
+ ADD_PROPERTY_TO_MAP(PROP_RADIUS_FINISH, radiusFinish);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_URL, MaterialURL, materialURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_MODE, MaterialMappingMode, materialMappingMode, MaterialMappingMode);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_PRIORITY, Priority, priority, quint16);
- ADD_PROPERTY_TO_MAP(PROP_PARENT_MATERIAL_NAME, ParentMaterialName, parentMaterialName, QString);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_POS, MaterialMappingPos, materialMappingPos, ScriptVec2Float);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_SCALE, MaterialMappingScale, materialMappingScale, ScriptVec2Float);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_ROT, MaterialMappingRot, materialMappingRot, float);
- ADD_PROPERTY_TO_MAP(PROP_MATERIAL_DATA, MaterialData, materialData, QString);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_URL, materialURL);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_MODE, materialMappingMode);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_PRIORITY, priority);
+ ADD_PROPERTY_TO_MAP(PROP_PARENT_MATERIAL_NAME, parentMaterialName);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_POS, materialMappingPos);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_SCALE, materialMappingScale);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_MAPPING_ROT, materialMappingRot);
+ ADD_PROPERTY_TO_MAP(PROP_MATERIAL_DATA, materialData);
- ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool);
+ ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, isVisibleInSecondaryCamera);
// Certifiable Properties
- ADD_PROPERTY_TO_MAP(PROP_ITEM_NAME, ItemName, itemName, QString);
- ADD_PROPERTY_TO_MAP(PROP_ITEM_DESCRIPTION, ItemDescription, itemDescription, QString);
- ADD_PROPERTY_TO_MAP(PROP_ITEM_CATEGORIES, ItemCategories, itemCategories, QString);
- ADD_PROPERTY_TO_MAP(PROP_ITEM_ARTIST, ItemArtist, itemArtist, QString);
- ADD_PROPERTY_TO_MAP(PROP_ITEM_LICENSE, ItemLicense, itemLicense, QString);
- ADD_PROPERTY_TO_MAP(PROP_LIMITED_RUN, LimitedRun, limitedRun, quint32);
- ADD_PROPERTY_TO_MAP(PROP_MARKETPLACE_ID, MarketplaceID, marketplaceID, QString);
- ADD_PROPERTY_TO_MAP(PROP_EDITION_NUMBER, EditionNumber, editionNumber, quint32);
- ADD_PROPERTY_TO_MAP(PROP_ENTITY_INSTANCE_NUMBER, EntityInstanceNumber, entityInstanceNumber, quint32);
- 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_ITEM_NAME, itemName);
+ ADD_PROPERTY_TO_MAP(PROP_ITEM_DESCRIPTION, itemDescription);
+ ADD_PROPERTY_TO_MAP(PROP_ITEM_CATEGORIES, itemCategories);
+ ADD_PROPERTY_TO_MAP(PROP_ITEM_ARTIST, itemArtist);
+ ADD_PROPERTY_TO_MAP(PROP_ITEM_LICENSE, itemLicense);
+ ADD_PROPERTY_TO_MAP(PROP_LIMITED_RUN, limitedRun);
+ ADD_PROPERTY_TO_MAP(PROP_MARKETPLACE_ID, marketplaceID);
+ ADD_PROPERTY_TO_MAP(PROP_EDITION_NUMBER, editionNumber);
+ ADD_PROPERTY_TO_MAP(PROP_ENTITY_INSTANCE_NUMBER, entityInstanceNumber);
+ ADD_PROPERTY_TO_MAP(PROP_CERTIFICATE_ID, certificateID);
+ ADD_PROPERTY_TO_MAP(PROP_STATIC_CERTIFICATE_VERSION, staticCertificateVersion);
- ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, KeyLightColor, keyLightColor, xColor);
- ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, KeyLightIntensity, keyLightIntensity, float);
- ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, KeyLightDirection, keyLightDirection, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, KeyLightCastShadows, keyLightCastShadows, bool);
+ ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_COLOR, keyLightColor);
+ ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_INTENSITY, keyLightIntensity);
+ ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_DIRECTION, keyLightDirection);
+ ADD_PROPERTY_TO_MAP(PROP_KEYLIGHT_CAST_SHADOW, keyLightCastShadows);
- ADD_PROPERTY_TO_MAP(PROP_VOXEL_VOLUME_SIZE, VoxelVolumeSize, voxelVolumeSize, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_VOXEL_DATA, VoxelData, voxelData, QByteArray);
- ADD_PROPERTY_TO_MAP(PROP_VOXEL_SURFACE_STYLE, VoxelSurfaceStyle, voxelSurfaceStyle, uint16_t);
- ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString);
- ADD_PROPERTY_TO_MAP(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString);
- ADD_PROPERTY_TO_MAP(PROP_LINE_WIDTH, LineWidth, lineWidth, float);
- ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector);
- ADD_PROPERTY_TO_MAP(PROP_HREF, Href, href, QString);
- ADD_PROPERTY_TO_MAP(PROP_DESCRIPTION, Description, description, QString);
- ADD_PROPERTY_TO_MAP(PROP_FACE_CAMERA, FaceCamera, faceCamera, bool);
- ADD_PROPERTY_TO_MAP(PROP_ACTION_DATA, ActionData, actionData, QByteArray);
- ADD_PROPERTY_TO_MAP(PROP_NORMALS, Normals, normals, QVector);
- ADD_PROPERTY_TO_MAP(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector);
- ADD_PROPERTY_TO_MAP(PROP_STROKE_WIDTHS, StrokeWidths, strokeWidths, QVector);
- ADD_PROPERTY_TO_MAP(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, QVector);
- ADD_PROPERTY_TO_MAP(PROP_X_TEXTURE_URL, XTextureURL, xTextureURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_Y_TEXTURE_URL, YTextureURL, yTextureURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_Z_TEXTURE_URL, ZTextureURL, zTextureURL, QString);
- ADD_PROPERTY_TO_MAP(PROP_X_N_NEIGHBOR_ID, XNNeighborID, xNNeighborID, EntityItemID);
- ADD_PROPERTY_TO_MAP(PROP_Y_N_NEIGHBOR_ID, YNNeighborID, yNNeighborID, EntityItemID);
- ADD_PROPERTY_TO_MAP(PROP_Z_N_NEIGHBOR_ID, ZNNeighborID, zNNeighborID, EntityItemID);
- ADD_PROPERTY_TO_MAP(PROP_X_P_NEIGHBOR_ID, XPNeighborID, xPNeighborID, EntityItemID);
- ADD_PROPERTY_TO_MAP(PROP_Y_P_NEIGHBOR_ID, YPNeighborID, yPNeighborID, EntityItemID);
- ADD_PROPERTY_TO_MAP(PROP_Z_P_NEIGHBOR_ID, ZPNeighborID, zPNeighborID, EntityItemID);
+ ADD_PROPERTY_TO_MAP(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize);
+ ADD_PROPERTY_TO_MAP(PROP_VOXEL_DATA, voxelData);
+ ADD_PROPERTY_TO_MAP(PROP_VOXEL_SURFACE_STYLE, voxelSurfaceStyle);
+ ADD_PROPERTY_TO_MAP(PROP_NAME, name);
+ ADD_PROPERTY_TO_MAP(PROP_SOURCE_URL, sourceUrl);
+ ADD_PROPERTY_TO_MAP(PROP_LINE_WIDTH, lineWidth);
+ ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, linePoints);
+ ADD_PROPERTY_TO_MAP(PROP_HREF, href);
+ ADD_PROPERTY_TO_MAP(PROP_DESCRIPTION, description);
+ ADD_PROPERTY_TO_MAP(PROP_FACE_CAMERA, faceCamera);
+ ADD_PROPERTY_TO_MAP(PROP_ACTION_DATA, actionData);
+ ADD_PROPERTY_TO_MAP(PROP_NORMALS, normals);
+ ADD_PROPERTY_TO_MAP(PROP_STROKE_COLORS, strokeColors);
+ ADD_PROPERTY_TO_MAP(PROP_STROKE_WIDTHS, strokeWidths);
+ ADD_PROPERTY_TO_MAP(PROP_IS_UV_MODE_STRETCH, isUVModeStretch);
+ ADD_PROPERTY_TO_MAP(PROP_X_TEXTURE_URL, xTextureURL);
+ ADD_PROPERTY_TO_MAP(PROP_Y_TEXTURE_URL, yTextureURL);
+ ADD_PROPERTY_TO_MAP(PROP_Z_TEXTURE_URL, zTextureURL);
+ ADD_PROPERTY_TO_MAP(PROP_X_N_NEIGHBOR_ID, xNNeighborID);
+ ADD_PROPERTY_TO_MAP(PROP_Y_N_NEIGHBOR_ID, yNNeighborID);
+ ADD_PROPERTY_TO_MAP(PROP_Z_N_NEIGHBOR_ID, zNNeighborID);
+ ADD_PROPERTY_TO_MAP(PROP_X_P_NEIGHBOR_ID, xPNeighborID);
+ ADD_PROPERTY_TO_MAP(PROP_Y_P_NEIGHBOR_ID, yPNeighborID);
+ ADD_PROPERTY_TO_MAP(PROP_Z_P_NEIGHBOR_ID, zPNeighborID);
- ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid);
- ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t);
+ ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, parentID);
+ ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, parentJointIndex);
- ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, LocalPosition, localPosition, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, glm::quat);
- ADD_PROPERTY_TO_MAP(PROP_LOCAL_VELOCITY, LocalVelocity, localVelocity, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_LOCAL_ANGULAR_VELOCITY, LocalAngularVelocity, localAngularVelocity, glm::vec3);
- ADD_PROPERTY_TO_MAP(PROP_LOCAL_DIMENSIONS, LocalDimensions, localDimensions, glm::vec3);
+ ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, localPosition);
+ ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, localRotation);
+ ADD_PROPERTY_TO_MAP(PROP_LOCAL_VELOCITY, localVelocity);
+ ADD_PROPERTY_TO_MAP(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity);
+ ADD_PROPERTY_TO_MAP(PROP_LOCAL_DIMENSIONS, localDimensions);
- ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector);
- ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector);
- ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector);
- ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS, JointTranslations, jointTranslations, QVector);
- ADD_PROPERTY_TO_MAP(PROP_RELAY_PARENT_JOINTS, RelayParentJoints, relayParentJoints, bool);
+ ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
+ ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, jointRotations);
+ ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
+ ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS, jointTranslations);
+ ADD_PROPERTY_TO_MAP(PROP_RELAY_PARENT_JOINTS, relayParentJoints);
- ADD_PROPERTY_TO_MAP(PROP_SHAPE, Shape, shape, QString);
+ ADD_PROPERTY_TO_MAP(PROP_SHAPE, shape);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_URL, Animation, animation, URL, url);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FPS, Animation, animation, FPS, fps);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FRAME_INDEX, Animation, animation, CurrentFrame, currentFrame);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_PLAYING, Animation, animation, Running, running);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LOOP, Animation, animation, Loop, loop);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FIRST_FRAME, Animation, animation, FirstFrame, firstFrame);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LAST_FRAME, Animation, animation, LastFrame, lastFrame);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_HOLD, Animation, animation, Hold, hold);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_ALLOW_TRANSLATION, Animation, animation, AllowTranslation, allowTranslation);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_URL, animation, url);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FPS, animation, fps);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FRAME_INDEX, animation, currentFrame);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_PLAYING, animation, running);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LOOP, animation, loop);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_FIRST_FRAME, animation, firstFrame);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LAST_FRAME, animation, lastFrame);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_HOLD, animation, hold);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_ALLOW_TRANSLATION, animation, allowTranslation);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_URL, Skybox, skybox, URL, url);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_COLOR, skybox, color);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_URL, skybox, url);
- ADD_PROPERTY_TO_MAP(PROP_FLYING_ALLOWED, FlyingAllowed, flyingAllowed, bool);
- ADD_PROPERTY_TO_MAP(PROP_GHOSTING_ALLOWED, GhostingAllowed, ghostingAllowed, bool);
- ADD_PROPERTY_TO_MAP(PROP_FILTER_URL, FilterURL, filterURL, QString);
+ ADD_PROPERTY_TO_MAP(PROP_FLYING_ALLOWED, flyingAllowed);
+ ADD_PROPERTY_TO_MAP(PROP_GHOSTING_ALLOWED, ghostingAllowed);
+ ADD_PROPERTY_TO_MAP(PROP_FILTER_URL, filterURL);
- ADD_PROPERTY_TO_MAP(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t);
+ ADD_PROPERTY_TO_MAP(PROP_HAZE_MODE, hazeMode);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_COLOR, Haze, haze, HazeGlareColor, hazeGlareColor);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ENABLE_GLARE, Haze, haze, HazeEnableGlare, hazeEnableGlare);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_ANGLE, Haze, haze, HazeGlareAngle, hazeGlareAngle);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_RANGE, haze, hazeRange);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_COLOR, haze, hazeColor);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_COLOR, haze, hazeGlareColor);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ENABLE_GLARE, haze, hazeEnableGlare);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_GLARE_ANGLE, haze, hazeGlareAngle);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ALTITUDE_EFFECT, Haze, haze, HazeAltitudeEffect, hazeAltitudeEfect);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_CEILING, Haze, haze, HazeCeiling, hazeCeiling);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BASE_REF, Haze, haze, HazeBaseRef, hazeBaseRef);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ALTITUDE_EFFECT, haze, hazeAltitudeEfect);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_CEILING, haze, hazeCeiling);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BASE_REF, haze, hazeBaseRef);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BACKGROUND_BLEND, Haze, haze, HazeBackgroundBlend, hazeBackgroundBlend);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_BACKGROUND_BLEND, haze, hazeBackgroundBlend);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ATTENUATE_KEYLIGHT, Haze, haze, HazeAttenuateKeyLight, hazeAttenuateKeyLight);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_RANGE, Haze, haze, HazeKeyLightRange, hazeKeyLightRange);
- ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_ALTITUDE, Haze, haze, HazeKeyLightAltitude, hazeKeyLightAltitude);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_ATTENUATE_KEYLIGHT, haze, hazeAttenuateKeyLight);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_RANGE, haze, hazeKeyLightRange);
+ ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_ALTITUDE, haze, hazeKeyLightAltitude);
- ADD_PROPERTY_TO_MAP(PROP_KEY_LIGHT_MODE, KeyLightMode, keyLightMode, uint32_t);
- ADD_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t);
- ADD_PROPERTY_TO_MAP(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t);
+ ADD_PROPERTY_TO_MAP(PROP_KEY_LIGHT_MODE, keyLightMode);
+ ADD_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_MODE, ambientLightMode);
+ ADD_PROPERTY_TO_MAP(PROP_SKYBOX_MODE, skyboxMode);
- ADD_PROPERTY_TO_MAP(PROP_DPI, DPI, dpi, uint16_t);
+ ADD_PROPERTY_TO_MAP(PROP_DPI, dpi);
- ADD_PROPERTY_TO_MAP(PROP_CLONEABLE, Cloneable, cloneable, bool);
- ADD_PROPERTY_TO_MAP(PROP_CLONE_LIFETIME, CloneLifetime, cloneLifetime, float);
- ADD_PROPERTY_TO_MAP(PROP_CLONE_LIMIT, CloneLimit, cloneLimit, float);
- ADD_PROPERTY_TO_MAP(PROP_CLONE_DYNAMIC, CloneDynamic, cloneDynamic, bool);
- ADD_PROPERTY_TO_MAP(PROP_CLONE_AVATAR_ENTITY, CloneAvatarEntity, cloneAvatarEntity, bool);
- ADD_PROPERTY_TO_MAP(PROP_CLONE_ORIGIN_ID, CloneOriginID, cloneOriginID, QUuid);
+ ADD_PROPERTY_TO_MAP(PROP_CLONEABLE, cloneable);
+ ADD_PROPERTY_TO_MAP(PROP_CLONE_LIFETIME, cloneLifetime);
+ ADD_PROPERTY_TO_MAP(PROP_CLONE_LIMIT, cloneLimit);
+ ADD_PROPERTY_TO_MAP(PROP_CLONE_DYNAMIC, cloneDynamic);
+ ADD_PROPERTY_TO_MAP(PROP_CLONE_AVATAR_ENTITY, cloneAvatarEntity);
+ ADD_PROPERTY_TO_MAP(PROP_CLONE_ORIGIN_ID, cloneOriginID);
// FIXME - these are not yet handled
- //ADD_PROPERTY_TO_MAP(PROP_CREATED, Created, created, quint64);
+ //ADD_PROPERTY_TO_MAP(PROP_CREATED, created);
});
@@ -2257,7 +2257,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
if (properties.getType() == EntityTypes::Light) {
APPEND_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, properties.getIsSpotlight());
- APPEND_ENTITY_PROPERTY(PROP_COLOR, properties.getColor());
APPEND_ENTITY_PROPERTY(PROP_INTENSITY, properties.getIntensity());
APPEND_ENTITY_PROPERTY(PROP_FALLOFF_RADIUS, properties.getFalloffRadius());
APPEND_ENTITY_PROPERTY(PROP_EXPONENT, properties.getExponent());
@@ -2585,7 +2584,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SCRIPT, QString, setScript);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SCRIPT_TIMESTAMP, quint64, setScriptTimestamp);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SERVER_SCRIPTS, QString, setServerScripts);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, xColor, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_REGISTRATION_POINT, ScriptVec3Float, setRegistrationPoint);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANGULAR_VELOCITY, ScriptVec3Float, setAngularVelocity);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ANGULAR_DAMPING, float, setAngularDamping);
@@ -2610,8 +2609,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, xColor, setTextColor);
- READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, xColor, setBackgroundColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_COLOR, ScriptVec3UChar, setTextColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, ScriptVec3UChar, setBackgroundColor);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FACE_CAMERA, bool, setFaceCamera);
}
@@ -2632,7 +2631,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, xColor, setColor);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR, ScriptVec3UChar, 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);
@@ -2660,7 +2659,7 @@ 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_SPREAD, xColor, setColorSpread);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_SPREAD, ScriptVec3UChar, setColorSpread);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_START, ScriptVec3Float, setColorStart);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLOR_FINISH, ScriptVec3Float, setColorFinish);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ALPHA_SPREAD, float, setAlphaSpread);
diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h
index b03dcae841..ff08fb531d 100644
--- a/libraries/entities/src/EntityItemProperties.h
+++ b/libraries/entities/src/EntityItemProperties.h
@@ -134,8 +134,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, xColor, ParticleEffectEntityItem::DEFAULT_XCOLOR);
- DEFINE_PROPERTY_REF(PROP_COLOR_SPREAD, ColorSpread, colorSpread, xColor, ParticleEffectEntityItem::DEFAULT_XCOLOR_SPREAD);
+ DEFINE_PROPERTY_REF(PROP_COLOR, Color, color, ScriptVec3UChar, particle::DEFAULT_COLOR);
+ DEFINE_PROPERTY_REF(PROP_COLOR_SPREAD, ColorSpread, colorSpread, ScriptVec3UChar, particle::DEFAULT_COLOR_SPREAD);
DEFINE_PROPERTY_REF(PROP_COLOR_START, ColorStart, colorStart, ScriptVec3Float, particle::DEFAULT_COLOR_UNINITIALIZED);
DEFINE_PROPERTY_REF(PROP_COLOR_FINISH, ColorFinish, colorFinish, ScriptVec3Float, particle::DEFAULT_COLOR_UNINITIALIZED);
DEFINE_PROPERTY(PROP_ALPHA, Alpha, alpha, float, particle::DEFAULT_ALPHA);
@@ -161,8 +161,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, xColor, TextEntityItem::DEFAULT_TEXT_COLOR);
- DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, xColor, TextEntityItem::DEFAULT_BACKGROUND_COLOR);
+ DEFINE_PROPERTY_REF(PROP_TEXT_COLOR, TextColor, textColor, ScriptVec3UChar, TextEntityItem::DEFAULT_TEXT_COLOR);
+ DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, ScriptVec3UChar, 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);
@@ -287,7 +287,7 @@ public:
std::array::const_iterator findComponent(const QString& mode);
public:
- float getMaxDimension() const { return glm::compMax(glm::vec3(_dimensions.x, _dimensions.y, _dimensions.z)); }
+ float getMaxDimension() const { return glm::compMax(_dimensions.toGlm()); }
float getAge() const { return (float)(usecTimestampNow() - _created) / (float)USECS_PER_SECOND; }
bool hasCreatedTime() const { return (_created != UNKNOWN_CREATED_TIME); }
@@ -314,10 +314,10 @@ public:
void clearID() { _id = UNKNOWN_ENTITY_ID; _idSet = false; }
void markAllChanged();
- const glm::vec3& getNaturalDimensions() const { return glm::vec3(_naturalDimensions.x, _naturalDimensions.y, _naturalDimensions.z); }
+ const glm::vec3& getNaturalDimensions() const { return _naturalDimensions.toGlm(); }
void setNaturalDimensions(const glm::vec3& value) { _naturalDimensions = value; }
- const glm::vec3& getNaturalPosition() const { return glm::vec3(_naturalPosition.x, _naturalPosition.y, _naturalPosition.z); }
+ const glm::vec3& getNaturalPosition() const { return _naturalPosition.toGlm(); }
void calculateNaturalPosition(const glm::vec3& min, const glm::vec3& max);
const QVariantMap& getTextureNames() const { return _textureNames; }
@@ -426,7 +426,7 @@ void EntityPropertyFlagsFromScriptValue(const QScriptValue& object, EntityProper
// define these inline here so the macros work
inline void EntityItemProperties::setPosition(const ScriptVec3Float& value)
- { _position = glm::clamp(glm::vec3(value.x, value.y, value.z), (float)-HALF_TREE_SCALE, (float)HALF_TREE_SCALE); _positionChanged = true; }
+ { _position = glm::clamp(value.toGlm(), (float)-HALF_TREE_SCALE, (float)HALF_TREE_SCALE); _positionChanged = true; }
inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
debug << "EntityItemProperties[" << "\n";
diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h
index 07dfcc4d23..09bee26040 100644
--- a/libraries/entities/src/EntityItemPropertiesMacros.h
+++ b/libraries/entities/src/EntityItemPropertiesMacros.h
@@ -103,7 +103,7 @@
inline QScriptValue convertScriptValue(QScriptEngine* e, const ScriptVec2Float& v) { return vec2FloatToScriptValue(e, v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, const ScriptVec3Float& v) { return vec3FloatToScriptValue(e, v); }
-inline QScriptValue convertScriptValue(QScriptEngine* e, const ScriptVec3UInt& v) { return vec3UIntToScriptValue(e, v); }
+inline QScriptValue convertScriptValue(QScriptEngine* e, const ScriptVec3UChar& v) { return vec3UCharToScriptValue(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); }
@@ -112,7 +112,6 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, quint32 v) { return QSc
inline QScriptValue convertScriptValue(QScriptEngine* e, quint64 v) { return QScriptValue((qsreal)v); }
inline QScriptValue convertScriptValue(QScriptEngine* e, const QString& v) { return QScriptValue(v); }
-inline QScriptValue convertScriptValue(QScriptEngine* e, const xColor& v) { return xColorToScriptValue(e, v); }
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 qVectorVec3ToScriptValue(e, v); }
@@ -236,10 +235,10 @@ inline ScriptVec3Float ScriptVec3Float_convertFromScriptValue(const QScriptValue
return vec3;
}
-inline ScriptVec3UInt ScriptVec3UInt_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
+inline ScriptVec3UChar ScriptVec3UChar_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
- ScriptVec3UInt vec3;
- vec3UIntFromScriptValue(v, vec3);
+ ScriptVec3UChar vec3;
+ vec3UCharFromScriptValue(v, vec3);
return vec3;
}
@@ -293,31 +292,6 @@ inline glm::quat quat_convertFromScriptValue(const QScriptValue& v, bool& isVali
return glm::quat();
}
-inline xColor xColor_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
- xColor newValue { 255, 255, 255 };
- isValid = false; /// assume it can't be converted
- QScriptValue r = v.property("red");
- QScriptValue g = v.property("green");
- QScriptValue b = v.property("blue");
- if (!r.isValid()) {
- r = v.property("x");
- }
- if (!g.isValid()) {
- g = v.property("y");
- }
- if (!b.isValid()) {
- b = v.property("z");
- }
- if (r.isValid() && g.isValid() && b.isValid()) {
- newValue.red = r.toVariant().toInt();
- newValue.green = g.toVariant().toInt();
- newValue.blue = b.toVariant().toInt();
- isValid = true;
- }
- return newValue;
-}
-
-
#define COPY_PROPERTY_IF_CHANGED(P) \
{ \
if (other._##P##Changed) { \
@@ -395,10 +369,10 @@ inline xColor xColor_convertFromScriptValue(const QScriptValue& v, bool& isValid
T _##n; \
static T _static##N;
-#define ADD_PROPERTY_TO_MAP(P, N, n, T) \
+#define ADD_PROPERTY_TO_MAP(P, n) \
_propertyStringsToEnums[#n] = P;
-#define ADD_GROUP_PROPERTY_TO_MAP(P, G, g, N, n) \
+#define ADD_GROUP_PROPERTY_TO_MAP(P, g, n) \
_propertyStringsToEnums[#g "." #n] = P;
#define DEFINE_CORE(N, n, T, V) \
diff --git a/libraries/entities/src/HazePropertyGroup.cpp b/libraries/entities/src/HazePropertyGroup.cpp
index c15b28707c..e1b0e4e49a 100644
--- a/libraries/entities/src/HazePropertyGroup.cpp
+++ b/libraries/entities/src/HazePropertyGroup.cpp
@@ -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, xColor, setHazeColor);
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeGlareColor, xColor, setHazeGlareColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeColor, ScriptVec3UChar, setHazeColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(haze, hazeGlareColor, ScriptVec3UChar, 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, xColor, setHazeColor);
- READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, xColor, setHazeGlareColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_COLOR, ScriptVec3UChar, setHazeColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, ScriptVec3UChar, 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, xColor, setHazeColor);
- READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, xColor, setHazeGlareColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_COLOR, ScriptVec3UChar, setHazeColor);
+ READ_ENTITY_PROPERTY(PROP_HAZE_GLARE_COLOR, ScriptVec3UChar, 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 e992aefbf3..cb5cfec014 100644
--- a/libraries/entities/src/HazePropertyGroup.h
+++ b/libraries/entities/src/HazePropertyGroup.h
@@ -28,8 +28,8 @@ class EntityTreeElementExtraEncodeData;
class ReadBitstreamToTreeParams;
static const float INITIAL_HAZE_RANGE{ 1000.0f };
-static const xColor initialHazeGlareColorXcolor{ 255, 229, 179 };
-static const xColor initialHazeColorXcolor{ 128, 154, 179 };
+static const ScriptVec3UChar initialHazeGlareColor { 255, 229, 179 };
+static const ScriptVec3UChar initialHazeColor { 128, 154, 179 };
static const float INITIAL_HAZE_GLARE_ANGLE{ 20.0f };
static const float INITIAL_HAZE_BASE_REFERENCE{ 0.0f };
@@ -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 {Color} hazeColor=128,154,179 - The color of the haze when looking away from the key light.
+ * @property {Vec3Color} 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 {Color} hazeGlareColor=255,299,179 - The color of the haze when looking towards the key light.
+ * @property {Vec3Color} 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.
*
@@ -118,8 +118,8 @@ public:
// Range only parameters
DEFINE_PROPERTY(PROP_HAZE_RANGE, HazeRange, hazeRange, float, INITIAL_HAZE_RANGE);
- DEFINE_PROPERTY_REF(PROP_HAZE_COLOR, HazeColor, hazeColor, xColor, initialHazeColorXcolor);
- DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_COLOR, HazeGlareColor, hazeGlareColor, xColor, initialHazeGlareColorXcolor);
+ DEFINE_PROPERTY_REF(PROP_HAZE_COLOR, HazeColor, hazeColor, ScriptVec3UChar, initialHazeColor);
+ DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_COLOR, HazeGlareColor, hazeGlareColor, ScriptVec3UChar, initialHazeGlareColor);
DEFINE_PROPERTY(PROP_HAZE_ENABLE_GLARE, HazeEnableGlare, hazeEnableGlare, bool, false);
DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_ANGLE, HazeGlareAngle, hazeGlareAngle, float, INITIAL_HAZE_GLARE_ANGLE);
diff --git a/libraries/entities/src/KeyLightPropertyGroup.cpp b/libraries/entities/src/KeyLightPropertyGroup.cpp
index 7a149a396e..0657d22073 100644
--- a/libraries/entities/src/KeyLightPropertyGroup.cpp
+++ b/libraries/entities/src/KeyLightPropertyGroup.cpp
@@ -17,7 +17,7 @@
#include "EntityItemProperties.h"
#include "EntityItemPropertiesMacros.h"
-const xColor KeyLightPropertyGroup::DEFAULT_KEYLIGHT_COLOR = { 255, 255, 255 };
+const ScriptVec3UChar KeyLightPropertyGroup::DEFAULT_KEYLIGHT_COLOR = { 255, 255, 255 };
const float KeyLightPropertyGroup::DEFAULT_KEYLIGHT_INTENSITY = 1.0f;
const float KeyLightPropertyGroup::DEFAULT_KEYLIGHT_AMBIENT_INTENSITY = 0.5f;
const glm::vec3 KeyLightPropertyGroup::DEFAULT_KEYLIGHT_DIRECTION = { 0.0f, -1.0f, 0.0f };
@@ -33,13 +33,13 @@ void KeyLightPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desired
}
void KeyLightPropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) {
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, color, xColor, setColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, color, ScriptVec3UChar, setColor);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, intensity, float, setIntensity);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, direction, ScriptVec3Float, setDirection);
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(keyLight, castShadows, bool, setCastShadows);
// legacy property support
- COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightColor, xColor, setColor, getColor);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightColor, ScriptVec3UChar, setColor, getColor);
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightIntensity, float, setIntensity, getIntensity);
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(keyLightDirection, ScriptVec3Float, 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, xColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_KEYLIGHT_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_INTENSITY, float, setIntensity);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_DIRECTION, ScriptVec3Float, 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, xColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_KEYLIGHT_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_INTENSITY, float, setIntensity);
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_DIRECTION, ScriptVec3Float, 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 8ccd26c4d8..3972b71254 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 {Color} color=255,255,255 - The color of the light.
+ * @property {Vec3Color} 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
@@ -84,13 +84,13 @@ public:
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) override;
- static const xColor DEFAULT_KEYLIGHT_COLOR;
+ static const ScriptVec3UChar DEFAULT_KEYLIGHT_COLOR;
static const float DEFAULT_KEYLIGHT_INTENSITY;
static const float DEFAULT_KEYLIGHT_AMBIENT_INTENSITY;
static const glm::vec3 DEFAULT_KEYLIGHT_DIRECTION;
static const bool DEFAULT_KEYLIGHT_CAST_SHADOWS;
- DEFINE_PROPERTY_REF(PROP_KEYLIGHT_COLOR, Color, color, xColor, DEFAULT_KEYLIGHT_COLOR);
+ DEFINE_PROPERTY_REF(PROP_KEYLIGHT_COLOR, Color, color, ScriptVec3UChar, DEFAULT_KEYLIGHT_COLOR);
DEFINE_PROPERTY(PROP_KEYLIGHT_INTENSITY, Intensity, intensity, float, DEFAULT_KEYLIGHT_INTENSITY);
DEFINE_PROPERTY_REF(PROP_KEYLIGHT_DIRECTION, Direction, direction, ScriptVec3Float, DEFAULT_KEYLIGHT_DIRECTION);
DEFINE_PROPERTY(PROP_KEYLIGHT_CAST_SHADOW, CastShadows, castShadows, bool, DEFAULT_KEYLIGHT_CAST_SHADOWS);
diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp
index e95af7ebf9..ab793c4c30 100644
--- a/libraries/entities/src/LightEntityItem.cpp
+++ b/libraries/entities/src/LightEntityItem.cpp
@@ -38,7 +38,6 @@ EntityItemPointer LightEntityItem::factory(const EntityItemID& entityID, const E
// our non-pure virtual subclass for now...
LightEntityItem::LightEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Light;
- _color[RED_INDEX] = _color[GREEN_INDEX] = _color[BLUE_INDEX] = 0;
}
void LightEntityItem::setUnscaledDimensions(const glm::vec3& value) {
@@ -73,7 +72,7 @@ EntityItemProperties LightEntityItem::getProperties(EntityPropertyFlags desiredP
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isSpotlight, getIsSpotlight);
- COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(intensity, getIntensity);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(exponent, getExponent);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(cutoff, getCutoff);
@@ -176,7 +175,7 @@ int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
const unsigned char* dataAt = data;
READ_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, bool, setIsSpotlight);
- READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_INTENSITY, float, setIntensity);
READ_ENTITY_PROPERTY(PROP_EXPONENT, float, setExponent);
READ_ENTITY_PROPERTY(PROP_CUTOFF, float, setCutoff);
@@ -214,26 +213,15 @@ void LightEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
APPEND_ENTITY_PROPERTY(PROP_FALLOFF_RADIUS, getFalloffRadius());
}
-const rgbColor& LightEntityItem::getColor() const {
- return _color;
-}
-
-xColor LightEntityItem::getXColor() const {
- xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color;
-}
-
-void LightEntityItem::setColor(const rgbColor& value) {
- withWriteLock([&] {
- memcpy(_color, value, sizeof(_color));
- _lightPropertiesChanged = true;
+const ScriptVec3UChar& LightEntityItem::getColor() const {
+ return resultWithReadLock([&] {
+ return _color;
});
}
-void LightEntityItem::setColor(const xColor& value) {
+void LightEntityItem::setColor(const ScriptVec3UChar& value) {
withWriteLock([&] {
- _color[RED_INDEX] = value.red;
- _color[GREEN_INDEX] = value.green;
- _color[BLUE_INDEX] = value.blue;
+ _color = value;
_lightPropertiesChanged = true;
});
}
diff --git a/libraries/entities/src/LightEntityItem.h b/libraries/entities/src/LightEntityItem.h
index 4d0bde3718..0e57015c49 100644
--- a/libraries/entities/src/LightEntityItem.h
+++ b/libraries/entities/src/LightEntityItem.h
@@ -52,18 +52,12 @@ public:
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) override;
- const rgbColor& getColor() const;
- xColor getXColor() const;
-
- void setColor(const rgbColor& value);
- void setColor(const xColor& value);
+ const ScriptVec3UChar& getColor() const;
+ void setColor(const ScriptVec3UChar& value);
bool getIsSpotlight() const;
void setIsSpotlight(bool value);
- void setIgnoredColor(const rgbColor& value) { }
- void setIgnoredAttenuation(float value) { }
-
float getIntensity() const;
void setIntensity(float value);
float getFalloffRadius() const;
@@ -92,7 +86,7 @@ public:
private:
// properties of a light
- rgbColor _color;
+ ScriptVec3UChar _color;
bool _isSpotlight { DEFAULT_IS_SPOTLIGHT };
float _intensity { DEFAULT_INTENSITY };
float _falloffRadius { DEFAULT_FALLOFF_RADIUS };
diff --git a/libraries/entities/src/LineEntityItem.cpp b/libraries/entities/src/LineEntityItem.cpp
index 2acf8670d9..21326ad0da 100644
--- a/libraries/entities/src/LineEntityItem.cpp
+++ b/libraries/entities/src/LineEntityItem.cpp
@@ -41,13 +41,8 @@ EntityItemProperties LineEntityItem::getProperties(EntityPropertyFlags desiredPr
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
-
- properties._color = getXColor();
- properties._colorChanged = false;
-
-
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineWidth, getLineWidth);
-
COPY_ENTITY_PROPERTY_TO_PROPERTIES(linePoints, getLinePoints);
return properties;
@@ -56,12 +51,11 @@ EntityItemProperties LineEntityItem::getProperties(EntityPropertyFlags desiredPr
bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
bool somethingChanged = false;
somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class
-
+
SET_ENTITY_PROPERTY_FROM_PROPERTIES(color, setColor);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lineWidth, setLineWidth);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(linePoints, setLinePoints);
-
if (somethingChanged) {
bool wantDebug = false;
if (wantDebug) {
@@ -120,7 +114,7 @@ int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
int bytesRead = 0;
const unsigned char* dataAt = data;
- READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY(PROP_LINE_POINTS, QVector, setLinePoints);
@@ -154,36 +148,21 @@ void LineEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
void LineEntityItem::debugDump() const {
quint64 now = usecTimestampNow();
qCDebug(entities) << " LINE EntityItem id:" << getEntityItemID() << "---------------------------------------------";
- qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2];
+ qCDebug(entities) << " color:" << _color;
qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition());
qCDebug(entities) << " dimensions:" << debugTreeVector(getScaledDimensions());
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
}
-
-const rgbColor& LineEntityItem::getColor() const {
- return _color;
-}
-
-xColor LineEntityItem::getXColor() const {
- xColor result;
- withReadLock([&] {
- result = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] };
- });
- return result;
-}
-
-void LineEntityItem::setColor(const rgbColor& value) {
- withWriteLock([&] {
- memcpy(_color, value, sizeof(_color));
+const ScriptVec3UChar& LineEntityItem::getColor() const {
+ return resultWithReadLock([&] {
+ return _color;
});
}
-void LineEntityItem::setColor(const xColor& value) {
+void LineEntityItem::setColor(const ScriptVec3UChar& value) {
withWriteLock([&] {
- _color[RED_INDEX] = value.red;
- _color[GREEN_INDEX] = value.green;
- _color[BLUE_INDEX] = value.blue;
+ _color = value;
});
}
diff --git a/libraries/entities/src/LineEntityItem.h b/libraries/entities/src/LineEntityItem.h
index 01f0f39c01..4965514e12 100644
--- a/libraries/entities/src/LineEntityItem.h
+++ b/libraries/entities/src/LineEntityItem.h
@@ -41,11 +41,8 @@ class LineEntityItem : public EntityItem {
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) override;
- const rgbColor& getColor() const;
- xColor getXColor() const;
-
- void setColor(const rgbColor& value);
- void setColor(const xColor& value);
+ const ScriptVec3UChar& getColor() const;
+ void setColor(const ScriptVec3UChar& value);
void setLineWidth(float lineWidth);
float getLineWidth() const;
@@ -71,7 +68,7 @@ class LineEntityItem : public EntityItem {
static const int MAX_POINTS_PER_LINE;
private:
- rgbColor _color;
+ ScriptVec3UChar _color;
float _lineWidth { DEFAULT_LINE_WIDTH };
QVector _points;
bool _pointsChanged { true };
diff --git a/libraries/entities/src/MaterialEntityItem.cpp b/libraries/entities/src/MaterialEntityItem.cpp
index 88da5dd4b5..a10937d537 100644
--- a/libraries/entities/src/MaterialEntityItem.cpp
+++ b/libraries/entities/src/MaterialEntityItem.cpp
@@ -211,7 +211,7 @@ void MaterialEntityItem::setMaterialData(const QString& materialData) {
void MaterialEntityItem::setMaterialMappingPos(const ScriptVec2Float& materialMappingPos) {
if (_materialMappingPos != materialMappingPos) {
removeMaterial();
- _materialMappingPos = glm::vec2(materialMappingPos.x, materialMappingPos.y);
+ _materialMappingPos = materialMappingPos.toGlm();
applyMaterial();
}
}
@@ -219,7 +219,7 @@ void MaterialEntityItem::setMaterialMappingPos(const ScriptVec2Float& materialMa
void MaterialEntityItem::setMaterialMappingScale(const ScriptVec2Float& materialMappingScale) {
if (_materialMappingScale != materialMappingScale) {
removeMaterial();
- _materialMappingScale = glm::vec2(materialMappingScale.x, materialMappingScale.y);
+ _materialMappingScale = materialMappingScale.toGlm();
applyMaterial();
}
}
diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp
index 2024663ecb..5a3bdc7849 100644
--- a/libraries/entities/src/ModelEntityItem.cpp
+++ b/libraries/entities/src/ModelEntityItem.cpp
@@ -39,7 +39,6 @@ ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID) : EntityItem(
// set the last animated when interface (re)starts
_type = EntityTypes::Model;
_lastKnownCurrentFrame = -1;
- _color[0] = _color[1] = _color[2] = 0;
}
const QString ModelEntityItem::getTextures() const {
@@ -55,7 +54,7 @@ void ModelEntityItem::setTextures(const QString& textures) {
EntityItemProperties ModelEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
- COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(modelURL, getModelURL);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(compoundShapeURL, getCompoundShapeURL);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures);
@@ -114,7 +113,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
const unsigned char* dataAt = data;
bool animationPropertiesChanged = false;
- READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL);
READ_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL);
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
@@ -506,9 +505,6 @@ QVector ModelEntityItem::getJointTranslationsSet() const {
}
-xColor ModelEntityItem::getXColor() const {
- xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color;
-}
bool ModelEntityItem::hasModel() const {
return resultWithReadLock([&] {
return !_modelURL.isEmpty();
@@ -540,17 +536,15 @@ QString ModelEntityItem::getCompoundShapeURL() const {
return _compoundShapeURL.get();
}
-void ModelEntityItem::setColor(const rgbColor& value) {
+void ModelEntityItem::setColor(const ScriptVec3UChar& value) {
withWriteLock([&] {
- memcpy(_color, value, sizeof(_color));
+ _color = value;
});
}
-void ModelEntityItem::setColor(const xColor& value) {
- withWriteLock([&] {
- _color[RED_INDEX] = value.red;
- _color[GREEN_INDEX] = value.green;
- _color[BLUE_INDEX] = value.blue;
+const ScriptVec3UChar& ModelEntityItem::getColor() const {
+ return resultWithReadLock([&] {
+ return _color;
});
}
diff --git a/libraries/entities/src/ModelEntityItem.h b/libraries/entities/src/ModelEntityItem.h
index 17c71c4b90..8022e44521 100644
--- a/libraries/entities/src/ModelEntityItem.h
+++ b/libraries/entities/src/ModelEntityItem.h
@@ -55,12 +55,11 @@ public:
void setShapeType(ShapeType type) override;
virtual ShapeType getShapeType() const override;
-
// TODO: Move these to subclasses, or other appropriate abstraction
// getters/setters applicable to models and particles
+ const ScriptVec3UChar& getColor() const;
+ void setColor(const ScriptVec3UChar& value);
- const rgbColor& getColor() const { return _color; }
- xColor getXColor() const;
bool hasModel() const;
virtual bool hasCompoundShapeURL() const;
@@ -70,9 +69,6 @@ public:
static const QString DEFAULT_COMPOUND_SHAPE_URL;
QString getCompoundShapeURL() const;
- void setColor(const rgbColor& value);
- void setColor(const xColor& value);
-
// model related properties
virtual void setModelURL(const QString& url);
virtual void setCompoundShapeURL(const QString& url);
@@ -157,7 +153,7 @@ protected:
QVector _localJointData;
int _lastKnownCurrentFrame{-1};
- rgbColor _color;
+ ScriptVec3UChar _color;
QString _modelURL;
bool _relayParentJoints;
diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp
index dff517c770..8238edb08b 100644
--- a/libraries/entities/src/ParticleEffectEntityItem.cpp
+++ b/libraries/entities/src/ParticleEffectEntityItem.cpp
@@ -145,9 +145,6 @@ uint64_t Properties::emitIntervalUsecs() const {
return 0;
}
-const xColor ParticleEffectEntityItem::DEFAULT_XCOLOR = xColor(static_cast(DEFAULT_COLOR.r), static_cast(DEFAULT_COLOR.g), static_cast(DEFAULT_COLOR.b));
-const xColor ParticleEffectEntityItem::DEFAULT_XCOLOR_SPREAD = xColor(static_cast(DEFAULT_COLOR_SPREAD.r), static_cast(DEFAULT_COLOR_SPREAD.g), static_cast(DEFAULT_COLOR_SPREAD.b));
-
EntityItemPointer ParticleEffectEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer entity(new ParticleEffectEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); });
entity->setProperties(properties);
@@ -159,7 +156,6 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
EntityItem(entityItemID)
{
_type = EntityTypes::ParticleEffect;
- setColor(DEFAULT_COLOR);
}
void ParticleEffectEntityItem::setAlpha(float alpha) {
@@ -368,7 +364,7 @@ void ParticleEffectEntityItem::computeAndUpdateDimensions() {
EntityItemProperties ParticleEffectEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
- COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(alpha, getAlpha);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType); // FIXME - this doesn't appear to get used
COPY_ENTITY_PROPERTY_TO_PROPERTIES(maxParticles, getMaxParticles);
@@ -449,28 +445,12 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
return somethingChanged;
}
-void ParticleEffectEntityItem::setColor(const vec3& value) {
+void ParticleEffectEntityItem::setColor(const ScriptVec3UChar& value) {
withWriteLock([&] {
- _particleProperties.color.gradient.target = value;
+ _particleProperties.color.gradient.target = value.toGlm();
});
}
-void ParticleEffectEntityItem::setColor(const xColor& value) {
- withWriteLock([&] {
- _particleProperties.color.gradient.target.r = value.red;
- _particleProperties.color.gradient.target.g = value.green;
- _particleProperties.color.gradient.target.b = value.blue;
- });
-}
-
-xColor ParticleEffectEntityItem::getXColor() const {
- xColor color;
- color.red = _particleProperties.color.gradient.target.r;
- color.green = _particleProperties.color.gradient.target.g;
- color.blue = _particleProperties.color.gradient.target.b;
- return color;
-}
-
int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
@@ -479,7 +459,7 @@ int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned ch
int bytesRead = 0;
const unsigned char* dataAt = data;
- READ_ENTITY_PROPERTY(PROP_COLOR, xColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, ScriptVec3UChar, 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);
@@ -495,7 +475,7 @@ 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, xColor, setColorSpread);
+ READ_ENTITY_PROPERTY(PROP_COLOR_SPREAD, ScriptVec3UChar, setColorSpread);
READ_ENTITY_PROPERTY(PROP_COLOR_START, ScriptVec3Float, setColorStart);
READ_ENTITY_PROPERTY(PROP_COLOR_FINISH, ScriptVec3Float, setColorFinish);
READ_ENTITY_PROPERTY(PROP_ALPHA, float, setAlpha);
@@ -564,7 +544,7 @@ void ParticleEffectEntityItem::appendSubclassData(OctreePacketData* packetData,
OctreeElement::AppendState& appendState) const {
bool successPropertyFits = true;
- APPEND_ENTITY_PROPERTY(PROP_COLOR, getXColor());
+ APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
APPEND_ENTITY_PROPERTY(PROP_EMITTING_PARTICLES, getIsEmitting());
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, getMaxParticles());
@@ -643,22 +623,12 @@ void ParticleEffectEntityItem::setColorFinish(const vec3& colorFinish) {
});
}
-void ParticleEffectEntityItem::setColorSpread(const xColor& value) {
+void ParticleEffectEntityItem::setColorSpread(const ScriptVec3UChar& value) {
withWriteLock([&] {
- _particleProperties.color.gradient.spread.r = value.red;
- _particleProperties.color.gradient.spread.g = value.green;
- _particleProperties.color.gradient.spread.b = value.blue;
+ _particleProperties.color.gradient.spread = value.toGlm();
});
}
-xColor ParticleEffectEntityItem::getColorSpread() const {
- xColor color;
- color.red = _particleProperties.color.gradient.spread.r;
- color.green = _particleProperties.color.gradient.spread.g;
- color.blue = _particleProperties.color.gradient.spread.b;
- return color;
-}
-
void ParticleEffectEntityItem::setEmitterShouldTrail(bool emitterShouldTrail) {
withWriteLock([&] {
_particleProperties.emission.shouldTrail = emitterShouldTrail;
@@ -672,10 +642,10 @@ particle::Properties ParticleEffectEntityItem::getParticleProperties() const {
// Special case the properties that get treated differently if they're unintialized
if (glm::any(glm::isnan(result.color.range.start))) {
- result.color.range.start = getColor();
+ result.color.range.start = getColor().toGlm();
}
if (glm::any(glm::isnan(result.color.range.finish))) {
- result.color.range.finish = getColor();
+ result.color.range.finish = getColor().toGlm();
}
if (glm::isnan(result.alpha.range.start)) {
result.alpha.range.start = getAlpha();
diff --git a/libraries/entities/src/ParticleEffectEntityItem.h b/libraries/entities/src/ParticleEffectEntityItem.h
index d02016b283..970315280d 100644
--- a/libraries/entities/src/ParticleEffectEntityItem.h
+++ b/libraries/entities/src/ParticleEffectEntityItem.h
@@ -20,9 +20,9 @@
namespace particle {
static const float SCRIPT_MAXIMUM_PI = 3.1416f; // Round up so that reasonable property values work
static const float UNINITIALIZED = NAN;
- static const vec3 DEFAULT_COLOR = { 255, 255, 255 };
+ static const ScriptVec3UChar DEFAULT_COLOR = { 255, 255, 255 };
static const vec3 DEFAULT_COLOR_UNINITIALIZED = { UNINITIALIZED, UNINITIALIZED, UNINITIALIZED };
- static const vec3 DEFAULT_COLOR_SPREAD = { 0, 0, 0 };
+ static const ScriptVec3UChar DEFAULT_COLOR_SPREAD = { 0, 0, 0 };
static const float DEFAULT_ALPHA = 1.0f;
static const float DEFAULT_ALPHA_SPREAD = 0.0f;
static const float DEFAULT_ALPHA_START = UNINITIALIZED;
@@ -147,7 +147,7 @@ namespace particle {
};
struct Properties {
- RangeGradient color { DEFAULT_COLOR, DEFAULT_COLOR_UNINITIALIZED, DEFAULT_COLOR_UNINITIALIZED, DEFAULT_COLOR_SPREAD };
+ RangeGradient color { DEFAULT_COLOR.toGlm(), DEFAULT_COLOR_UNINITIALIZED, DEFAULT_COLOR_UNINITIALIZED, DEFAULT_COLOR_SPREAD.toGlm() };
RangeGradient alpha { DEFAULT_ALPHA, DEFAULT_ALPHA_START, DEFAULT_ALPHA_FINISH, DEFAULT_ALPHA_SPREAD };
float radiusStart { DEFAULT_EMIT_RADIUS_START };
RangeGradient radius { DEFAULT_PARTICLE_RADIUS, DEFAULT_RADIUS_START, DEFAULT_RADIUS_FINISH, DEFAULT_RADIUS_SPREAD };
@@ -178,10 +178,10 @@ namespace particle {
return *this;
}
- vec4 getColorStart() const { return vec4(ColorUtils::sRGBToLinearVec3(color.range.start / 255.0f), alpha.range.start); }
- vec4 getColorMiddle() const { return vec4(ColorUtils::sRGBToLinearVec3(color.gradient.target / 255.0f), alpha.gradient.target); }
- vec4 getColorFinish() const { return vec4(ColorUtils::sRGBToLinearVec3(color.range.finish / 255.0f), alpha.range.finish); }
- vec4 getColorSpread() const { return vec4(ColorUtils::sRGBToLinearVec3(color.gradient.spread / 255.0f), alpha.gradient.spread); }
+ vec4 getColorStart() const { return vec4(ColorUtils::sRGBToLinearVec3(toGlm(color.range.start)), alpha.range.start); }
+ vec4 getColorMiddle() const { return vec4(ColorUtils::sRGBToLinearVec3(toGlm(color.gradient.target)), alpha.gradient.target); }
+ vec4 getColorFinish() const { return vec4(ColorUtils::sRGBToLinearVec3(toGlm(color.range.finish)), alpha.range.finish); }
+ vec4 getColorSpread() const { return vec4(ColorUtils::sRGBToLinearVec3(toGlm(color.gradient.spread)), alpha.gradient.spread); }
};
} // namespace particles
@@ -217,11 +217,8 @@ public:
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) override;
- xColor getXColor() const;
- vec3 getColor() const { return _particleProperties.color.gradient.target; }
-
- void setColor(const vec3& value);
- void setColor(const xColor& value);
+ void setColor(const ScriptVec3UChar& value);
+ ScriptVec3UChar getColor() const { return _particleProperties.color.gradient.target; }
void setColorStart(const vec3& colorStart);
void setColorStart(const ScriptVec3Float& colorStart) { setColorStart(colorStart.toGlm()); }
@@ -233,8 +230,8 @@ public:
vec3 getColorFinish() const { return _particleProperties.color.range.finish; }
ScriptVec3Float getScriptColorFinish() const { return getColorFinish(); }
- void setColorSpread(const xColor& colorSpread);
- xColor getColorSpread() const;
+ void setColorSpread(const ScriptVec3UChar& colorSpread);
+ ScriptVec3UChar getColorSpread() const { return _particleProperties.color.gradient.spread; }
void setAlpha(float alpha);
float getAlpha() const { return _particleProperties.alpha.gradient.target; }
@@ -328,9 +325,6 @@ public:
particle::Properties getParticleProperties() const;
- static const xColor DEFAULT_XCOLOR;
- static const xColor DEFAULT_XCOLOR_SPREAD;
-
protected:
particle::Properties _particleProperties;
bool _isEmitting { true };
diff --git a/libraries/entities/src/PolyLineEntityItem.cpp b/libraries/entities/src/PolyLineEntityItem.cpp
index c4e8f4a7bc..47438bdba0 100644
--- a/libraries/entities/src/PolyLineEntityItem.cpp
+++ b/libraries/entities/src/PolyLineEntityItem.cpp
@@ -39,12 +39,8 @@ PolyLineEntityItem::PolyLineEntityItem(const EntityItemID& entityItemID) : Entit
EntityItemProperties PolyLineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
QWriteLocker lock(&_quadReadWriteLock);
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
-
-
- properties._color = getXColor();
- properties._colorChanged = false;
-
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineWidth, getLineWidth);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(linePoints, getLinePoints);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(normals, getNormals);
@@ -204,7 +200,7 @@ int PolyLineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* da
int bytesRead = 0;
const unsigned char* dataAt = data;
- READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY(PROP_LINE_POINTS, QVector, setLinePoints);
READ_ENTITY_PROPERTY(PROP_NORMALS, QVector, setNormals);
@@ -253,7 +249,7 @@ void PolyLineEntityItem::appendSubclassData(OctreePacketData* packetData, Encode
void PolyLineEntityItem::debugDump() const {
quint64 now = usecTimestampNow();
qCDebug(entities) << " QUAD EntityItem id:" << getEntityItemID() << "---------------------------------------------";
- qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2];
+ qCDebug(entities) << " color:" << _color;
qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition());
qCDebug(entities) << " dimensions:" << debugTreeVector(getScaledDimensions());
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
@@ -309,3 +305,15 @@ void PolyLineEntityItem::setTextures(const QString& textures) {
}
});
}
+
+void PolyLineEntityItem::setColor(const ScriptVec3UChar& value) {
+ withWriteLock([&] {
+ _color = value;
+ });
+}
+
+const ScriptVec3UChar& PolyLineEntityItem::getColor() const {
+ return resultWithReadLock([&] {
+ return _color;
+ });
+}
diff --git a/libraries/entities/src/PolyLineEntityItem.h b/libraries/entities/src/PolyLineEntityItem.h
index a30b32e2fa..db381e4d01 100644
--- a/libraries/entities/src/PolyLineEntityItem.h
+++ b/libraries/entities/src/PolyLineEntityItem.h
@@ -41,19 +41,8 @@ class PolyLineEntityItem : public EntityItem {
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) override;
- const rgbColor& getColor() const { return _color; }
- xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }
-
- void setColor(const rgbColor& value) {
- _strokeColorsChanged = true;
- memcpy(_color, value, sizeof(_color));
- }
- void setColor(const xColor& value) {
- _strokeColorsChanged = true;
- _color[RED_INDEX] = value.red;
- _color[GREEN_INDEX] = value.green;
- _color[BLUE_INDEX] = value.blue;
- }
+ const ScriptVec3UChar& getColor() const;
+ void setColor(const ScriptVec3UChar& value);
void setLineWidth(float lineWidth){ _lineWidth = lineWidth; }
float getLineWidth() const{ return _lineWidth; }
@@ -105,7 +94,7 @@ private:
void calculateScaleAndRegistrationPoint();
protected:
- rgbColor _color;
+ ScriptVec3UChar _color;
float _lineWidth { DEFAULT_LINE_WIDTH };
bool _pointsChanged { true };
bool _normalsChanged { true };
diff --git a/libraries/entities/src/ShapeEntityItem.cpp b/libraries/entities/src/ShapeEntityItem.cpp
index 943ae2e462..bb56ad7cb9 100644
--- a/libraries/entities/src/ShapeEntityItem.cpp
+++ b/libraries/entities/src/ShapeEntityItem.cpp
@@ -73,7 +73,7 @@ namespace entity {
return Shape::Sphere;
}
- ::QString stringFromShape(Shape shape) {
+ QString stringFromShape(Shape shape) {
return shapeStrings[shape];
}
}
@@ -117,8 +117,10 @@ ShapeEntityItem::ShapeEntityItem(const EntityItemID& entityItemID) : EntityItem(
EntityItemProperties ShapeEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
+
properties.setShape(entity::stringFromShape(getShape()));
- COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor);
+ properties._shapeChanged = false;
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(alpha, getAlpha);
return properties;
@@ -182,7 +184,7 @@ int ShapeEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
const unsigned char* dataAt = data;
READ_ENTITY_PROPERTY(PROP_SHAPE, QString, setShape);
- READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_COLOR, ScriptVec3UChar, setColor);
READ_ENTITY_PROPERTY(PROP_ALPHA, float, setAlpha);
return bytesRead;
@@ -210,27 +212,16 @@ void ShapeEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
APPEND_ENTITY_PROPERTY(PROP_ALPHA, getAlpha());
}
-void ShapeEntityItem::setColor(const rgbColor& value) {
- memcpy(_color, value, sizeof(rgbColor));
- _material->setAlbedo(glm::vec3(_color[0], _color[1], _color[2]) / 255.0f);
+void ShapeEntityItem::setColor(const ScriptVec3UChar& value) {
+ withWriteLock([&] {
+ _color = value;
+ });
}
-xColor ShapeEntityItem::getXColor() const {
- return xColor { _color[0], _color[1], _color[2] };
-}
-
-void ShapeEntityItem::setColor(const xColor& value) {
- setColor(rgbColor { value.red, value.green, value.blue });
-}
-
-QColor ShapeEntityItem::getQColor() const {
- auto& color = getColor();
- return QColor(color[0], color[1], color[2], (int)(getAlpha() * 255));
-}
-
-void ShapeEntityItem::setColor(const QColor& value) {
- setColor(rgbColor { (uint8_t)value.red(), (uint8_t)value.green(), (uint8_t)value.blue() });
- setAlpha(value.alpha());
+const ScriptVec3UChar& ShapeEntityItem::getColor() const {
+ return resultWithReadLock([&] {
+ return _color;
+ });
}
void ShapeEntityItem::setAlpha(float alpha) {
@@ -288,7 +279,7 @@ void ShapeEntityItem::debugDump() const {
qCDebug(entities) << " name:" << _name;
qCDebug(entities) << " shape:" << stringFromShape(_shape) << " (EnumId: " << _shape << " )";
qCDebug(entities) << " collisionShapeType:" << ShapeInfo::getNameForShapeType(getShapeType());
- qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2];
+ qCDebug(entities) << " color:" << _color;
qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition());
qCDebug(entities) << " dimensions:" << debugTreeVector(getScaledDimensions());
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
@@ -394,5 +385,4 @@ void ShapeEntityItem::computeShapeInfo(ShapeInfo& info) {
// This value specifies how the shape should be treated by physics calculations.
ShapeType ShapeEntityItem::getShapeType() const {
return _collisionShapeType;
-}
-
+}
\ No newline at end of file
diff --git a/libraries/entities/src/ShapeEntityItem.h b/libraries/entities/src/ShapeEntityItem.h
index adc33b764b..6796c2f621 100644
--- a/libraries/entities/src/ShapeEntityItem.h
+++ b/libraries/entities/src/ShapeEntityItem.h
@@ -31,7 +31,7 @@ namespace entity {
};
Shape shapeFromString(const ::QString& shapeString);
- ::QString stringFromShape(Shape shape);
+ QString stringFromShape(Shape shape);
}
class ShapeEntityItem : public EntityItem {
@@ -77,17 +77,11 @@ public:
float getAlpha() const { return _alpha; };
void setAlpha(float alpha);
- const rgbColor& getColor() const { return _color; }
- void setColor(const rgbColor& value);
+ const ScriptVec3UChar& getColor() const;
+ void setColor(const ScriptVec3UChar& value);
void setUnscaledDimensions(const glm::vec3& value) override;
- xColor getXColor() const;
- void setColor(const xColor& value);
-
- QColor getQColor() const;
- void setColor(const QColor& value);
-
bool shouldBePhysical() const override { return !isDead(); }
bool supportsDetailedRayIntersection() const override;
@@ -106,7 +100,7 @@ public:
protected:
float _alpha { 1.0f };
- rgbColor _color;
+ ScriptVec3UChar _color;
entity::Shape _shape { entity::Shape::Sphere };
//! This is SHAPE_TYPE_ELLIPSOID rather than SHAPE_TYPE_NONE to maintain
diff --git a/libraries/entities/src/SkyboxPropertyGroup.cpp b/libraries/entities/src/SkyboxPropertyGroup.cpp
index ba40c3fa6f..2ed3253536 100644
--- a/libraries/entities/src/SkyboxPropertyGroup.cpp
+++ b/libraries/entities/src/SkyboxPropertyGroup.cpp
@@ -16,7 +16,7 @@
#include "EntityItemProperties.h"
#include "EntityItemPropertiesMacros.h"
-const xColor SkyboxPropertyGroup::DEFAULT_COLOR = { 0, 0, 0 };
+const ScriptVec3UChar 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);
@@ -24,7 +24,7 @@ void SkyboxPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredPr
}
void SkyboxPropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) {
- COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(skybox, color, xColor, setColor);
+ COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(skybox, color, ScriptVec3UChar, 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, xColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, ScriptVec3UChar, 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, xColor, setColor);
+ READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, ScriptVec3UChar, 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 a94365d24d..447d36f842 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 {Color} color=0,0,0 - Sets the color of the sky if url
is ""
, otherwise modifies the
+ * @property {Vec3Color} 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.
*/
@@ -83,16 +83,8 @@ public:
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) override;
- glm::vec3 getColorVec3() const {
- const quint8 MAX_COLOR = 255;
- glm::vec3 color = { (float)_color.red / (float)MAX_COLOR,
- (float)_color.green / (float)MAX_COLOR,
- (float)_color.blue / (float)MAX_COLOR };
- return color;
- }
-
- static const xColor DEFAULT_COLOR;
- DEFINE_PROPERTY_REF(PROP_SKYBOX_COLOR, Color, color, xColor, DEFAULT_COLOR);
+ static const ScriptVec3UChar DEFAULT_COLOR;
+ DEFINE_PROPERTY_REF(PROP_SKYBOX_COLOR, Color, color, ScriptVec3UChar, DEFAULT_COLOR);
DEFINE_PROPERTY_REF(PROP_SKYBOX_URL, URL, url, QString, "");
};
diff --git a/libraries/entities/src/TextEntityItem.cpp b/libraries/entities/src/TextEntityItem.cpp
index 56e12e66d9..c5e0cf0bb1 100644
--- a/libraries/entities/src/TextEntityItem.cpp
+++ b/libraries/entities/src/TextEntityItem.cpp
@@ -25,8 +25,8 @@
const QString TextEntityItem::DEFAULT_TEXT("");
const float TextEntityItem::DEFAULT_LINE_HEIGHT = 0.1f;
-const xColor TextEntityItem::DEFAULT_TEXT_COLOR = { 255, 255, 255 };
-const xColor TextEntityItem::DEFAULT_BACKGROUND_COLOR = { 0, 0, 0};
+const ScriptVec3UChar TextEntityItem::DEFAULT_TEXT_COLOR = { 255, 255, 255 };
+const ScriptVec3UChar TextEntityItem::DEFAULT_BACKGROUND_COLOR = { 0, 0, 0};
const bool TextEntityItem::DEFAULT_FACE_CAMERA = false;
EntityItemPointer TextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
@@ -51,8 +51,8 @@ EntityItemProperties TextEntityItem::getProperties(EntityPropertyFlags desiredPr
COPY_ENTITY_PROPERTY_TO_PROPERTIES(text, getText);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineHeight, getLineHeight);
- COPY_ENTITY_PROPERTY_TO_PROPERTIES(textColor, getTextColorX);
- COPY_ENTITY_PROPERTY_TO_PROPERTIES(backgroundColor, getBackgroundColorX);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(textColor, getTextColor);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(backgroundColor, getBackgroundColor);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(faceCamera, getFaceCamera);
return properties;
}
@@ -91,8 +91,8 @@ int TextEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_TEXT, QString, setText);
READ_ENTITY_PROPERTY(PROP_LINE_HEIGHT, float, setLineHeight);
- READ_ENTITY_PROPERTY(PROP_TEXT_COLOR, rgbColor, setTextColor);
- READ_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, rgbColor, setBackgroundColor);
+ READ_ENTITY_PROPERTY(PROP_TEXT_COLOR, ScriptVec3UChar, setTextColor);
+ READ_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, ScriptVec3UChar, setBackgroundColor);
READ_ENTITY_PROPERTY(PROP_FACE_CAMERA, bool, setFaceCamera);
return bytesRead;
@@ -168,55 +168,27 @@ float TextEntityItem::getLineHeight() const {
return result;
}
-const rgbColor& TextEntityItem::getTextColor() const {
- return _textColor;
-}
-
-const rgbColor& TextEntityItem::getBackgroundColor() const {
- return _backgroundColor;
-}
-
-xColor TextEntityItem::getTextColorX() const {
- xColor result;
- withReadLock([&] {
- result = { _textColor[RED_INDEX], _textColor[GREEN_INDEX], _textColor[BLUE_INDEX] };
- });
- return result;
-}
-
-void TextEntityItem::setTextColor(const rgbColor& value) {
+void TextEntityItem::setTextColor(const ScriptVec3UChar& value) {
withWriteLock([&] {
- memcpy(_textColor, value, sizeof(_textColor));
+ _textColor = value;
});
}
-void TextEntityItem::setTextColor(const xColor& value) {
+const ScriptVec3UChar& TextEntityItem::getTextColor() const {
+ return resultWithReadLock([&] {
+ return _textColor;
+ });
+}
+
+void TextEntityItem::setBackgroundColor(const ScriptVec3UChar& value) {
withWriteLock([&] {
- _textColor[RED_INDEX] = value.red;
- _textColor[GREEN_INDEX] = value.green;
- _textColor[BLUE_INDEX] = value.blue;
+ _backgroundColor = value;
});
}
-xColor TextEntityItem::getBackgroundColorX() const {
- xColor result;
- withReadLock([&] {
- result = { _backgroundColor[RED_INDEX], _backgroundColor[GREEN_INDEX], _backgroundColor[BLUE_INDEX] };
- });
- return result;
-}
-
-void TextEntityItem::setBackgroundColor(const rgbColor& value) {
- withWriteLock([&] {
- memcpy(_backgroundColor, value, sizeof(_backgroundColor));
- });
-}
-
-void TextEntityItem::setBackgroundColor(const xColor& value) {
- withWriteLock([&] {
- _backgroundColor[RED_INDEX] = value.red;
- _backgroundColor[GREEN_INDEX] = value.green;
- _backgroundColor[BLUE_INDEX] = value.blue;
+const ScriptVec3UChar& TextEntityItem::getBackgroundColor() const {
+ return resultWithReadLock([&] {
+ return _backgroundColor;
});
}
diff --git a/libraries/entities/src/TextEntityItem.h b/libraries/entities/src/TextEntityItem.h
index efdc84bcd8..fa6cbdfcf4 100644
--- a/libraries/entities/src/TextEntityItem.h
+++ b/libraries/entities/src/TextEntityItem.h
@@ -59,21 +59,13 @@ public:
void setLineHeight(float value);
float getLineHeight() const;
- static const xColor DEFAULT_TEXT_COLOR;
- // FIXME should not return a reference because of thread safety, but can't return an array
- const rgbColor& getTextColor() const;
- xColor getTextColorX() const;
+ static const ScriptVec3UChar DEFAULT_TEXT_COLOR;
+ const ScriptVec3UChar& getTextColor() const;
+ void setTextColor(const ScriptVec3UChar& value);
- void setTextColor(const rgbColor& value);
- void setTextColor(const xColor& value);
-
- static const xColor DEFAULT_BACKGROUND_COLOR;
- // FIXME should not return a reference because of thread safety, but can't return an array
- const rgbColor& getBackgroundColor() const;
- xColor getBackgroundColorX() const;
-
- void setBackgroundColor(const rgbColor& value);
- void setBackgroundColor(const xColor& value);
+ static const ScriptVec3UChar DEFAULT_BACKGROUND_COLOR;
+ const ScriptVec3UChar& getBackgroundColor() const;
+ void setBackgroundColor(const ScriptVec3UChar& value);
static const bool DEFAULT_FACE_CAMERA;
bool getFaceCamera() const;
@@ -82,8 +74,8 @@ public:
private:
QString _text;
float _lineHeight;
- rgbColor _textColor;
- rgbColor _backgroundColor;
+ ScriptVec3UChar _textColor;
+ ScriptVec3UChar _backgroundColor;
bool _faceCamera;
};
diff --git a/libraries/octree/src/OctreePacketData.cpp b/libraries/octree/src/OctreePacketData.cpp
index d259f8cf6b..0f3904c09e 100644
--- a/libraries/octree/src/OctreePacketData.cpp
+++ b/libraries/octree/src/OctreePacketData.cpp
@@ -297,14 +297,6 @@ bool OctreePacketData::appendValue(const nodeColor& color) {
return appendColor(color[RED_INDEX], color[GREEN_INDEX], color[BLUE_INDEX]);
}
-bool OctreePacketData::appendValue(const xColor& color) {
- return appendColor(color.red, color.green, color.blue);
-}
-
-bool OctreePacketData::appendValue(const rgbColor& color) {
- return appendColor(color[RED_INDEX], color[GREEN_INDEX], color[BLUE_INDEX]);
-}
-
bool OctreePacketData::appendColor(colorPart red, colorPart green, colorPart blue) {
// eventually we can make this use a dictionary...
bool success = false;
@@ -404,6 +396,11 @@ bool OctreePacketData::appendValue(const ScriptVec3Float& value) {
return success;
}
+
+bool OctreePacketData::appendValue(const ScriptVec3UChar& color) {
+ return appendColor(color.x, color.y, color.z);
+}
+
bool OctreePacketData::appendValue(const QVector& value) {
uint16_t qVecSize = value.size();
bool success = appendValue(qVecSize);
@@ -695,14 +692,6 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QUuid&
return sizeof(length) + length;
}
-int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, xColor& result) {
- result.red = dataBytes[RED_INDEX];
- result.green = dataBytes[GREEN_INDEX];
- result.blue = dataBytes[BLUE_INDEX];
- return sizeof(rgbColor);
-}
-
-
int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVector& result) {
uint16_t length;
memcpy(&length, dataBytes, sizeof(uint16_t));
diff --git a/libraries/octree/src/OctreePacketData.h b/libraries/octree/src/OctreePacketData.h
index 2309b5e67b..5ce0d5bea4 100644
--- a/libraries/octree/src/OctreePacketData.h
+++ b/libraries/octree/src/OctreePacketData.h
@@ -143,12 +143,6 @@ public:
/// appends a color to the end of the stream, may fail if new data stream is too long to fit in packet
bool appendValue(const nodeColor& color);
- /// appends a color to the end of the stream, may fail if new data stream is too long to fit in packet
- bool appendValue(const xColor& color);
-
- /// appends a color to the end of the stream, may fail if new data stream is too long to fit in packet
- bool appendValue(const rgbColor& color);
-
/// appends a unsigned 8 bit int to the end of the stream, may fail if new data stream is too long to fit in packet
bool appendValue(uint8_t value);
@@ -170,6 +164,9 @@ public:
/// appends a non-position vector to the end of the stream, may fail if new data stream is too long to fit in packet
bool appendValue(const ScriptVec3Float& value);
+ /// appends a color to the end of the stream, may fail if new data stream is too long to fit in packet
+ bool appendValue(const ScriptVec3UChar& value);
+
/// appends a QVector of vec3s to the end of the stream, may fail if new data stream is too long to fit in packet
bool appendValue(const QVector& value);
@@ -255,18 +252,17 @@ public:
static int unpackDataFromBytes(const unsigned char* dataBytes, float& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, ScriptVec2Float& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, ScriptVec3Float& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
+ static int unpackDataFromBytes(const unsigned char* dataBytes, ScriptVec3UChar& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, bool& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, quint64& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, uint32_t& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, uint16_t& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, uint8_t& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
- static int unpackDataFromBytes(const unsigned char* dataBytes, rgbColor& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, glm::quat& result) { int bytes = unpackOrientationQuatFromBytes(dataBytes, result); return bytes; }
static int unpackDataFromBytes(const unsigned char* dataBytes, ShapeType& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, MaterialMappingMode& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
static int unpackDataFromBytes(const unsigned char* dataBytes, QString& result);
static int unpackDataFromBytes(const unsigned char* dataBytes, QUuid& result);
- static int unpackDataFromBytes(const unsigned char* dataBytes, xColor& result);
static int unpackDataFromBytes(const unsigned char* dataBytes, QVector& result);
static int unpackDataFromBytes(const unsigned char* dataBytes, QVector& result);
static int unpackDataFromBytes(const unsigned char* dataBytes, QVector& result);
diff --git a/libraries/shared/src/BufferParser.h b/libraries/shared/src/BufferParser.h
index 74b47cb72f..73bfa4bfdc 100644
--- a/libraries/shared/src/BufferParser.h
+++ b/libraries/shared/src/BufferParser.h
@@ -94,12 +94,12 @@ inline void BufferParser::readValue(QUuid& result) {
readUuid(result);
}
-template<>
-inline void BufferParser::readValue(xColor& result) {
- readValue(result.red);
- readValue(result.blue);
- readValue(result.green);
-}
+//template<>
+//inline void BufferParser::readValue(xColor& result) {
+// readValue(result.red);
+// readValue(result.blue);
+// readValue(result.green);
+//}
template<>
inline void BufferParser::readValue(QVector& result) {
diff --git a/libraries/shared/src/ColorUtils.h b/libraries/shared/src/ColorUtils.h
index e113449db3..d73fb478c8 100644
--- a/libraries/shared/src/ColorUtils.h
+++ b/libraries/shared/src/ColorUtils.h
@@ -18,11 +18,13 @@
#include "DependencyManager.h"
+#include "RegisteredMetaTypes.h"
+
extern const float srgbToLinearLookupTable[256];
class ColorUtils {
public:
- inline static glm::vec3 toVec3(const xColor& color);
+ inline static glm::vec3 toVec3(const ScriptVec3UChar& color);
// Convert to gamma 2.2 space from linear
inline static glm::vec3 toGamma22Vec3(const glm::vec3& linear);
@@ -40,9 +42,9 @@ public:
inline static float tosRGBFloat(const float& linear);
};
-inline glm::vec3 ColorUtils::toVec3(const xColor& color) {
+inline glm::vec3 ColorUtils::toVec3(const ScriptVec3UChar& color) {
const float ONE_OVER_255 = 1.0f / 255.0f;
- return glm::vec3(color.red * ONE_OVER_255, color.green * ONE_OVER_255, color.blue * ONE_OVER_255);
+ return glm::vec3(color.x * ONE_OVER_255, color.y * ONE_OVER_255, color.z * ONE_OVER_255);
}
inline glm::vec3 ColorUtils::toGamma22Vec3(const glm::vec3& linear) {
diff --git a/libraries/shared/src/GLMHelpers.cpp b/libraries/shared/src/GLMHelpers.cpp
index 4be8ad0e41..36719453ad 100644
--- a/libraries/shared/src/GLMHelpers.cpp
+++ b/libraries/shared/src/GLMHelpers.cpp
@@ -13,6 +13,8 @@
#include
#include "NumericalConstants.h"
+#include "RegisteredMetaTypes.h"
+
const vec3 Vectors::UNIT_X{ 1.0f, 0.0f, 0.0f };
const vec3 Vectors::UNIT_Y{ 0.0f, 1.0f, 0.0f };
const vec3 Vectors::UNIT_Z{ 0.0f, 0.0f, 1.0f };
@@ -436,12 +438,17 @@ glm::vec2 toGlm(const QPointF& pt) {
return glm::vec2(pt.x(), pt.y());
}
-glm::vec3 toGlm(const xColor& color) {
+glm::vec3 toGlm(const ScriptVec3UChar& color) {
static const float MAX_COLOR = 255.0f;
- return glm::vec3(color.red, color.green, color.blue) / MAX_COLOR;
+ return color.toGlm() / MAX_COLOR;
}
-xColor xColorFromGlm(const glm::vec3 & color) {
+vec4 toGlm(const ScriptVec3UChar& color, float alpha) {
+ static const float MAX_COLOR = 255.0f;
+ return vec4(color.toGlm() / MAX_COLOR, alpha);
+}
+
+ScriptVec3UChar scriptVec3UCharFromGlm(const glm::vec3 & color) {
static const float MAX_COLOR = 255.0f;
return { (uint8_t)(color.x * MAX_COLOR), (uint8_t)(color.y * MAX_COLOR), (uint8_t)(color.z * MAX_COLOR) };
}
@@ -463,10 +470,6 @@ QSize fromGlm(const glm::ivec2 & v) {
return QSize(v.x, v.y);
}
-vec4 toGlm(const xColor& color, float alpha) {
- return vec4((float)color.red / 255.0f, (float)color.green / 255.0f, (float)color.blue / 255.0f, alpha);
-}
-
QRectF glmToRect(const glm::vec2 & pos, const glm::vec2 & size) {
QRectF result(pos.x, pos.y, size.x, size.y);
return result;
diff --git a/libraries/shared/src/GLMHelpers.h b/libraries/shared/src/GLMHelpers.h
index 7e6ef4cb28..b2b5226c7f 100644
--- a/libraries/shared/src/GLMHelpers.h
+++ b/libraries/shared/src/GLMHelpers.h
@@ -33,6 +33,8 @@ using glm::vec3;
using glm::vec4;
using glm::quat;
+class ScriptVec3UChar;
+
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion"
@@ -174,12 +176,12 @@ bool isSimilarPosition(const glm::vec3& positionA, const glm::vec3& positionB, f
uvec2 toGlm(const QSize& size);
ivec2 toGlm(const QPoint& pt);
vec2 toGlm(const QPointF& pt);
-vec3 toGlm(const xColor& color);
+vec3 toGlm(const ScriptVec3UChar& color);
vec4 toGlm(const QColor& color);
ivec4 toGlm(const QRect& rect);
-vec4 toGlm(const xColor& color, float alpha);
+vec4 toGlm(const ScriptVec3UChar& color, float alpha);
-xColor xColorFromGlm(const glm::vec3 & c);
+ScriptVec3UChar scriptVec3UCharFromGlm(const glm::vec3 & c);
QSize fromGlm(const glm::ivec2 & v);
QMatrix4x4 fromGlm(const glm::mat4 & m);
diff --git a/libraries/shared/src/QVariantGLM.cpp b/libraries/shared/src/QVariantGLM.cpp
index f7fd7fbc8a..12c4628fbd 100644
--- a/libraries/shared/src/QVariantGLM.cpp
+++ b/libraries/shared/src/QVariantGLM.cpp
@@ -20,10 +20,6 @@ QVariantList quatToQList(const glm::quat& g) {
return QVariantList() << g.x << g.y << g.z << g.w;
}
-QVariantList rgbColorToQList(const rgbColor& v) {
- return QVariantList() << (int)(v[0]) << (int)(v[1]) << (int)(v[2]);
-}
-
QVariantMap vec3ToQMap(const glm::vec3& glmVector) {
QVariantMap vectorAsVariantMap;
vectorAsVariantMap["x"] = glmVector.x;
@@ -56,14 +52,6 @@ glm::quat qListToQuat(const QVariant& q) {
return glm::quat(w, x, y, z);
}
-void qListToRgbColor(const QVariant& q, rgbColor& returnValue) {
- QVariantList qList = q.toList();
- returnValue[RED_INDEX] = qList[RED_INDEX].toInt();
- returnValue[GREEN_INDEX] = qList[GREEN_INDEX].toInt();
- returnValue[BLUE_INDEX] = qList[BLUE_INDEX].toInt();
-}
-
-
glm::vec3 qMapToVec3(const QVariant& q) {
QVariantMap qMap = q.toMap();
if (qMap.contains("x") && qMap.contains("y") && qMap.contains("z")) {
diff --git a/libraries/shared/src/QVariantGLM.h b/libraries/shared/src/QVariantGLM.h
index a8f8b531c0..d61f64312a 100644
--- a/libraries/shared/src/QVariantGLM.h
+++ b/libraries/shared/src/QVariantGLM.h
@@ -19,14 +19,12 @@
QVariantList vec3ToQList(const glm::vec3& g);
QVariantList quatToQList(const glm::quat& g);
-QVariantList rgbColorToQList(const rgbColor& v);
QVariantMap vec3ToQMap(const glm::vec3& glmVector);
QVariantMap quatToQMap(const glm::quat& glmQuat);
glm::vec3 qListToVec3(const QVariant& q);
glm::quat qListToQuat(const QVariant& q);
-void qListToRgbColor(const QVariant& q, rgbColor& returnValue);
glm::vec3 qMapToVec3(const QVariant& q);
glm::quat qMapToQuat(const QVariant& q);
diff --git a/libraries/shared/src/RegisteredMetaTypes.cpp b/libraries/shared/src/RegisteredMetaTypes.cpp
index f0754b2a48..99f38c835e 100644
--- a/libraries/shared/src/RegisteredMetaTypes.cpp
+++ b/libraries/shared/src/RegisteredMetaTypes.cpp
@@ -30,13 +30,12 @@ int glmVec2MetaTypeId = qRegisterMetaType();
int vec2FloatMetaTypeId = qRegisterMetaType();
int glmVec3MetaTypeId = qRegisterMetaType();
int vec3FloatMetaTypeId = qRegisterMetaType();
-int vec3UintMetaTypeId = qRegisterMetaType();
+int vec3UintMetaTypeId = qRegisterMetaType();
int vec4MetaTypeId = qRegisterMetaType();
int qVectorVec3MetaTypeId = qRegisterMetaType>();
int qVectorQuatMetaTypeId = qRegisterMetaType>();
int qVectorBoolMetaTypeId = qRegisterMetaType>();
int quatMetaTypeId = qRegisterMetaType();
-int xColorMetaTypeId = qRegisterMetaType();
int pickRayMetaTypeId = qRegisterMetaType();
int collisionMetaTypeId = qRegisterMetaType();
int qMapURLStringMetaTypeId = qRegisterMetaType>();
@@ -49,7 +48,7 @@ void registerMetaTypes(QScriptEngine* engine) {
qScriptRegisterMetaType(engine, vec2FloatToScriptValue, vec2FloatFromScriptValue);
qScriptRegisterMetaType(engine, vec3ToScriptValue, vec3FromScriptValue);
qScriptRegisterMetaType(engine, vec3FloatToScriptValue, vec3FloatFromScriptValue);
- qScriptRegisterMetaType(engine, vec3UIntToScriptValue, vec3UIntFromScriptValue);
+ qScriptRegisterMetaType(engine, vec3UCharToScriptValue, vec3UCharFromScriptValue);
qScriptRegisterMetaType(engine, vec4toScriptValue, vec4FromScriptValue);
qScriptRegisterMetaType(engine, quatToScriptValue, quatFromScriptValue);
qScriptRegisterMetaType(engine, mat4toScriptValue, mat4FromScriptValue);
@@ -65,7 +64,6 @@ void registerMetaTypes(QScriptEngine* engine) {
qScriptRegisterMetaType(engine, qURLToScriptValue, qURLFromScriptValue);
qScriptRegisterMetaType(engine, qColorToScriptValue, qColorFromScriptValue);
- qScriptRegisterMetaType(engine, xColorToScriptValue, xColorFromScriptValue);
qScriptRegisterMetaType(engine, pickRayToScriptValue, pickRayFromScriptValue);
qScriptRegisterMetaType(engine, collisionToScriptValue, collisionFromScriptValue);
qScriptRegisterMetaType(engine, quuidToScriptValue, quuidFromScriptValue);
@@ -208,15 +206,23 @@ void vec3FloatFromScriptValue(const QScriptValue& object, ScriptVec3Float& vec3)
vec3 = ScriptVec3Float();
}
-QScriptValue vec3UIntToScriptValue(QScriptEngine* engine, const ScriptVec3UInt& vec3) {
- return engine->newQObject(new ScriptVec3UInt(vec3), QScriptEngine::ScriptOwnership);
+QScriptValue vec3UCharToScriptValue(QScriptEngine* engine, const ScriptVec3UChar& vec3) {
+ return engine->newQObject(new ScriptVec3UChar(vec3), QScriptEngine::ScriptOwnership);
}
-void vec3UIntFromScriptValue(const QScriptValue& object, ScriptVec3UInt& vec3) {
+void vec3UCharFromScriptValue(const QScriptValue& object, ScriptVec3UChar& vec3) {
if (object.isQObject()) {
auto qObject = object.toQObject();
if (qObject) {
- vec3 = *qobject_cast(qObject);
+ vec3 = *qobject_cast(qObject);
+ return;
+ }
+ } else if (object.isString()) {
+ QColor qColor(object.toString());
+ if (qColor.isValid()) {
+ vec3.x = (uint8_t)qColor.red();
+ vec3.y = (uint8_t)qColor.blue();
+ vec3.z = (uint8_t)qColor.green();
return;
}
} else {
@@ -249,7 +255,7 @@ void vec3UIntFromScriptValue(const QScriptValue& object, ScriptVec3UInt& vec3) {
vec3.z = z.toVariant().toUInt();
return;
}
- vec3 = ScriptVec3UInt();
+ vec3 = ScriptVec3UChar();
}
QScriptValue vec3ToScriptValue(QScriptEngine* engine, const glm::vec3 &vec3) {
@@ -296,6 +302,22 @@ glm::vec3 vec3FromVariant(const QVariant& object, bool& valid) {
v.y = qvec3.y();
v.z = qvec3.z();
valid = true;
+ } else if (object.canConvert()) {
+ QColor qColor(object.toString());
+ if (qColor.isValid()) {
+ v.x = (uint8_t)qColor.red();
+ v.y = (uint8_t)qColor.blue();
+ v.z = (uint8_t)qColor.green();
+ valid = true;
+ }
+ } else if (object.canConvert()) {
+ QColor qColor = qvariant_cast(object);
+ if (qColor.isValid()) {
+ v.x = (uint8_t)qColor.red();
+ v.y = (uint8_t)qColor.blue();
+ v.z = (uint8_t)qColor.green();
+ valid = true;
+ }
} else {
auto map = object.toMap();
auto x = map["x"];
@@ -684,14 +706,6 @@ void qRectFromScriptValue(const QScriptValue &object, QRect& rect) {
rect.setHeight(object.property("height").toVariant().toInt());
}
-QScriptValue xColorToScriptValue(QScriptEngine *engine, const xColor& color) {
- QScriptValue obj = engine->newObject();
- obj.setProperty("red", color.red);
- obj.setProperty("green", color.green);
- obj.setProperty("blue", color.blue);
- return obj;
-}
-
/**jsdoc
* Defines a rectangular portion of an image or screen.
* @typedef {object} Rect
@@ -731,86 +745,6 @@ QRect qRectFromVariant(const QVariant& object) {
return qRectFromVariant(object, valid);
}
-
-void xColorFromScriptValue(const QScriptValue &object, xColor& color) {
- if (!object.isValid()) {
- return;
- }
- if (object.isNumber()) {
- color.red = color.green = color.blue = (uint8_t)object.toUInt32();
- } else if (object.isString()) {
- QColor qcolor(object.toString());
- if (qcolor.isValid()) {
- color.red = (uint8_t)qcolor.red();
- color.blue = (uint8_t)qcolor.blue();
- color.green = (uint8_t)qcolor.green();
- }
- } else {
- color.red = object.property("red").toVariant().toInt();
- color.green = object.property("green").toVariant().toInt();
- color.blue = object.property("blue").toVariant().toInt();
- }
-}
-
-/**jsdoc
- * An RGB color value.
- * @typedef {object} Color
- * @property {number} red - Red component value. Integer in the range 0
- 255
.
- * @property {number} green - Green component value. Integer in the range 0
- 255
.
- * @property {number} blue - Blue component value. Integer in the range 0
- 255
.
- */
-QVariant xColorToVariant(const xColor& color) {
- QVariantMap obj;
- obj["red"] = color.red;
- obj["green"] = color.green;
- obj["blue"] = color.blue;
- return obj;
-}
-
-xColor xColorFromVariant(const QVariant &object, bool& isValid) {
- isValid = false;
- xColor color { 0, 0, 0 };
- if (!object.isValid()) {
- return color;
- }
- if (object.canConvert()) {
- isValid = true;
- color.red = color.green = color.blue = (uint8_t)object.toInt();
- } else if (object.canConvert()) {
- QColor qcolor(object.toString());
- if (qcolor.isValid()) {
- isValid = true;
- color.red = (uint8_t)qcolor.red();
- color.blue = (uint8_t)qcolor.blue();
- color.green = (uint8_t)qcolor.green();
- }
- } else if (object.canConvert()) {
- QColor qcolor = qvariant_cast(object);
- if (qcolor.isValid()) {
- isValid = true;
- color.red = (uint8_t)qcolor.red();
- color.blue = (uint8_t)qcolor.blue();
- color.green = (uint8_t)qcolor.green();
- }
- } else {
- QVariantMap map = object.toMap();
- color.red = map["red"].toInt(&isValid);
- if (isValid) {
- color.green = map["green"].toInt(&isValid);
- }
- if (isValid) {
- color.blue = map["blue"].toInt(&isValid);
- }
- }
- return color;
-}
-
-xColor xColorFromVariant(const QVariant &object) {
- bool valid;
- return xColorFromVariant(object, valid);
-}
-
-
QScriptValue qColorToScriptValue(QScriptEngine* engine, const QColor& color) {
QScriptValue object = engine->newObject();
object.setProperty("red", color.red());
diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h
index eca7552e23..89118dc91b 100644
--- a/libraries/shared/src/RegisteredMetaTypes.h
+++ b/libraries/shared/src/RegisteredMetaTypes.h
@@ -33,7 +33,6 @@ class QUrl;
Q_DECLARE_METATYPE(glm::vec4)
Q_DECLARE_METATYPE(glm::quat)
Q_DECLARE_METATYPE(glm::mat4)
-Q_DECLARE_METATYPE(xColor)
Q_DECLARE_METATYPE(QVector)
Q_DECLARE_METATYPE(AACube)
Q_DECLARE_METATYPE(std::function);
@@ -67,10 +66,10 @@ public:
ScriptVec2Float(const ScriptVec2Float& other) : x(other.x), y(other.y) {}
ScriptVec2Float(const glm::vec2& other) : x(other.x), y(other.y) {}
void operator=(const ScriptVec2Float& other) { x = other.x; y = other.y; }
- inline bool operator==(const ScriptVec2Float& other) { return (x == other.x && y == other.y); }
- inline bool operator!=(const ScriptVec2Float& other) { return !(*this == other); }
- inline bool operator==(const glm::vec2& other) { return (x == other.x && y == other.y); }
- inline bool operator!=(const glm::vec2& other) { return !(*this == other); }
+ inline bool operator==(const ScriptVec2Float& other) const { return (x == other.x && y == other.y); }
+ inline bool operator!=(const ScriptVec2Float& other) const { return !(*this == other); }
+ inline bool operator==(const glm::vec2& other) const { return (x == other.x && y == other.y); }
+ inline bool operator!=(const glm::vec2& other) const { return !(*this == other); }
glm::vec2 toGlm() const { return glm::vec2(x, y); }
Q_INVOKABLE QVariantMap toJSON() { return toJsonValue(*this, { "x", "y" }).toObject().toVariantMap(); }
@@ -128,8 +127,8 @@ public:
void operator=(const ScriptVec3Float& other) { x = other.x; y = other.y; z = other.z; }
inline bool operator==(const ScriptVec3Float& other) const { return (x == other.x && y == other.y && z == other.z); }
inline bool operator!=(const ScriptVec3Float& other) const { return !(*this == other); }
- inline bool operator==(const glm::vec3& other) { return (x == other.x && y == other.y && z == other.z); }
- inline bool operator!=(const glm::vec3& other) { return !(*this == other); }
+ inline bool operator==(const glm::vec3& other) const { return (x == other.x && y == other.y && z == other.z); }
+ inline bool operator!=(const glm::vec3& other) const { return !(*this == other); }
glm::vec3 toGlm() const { return glm::vec3(x, y, z); }
Q_INVOKABLE QVariantMap toJSON() { return toJsonValue(*this, { "x", "y", "z" }).toObject().toVariantMap(); }
@@ -160,7 +159,7 @@ void vec3FloatFromScriptValue(const QScriptValue& object, ScriptVec3Float& vec3)
* @property {number} y - Green component value. Integer in the range 0
- 255
. Synonyms: g
and green
.
* @property {number} z - Blue component value. Integer in the range 0
- 255
. Synonyms: b
and blue
.
*/
-class ScriptVec3UInt : public QObject {
+class ScriptVec3UChar : public QObject {
Q_OBJECT
Q_PROPERTY(unsigned int x MEMBER x)
Q_PROPERTY(unsigned int y MEMBER y)
@@ -172,31 +171,35 @@ class ScriptVec3UInt : public QObject {
Q_PROPERTY(unsigned int green MEMBER y)
Q_PROPERTY(unsigned int blue MEMBER z)
public:
- ScriptVec3UInt() {}
- ScriptVec3UInt(unsigned int xyz) : x(xyz), y(xyz), z(xyz) {}
- ScriptVec3UInt(unsigned int x, unsigned int y, unsigned int z) : x(x), y(y), z(z) {}
- ScriptVec3UInt(const ScriptVec3UInt& other) : x(other.x), y(other.y), z(other.z) {}
- void operator=(const ScriptVec3UInt& other) { x = other.x; y = other.y; z = other.z; }
- inline bool operator==(const ScriptVec3UInt& other) { return (x == other.x && y == other.y && z == other.z); }
- inline bool operator!=(const ScriptVec3UInt& other) { return !(*this == other); }
+ ScriptVec3UChar() {}
+ ScriptVec3UChar(unsigned int xyz) : x(xyz), y(xyz), z(xyz) {}
+ ScriptVec3UChar(unsigned int x, unsigned int y, unsigned int z) : x(x), y(y), z(z) {}
+ ScriptVec3UChar(const ScriptVec3UChar& other) : x(other.x), y(other.y), z(other.z) {}
+ ScriptVec3UChar(const glm::vec3& other) : x(other.x), y(other.y), z(other.z) {}
+ void operator=(const ScriptVec3UChar& other) { x = other.x; y = other.y; z = other.z; }
+ inline bool operator==(const ScriptVec3UChar& other) const { return (x == other.x && y == other.y && z == other.z); }
+ inline bool operator!=(const ScriptVec3UChar& other) const { return !(*this == other); }
+ glm::vec3 toGlm() const { return glm::vec3(x, y, z); }
Q_INVOKABLE QVariantMap toJSON() { return toJsonValue(*this, { "x", "y", "z" }).toObject().toVariantMap(); }
- unsigned int x { 0 };
- unsigned int y { 0 };
- unsigned int z { 0 };
+ unsigned char x { 0 };
+ unsigned char y { 0 };
+ unsigned char z { 0 };
private:
- friend QDebug operator<<(QDebug debug, const ScriptVec3UInt& vec3);
+ friend QDebug operator<<(QDebug debug, const ScriptVec3UChar& vec3);
+ friend bool operator==(glm::vec3 glmVec3, const ScriptVec3UChar& vec3);
+ friend bool operator!=(glm::vec3 glmVec3, const ScriptVec3UChar& vec3);
};
-inline QDebug operator<<(QDebug debug, const ScriptVec3UInt& vec3) {
+inline QDebug operator<<(QDebug debug, const ScriptVec3UChar& vec3) {
debug << "(" << vec3.x << "," << vec3.y << "," << vec3.z << ")";
return debug;
}
-inline bool operator==(glm::vec3 glmVec3, const ScriptVec3UInt& vec3) { return (glmVec3.x == vec3.x && glmVec3.y == vec3.y && glmVec3.z == vec3.z); }
-inline bool operator!=(glm::vec3 glmVec3, const ScriptVec3UInt& vec3) { return !(glmVec3 == vec3); }
-Q_DECLARE_METATYPE(ScriptVec3UInt)
-QScriptValue vec3UIntToScriptValue(QScriptEngine* engine, const ScriptVec3UInt& vec3);
-void vec3UIntFromScriptValue(const QScriptValue& object, ScriptVec3UInt& vec3);
+inline bool operator==(glm::vec3 glmVec3, const ScriptVec3UChar& vec3) { return (glmVec3.x == vec3.x && glmVec3.y == vec3.y && glmVec3.z == vec3.z); }
+inline bool operator!=(glm::vec3 glmVec3, const ScriptVec3UChar& vec3) { return !(glmVec3 == vec3); }
+Q_DECLARE_METATYPE(ScriptVec3UChar)
+QScriptValue vec3UCharToScriptValue(QScriptEngine* engine, const ScriptVec3UChar& vec3);
+void vec3UCharFromScriptValue(const QScriptValue& object, ScriptVec3UChar& vec3);
Q_DECLARE_METATYPE(glm::vec3)
QScriptValue vec3ToScriptValue(QScriptEngine* engine, const glm::vec3 &vec3);
@@ -236,14 +239,6 @@ QRect qRectFromVariant(const QVariant& object, bool& isValid);
QRect qRectFromVariant(const QVariant& object);
QVariant qRectToVariant(const QRect& rect);
-
-// xColor
-QScriptValue xColorToScriptValue(QScriptEngine* engine, const xColor& color);
-void xColorFromScriptValue(const QScriptValue &object, xColor& color);
-
-QVariant xColorToVariant(const xColor& color);
-xColor xColorFromVariant(const QVariant &object, bool& isValid);
-
// QColor
QScriptValue qColorToScriptValue(QScriptEngine* engine, const QColor& color);
void qColorFromScriptValue(const QScriptValue& object, QColor& color);
diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp
index bb22a1e753..5c042d87e1 100644
--- a/libraries/shared/src/SharedUtil.cpp
+++ b/libraries/shared/src/SharedUtil.cpp
@@ -24,6 +24,7 @@
#include
+#include "RegisteredMetaTypes.h"
#ifdef Q_OS_WIN
#include
@@ -420,7 +421,7 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
}
auto voxelSizeInBytes = bytesRequiredForCodeLength(voxelSizeInOctets); // (voxelSizeInBits/8)+1;
- auto voxelBufferSize = voxelSizeInBytes + sizeof(rgbColor); // 3 for color
+ auto voxelBufferSize = voxelSizeInBytes + sizeof(ScriptVec3UChar); // 3 for color
// allocate our resulting buffer
unsigned char* voxelOut = new unsigned char[voxelBufferSize];
diff --git a/libraries/shared/src/SharedUtil.h b/libraries/shared/src/SharedUtil.h
index 3b24110f18..f36574bed6 100644
--- a/libraries/shared/src/SharedUtil.h
+++ b/libraries/shared/src/SharedUtil.h
@@ -80,43 +80,6 @@ const int BYTES_PER_COLOR = 3;
const int BYTES_PER_FLAGS = 1;
typedef unsigned char colorPart;
typedef unsigned char nodeColor[BYTES_PER_COLOR + BYTES_PER_FLAGS];
-typedef unsigned char rgbColor[BYTES_PER_COLOR];
-
-inline QDebug& operator<<(QDebug& dbg, const rgbColor& c) {
- dbg.nospace() << "{type='rgbColor'"
- ", red=" << c[0] <<
- ", green=" << c[1] <<
- ", blue=" << c[2] <<
- "}";
- return dbg;
-}
-
-struct xColor {
- xColor() {}
- xColor(unsigned char r, unsigned char g, unsigned char b) : red(r), green(g), blue(b) {}
- unsigned char red;
- unsigned char green;
- unsigned char blue;
-};
-
-inline QDebug& operator<<(QDebug& dbg, const xColor& c) {
- dbg.nospace() << "{type='xColor'"
- ", red=" << c.red <<
- ", green=" << c.green <<
- ", blue=" << c.blue <<
- "}";
- return dbg;
-}
-
-inline bool operator==(const xColor& lhs, const xColor& rhs)
-{
- return (lhs.red == rhs.red) && (lhs.green == rhs.green) && (lhs.blue == rhs.blue);
-}
-
-inline bool operator!=(const xColor& lhs, const xColor& rhs)
-{
- return (lhs.red != rhs.red) || (lhs.green != rhs.green) || (lhs.blue != rhs.blue);
-}
// Use a custom User-Agent to avoid ModSecurity filtering, e.g. by hosting providers.
const QByteArray HIGH_FIDELITY_USER_AGENT = "Mozilla/5.0 (HighFidelityInterface)";
diff --git a/libraries/shared/src/shared/JSONHelpers.cpp b/libraries/shared/src/shared/JSONHelpers.cpp
index 9cda41ced0..afbdfdbd41 100644
--- a/libraries/shared/src/shared/JSONHelpers.cpp
+++ b/libraries/shared/src/shared/JSONHelpers.cpp
@@ -80,8 +80,8 @@ QJsonValue toJsonValueHelper(const QVariant& variant, int type) {
return toJsonValue(variant.value(), {"x", "y"});
} else if (type == qMetaTypeId()) {
return toJsonValue(variant.value(), { "x", "y", "z" });
- } else if (type == qMetaTypeId()) {
- return toJsonValue(variant.value(), { "x", "y", "z" });
+ } else if (type == qMetaTypeId()) {
+ return toJsonValue(variant.value(), { "x", "y", "z" });
} else {
// Qt types are converted automatically
return QJsonValue::fromVariant(variant);