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