mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 11:46:34 +02:00
commit
e054f16c46
41 changed files with 2975 additions and 211 deletions
|
@ -15,6 +15,24 @@
|
|||
#include <EntityItem.h>
|
||||
#include <ObjectActionTractor.h>
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"far-grab"</code> {@link Entities.ActionType|ActionType} moves and rotates an entity to a target position and
|
||||
* orientation, optionally relative to another entity. Collisions between the entity and the user's avatar are disabled during
|
||||
* the far-grab.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-FarGrab
|
||||
* @property {Vec3} targetPosition=0,0,0 - The target position.
|
||||
* @property {Quat} targetRotation=0,0,0,1 - The target rotation.
|
||||
* @property {Uuid} otherID=null - If an entity ID, the <code>targetPosition</code> and <code>targetRotation</code> are
|
||||
* relative to this entity's position and rotation.
|
||||
* @property {number} linearTimeScale=3.4e+38 - Controls how long it takes for the entity's position to catch up with the
|
||||
* target position. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the action
|
||||
* is applied using an exponential decay.
|
||||
* @property {number} angularTimeScale=3.4e+38 - Controls how long it takes for the entity's orientation to catch up with the
|
||||
* target orientation. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the
|
||||
* action is applied using an exponential decay.
|
||||
*/
|
||||
class AvatarActionFarGrab : public ObjectActionTractor {
|
||||
public:
|
||||
AvatarActionFarGrab(const QUuid& id, EntityItemPointer ownerEntity);
|
||||
|
|
|
@ -416,6 +416,26 @@ bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"hold"</code> {@link Entities.ActionType|ActionType} positions and rotates an entity relative to an avatar's hand.
|
||||
* Collisions between the entity and the user's avatar are disabled during the hold.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-Hold
|
||||
* @property {Uuid} holderID=MyAvatar.sessionUUID - The ID of the avatar holding the entity.
|
||||
* @property {Vec3} relativePosition=0,0,0 - The target position relative to the avatar's hand.
|
||||
* @property {Vec3} relativeRotation=0,0,0,1 - The target rotation relative to the avatar's hand.
|
||||
* @property {number} timeScale=3.4e+38 - Controls how long it takes for the entity's position and rotation to catch up with
|
||||
* the target. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the action is
|
||||
* applied using an exponential decay.
|
||||
* @property {string} hand=right - The hand holding the entity: <code>"left"</code> or <code>"right"</code>.
|
||||
* @property {boolean} kinematic=false - If <code>true</code>, the entity is made kinematic during the action; the entity won't
|
||||
* lag behind the hand but constraint actions such as <code>"hinge"</code> won't act properly.
|
||||
* @property {boolean} kinematicSetVelocity=false - If <code>true</code> and <code>kinematic</code> is <code>true</code>, the
|
||||
* entity's <code>velocity</code> property will be set during the action, e.g., so that other scripts may use the value.
|
||||
* @property {boolean} ignoreIK=false - If <code>true</code>, the entity follows the HMD controller rather than the avatar's
|
||||
* hand.
|
||||
*/
|
||||
QVariantMap AvatarActionHold::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&]{
|
||||
|
|
|
@ -44,6 +44,8 @@ void OverlayPropertyResultFromScriptValue(const QScriptValue& object, OverlayPro
|
|||
const OverlayID UNKNOWN_OVERLAY_ID = OverlayID();
|
||||
|
||||
/**jsdoc
|
||||
* The result of a {@link PickRay} search using {@link Overlays.findRayIntersection|findRayIntersection} or
|
||||
* {@link Overlays.findRayIntersectionVector|findRayIntersectionVector}.
|
||||
* @typedef {object} Overlays.RayToOverlayIntersectionResult
|
||||
* @property {boolean} intersects - <code>true</code> if the {@link PickRay} intersected with a 3D overlay, otherwise
|
||||
* <code>false</code>.
|
||||
|
@ -75,7 +77,8 @@ void RayToOverlayIntersectionResultFromScriptValue(const QScriptValue& object, R
|
|||
* yourself and that aren't persisted to the domain. They are used for UI.
|
||||
* @namespace Overlays
|
||||
* @property {Uuid} keyboardFocusOverlay - Get or set the {@link Overlays.OverlayType|web3d} overlay that has keyboard focus.
|
||||
* If no overlay is set, get returns <code>null</code>; set to <code>null</code> to clear keyboard focus.
|
||||
* If no overlay has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid|Uuid.NULL} to
|
||||
* clear keyboard focus.
|
||||
*/
|
||||
|
||||
class Overlays : public QObject {
|
||||
|
@ -116,7 +119,7 @@ public slots:
|
|||
* @function Overlays.addOverlay
|
||||
* @param {Overlays.OverlayType} type - The type of the overlay to add.
|
||||
* @param {Overlays.OverlayProperties} properties - The properties of the overlay to add.
|
||||
* @returns {Uuid} The ID of the newly created overlay.
|
||||
* @returns {Uuid} The ID of the newly created overlay if successful, otherwise {@link Uuid|Uuid.NULL}.
|
||||
* @example <caption>Add a cube overlay in front of your avatar.</caption>
|
||||
* var overlay = Overlays.addOverlay("cube", {
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
|
||||
|
@ -131,7 +134,7 @@ public slots:
|
|||
* Create a clone of an existing overlay.
|
||||
* @function Overlays.cloneOverlay
|
||||
* @param {Uuid} overlayID - The ID of the overlay to clone.
|
||||
* @returns {Uuid} The ID of the new overlay.
|
||||
* @returns {Uuid} The ID of the new overlay if successful, otherwise {@link Uuid|Uuid.NULL}.
|
||||
* @example <caption>Add an overlay in front of your avatar, clone it, and move the clone to be above the
|
||||
* original.</caption>
|
||||
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 }));
|
||||
|
@ -322,10 +325,8 @@ public slots:
|
|||
* @function Overlays.findRayIntersection
|
||||
* @param {PickRay} pickRay - The PickRay to use for finding overlays.
|
||||
* @param {boolean} [precisionPicking=false] - <em>Unused</em>; exists to match Entity API.
|
||||
* @param {Array.<Uuid>} [overlayIDsToInclude=[]] - Whitelist for intersection test. If empty then the result isn't limited
|
||||
* to overlays in the list.
|
||||
* @param {Array.<Uuid>} [overlayIDsToExclude=[]] - Blacklist for intersection test. If empty then the result doesn't
|
||||
* exclude overlays in the list.
|
||||
* @param {Array.<Uuid>} [overlayIDsToInclude=[]] - If not empty then the search is restricted to these overlays.
|
||||
* @param {Array.<Uuid>} [overlayIDsToExclude=[]] - Overlays to ignore during the search.
|
||||
* @param {boolean} [visibleOnly=false] - <em>Unused</em>; exists to match Entity API.
|
||||
* @param {boolean} [collidableOnly=false] - <em>Unused</em>; exists to match Entity API.
|
||||
* @returns {Overlays.RayToOverlayIntersectionResult} The closest 3D overlay intersected by <code>pickRay</code>, taking
|
||||
|
@ -531,7 +532,7 @@ public slots:
|
|||
* Set the Web3D overlay that has keyboard focus.
|
||||
* @function Overlays.setKeyboardFocusOverlay
|
||||
* @param {Uuid} overlayID - The ID of the {@link Overlays.OverlayType|web3d} overlay to set keyboard focus to. Use
|
||||
* {@link Uuid|Uuid.NULL} or <code>null</code> to unset keyboard focus from an overlay.
|
||||
* <code>null</code> or {@link Uuid|Uuid.NULL} to unset keyboard focus from an overlay.
|
||||
*/
|
||||
void setKeyboardFocusOverlay(const OverlayID& id);
|
||||
|
||||
|
|
|
@ -67,6 +67,32 @@ Shape3DOverlay* Shape3DOverlay::createClone() const {
|
|||
}
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* <p>A <code>shape</code> {@link Overlays.OverlayType|OverlayType} may display as one of the following geometrical shapes:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Dimensions</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"Circle"</code></td><td>2D</td><td>A circle oriented in 3D.</td></td></tr>
|
||||
* <tr><td><code>"Cone"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Cube"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Cylinder"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Dodecahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Hexagon"</code></td><td>3D</td><td>A hexagonal prism.</td></tr>
|
||||
* <tr><td><code>"Icosahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Line"</code></td><td>1D</td><td>A line oriented in 3D.</td></tr>
|
||||
* <tr><td><code>"Octagon"</code></td><td>3D</td><td>An octagonal prism.</td></tr>
|
||||
* <tr><td><code>"Octahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Quad"</code></td><td>2D</td><td>A square oriented in 3D.</tr>
|
||||
* <tr><td><code>"Sphere"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Tetrahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Torus"</code></td><td>3D</td><td><em>Not implemented.</em></td></tr>
|
||||
* <tr><td><code>"Triangle"</code></td><td>3D</td><td>A triangular prism.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Overlays.Shape
|
||||
*/
|
||||
static const std::array<QString, GeometryCache::Shape::NUM_SHAPES> shapeStrings { {
|
||||
"Line",
|
||||
"Triangle",
|
||||
|
@ -80,7 +106,7 @@ static const std::array<QString, GeometryCache::Shape::NUM_SHAPES> shapeStrings
|
|||
"Octahedron",
|
||||
"Dodecahedron",
|
||||
"Icosahedron",
|
||||
"Torus",
|
||||
"Torus", // Not implemented yet.
|
||||
"Cone",
|
||||
"Cylinder"
|
||||
} };
|
||||
|
@ -145,7 +171,7 @@ void Shape3DOverlay::setProperties(const QVariantMap& properties) {
|
|||
*
|
||||
* @property {Vec3} dimensions - The dimensions of the overlay. Synonyms: <code>scale</code>, <code>size</code>.
|
||||
*
|
||||
* @property {Shape} shape=Hexagon - The geometrical shape of the overlay.
|
||||
* @property {Overlays.Shape} shape=Hexagon - The geometrical shape of the overlay.
|
||||
*/
|
||||
QVariant Shape3DOverlay::getProperty(const QString& property) {
|
||||
if (property == "shape") {
|
||||
|
|
|
@ -433,7 +433,7 @@ void ZoneEntityRenderer::setAmbientURL(const QString& ambientUrl) {
|
|||
_ambientTexture = textureCache->getTexture(_ambientTextureURL, image::TextureUsage::CUBE_TEXTURE);
|
||||
|
||||
// keep whatever is assigned on the ambient map/sphere until texture is loaded
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneEntityRenderer::updateAmbientMap() {
|
||||
|
|
|
@ -27,6 +27,14 @@ class OctreePacketData;
|
|||
class EntityTreeElementExtraEncodeData;
|
||||
class ReadBitstreamToTreeParams;
|
||||
|
||||
/**jsdoc
|
||||
* Ambient light is defined by the following properties.
|
||||
* @typedef {object} Entities.AmbientLight
|
||||
* @property {number} ambientIntensity=0.5 - The intensity of the light.
|
||||
* @property {string} ambientURL="" - A cube map image that defines the color of the light coming from each direction. If
|
||||
* <code>""</code> then the entity's {@link Entities.Skybox|Skybox} <code>url</code> property value is used, unless that also is <code>""</code> in which
|
||||
* case the entity's <code>ambientLightMode</code> property is set to <code>"inherit"</code>.
|
||||
*/
|
||||
class AmbientLightPropertyGroup : public PropertyGroup {
|
||||
public:
|
||||
// EntityItemProperty related helpers
|
||||
|
|
|
@ -44,6 +44,19 @@ bool operator!=(const AnimationPropertyGroup& a, const AnimationPropertyGroup& b
|
|||
}
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* The AnimationProperties are used to configure an animation.
|
||||
* @typedef Entities.AnimationProperties
|
||||
* @property {string} url="" - The URL of the FBX file that has the animation.
|
||||
* @property {number} fps=30 - The speed in frames/s that the animation is played at.
|
||||
* @property {number} firstFrame=0 - The first frame to play in the animation.
|
||||
* @property {number} lastFrame=100000 - The last frame to play in the animation.
|
||||
* @property {number} currentFrame=0 - The current frame being played in the animation.
|
||||
* @property {boolean} running=false - If <code>true</code> then the animation should play.
|
||||
* @property {boolean} loop=true - If <code>true</code> then the animation should be continuously repeated in a loop.
|
||||
* @property {boolean} hold=false - If <code>true</code> then the rotations and translations of the last frame played should be
|
||||
* maintained when the animation stops playing.
|
||||
*/
|
||||
void AnimationPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const {
|
||||
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_URL, Animation, animation, URL, url);
|
||||
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ANIMATION_ALLOW_TRANSLATION, Animation, animation, AllowTranslation, allowTranslation);
|
||||
|
|
|
@ -94,6 +94,49 @@ variables. These argument variables are used by the code which is run when bull
|
|||
#include "EntityDynamicInterface.h"
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* <p>An entity action may be one of the following types:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Type</th><th>Description</th><th>Arguments</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"far-grab"</code></td><td>Avatar action</td>
|
||||
* <td>Moves and rotates an entity to a target position and orientation, optionally relative to another entity. Collisions
|
||||
* between the entity and the user's avatar are disabled during the far-grab.</td>
|
||||
* <td>{@link Entities.ActionArguments-FarGrab}</td></tr>
|
||||
* <tr><td><code>"hold"</code></td><td>Avatar action</td>
|
||||
* <td>Positions and rotates an entity relative to an avatar's hand. Collisions between the entity and the user's avatar
|
||||
* are disabled during the hold.</td>
|
||||
* <td>{@link Entities.ActionArguments-Hold}</td></tr>
|
||||
* <tr><td><code>"offset"</code></td><td>Object action</td>
|
||||
* <td>Moves an entity so that it is a set distance away from a target point.</td>
|
||||
* <td>{@link Entities.ActionArguments-Offset}</td></tr>
|
||||
* <tr><td><code>"tractor"</code></td><td>Object action</td>
|
||||
* <td>Moves and rotates an entity to a target position and orientation, optionally relative to another entity.</td>
|
||||
* <td>{@link Entities.ActionArguments-Tractor}</td></tr>
|
||||
* <tr><td><code>"travel-oriented"</code></td><td>Object action</td>
|
||||
* <td>Orients an entity to align with its direction of travel.</td>
|
||||
* <td>{@link Entities.ActionArguments-TravelOriented}</td></tr>
|
||||
* <tr><td><code>"hinge"</code></td><td>Object constraint</td>
|
||||
* <td>Lets an entity pivot about an axis or connects two entities with a hinge joint.</td>
|
||||
* <td>{@link Entities.ActionArguments-Hinge}</td></tr>
|
||||
* <tr><td><code>"slider"</code></td><td>Object constraint</td>
|
||||
* <td>Lets an entity slide and rotate along an axis, or connects two entities that slide and rotate along a shared
|
||||
* axis.</td>
|
||||
* <td>{@link Entities.ActionArguments-Slider|ActionArguments-Slider}</td></tr>
|
||||
* <tr><td><code>"cone-twist"</code></td><td>Object constraint</td>
|
||||
* <td>Connects two entities with a joint that can move through a cone and can twist.</td>
|
||||
* <td>{@link Entities.ActionArguments-ConeTwist}</td></tr>
|
||||
* <tr><td><code>"ball-socket"</code></td><td>Object constraint</td>
|
||||
* <td>Connects two entities with a ball and socket joint.</td>
|
||||
* <td>{@link Entities.ActionArguments-BallSocket}</td></tr>
|
||||
* <tr><td><code>"spring"</code></td><td colspan="3">Synonym for <code>"tractor"</code>. <em>Legacy value.</em></td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Entities.ActionType
|
||||
*/
|
||||
// Note: The "none" action type is not listed because it's an internal "uninitialized" value and not useful for scripts.
|
||||
EntityDynamicType EntityDynamicInterface::dynamicTypeFromString(QString dynamicTypeString) {
|
||||
QString normalizedDynamicTypeString = dynamicTypeString.toLower().remove('-').remove('_');
|
||||
if (normalizedDynamicTypeString == "none") {
|
||||
|
|
|
@ -440,6 +440,707 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
return changedProperties;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* Different entity types have different properties: some common to all entities (listed below) and some specific to each
|
||||
* {@link Entities.EntityType|EntityType} (linked to below). The properties are accessed as an object of property names and
|
||||
* values.
|
||||
*
|
||||
* @typedef {object} Entities.EntityProperties
|
||||
* @property {Uuid} id - The ID of the entity. <em>Read-only.</em>
|
||||
* @property {string} name="" - A name for the entity. Need not be unique.
|
||||
* @property {Entities.EntityType} type - The entity type. You cannot change the type of an entity after it's created. (Though
|
||||
* its value may switch among <code>"Box"</code>, <code>"Shape"</code>, and <code>"Sphere"</code> depending on changes to
|
||||
* the <code>shape</code> property set for entities of these types.) <em>Read-only.</em>
|
||||
* @property {boolean} clientOnly=false - If <code>true</code> then the entity is an avatar entity, otherwise it is a server
|
||||
* entity. <em>Read-only.</em>
|
||||
* @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if <code>clientOnly</code> is
|
||||
* <code>true</code>, otherwise {@link Uuid|Uuid.NULL}. <em>Read-only.</em>
|
||||
*
|
||||
* @property {string} created - The UTC date and time that the entity was created, in ISO 8601 format as
|
||||
* <code>yyyy-MM-ddTHH:mm:ssZ</code>. <em>Read-only.</em>
|
||||
* @property {number} age - The age of the entity in seconds since it was created. <em>Read-only.</em>
|
||||
* @property {string} ageAsText - The age of the entity since it was created, formatted as <code>h hours m minutes s
|
||||
* seconds</code>.
|
||||
* @property {number} lifetime=-1 - How long an entity lives for, in seconds, before being automatically deleted. A value of
|
||||
* <code>-1</code> means that the entity lives for ever.
|
||||
* @property {number} lastEdited - When the entity was last edited, expressed as the number of microseconds since
|
||||
* 1970-01-01T00:00:00 UTC. <em>Read-only.</em>
|
||||
* @property {Uuid} lastEditedBy - The session ID of the avatar or agent that most recently created or edited the entity.
|
||||
* <em>Read-only.</em>
|
||||
*
|
||||
* @property {boolean} locked=false - Whether or not the entity can be edited or deleted. If <code>true</code> then the
|
||||
* entity's properties other than <code>locked</code> cannot be changed, and the entity cannot be deleted.
|
||||
* @property {boolean} visible=true - Whether or not the entity is rendered. If <code>true</code> then the entity is rendered.
|
||||
* @property {boolean} canCastShadows=true - Whether or not the entity casts shadows. Currently applicable only to
|
||||
* {@link Entities.EntityType|Model} and {@link Entities.EntityType|Shape} entities. Shadows are cast if inside a
|
||||
* {@link Entities.EntityType|Zone} entity with <code>castShadows</code> enabled in its {@link Entities.EntityProperties-Zone|keyLight} property.
|
||||
*
|
||||
* @property {Vec3} position=0,0,0 - The position of the entity.
|
||||
* @property {Quat} rotation=0,0,0,1 - The orientation of the entity with respect to world coordinates.
|
||||
* @property {Vec3} registrationPoint=0.5,0.5,0.5 - The point in the entity that is set to the entity's position and is rotated
|
||||
* about, {@link Vec3|Vec3.ZERO} – {@link Vec3|Vec3.ONE}. A value of {@link Vec3|Vec3.ZERO} is the entity's
|
||||
* minimum x, y, z corner; a value of {@link Vec3|Vec3.ONE} is the entity's maximum x, y, z corner.
|
||||
*
|
||||
* @property {Vec3} naturalPosition=0,0,0 - The center of the entity's unscaled mesh model if it has one, otherwise
|
||||
* {@link Vec3|Vec3.ZERO}. <em>Read-only.</em>
|
||||
* @property {Vec3} naturalDimensions - The dimensions of the entity's unscaled mesh model if it has one, otherwise
|
||||
* {@link Vec3|Vec3.ONE}. <em>Read-only.</em>
|
||||
*
|
||||
* @property {Vec3} velocity=0,0,0 - The linear velocity of the entity in m/s with respect to world coordinates.
|
||||
* @property {number} damping=0.39347 - How much to slow down the linear velocity of an entity over time, <code>0.0</code>
|
||||
* – <code>1.0</code>. A higher damping value slows down the entity more quickly. The default value is for an
|
||||
* exponential decay timescale of 2.0s, where it takes 2.0s for the movement to slow to <code>1/e = 0.368</code> of its
|
||||
* initial value.
|
||||
* @property {Vec3} angularVelocity=0,0,0 - The angular velocity of the entity in rad/s with respect to its axes, about its
|
||||
* registration point.
|
||||
* @property {number} angularDamping=0.39347 - How much to slow down the angular velocity of an entity over time,
|
||||
* <code>0.0</code> – <code>1.0</code>. A higher damping value slows down the entity more quickly. The default value
|
||||
* is for an exponential decay timescale of 2.0s, where it takes 2.0s for the movement to slow to <code>1/e = 0.368</code>
|
||||
* of its initial value.
|
||||
*
|
||||
* @property {Vec3} gravity=0,0,0 - The acceleration due to gravity in m/s<sup>2</sup> that the entity should move with, in
|
||||
* world coordinates. Set to <code>{ x: 0, y: -9.8, z: 0 }</code> to simulate Earth's gravity. Gravity is applied to an
|
||||
* entity's motion only if its <code>dynamic</code> property is <code>true</code>. If changing an entity's
|
||||
* <code>gravity</code> from {@link Vec3|Vec3.ZERO}, you need to give it a small <code>velocity</code> in order to kick off
|
||||
* physics simulation.
|
||||
* The <code>gravity</code> value is applied in addition to the <code>acceleration</code> value.
|
||||
* @property {Vec3} acceleration=0,0,0 - A general acceleration in m/s<sup>2</sup> that the entity should move with, in world
|
||||
* coordinates. The acceleration is applied to an entity's motion only if its <code>dynamic</code> property is
|
||||
* <code>true</code>. If changing an entity's <code>acceleration</code> from {@link Vec3|Vec3.ZERO}, you need to give it a
|
||||
* small <code>velocity</code> in order to kick off physics simulation.
|
||||
* The <code>acceleration</code> value is applied in addition to the <code>gravity</code> value.
|
||||
* @property {number} restitution=0.5 - The "bounciness" of an entity when it collides, <code>0.0</code> –
|
||||
* <code>0.99</code>. The higher the value, the more bouncy.
|
||||
* @property {number} friction=0.5 - How much to slow down an entity when it's moving against another, <code>0.0</code> –
|
||||
* <code>10.0</code>. The higher the value, the more quickly it slows down. Examples: <code>0.1</code> for ice,
|
||||
* <code>0.9</code> for sandpaper.
|
||||
* @property {number} density=1000 - The density of the entity in kg/m<sup>3</sup>, <code>100</code> for balsa wood –
|
||||
* <code>10000</code> for silver. The density is used in conjunction with the entity's bounding box volume to work out its
|
||||
* mass in the application of physics.
|
||||
*
|
||||
* @property {boolean} collisionless=false - Whether or not the entity should collide with items per its
|
||||
* <code>collisionMask<code> property. If <code>true</code> then the entity does not collide.
|
||||
* @property {boolean} ignoreForCollisions=false - Synonym for <code>collisionless</code>.
|
||||
* @property {Entities.CollisionMask} collisionMask=31 - What types of items the entity should collide with.
|
||||
* @property {string} collidesWith="static,dynamic,kinematic,myAvatar,otherAvatar," - Synonym for <code>collisionMask</code>,
|
||||
* in text format.
|
||||
* @property {string} collisionSoundURL="" - The sound to play when the entity experiences a collision. Valid file formats are
|
||||
* as per the {@link SoundCache} object.
|
||||
* @property {boolean} dynamic=false - Whether or not the entity should be affected by collisions. If <code>true</code> then
|
||||
* the entity's movement is affected by collisions.
|
||||
* @property {boolean} collisionsWillMove=false - Synonym for <code>dynamic</code>.
|
||||
*
|
||||
* @property {string} href="" - A "hifi://" metaverse address that a user is taken to when they click on the entity.
|
||||
* @property {string} description="" - A description of the <code>href</code> property value.
|
||||
*
|
||||
* @property {string} userData="" - Used to store extra data about the entity in JSON format. WARNING: Other apps such as the
|
||||
* Create app can also use this property, so make sure you handle data stored by other apps — edit only your bit and
|
||||
* leave the rest of the data intact. You can use <code>JSON.parse()</code> to parse the string into a JavaScript object
|
||||
* which you can manipulate the properties of, and use <code>JSON.stringify()</code> to convert the object into a string to
|
||||
* put in the property.
|
||||
*
|
||||
* @property {string} script="" - The URL of the client entity script, if any, that is attached to the entity.
|
||||
* @property {number} scriptTimestamp=0 - Intended to be used to indicate when the client entity script was loaded. Should be
|
||||
* an integer number of milliseconds since midnight GMT on January 1, 1970 (e.g., as supplied by <code>Date.now()</code>.
|
||||
* If you update the property's value, the <code>script</code> is re-downloaded and reloaded. This is how the "reload"
|
||||
* button beside the "script URL" field in properties tab of the Create app works.
|
||||
* @property {string} serverScripts="" - The URL of the server entity script, if any, that is attached to the entity.
|
||||
*
|
||||
* @property {Uuid} parentID=Uuid.NULL - The ID of the entity or avatar that this entity is parented to. {@link Uuid|Uuid.NULL}
|
||||
* if the entity is not parented.
|
||||
* @property {number} parentJointIndex=65535 - The joint of the entity or avatar that this entity is parented to. Use
|
||||
* <code>65535</code> or <code>-1</code> to parent to the entity or avatar's position and orientation rather than a joint.
|
||||
* @property {Vec3} localPosition=0,0,0 - The position of the entity relative to its parent if the entity is parented,
|
||||
* otherwise the same value as <code>position</code>. If the entity is parented to an avatar and is <code>clientOnly</code>
|
||||
* so that it scales with the avatar, this value remains the original local position value while the avatar scale changes.
|
||||
* @property {Quat} localRotation=0,0,0,1 - The rotation of the entity relative to its parent if the entity is parented,
|
||||
* otherwise the same value as <code>rotation</code>.
|
||||
* @property {Vec3} localVelocity=0,0,0 - The velocity of the entity relative to its parent if the entity is parented,
|
||||
* otherwise the same value as <code>velocity</code>.
|
||||
* @property {Vec3} localAngularVelocity=0,0,0 - The angular velocity of the entity relative to its parent if the entity is
|
||||
* parented, otherwise the same value as <code>position</code>.
|
||||
* @property {Vec3} localDimensions - The dimensions of the entity. If the entity is parented to an avatar and is
|
||||
* <code>clientOnly</code> so that it scales with the avatar, this value remains the original dimensions value while the
|
||||
* avatar scale changes.
|
||||
*
|
||||
* @property {Entities.BoundingBox} boundingBox - The axis-aligned bounding box that tightly encloses the entity.
|
||||
* <em>Read-only.</em>
|
||||
* @property {AACube} queryAACube - The axis-aligned cube that determines where the entity lives in the entity server's octree.
|
||||
* The cube may be considerably larger than the entity in some situations, e.g., when the entity is grabbed by an avatar:
|
||||
* the position of the entity is determined through avatar mixer updates and so the AA cube is expanded in order to reduce
|
||||
* unnecessary entity server updates. Scripts should not change this property's value.
|
||||
*
|
||||
* @property {string} actionData="" - Base-64 encoded compressed dump of the actions associated with the entity. This property
|
||||
* is typically not used in scripts directly; rather, functions that manipulate an entity's actions update it.
|
||||
* The size of this property increases with the number of actions. Because this property value has to fit within a High
|
||||
* Fidelity datagram packet there is a limit to the number of actions that an entity can have, and edits which would result
|
||||
* in overflow are rejected.
|
||||
* <em>Read-only.</em>
|
||||
* @property {Entities.RenderInfo} renderInfo - Information on the cost of rendering the entity. Currently information is only
|
||||
* provided for <code>Model</code> entities. <em>Read-only.</em>
|
||||
*
|
||||
* @property {string} itemName="" - Certifiable name of the Marketplace item.
|
||||
* @property {string} itemDescription="" - Certifiable description of the Marketplace item.
|
||||
* @property {string} itemCategories="" - Certifiable category of the Marketplace item.
|
||||
* @property {string} itemArtist="" - Certifiable artist that created the Marketplace item.
|
||||
* @property {string} itemLicense="" - Certifiable license URL for the Marketplace item.
|
||||
* @property {number} limitedRun=4294967295 - Certifiable maximum integer number of editions (copies) of the Marketplace item
|
||||
* allowed to be sold.
|
||||
* @property {number} editionNumber=0 - Certifiable integer edition (copy) number or the Marketplace item. Each copy sold in
|
||||
* the Marketplace is numbered sequentially, starting at 1.
|
||||
* @property {number} entityInstanceNumber=0 - Certifiable integer instance number for identical entities in a Marketplace
|
||||
* item. A Marketplace item may have identical parts. If so, then each is numbered sequentially with an instance number.
|
||||
* @property {string} marketplaceID="" - Certifiable UUID for the Marketplace item, as used in the URL of the item's download
|
||||
* and its Marketplace Web page.
|
||||
* @property {string} certificateID="" - Hash of the entity's static certificate JSON, signed by the artist's private key.
|
||||
* @property {number} staticCertificateVersion=0 - The version of the method used to generate the <code>certificateID</code>.
|
||||
*
|
||||
* @see The different entity types have additional properties as follows:
|
||||
* @see {@link Entities.EntityProperties-Box|EntityProperties-Box}
|
||||
* @see {@link Entities.EntityProperties-Light|EntityProperties-Light}
|
||||
* @see {@link Entities.EntityProperties-Line|EntityProperties-Line}
|
||||
* @see {@link Entities.EntityProperties-Material|EntityProperties-Material}
|
||||
* @see {@link Entities.EntityProperties-Model|EntityProperties-Model}
|
||||
* @see {@link Entities.EntityProperties-ParticleEffect|EntityProperties-ParticleEffect}
|
||||
* @see {@link Entities.EntityProperties-PolyLine|EntityProperties-PolyLine}
|
||||
* @see {@link Entities.EntityProperties-PolyVox|EntityProperties-PolyVox}
|
||||
* @see {@link Entities.EntityProperties-Shape|EntityProperties-Shape}
|
||||
* @see {@link Entities.EntityProperties-Sphere|EntityProperties-Sphere}
|
||||
* @see {@link Entities.EntityProperties-Text|EntityProperties-Text}
|
||||
* @see {@link Entities.EntityProperties-Web|EntityProperties-Web}
|
||||
* @see {@link Entities.EntityProperties-Zone|EntityProperties-Zone}
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Box"</code> {@link Entities.EntityType|EntityType} is the same as the <code>"Shape"</code>
|
||||
* {@link Entities.EntityType|EntityType} except that its <code>shape</code> value is always set to <code>"Cube"</code>
|
||||
* when the entity is created. If its <code>shape</code> property value is subsequently changed then the entity's
|
||||
* <code>type</code> will be reported as <code>"Sphere"</code> if the <code>shape</code> is set to <code>"Sphere"</code>,
|
||||
* otherwise it will be reported as <code>"Shape"</code>.
|
||||
* @typedef {object} Entities.EntityProperties-Box
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Light"</code> {@link Entities.EntityType|EntityType} adds local lighting effects.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Light
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. Entity surface outside these dimensions are not lit
|
||||
* by the light.
|
||||
* @property {Color} color=255,255,255 - The color of the light emitted.
|
||||
* @property {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
|
||||
* local negative z-axis; otherwise the light is a point light which emanates in all directions.
|
||||
* @property {number} exponent=0 - Affects the softness of the spotlight beam: the higher the value the softer the beam.
|
||||
* @property {number} cutoff=1.57 - Affects the size of the spotlight beam: the higher the value the larger the beam.
|
||||
* @example <caption>Create a spotlight pointing at the ground.</caption>
|
||||
* Entities.addEntity({
|
||||
* type: "Light",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -4 })),
|
||||
* rotation: Quat.fromPitchYawRollDegrees(-75, 0, 0),
|
||||
* dimensions: { x: 5, y: 5, z: 5 },
|
||||
* intensity: 100,
|
||||
* falloffRadius: 0.3,
|
||||
* isSpotlight: true,
|
||||
* exponent: 20,
|
||||
* cutoff: 30,
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Line"</code> {@link Entities.EntityType|EntityType} draws thin, straight lines between a sequence of two or more
|
||||
* points.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Line
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. Must be sufficient to contain all the
|
||||
* <code>linePoints</code>.
|
||||
* @property {Vec3[]} linePoints=[]] - The sequence of points to draw lines between. The values are relative to the entity's
|
||||
* 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 {Color} color=255,255,255 - The color of the line.
|
||||
* @example <caption>Draw lines in a "V".</caption>
|
||||
* var entity = Entities.addEntity({
|
||||
* type: "Line",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -5 })),
|
||||
* rotation: MyAvatar.orientation,
|
||||
* dimensions: { x: 2, y: 2, z: 1 },
|
||||
* linePoints: [
|
||||
* { x: -1, y: 1, z: 0 },
|
||||
* { x: 0, y: -1, z: 0 },
|
||||
* { x: 1, y: 1, z: 0 },
|
||||
* ],
|
||||
* color: { red: 255, green: 0, blue: 0 },
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Material"</code> {@link Entities.EntityType|EntityType} modifies the existing materials on
|
||||
* {@link Entities.EntityType|Model} entities, {@link Entities.EntityType|Shape} entities (albedo only),
|
||||
* {@link Overlays.OverlayType|model overlays}, and avatars.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.<br />
|
||||
* To apply a material to an entity or overlay, set the material entity's <code>parentID</code> property to the entity or
|
||||
* overlay's ID.
|
||||
* To apply a material to an avatar, set the material entity's <code>parentID</code> property to the avatar's session UUID.
|
||||
* To apply a material to your avatar such that it persists across domains and log-ins, create the material as an avatar entity
|
||||
* by setting the <code>clientOnly</code> parameter in {@link Entities.addEntity} to <code>true</code>.
|
||||
* Material entities render as non-scalable spheres if they don't have their parent set.
|
||||
* @typedef {object} Entities.EntityProperties-Material
|
||||
* @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append <code>?name</code> to the URL, the
|
||||
* material with that name in the {@link MaterialResource} will be applied to the entity. <br />
|
||||
* Alternatively, set the property value to <code>"userData"</code> to use the {@link Entities.EntityProperties|userData}
|
||||
* entity property to live edit the material resource values.
|
||||
* @property {number} priority=0 - The priority for applying the material to its parent. Only the highest priority material is
|
||||
* applied, with materials of the same priority randomly assigned. Materials that come with the model have a priority of
|
||||
* <code>0</code>.
|
||||
* @property {string|number} parentMaterialName="0" - Selects the submesh or submeshes within the parent to apply the material
|
||||
* to. If in the format <code>"mat::string"</code>, all submeshes with material name <code>"string"</code> are replaced.
|
||||
* Otherwise the property value is parsed as an unsigned integer, specifying the mesh index to modify. Invalid values are
|
||||
* parsed to <code>0</code>.
|
||||
* @property {string} materialMappingMode="uv" - How the material is mapped to the entity. Either <code>"uv"</code> or
|
||||
* <code>"projected"</code>. <em>Currently, only <code>"uv"</code> is supported.
|
||||
* @property {Vec2} materialMappingPos=0,0 - Offset position in UV-space of the top left of the material, range
|
||||
* <code>{ x: 0, y: 0 }</code> – <code>{ x: 1, y: 1 }</code>.
|
||||
* @property {Vec2} materialMappingScale=1,1 - How much to scale the material within the parent's UV-space.
|
||||
* @property {number} materialMappingRot=0 - How much to rotate the material within the parent's UV-space, in degrees.
|
||||
* @example <caption>Color a sphere using a Material entity.</caption>
|
||||
* var entityID = Entities.addEntity({
|
||||
* type: "Sphere",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
|
||||
* dimensions: { x: 1, y: 1, z: 1 },
|
||||
* color: { red: 128, green: 128, blue: 128 },
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*
|
||||
* var materialID = Entities.addEntity({
|
||||
* type: "Material",
|
||||
* parentID: entityID,
|
||||
* materialURL: "userData",
|
||||
* priority: 1,
|
||||
* userData: JSON.stringify({
|
||||
* materials: {
|
||||
* // Can only set albedo on a Shape entity.
|
||||
* // Value overrides entity's "color" property.
|
||||
* albedo: [1.0, 0, 0]
|
||||
* }
|
||||
* }),
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Model"</code> {@link Entities.EntityType|EntityType} displays an FBX or OBJ model.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Model
|
||||
* @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 {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.
|
||||
* @property {string} textures="" - A JSON string of texture name, URL pairs used when rendering the model in place of the
|
||||
* model's original textures. Use a texture name from the <code>originalTextures</code> property to override that texture.
|
||||
* Only the texture names and URLs to be overridden need be specified; original textures are used where there are no
|
||||
* overrides. You can use <code>JSON.stringify()</code> to convert a JavaScript object of name, URL pairs into a JSON
|
||||
* string.
|
||||
* @property {string} originalTextures="{}" - A JSON string of texture name, URL pairs used in the model. The property value is
|
||||
* filled in after the entity has finished rezzing (i.e., textures have loaded). You can use <code>JSON.parse()</code> to
|
||||
* parse the JSON string into a JavaScript object of name, URL pairs. <em>Read-only.</em>
|
||||
*
|
||||
* @property {ShapeType} shapeType="none" - The shape of the collision hull used if collisions are enabled.
|
||||
* @property {string} compoundShapeURL="" - The OBJ file to use for the compound shape if <code>shapeType</code> is
|
||||
* <code>"compound"</code>.
|
||||
*
|
||||
* @property {Entities.AnimationProperties} animation - An animation to play on the model.
|
||||
*
|
||||
* @property {Quat[]} jointRotations=[]] - Joint rotations applied to the model; <code>[]</code> if none are applied or the
|
||||
* model hasn't loaded. The array indexes are per {@link Entities.getJointIndex|getJointIndex}. Rotations are relative to
|
||||
* each joint's parent.<br />
|
||||
* Joint rotations can be set by {@link Entities.setLocalJointRotation|setLocalJointRotation} and similar functions, or by
|
||||
* setting the value of this property. If you set a joint rotation using this property you also need to set the
|
||||
* corresponding <code>jointRotationsSet</code> value to <code>true</code>.
|
||||
* @property {boolean[]} jointRotationsSet=[]] - <code>true</code> values for joints that have had rotations applied,
|
||||
* <code>false</code> otherwise; <code>[]</code> if none are applied or the model hasn't loaded. The array indexes are per
|
||||
* {@link Entities.getJointIndex|getJointIndex}.
|
||||
* @property {Vec3[]} jointTranslations=[]] - Joint translations applied to the model; <code>[]</code> if none are applied or
|
||||
* the model hasn't loaded. The array indexes are per {@link Entities.getJointIndex|getJointIndex}. Rotations are relative
|
||||
* to each joint's parent.<br />
|
||||
* Joint translations can be set by {@link Entities.setLocalJointTranslation|setLocalJointTranslation} and similar
|
||||
* functions, or by setting the value of this property. If you set a joint translation using this property you also need to
|
||||
* set the corresponding <code>jointTranslationsSet</code> value to <code>true</code>.
|
||||
* @property {boolean[]} jointTranslationsSet=[]] - <code>true</code> values for joints that have had translations applied,
|
||||
* <code>false</code> otherwise; <code>[]</code> if none are applied or the model hasn't loaded. The array indexes are per
|
||||
* {@link Entities.getJointIndex|getJointIndex}.
|
||||
* @property {boolean} relayParentJoints=false - If <code>true</code> and the entity is parented to an avatar, then the
|
||||
* avatar's joint rotations are applied to the entity's joints.
|
||||
*
|
||||
* @example <caption>Rez a Vive tracker puck.</caption>
|
||||
* var entity = Entities.addEntity({
|
||||
* type: "Model",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -2 })),
|
||||
* rotation: MyAvatar.orientation,
|
||||
* modelURL: "http://content.highfidelity.com/seefo/production/puck-attach/vive_tracker_puck.obj",
|
||||
* dimensions: { x: 0.0945, y: 0.0921, z: 0.0423 },
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
* @example <caption>Create an "Image" entity like you can in the Create app.</caption>
|
||||
* var IMAGE_MODEL = "https://hifi-content.s3.amazonaws.com/DomainContent/production/default-image-model.fbx";
|
||||
* var DEFAULT_IMAGE = "https://hifi-content.s3.amazonaws.com/DomainContent/production/no-image.jpg";
|
||||
* var entity = Entities.addEntity({
|
||||
* type: "Model",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -3 })),
|
||||
* rotation: MyAvatar.orientation,
|
||||
* dimensions: {
|
||||
* x: 0.5385,
|
||||
* y: 0.2819,
|
||||
* z: 0.0092
|
||||
* },
|
||||
* shapeType: "box",
|
||||
* collisionless: true,
|
||||
* modelURL: IMAGE_MODEL,
|
||||
* textures: JSON.stringify({ "tex.picture": DEFAULT_IMAGE }),
|
||||
* lifetime: 300 // Delete after 5 minutes
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"ParticleEffect"</code> {@link Entities.EntityType|EntityType} displays a particle system that can be used to
|
||||
* simulate things such as fire, smoke, snow, magic spells, etc. The particles emanate from an ellipsoid or part thereof.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-ParticleEffect
|
||||
|
||||
* @property {boolean} isEmitting=true - If <code>true</code> then particles are emitted.
|
||||
* @property {number} maxParticles=1000 - The maximum number of particles to render at one time. Older particles are deleted if
|
||||
* necessary when new ones are created.
|
||||
* @property {number} lifespan=3s - How long, in seconds, each particle lives.
|
||||
* @property {number} emitRate=15 - The number of particles per second to emit.
|
||||
* @property {number} emitSpeed=5 - The speed, in m/s, that each particle is emitted at.
|
||||
* @property {number} speedSpread=1 - The spread in speeds at which particles are emitted at. If <code>emitSpeed == 5</code>
|
||||
* and <code>speedSpread == 1</code>, particles will be emitted with speeds in the range 4m/s – 6m/s.
|
||||
* @property {vec3} emitAcceleration=0,-9.8,0 - The acceleration that is applied to each particle during its lifetime. The
|
||||
* default is Earth's gravity value.
|
||||
* @property {vec3} accelerationSpread=0,0,0 - The spread in accelerations that each particle is given. If
|
||||
* <code>emitAccelerations == {x: 0, y: -9.8, z: 0}</code> and <code>accelerationSpread ==
|
||||
* {x: 0, y: 1, z: 0}</code>, each particle will have an acceleration in the range, <code>{x: 0, y: -10.8, z: 0}</code>
|
||||
* – <code>{x: 0, y: -8.8, z: 0}</code>.
|
||||
* @property {Vec3} dimensions - The dimensions of the particle effect, i.e., a bounding box containing all the particles
|
||||
* during their lifetimes, assuming that <code>emitterShouldTrail</code> is <code>false</code>. <em>Read-only.</em>
|
||||
* @property {boolean} emitterShouldTrail=false - If <code>true</code> then particles are "left behind" as the emitter moves,
|
||||
* otherwise they stay with the entity's dimensions.
|
||||
*
|
||||
* @property {Quat} emitOrientation=-0.707,0,0,0.707 - The orientation of particle emission relative to the entity's axes. By
|
||||
* default, particles emit along the entity's local z-axis, and <code>azimuthStart</code> and <code>azimuthFinish</code>
|
||||
* are relative to the entity's local x-axis. The default value is a rotation of -90 degrees about the local x-axis, i.e.,
|
||||
* the particles emit vertically.
|
||||
* @property {vec3} emitDimensions=0,0,0 - The dimensions of the ellipsoid from which particles are emitted.
|
||||
* @property {number} emitRadiusStart=1 - The starting radius within the ellipsoid at which particles start being emitted;
|
||||
* range <code>0.0</code> – <code>1.0</code> for the ellipsoid center to the ellipsoid surface, respectively.
|
||||
* Particles are emitted from the portion of the ellipsoid that lies between <code>emitRadiusStart</code> and the
|
||||
* ellipsoid's surface.
|
||||
* @property {number} polarStart=0 - The angle in radians from the entity's local z-axis at which particles start being emitted
|
||||
* within the ellipsoid; range <code>0</code> – <code>Math.PI</code>. Particles are emitted from the portion of the
|
||||
* ellipsoid that lies between <code>polarStart<code> and <code>polarFinish</code>.
|
||||
* @property {number} polarFinish=0 - The angle in radians from the entity's local z-axis at which particles stop being emitted
|
||||
* within the ellipsoid; range <code>0</code> – <code>Math.PI</code>. Particles are emitted from the portion of the
|
||||
* ellipsoid that lies between <code>polarStart<code> and <code>polarFinish</code>.
|
||||
* @property {number} azimuthStart=-Math.PI - The angle in radians from the entity's local x-axis about the entity's local
|
||||
* z-axis at which particles start being emitted; range <code>-Math.PI</code> – <code>Math.PI</code>. Particles are
|
||||
* emitted from the portion of the ellipsoid that lies between <code>azimuthStart<code> and <code>azimuthFinish</code>.
|
||||
* @property {number} azimuthFinish=Math.PI - The angle in radians from the entity's local x-axis about the entity's local
|
||||
* z-axis at which particles stop being emitted; range <code>-Math.PI</code> – <code>Math.PI</code>. Particles are
|
||||
* emitted from the portion of the ellipsoid that lies between <code>azimuthStart<code> and <code>azimuthFinish</code>.
|
||||
*
|
||||
* @property {string} textures="" - The URL of a JPG or PNG image file to display for each particle. If you want transparency,
|
||||
* use PNG format.
|
||||
* @property {number} particleRadius=0.025 - The radius of each particle at the middle of its life.
|
||||
* @property {number} radiusStart=0.025 - The radius of each particle at the start of its life. If not explicitly set, the
|
||||
* <code>particleRadius</code> value is used.
|
||||
* @property {number} radiusFinish=0.025 - The radius of each particle at the end of its life. If not explicitly set, the
|
||||
* <code>particleRadius</code> value is used.
|
||||
* @property {number} radiusSpread=0 - <em>Currently not used.</em>
|
||||
* @property {Color} color=255,255,255 - The color of each particle at the middle of its life.
|
||||
* @property {Color} colorStart=255,255,255 - The color of each particle at the start of its life. If not explicitly set, the
|
||||
* <code>color</code> value is used.
|
||||
* @property {Color} colorFinish=255,255,255 - The color of each particle at the end of its life. If not explicitly set, the
|
||||
* <code>color</code> value is used.
|
||||
* @property {Color} colorSpread=0,0,0 - <em>Currently not used.</em>
|
||||
* @property {number} alpha=1 - The alpha of each particle at the middle of its life.
|
||||
* @property {number} alphaStart=1 - The alpha of each particle at the start of its life. If not explicitly set, the
|
||||
* <code>alpha</code> value is used.
|
||||
* @property {number} alphaFinish=1 - The alpha of each particle at the end of its life. If not explicitly set, the
|
||||
* <code>alpha</code> value is used.
|
||||
* @property {number} alphaSpread=0 - <em>Currently not used.</em>
|
||||
*
|
||||
* @property {ShapeType} shapeType="none" - <em>Currently not used.</em> <em>Read-only.</em>
|
||||
*
|
||||
* @example <caption>Create a ball of green smoke.</caption>
|
||||
* particles = Entities.addEntity({
|
||||
* type: "ParticleEffect",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -4 })),
|
||||
* lifespan: 5,
|
||||
* emitRate: 10,
|
||||
* emitSpeed: 0.02,
|
||||
* speedSpread: 0.01,
|
||||
* emitAcceleration: { x: 0, y: 0.02, z: 0 },
|
||||
* polarFinish: Math.PI,
|
||||
* textures: "https://content.highfidelity.com/DomainContent/production/Particles/wispy-smoke.png",
|
||||
* particleRadius: 0.1,
|
||||
* color: { red: 0, green: 255, blue: 0 },
|
||||
* alphaFinish: 0,
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"PolyLine"</code> {@link Entities.EntityType|EntityType} draws textured, straight lines between a sequence of
|
||||
* points.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-PolyLine
|
||||
* @property {Vec3} dimensions=1,1,1 - The dimensions of the entity, i.e., the size of the bounding box that contains the
|
||||
* lines drawn.
|
||||
* @property {Vec3[]} linePoints=[]] - The sequence of points to draw lines between. The values are relative to the entity's
|
||||
* position. A maximum of 70 points can be specified. Must be specified in order for the entity to render.
|
||||
* @property {Vec3[]} normals=[]] - The normal vectors for the line's surface at the <code>linePoints</code>. The values are
|
||||
* relative to the entity's orientation. Must be specified in order for the entity to render.
|
||||
* @property {number[]} strokeWidths=[]] - The widths, in m, of the line at the <code>linePoints</code>. Must be specified in
|
||||
* order for the entity to render.
|
||||
* @property {number} lineWidth=2 - <em>Currently not used.</code>
|
||||
* @property {Vec3[]} strokeColors=[]] - <em>Currently not used.</em>
|
||||
* @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.
|
||||
* @property {boolean} isUVModeStretch=true - If <code>true</code>, the texture is stretched to fill the whole line, otherwise
|
||||
* the texture repeats along the line.
|
||||
* @example <caption>Draw a textured "V".</caption>
|
||||
* var entity = Entities.addEntity({
|
||||
* type: "PolyLine",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -5 })),
|
||||
* rotation: MyAvatar.orientation,
|
||||
* linePoints: [
|
||||
* { x: -1, y: 0.5, z: 0 },
|
||||
* { x: 0, y: 0, z: 0 },
|
||||
* { x: 1, y: 0.5, z: 0 }
|
||||
* ],
|
||||
* normals: [
|
||||
* { x: 0, y: 0, z: 1 },
|
||||
* { x: 0, y: 0, z: 1 },
|
||||
* { x: 0, y: 0, z: 1 }
|
||||
* ],
|
||||
* strokeWidths: [ 0.1, 0.1, 0.1 ],
|
||||
* color: { red: 255, green: 0, blue: 0 }, // Use just the red channel from the image.
|
||||
* textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/trails.png",
|
||||
* isUVModeStretch: true,
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"PolyVox"</code> {@link Entities.EntityType|EntityType} displays a set of textured voxels.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* If you have two or more neighboring PolyVox entities of the same size abutting each other, you can display them as joined by
|
||||
* configuring their <code>voxelSurfaceStyle</code> and neighbor ID properties.<br />
|
||||
* PolyVox entities uses a library from <a href="http://www.volumesoffun.com/">Volumes of Fun</a>. Their
|
||||
* <a href="http://www.volumesoffun.com/polyvox-documentation/">library documentation</a> may be useful to read.
|
||||
* @typedef {object} Entities.EntityProperties-PolyVox
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity.
|
||||
* @property {Vec3} voxelVolumeSize=32,32,32 - Integer number of voxels along each axis of the entity, in the range
|
||||
* <code>1,1,1</code> to <code>128,128,128</code>. The dimensions of each voxel is
|
||||
* <code>dimensions / voxelVolumesize</code>.
|
||||
* @property {string} voxelData="ABAAEAAQAAAAHgAAEAB42u3BAQ0AAADCoPdPbQ8HFAAAAPBuEAAAAQ==" - Base-64 encoded compressed dump of
|
||||
* the PolyVox data. This property is typically not used in scripts directly; rather, functions that manipulate a PolyVox
|
||||
* entity update it.<br />
|
||||
* The size of this property increases with the size and complexity of the PolyVox entity, with the size depending on how
|
||||
* the particular entity's voxels compress. Because this property value has to fit within a High Fidelity datagram packet
|
||||
* there is a limit to the size and complexity of a PolyVox entity, and edits which would result in an overflow are
|
||||
* rejected.
|
||||
* @property {Entities.PolyVoxSurfaceStyle} voxelSurfaceStyle=2 - The style of rendering the voxels' surface and how
|
||||
* neighboring PolyVox entities are joined.
|
||||
* @property {string} xTextureURL="" - URL of the texture to map to surfaces perpendicular to the entity's local x-axis. JPG or
|
||||
* PNG format. If no texture is specified the surfaces display white.
|
||||
* @property {string} yTextureURL="" - URL of the texture to map to surfaces perpendicular to the entity's local y-axis. JPG or
|
||||
* PNG format. If no texture is specified the surfaces display white.
|
||||
* @property {string} zTextureURL="" - URL of the texture to map to surfaces perpendicular to the entity's local z-axis. JPG or
|
||||
* PNG format. If no texture is specified the surfaces display white.
|
||||
* @property {Uuid} xNNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's -ve local x-axis direction,
|
||||
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
|
||||
* @property {Uuid} yNNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's -ve local y-axis direction,
|
||||
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
|
||||
* @property {Uuid} zNNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's -ve local z-axis direction,
|
||||
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
|
||||
* @property {Uuid} xPNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's +ve local x-axis direction,
|
||||
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
|
||||
* @property {Uuid} yPNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's +ve local y-axis direction,
|
||||
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
|
||||
* @property {Uuid} zPNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's +ve local z-axis direction,
|
||||
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
|
||||
* @example <caption>Create a textured PolyVox sphere.</caption>
|
||||
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -8 }));
|
||||
* var texture = "http://public.highfidelity.com/cozza13/tuscany/Concrete2.jpg";
|
||||
* var polyVox = Entities.addEntity({
|
||||
* type: "PolyVox",
|
||||
* position: position,
|
||||
* dimensions: { x: 2, y: 2, z: 2 },
|
||||
* xTextureURL: texture,
|
||||
* yTextureURL: texture,
|
||||
* zTextureURL: texture,
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
* Entities.setVoxelSphere(polyVox, position, 0.8, 255);
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Shape"</code> {@link Entities.EntityType|EntityType} displays an entity of a specified <code>shape</code>.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Shape
|
||||
* @property {Entities.Shape} shape="Sphere" - The shape of the entity.
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity.
|
||||
* @property {Color} color=255,255,255 - The color of the entity.
|
||||
* @example <caption>Create a cylinder.</caption>
|
||||
* var shape = Entities.addEntity({
|
||||
* type: "Shape",
|
||||
* shape: "Cylinder",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
|
||||
* dimensions: { x: 0.4, y: 0.6, z: 0.4 },
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Sphere"</code> {@link Entities.EntityType|EntityType} is the same as the <code>"Shape"</code>
|
||||
* {@link Entities.EntityType|EntityType} except that its <code>shape</code> value is always set to <code>"Sphere"</code>
|
||||
* when the entity is created. If its <code>shape</code> property value is subsequently changed then the entity's
|
||||
* <code>type</code> will be reported as <code>"Box"</code> if the <code>shape</code> is set to <code>"Cube"</code>,
|
||||
* otherwise it will be reported as <code>"Shape"</code>.
|
||||
* @typedef {object} Entities.EntityProperties-Sphere
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Text"</code> {@link Entities.EntityType|EntityType} displays a 2D rectangle of text in the domain.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Text
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.01 - The dimensions of the entity.
|
||||
* @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 {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>
|
||||
* var text = Entities.addEntity({
|
||||
* type: "Text",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
|
||||
* dimensions: { x: 0.6, y: 0.3, z: 0.01 },
|
||||
* lineHeight: 0.12,
|
||||
* text: "Hello\nthere!",
|
||||
* faceCamera: true,
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Web"</code> {@link Entities.EntityType|EntityType} displays a browsable Web page. Each user views their own copy
|
||||
* of the Web page: if one user navigates to another page on the entity, other users do not see the change; if a video is being
|
||||
* played, users don't see it in sync.
|
||||
* The entity has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Web
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.01 - The dimensions of the entity.
|
||||
* @property {string} sourceUrl="" - The URL of the Web page to display. This value does not change as you or others navigate
|
||||
* on the Web entity.
|
||||
* @property {number} dpi=30 - The resolution to display the page at, in dots per inch. If you convert this to dots per meter
|
||||
* (multiply by 1 / 0.0254 = 39.3701) then multiply <code>dimensions.x</code> and <code>dimensions.y</code> by that value
|
||||
* you get the resolution in pixels.
|
||||
* @example <caption>Create a Web entity displaying at 1920 x 1080 resolution.</caption>
|
||||
* var METERS_TO_INCHES = 39.3701;
|
||||
* var entity = Entities.addEntity({
|
||||
* type: "Web",
|
||||
* sourceUrl: "https://highfidelity.com/",
|
||||
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -4 })),
|
||||
* rotation: MyAvatar.orientation,
|
||||
* dimensions: {
|
||||
* x: 3,
|
||||
* y: 3 * 1080 / 1920,
|
||||
* z: 0.01
|
||||
* },
|
||||
* dpi: 1920 / (3 * METERS_TO_INCHES),
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"Zone"</code> {@link Entities.EntityType|EntityType} is a volume of lighting effects and avatar permissions.
|
||||
* Avatar interaction events such as {@link Entities.enterEntity} are also often used with a Zone entity.
|
||||
* It has properties in addition to the common {@link Entities.EntityProperties|EntityProperties}.
|
||||
* @typedef {object} Entities.EntityProperties-Zone
|
||||
* @property {Vec3} dimensions=0.1,0.1,0.1 - The size of the volume in which the zone's lighting effects and avatar permissions
|
||||
* have effect.
|
||||
*
|
||||
* @property {ShapeType} shapeType="box" - The shape of the volume in which the zone's lighting effects and avatar
|
||||
* permissions have effect. Reverts to the default value if set to <code>"none"</code>, or set to <code>"compound"</code>
|
||||
* and <code>compoundShapeURL</code> is <code>""</code>.
|
||||
* @property {string} compoundShapeURL="" - The OBJ file to use for the compound shape if <code>shapeType</code> is
|
||||
* <code>"compound"</code>.
|
||||
*
|
||||
* @property {string} keyLightMode="inherit" - Configures the key light in the zone. Possible values:<br />
|
||||
* <code>"inherit"</code>: The key light from any enclosing zone continues into this zone.<br />
|
||||
* <code>"disabled"</code>: The key light from any enclosing zone and the key light of this zone are disabled in this
|
||||
* zone.<br />
|
||||
* <code>"enabled"</code>: The key light properties of this zone are enabled, overriding the key light of from any
|
||||
* enclosing zone.
|
||||
* @property {Entities.KeyLight} keyLight - The key light properties of the zone.
|
||||
*
|
||||
* @property {string} ambientLightMode="inherit" - Configures the ambient light in the zone. Possible values:<br />
|
||||
* <code>"inherit"</code>: The ambient light from any enclosing zone continues into this zone.<br />
|
||||
* <code>"disabled"</code>: The ambient light from any enclosing zone and the ambient light of this zone are disabled in
|
||||
* this zone.<br />
|
||||
* <code>"enabled"</code>: The ambient light properties of this zone are enabled, overriding the ambient light from any
|
||||
* enclosing zone.
|
||||
* @property {Entities.AmbientLight} ambientLight - The ambient light properties of the zone.
|
||||
*
|
||||
* @property {string} skyboxMode="inherit" - Configures the skybox displayed in the zone. Possible values:<br />
|
||||
* <code>"inherit"</code>: The skybox from any enclosing zone is dislayed in this zone.<br />
|
||||
* <code>"disabled"</code>: The skybox from any enclosing zone and the skybox of this zone are disabled in this zone.<br />
|
||||
* <code>"enabled"</code>: The skybox properties of this zone are enabled, overriding the skybox from any enclosing zone.
|
||||
* @property {Entities.Skybox} skybox - The skybox properties of the zone.
|
||||
*
|
||||
* @property {string} hazeMode="inherit" - Configures the haze in the zone. Possible values:<br />
|
||||
* <code>"inherit"</code>: The haze from any enclosing zone continues into this zone.<br />
|
||||
* <code>"disabled"</code>: The haze from any enclosing zone and the haze of this zone are disabled in this zone.<br />
|
||||
* <code>"enabled"</code>: The haze properties of this zone are enabled, overriding the haze from any enclosing zone.
|
||||
* @property {Entities.Haze} haze - The haze properties of the zone.
|
||||
*
|
||||
* @property {boolean} flyingAllowed=true - If <code>true</code> then visitors can fly in the zone; otherwise they cannot.
|
||||
* @property {boolean} ghostingAllowed=true - If <code>true</code> then visitors with avatar collisions turned off will not
|
||||
* collide with content in the zone; otherwise visitors will always collide with content in the zone.
|
||||
|
||||
* @property {string} filterURL="" - The URL of a JavaScript file that filters changes to properties of entities within the
|
||||
* zone. It is periodically executed for each entity in the zone. It can, for example, be used to not allow changes to
|
||||
* certain properties.<br />
|
||||
* <pre>
|
||||
* function filter(properties) {
|
||||
* // Test and edit properties object values,
|
||||
* // e.g., properties.modelURL, as required.
|
||||
* return properties;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @example <caption>Create a zone that casts a red key light along the x-axis.</caption>
|
||||
* var zone = Entities.addEntity({
|
||||
* type: "Zone",
|
||||
* position: MyAvatar.position,
|
||||
* dimensions: { x: 100, y: 100, z: 100 },
|
||||
* keyLightMode: "enabled",
|
||||
* keyLight: {
|
||||
* "color": { "red": 255, "green": 0, "blue": 0 },
|
||||
* "direction": { "x": 1, "y": 0, "z": 0 }
|
||||
* },
|
||||
* lifetime: 300 // Delete after 5 minutes.
|
||||
* });
|
||||
*/
|
||||
|
||||
QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool skipDefaults, bool allowUnknownCreateTime, bool strictSemantics) const {
|
||||
// If strictSemantics is true and skipDefaults is false, then all and only those properties are copied for which the property flag
|
||||
// is included in _desiredProperties, or is one of the specially enumerated ALWAYS properties below.
|
||||
|
@ -491,7 +1192,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ANGULAR_VELOCITY, angularVelocity);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ANGULAR_DAMPING, angularDamping);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CAN_CAST_SHADOW, canCastShadow);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CAN_CAST_SHADOW, canCastShadow); // Relevant to Shape and Model entities only.
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISIONLESS, collisionless);
|
||||
COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISIONLESS, collisionless, ignoreForCollisions, getCollisionless()); // legacy support
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISION_MASK, collisionMask);
|
||||
|
@ -500,7 +1201,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_DYNAMIC, dynamic, collisionsWillMove, getDynamic()); // legacy support
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_HREF, href);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DESCRIPTION, description);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FACE_CAMERA, faceCamera);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FACE_CAMERA, faceCamera); // Text only.
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ACTION_DATA, actionData);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCKED, locked);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_USER_DATA, userData);
|
||||
|
@ -521,7 +1222,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NAME, name);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISION_SOUND_URL, collisionSoundURL);
|
||||
|
||||
// Boxes, Spheres, Light, Line, Model(??), Particle, PolyLine
|
||||
// Light, Line, Model, ParticleEffect, PolyLine, Shape
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLOR, color);
|
||||
|
||||
// Particles only
|
||||
|
@ -569,12 +1270,15 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
if (_type == EntityTypes::Model || _type == EntityTypes::Zone || _type == EntityTypes::ParticleEffect) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, getShapeTypeAsString());
|
||||
}
|
||||
|
||||
// FIXME: Shouldn't provide a shapeType property for Box and Sphere entities.
|
||||
if (_type == EntityTypes::Box) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, QString("Box"));
|
||||
}
|
||||
if (_type == EntityTypes::Sphere) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, QString("Sphere"));
|
||||
}
|
||||
|
||||
if (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHAPE, shape);
|
||||
}
|
||||
|
@ -653,11 +1357,11 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
if (_type == EntityTypes::Line || _type == EntityTypes::PolyLine) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_WIDTH, lineWidth);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_POINTS, linePoints);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NORMALS, normals);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_COLORS, strokeColors);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_WIDTHS, strokeWidths);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_NORMALS, normals); // Polyline only.
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_COLORS, strokeColors); // 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.
|
||||
}
|
||||
|
||||
// Materials
|
||||
|
@ -671,6 +1375,14 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MATERIAL_MAPPING_ROT, materialMappingRot);
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The axis-aligned bounding box of an entity.
|
||||
* @typedef Entities.BoundingBox
|
||||
* @property {Vec3} brn - The bottom right near (minimum axes values) corner of the AA box.
|
||||
* @property {Vec3} tfl - The top far left (maximum axes values) corner of the AA box.
|
||||
* @property {Vec3} center - The center of the AA box.
|
||||
* @property {Vec3} dimensions - The dimensions of the AA box.
|
||||
*/
|
||||
if (!skipDefaults && !strictSemantics) {
|
||||
AABox aaBox = getAABox();
|
||||
QScriptValue boundingBox = engine->newObject();
|
||||
|
@ -692,6 +1404,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_ID, parentID);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
||||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube);
|
||||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition);
|
||||
|
@ -700,13 +1413,23 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions);
|
||||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly); // Gettable but not settable
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); // Gettable but not settable
|
||||
|
||||
// Rendering info
|
||||
if (!skipDefaults && !strictSemantics) {
|
||||
QScriptValue renderInfo = engine->newObject();
|
||||
|
||||
/**jsdoc
|
||||
* Information on how an entity is rendered. Properties are only filled in for <code>Model</code> entities; other
|
||||
* entity types have an empty object, <code>{}</code>.
|
||||
* @typedef {object} Entities.RenderInfo
|
||||
* @property {number} verticesCount - The number of vertices in the entity.
|
||||
* @property {number} texturesCount - The number of textures in the entity.
|
||||
* @property {number} textureSize - The total size of the textures in the entity, in bytes.
|
||||
* @property {boolean} hasTransparent - Is <code>true</code> if any of the textures has transparency.
|
||||
* @property {number} drawCalls - The number of draw calls required to render the entity.
|
||||
*/
|
||||
// currently only supported by models
|
||||
if (_type == EntityTypes::Model) {
|
||||
renderInfo.setProperty("verticesCount", (int)getRenderInfoVertexCount()); // FIXME - theoretically the number of vertex could be > max int
|
||||
|
@ -719,6 +1442,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(renderInfo, renderInfo); // Gettable but not settable
|
||||
}
|
||||
|
||||
// FIXME: These properties should already have been set above.
|
||||
properties.setProperty("clientOnly", convertScriptValue(engine, getClientOnly()));
|
||||
properties.setProperty("owningAvatarID", convertScriptValue(engine, getOwningAvatarID()));
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ public:
|
|||
DEFINE_PROPERTY(PROP_NORMALS, Normals, normals, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
||||
DEFINE_PROPERTY(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
||||
DEFINE_PROPERTY(PROP_STROKE_WIDTHS, StrokeWidths, strokeWidths, QVector<float>, QVector<float>());
|
||||
DEFINE_PROPERTY(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, bool, true);
|
||||
DEFINE_PROPERTY(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, bool, true);
|
||||
DEFINE_PROPERTY_REF(PROP_X_TEXTURE_URL, XTextureURL, xTextureURL, QString, "");
|
||||
DEFINE_PROPERTY_REF(PROP_Y_TEXTURE_URL, YTextureURL, yTextureURL, QString, "");
|
||||
DEFINE_PROPERTY_REF(PROP_Z_TEXTURE_URL, ZTextureURL, zTextureURL, QString, "");
|
||||
|
|
|
@ -538,7 +538,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
|||
NestableType nestableType = nestable->getNestableType();
|
||||
if (nestableType == NestableType::Overlay || nestableType == NestableType::Avatar) {
|
||||
qCWarning(entities) << "attempted edit on non-entity: " << id << nestable->getName();
|
||||
return QUuid(); // null UUID to indicate failure
|
||||
return QUuid(); // null script value to indicate failure
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1017,6 +1017,25 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c
|
|||
|
||||
QString faceName = "";
|
||||
// handle BoxFace
|
||||
/**jsdoc
|
||||
* <p>A <code>BoxFace</code> specifies the face of an axis-aligned (AA) box.
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"MIN_X_FACE"</code></td><td>The minimum x-axis face.</td></tr>
|
||||
* <tr><td><code>"MAX_X_FACE"</code></td><td>The maximum x-axis face.</td></tr>
|
||||
* <tr><td><code>"MIN_Y_FACE"</code></td><td>The minimum y-axis face.</td></tr>
|
||||
* <tr><td><code>"MAX_Y_FACE"</code></td><td>The maximum y-axis face.</td></tr>
|
||||
* <tr><td><code>"MIN_Z_FACE"</code></td><td>The minimum z-axis face.</td></tr>
|
||||
* <tr><td><code>"MAX_Z_FACE"</code></td><td>The maximum z-axis face.</td></tr>
|
||||
* <tr><td><code>"UNKNOWN_FACE"</code></td><td>Unknown value.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} BoxFace
|
||||
*/
|
||||
// FIXME: Move enum to string function to BoxBase.cpp.
|
||||
switch (value.face) {
|
||||
case MIN_X_FACE:
|
||||
faceName = "MIN_X_FACE";
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -35,6 +35,56 @@ typedef EntityItemPointer (*EntityTypeFactory)(const EntityItemID& entityID, con
|
|||
|
||||
class EntityTypes {
|
||||
public:
|
||||
/**jsdoc
|
||||
* <p>An entity may be one of the following types:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th><th>Properties</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"Box"</code></td><td>A rectangular prism. This is a synonym of <code>"Shape"</code> for the case
|
||||
* where the entity's <code>shape</code> property value is <code>"Cube"</code>.<br />
|
||||
* If an entity is created with its <code>type</code>
|
||||
* set to <code>"Box"</code> it will always be created with a <code>shape</code> property value of
|
||||
* <code>"Cube"</code>. If an entity of type <code>Shape</code> or <code>Sphere</code> has its <code>shape</code> set
|
||||
* to <code>"Cube"</code> then its <code>type</code> will be reported as <code>"Box"</code>.
|
||||
* <td>{@link Entities.EntityProperties-Box|EntityProperties-Box}</td></tr>
|
||||
* <tr><td><code>"Light"</code></td><td>A local lighting effect.</td>
|
||||
* <td>{@link Entities.EntityProperties-Light|EntityProperties-Light}</td></tr>
|
||||
* <tr><td><code>"Line"</code></td><td>A sequence of one or more simple straight lines.</td>
|
||||
* <td>{@link Entities.EntityProperties-Line|EntityProperties-Line}</td></tr>
|
||||
* <tr><td><code>"Material"</code></td><td>Modifies the existing materials on Model entities, Shape entities (albedo
|
||||
* only), {@link Overlays.OverlayType|model overlays}, and avatars.</td>
|
||||
* <td>{@link Entities.EntityProperties-Material|EntityProperties-Material}</td></tr>
|
||||
* <tr><td><code>"Model"</code></td><td>A mesh model from an FBX or OBJ file.</td>
|
||||
* <td>{@link Entities.EntityProperties-Model|EntityProperties-Model}</td></tr>
|
||||
* <tr><td><code>"ParticleEffect"</code></td><td>A particle system that can be used to simulate things such as fire,
|
||||
* smoke, snow, magic spells, etc.</td>
|
||||
* <td>{@link Entities.EntityProperties-ParticleEffect|EntityProperties-ParticleEffect}</td></tr>
|
||||
* <tr><td><code>"PolyLine"</code></td><td>A sequence of one or more textured straight lines.</td>
|
||||
* <td>{@link Entities.EntityProperties-PolyLine|EntityProperties-PolyLine}</td></tr>
|
||||
* <tr><td><code>"PolyVox"</code></td><td>A set of textured voxels.</td>
|
||||
* <td>{@link Entities.EntityProperties-PolyVox|EntityProperties-PolyVox}</td></tr>
|
||||
* <tr><td><code>"Shape"</code></td><td>A basic entity such as a cube.
|
||||
* See also, the <code>"Box"</code> and <code>"Sphere"</code> entity types.</td>
|
||||
* <td>{@link Entities.EntityProperties-Shape|EntityProperties-Shape}</td></tr>
|
||||
* <tr><td><code>"Sphere"</code></td><td>A sphere. This is a synonym of <code>"Shape"</code> for the case
|
||||
* where the entity's <code>shape</code> property value is <code>"Sphere"</code>.<br />
|
||||
* If an entity is created with its <code>type</code>
|
||||
* set to <code>"Sphere"</code> it will always be created with a <code>shape</code> property value of
|
||||
* <code>"Sphere"</code>. If an entity of type <code>Box</code> or <code>Shape</code> has its <code>shape</code> set
|
||||
* to <code>"Sphere"</code> then its <code>type</code> will be reported as <code>"Sphere"</code>.
|
||||
* <td>{@link Entities.EntityProperties-Sphere|EntityProperties-Sphere}</td></tr>
|
||||
* <tr><td><code>"Text"</code></td><td>A pane of text oriented in space.</td>
|
||||
* <td>{@link Entities.EntityProperties-Text|EntityProperties-Text}</td></tr>
|
||||
* <tr><td><code>"Web"</code></td><td>A browsable Web page.</td>
|
||||
* <td>{@link Entities.EntityProperties-Web|EntityProperties-Web}</td></tr>
|
||||
* <tr><td><code>"Zone"</code></td><td>A volume of lighting effects and avatar permissions.</td>
|
||||
* <td>{@link Entities.EntityProperties-Zone|EntityProperties-Zone}</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Entities.EntityType
|
||||
*/
|
||||
typedef enum EntityType_t {
|
||||
Unknown,
|
||||
Model,
|
||||
|
|
|
@ -40,6 +40,35 @@ static const float INITIAL_HAZE_BACKGROUND_BLEND{ 0.0f };
|
|||
static const float INITIAL_KEY_LIGHT_RANGE{ 1000.0f };
|
||||
static const float INITIAL_KEY_LIGHT_ALTITUDE{ 200.0f };
|
||||
|
||||
// FIXME: Document hazeAttenuationKeyLight, hazeKeyLightRange, and hazeKeyLightAltitude once they're working and are provided
|
||||
// in the Create app's UI.
|
||||
/**jsdoc
|
||||
* Haze is defined by the following properties.
|
||||
* @typedef {object} Entities.Haze
|
||||
*
|
||||
* @property {number} hazeRange=1000 - The horizontal distance at which visibility is reduced to 95%; i.e., 95% of each pixel's
|
||||
* color is haze.
|
||||
* @property {Color} hazeColor=128,154,179 - The color of the haze when looking away from the key light.
|
||||
* @property {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 {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.
|
||||
*
|
||||
* @property {boolean} hazeAltitudeEffect=false - If <code>true</code> then haze decreases with altitude as defined by the
|
||||
* entity's local coordinate system; <code>hazeBaseRef</code> and </code>hazeCeiling</code> are used.
|
||||
* @property {number} hazeBaseRef=0 - The y-axis value in the entity's local coordinate system at which the haze density starts
|
||||
* reducing with altitude.
|
||||
* @property {number} hazeCeiling=200 - The y-axis value in the entity's local coordinate system at which the haze density has
|
||||
* reduced to 5%.
|
||||
*
|
||||
* @property {number} hazeBackgroundBlend=0 - The proportion of the skybox image to show through the haze: <code>0.0</code>
|
||||
* displays no skybox image; <code>1.0</code> displays no haze.
|
||||
*
|
||||
* @property {boolean} hazeAttenuateKeyLight=false - <em>Currently not supported.</em>
|
||||
* @property {number} hazeKeyLightRange=1000 - <em>Currently not supported.</em>
|
||||
* @property {number} hazeKeyLightAltitude=200 - <em>Currently not supported.</em>
|
||||
*/
|
||||
class HazePropertyGroup : public PropertyGroup {
|
||||
public:
|
||||
// EntityItemProperty related helpers
|
||||
|
|
|
@ -27,6 +27,16 @@ class OctreePacketData;
|
|||
class EntityTreeElementExtraEncodeData;
|
||||
class ReadBitstreamToTreeParams;
|
||||
|
||||
/**jsdoc
|
||||
* A key light is defined by the following properties.
|
||||
* @typedef {object} Entities.KeyLight
|
||||
* @property {Color} color=255,255,255 - The color of the light.
|
||||
* @property {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
|
||||
* {@link Entities.EntityType|Model} and {@link Entities.EntityType|Shape} entities that have their
|
||||
* <code>{@link Entities.EntityProperties|canCastShadows}</code> property set to <code>true</code>.
|
||||
*/
|
||||
class KeyLightPropertyGroup : public PropertyGroup {
|
||||
public:
|
||||
// EntityItemProperty related helpers
|
||||
|
|
|
@ -59,6 +59,25 @@ class PolyVoxEntityItem : public EntityItem {
|
|||
|
||||
virtual int getOnCount() const { return 0; }
|
||||
|
||||
/**jsdoc
|
||||
* <p>A <code>PolyVoxSurfaceStyle</code> may be one of the following:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Type</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>0</code></td><td>Marching cubes.</td><td>Chamfered edges. Open volume.
|
||||
* Joins neighboring PolyVox entities reasonably well.</td></tr>
|
||||
* <tr><td><code>1</code></td><td>Cubic.</td><td>Square edges. Open volume.
|
||||
* Joins neighboring PolyVox entities cleanly.</td></tr>
|
||||
* <tr><td><code>2</code></td><td>Edged cubic.</td><td>Square edges. Enclosed volume.
|
||||
* Joins neighboring PolyVox entities cleanly.</td></tr>
|
||||
* <tr><td><code>3</code></td><td>Edged marching cubes.</td><td>Chamfered edges. Enclosed volume.
|
||||
* Doesn't join neighboring PolyVox entities.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {number} Entities.PolyVoxSurfaceStyle
|
||||
*/
|
||||
enum PolyVoxSurfaceStyle {
|
||||
SURFACE_MARCHING_CUBES,
|
||||
SURFACE_CUBIC,
|
||||
|
|
|
@ -20,6 +20,33 @@
|
|||
#include "ShapeEntityItem.h"
|
||||
|
||||
namespace entity {
|
||||
|
||||
/**jsdoc
|
||||
* <p>A <code>Shape</code>, <code>Box</code>, or <code>Sphere</code> {@link Entities.EntityType|EntityType} may display as
|
||||
* one of the following geometrical shapes:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Dimensions</th><th>Notes</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"Circle"</code></td><td>2D</td><td>A circle oriented in 3D.</td></tr>
|
||||
* <tr><td><code>"Cube"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Cone"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Cylinder"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Dodecahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Hexagon"</code></td><td>3D</td><td>A hexagonal prism.</td></tr>
|
||||
* <tr><td><code>"Icosahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Octagon"</code></td><td>3D</td><td>An octagonal prism.</td></tr>
|
||||
* <tr><td><code>"Octahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Quad"</code></td><td>2D</td><td>A square oriented in 3D.</td></tr>
|
||||
* <tr><td><code>"Sphere"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Tetrahedron"</code></td><td>3D</td><td></td></tr>
|
||||
* <tr><td><code>"Torus"</code></td><td>3D</td><td><em>Not implemented.</em></td></tr>
|
||||
* <tr><td><code>"Triangle"</code></td><td>3D</td><td>A triangular prism.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Entities.Shape
|
||||
*/
|
||||
static const std::array<QString, Shape::NUM_SHAPES> shapeStrings { {
|
||||
"Triangle",
|
||||
"Quad",
|
||||
|
@ -32,7 +59,7 @@ namespace entity {
|
|||
"Octahedron",
|
||||
"Dodecahedron",
|
||||
"Icosahedron",
|
||||
"Torus",
|
||||
"Torus", // Not implemented yet.
|
||||
"Cone",
|
||||
"Cylinder"
|
||||
} };
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
float _alpha { 1 };
|
||||
float _alpha { 1 }; // FIXME: This property is not used.
|
||||
rgbColor _color;
|
||||
entity::Shape _shape { entity::Shape::Sphere };
|
||||
|
||||
|
|
|
@ -27,6 +27,13 @@ class OctreePacketData;
|
|||
class EntityTreeElementExtraEncodeData;
|
||||
class ReadBitstreamToTreeParams;
|
||||
|
||||
/**jsdoc
|
||||
* A skybox is defined by the following properties.
|
||||
* @typedef {object} Entities.Skybox
|
||||
* @property {Color} color=0,0,0 - Sets the color of the sky if <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.
|
||||
*/
|
||||
class SkyboxPropertyGroup : public PropertyGroup {
|
||||
public:
|
||||
// EntityItemProperty related helpers
|
||||
|
|
|
@ -38,7 +38,7 @@ public slots:
|
|||
* Returns a model reference object associated with the specified UUID ({@link EntityID}, {@link OverlayID}, or {@link AvatarID}).
|
||||
*
|
||||
* @function Graphics.getModel
|
||||
* @param {UUID} The objectID of the model whose meshes are to be retrieved.
|
||||
* @param {UUID} entityID - The objectID of the model whose meshes are to be retrieved.
|
||||
* @return {Graphics.Model} the resulting Model object
|
||||
*/
|
||||
scriptable::ScriptableModelPointer getModel(QUuid uuid);
|
||||
|
|
|
@ -28,6 +28,25 @@ void NetworkMaterialResource::downloadFinished(const QByteArray& data) {
|
|||
finishedLoading(true);
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* <p>An RGB or SRGB color value.</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Index</th><th>Type</th><th>Attributes</th><th>Default</th><th>Value</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>0</code></td><td>number</td><td></td><td></td>
|
||||
* <td>Red component value. Number in the range <code>0.0</code> – <code>1.0</code>.</td></tr>
|
||||
* <tr><td><code>1</code></td><td>number</td><td></td><td></td>
|
||||
* <td>Green component value. Number in the range <code>0.0</code> – <code>1.0</code>.</td></tr>
|
||||
* <tr><td><code>2</code></td><td>number</td><td></td><td></td>
|
||||
* <td>Blue component value. Number in the range <code>0.0</code> – <code>1.0</code>.</td></tr>
|
||||
* <tr><td><code>3</code></td><td>boolean</td><td><optional></td><td>false</td>
|
||||
* <td>If <code>true</code> then the color is an SRGB color.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {array} RGBS
|
||||
*/
|
||||
bool NetworkMaterialResource::parseJSONColor(const QJsonValue& array, glm::vec3& color, bool& isSRGB) {
|
||||
if (array.isArray()) {
|
||||
QJsonArray colorArray = array.toArray();
|
||||
|
@ -50,6 +69,12 @@ bool NetworkMaterialResource::parseJSONColor(const QJsonValue& array, glm::vec3&
|
|||
return false;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* A material or set of materials such as may be used by a {@link Entities.EntityType|Material} entity.
|
||||
* @typedef {object} MaterialResource
|
||||
* @property {number} materialVersion=1 - The version of the material. <em>Currently not used.</em>
|
||||
* @property {Material|Material[]} materials - The details of the material or materials.
|
||||
*/
|
||||
NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMaterials(const QJsonDocument& materialJSON) {
|
||||
ParsedMaterials toReturn;
|
||||
if (!materialJSON.isNull() && materialJSON.isObject()) {
|
||||
|
@ -83,6 +108,36 @@ NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMater
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* A material such as may be used by a {@link Entities.EntityType|Material} entity.
|
||||
* @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
|
||||
* 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
|
||||
* 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>.
|
||||
* @property {number} scattering - The scattering, <code>0.0</code> – <code>1.0</code>.
|
||||
* @property {string} emissiveMap - URL of emissive texture image.
|
||||
* @property {string} albedoMap - URL of albedo texture image.
|
||||
* @property {string} opacityMap - URL of opacity texture image. Set value the same as the <code>albedoMap</code> value for
|
||||
* transparency.
|
||||
* @property {string} roughnessMap - URL of roughness texture image. Can use this or <code>glossMap</code>, but not both.
|
||||
* @property {string} glossMap - URL of gloss texture image. Can use this or <code>roughnessMap</code>, but not both.
|
||||
* @property {string} metallicMap - URL of metallic texture image. Can use this or <code>specularMap</code>, but not both.
|
||||
* @property {string} specularMap - URL of specular texture image. Can use this or <code>metallicMap</code>, but not both.
|
||||
* @property {string} normalMap - URL of normal texture image. Can use this or <code>bumpMap</code>, but not both.
|
||||
* @property {string} bumpMap - URL of bump texture image. Can use this or <code>normalMap</code>, but not both.
|
||||
* @property {string} occlusionMap - URL of occlusion texture image.
|
||||
* @property {string} scatteringMap - URL of scattering texture image. Only used if <code>normalMap</code> or
|
||||
* <code>bumpMap</code> is specified.
|
||||
* @property {string} lightMap - URL of light map texture image. <em>Currently not used.</em>
|
||||
*/
|
||||
// Note: See MaterialEntityItem.h for default values used in practice.
|
||||
std::pair<std::string, std::shared_ptr<NetworkMaterial>> NetworkMaterialResource::parseJSONMaterial(const QJsonObject& materialJSON) {
|
||||
std::string name = "";
|
||||
std::shared_ptr<NetworkMaterial> material = std::make_shared<NetworkMaterial>();
|
||||
|
|
|
@ -35,48 +35,126 @@ private slots:
|
|||
void cleanupManagedObjects();
|
||||
|
||||
public slots:
|
||||
|
||||
/**jsdoc
|
||||
* Set the maximum number of entity packets that the client can send per second.
|
||||
* @function Entities.setPacketsPerSecond
|
||||
* @param {number} packetsPerSecond - Integer maximum number of entity packets that the client can send per second.
|
||||
*/
|
||||
/// set the max packets per second send rate
|
||||
void setPacketsPerSecond(int packetsPerSecond) { return _packetSender->setPacketsPerSecond(packetsPerSecond); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the maximum number of entity packets that the client can send per second.
|
||||
* @function Entities.getPacketsPerSecond
|
||||
* @returns {number} Integer maximum number of entity packets that the client can send per second.
|
||||
*/
|
||||
/// get the max packets per second send rate
|
||||
int getPacketsPerSecond() const { return _packetSender->getPacketsPerSecond(); }
|
||||
|
||||
/// does a particle server exist to send to
|
||||
/**jsdoc
|
||||
* Check whether servers exist for the client to send entity packets to, i.e., whether you are connected to a domain and
|
||||
* its entity server is working.
|
||||
* @function Entities.serversExist
|
||||
* @returns {boolean} <code>true</code> if servers exist for the client to send entity packets to, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
/// does a server exist to send to
|
||||
bool serversExist() const { return _packetSender->serversExist(); }
|
||||
|
||||
/**jsdoc
|
||||
* Check whether the client has entity packets waiting to be sent.
|
||||
* @function Entities.hasPacketsToSend
|
||||
* @returns {boolean} <code>true</code> if the client has entity packets waiting to be sent, otherwise <code>false</code>.
|
||||
*/
|
||||
/// are there packets waiting in the send queue to be sent
|
||||
bool hasPacketsToSend() const { return _packetSender->hasPacketsToSend(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the number of entity packets the client has waiting to be sent.
|
||||
* @function Entities.packetsToSendCount
|
||||
* @returns {number} Integer number of entity packets the client has waiting to be sent.
|
||||
*/
|
||||
/// how many packets are there in the send queue waiting to be sent
|
||||
int packetsToSendCount() const { return (int)_packetSender->packetsToSendCount(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the entity packets per second send rate of the client over its lifetime.
|
||||
* @function Entities.getLifetimePPS
|
||||
* @returns {number} Entity packets per second send rate of the client over its lifetime.
|
||||
*/
|
||||
/// returns the packets per second send rate of this object over its lifetime
|
||||
float getLifetimePPS() const { return _packetSender->getLifetimePPS(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the entity bytes per second send rate of the client over its lifetime.
|
||||
* @function Entities.getLifetimeBPS
|
||||
* @returns {number} Entity bytes per second send rate of the client over its lifetime.
|
||||
*/
|
||||
/// returns the bytes per second send rate of this object over its lifetime
|
||||
float getLifetimeBPS() const { return _packetSender->getLifetimeBPS(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the entity packets per second queued rate of the client over its lifetime.
|
||||
* @function Entities.getLifetimePPSQueued
|
||||
* @returns {number} Entity packets per second queued rate of the client over its lifetime.
|
||||
*/
|
||||
/// returns the packets per second queued rate of this object over its lifetime
|
||||
float getLifetimePPSQueued() const { return _packetSender->getLifetimePPSQueued(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the entity bytes per second queued rate of the client over its lifetime.
|
||||
* @function Entities.getLifetimeBPSQueued
|
||||
* @returns {number} Entity bytes per second queued rate of the client over its lifetime.
|
||||
*/
|
||||
/// returns the bytes per second queued rate of this object over its lifetime
|
||||
float getLifetimeBPSQueued() const { return _packetSender->getLifetimeBPSQueued(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the lifetime of the client from the first entity packet sent until now, in microseconds.
|
||||
* @function Entities.getLifetimeInUsecs
|
||||
* @returns {number} Lifetime of the client from the first entity packet sent until now, in microseconds.
|
||||
*/
|
||||
/// returns lifetime of this object from first packet sent to now in usecs
|
||||
long long unsigned int getLifetimeInUsecs() const { return _packetSender->getLifetimeInUsecs(); }
|
||||
|
||||
/// returns lifetime of this object from first packet sent to now in usecs
|
||||
/**jsdoc
|
||||
* Get the lifetime of the client from the first entity packet sent until now, in seconds.
|
||||
* @function Entities.getLifetimeInSeconds
|
||||
* @returns {number} Lifetime of the client from the first entity packet sent until now, in seconds.
|
||||
*/
|
||||
/// returns lifetime of this object from first packet sent to now in secs
|
||||
float getLifetimeInSeconds() const { return _packetSender->getLifetimeInSeconds(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the total number of entity packets sent by the client over its lifetime.
|
||||
* @function Entities.getLifetimePacketsSent
|
||||
* @returns {number} The total number of entity packets sent by the client over its lifetime.
|
||||
*/
|
||||
/// returns the total packets sent by this object over its lifetime
|
||||
long long unsigned int getLifetimePacketsSent() const { return _packetSender->getLifetimePacketsSent(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the total bytes of entity packets sent by the client over its lifetime.
|
||||
* @function Entities.getLifetimeBytesSent
|
||||
* @returns {number} The total bytes of entity packets sent by the client over its lifetime.
|
||||
*/
|
||||
/// returns the total bytes sent by this object over its lifetime
|
||||
long long unsigned int getLifetimeBytesSent() const { return _packetSender->getLifetimeBytesSent(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the total number of entity packets queued by the client over its lifetime.
|
||||
* @function Entities.getLifetimePacketsQueued
|
||||
* @returns {number} The total number of entity packets queued by the client over its lifetime.
|
||||
*/
|
||||
/// returns the total packets queued by this object over its lifetime
|
||||
long long unsigned int getLifetimePacketsQueued() const { return _packetSender->getLifetimePacketsQueued(); }
|
||||
|
||||
/**jsdoc
|
||||
* Get the total bytes of entity packets queued by the client over its lifetime.
|
||||
* @function Entities.getLifetimeBytesQueued
|
||||
* @returns {number} The total bytes of entity packets queued by the client over its lifetime.
|
||||
*/
|
||||
/// returns the total bytes queued by this object over its lifetime
|
||||
long long unsigned int getLifetimeBytesQueued() const { return _packetSender->getLifetimeBytesQueued(); }
|
||||
|
||||
|
|
|
@ -142,6 +142,18 @@ bool ObjectActionOffset::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"offset"</code> {@link Entities.ActionType|ActionType} moves an entity so that it is a set distance away from a
|
||||
* target point.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-Offset
|
||||
* @property {Vec3} pointToOffsetFrom=0,0,0 - The target point to offset the entity from.
|
||||
* @property {number} linearDistance=0 - The distance away from the target point to position the entity.
|
||||
* @property {number} linearTimeScale=34e+38 - Controls how long it takes for the entity's position to catch up with the
|
||||
* target offset. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the action
|
||||
* is applied using an exponential decay.
|
||||
*/
|
||||
QVariantMap ObjectActionOffset::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -307,6 +307,23 @@ bool ObjectActionTractor::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"tractor"</code> {@link Entities.ActionType|ActionType} moves and rotates an entity to a target position and
|
||||
* orientation, optionally relative to another entity.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-Tractor
|
||||
* @property {Vec3} targetPosition=0,0,0 - The target position.
|
||||
* @property {Quat} targetRotation=0,0,0,1 - The target rotation.
|
||||
* @property {Uuid} otherID=null - If an entity ID, the <code>targetPosition</code> and <code>targetRotation</code> are
|
||||
* relative to this entity's position and rotation.
|
||||
* @property {number} linearTimeScale=3.4e+38 - Controls how long it takes for the entity's position to catch up with the
|
||||
* target position. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the action
|
||||
* is applied using an exponential decay.
|
||||
* @property {number} angularTimeScale=3.4e+38 - Controls how long it takes for the entity's orientation to catch up with the
|
||||
* target orientation. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the
|
||||
* action is applied using an exponential decay.
|
||||
*/
|
||||
QVariantMap ObjectActionTractor::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -146,6 +146,17 @@ bool ObjectActionTravelOriented::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"travel-oriented"</code> {@link Entities.ActionType|ActionType} orients an entity to align with its direction of
|
||||
* travel.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-TravelOriented
|
||||
* @property {Vec3} forward=0,0,0 - The axis of the entity to align with the entity's direction of travel.
|
||||
* @property {number} angularTimeScale=0.1 - Controls how long it takes for the entity's orientation to catch up with the
|
||||
* direction of travel. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the
|
||||
* action is applied using an exponential decay.
|
||||
*/
|
||||
QVariantMap ObjectActionTravelOriented::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -181,6 +181,15 @@ bool ObjectConstraintBallSocket::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"ball-socket"</code> {@link Entities.ActionType|ActionType} connects two entities with a ball and socket joint.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-BallSocket
|
||||
* @property {Vec3} pivot=0,0,0 - The local offset of the joint relative to the entity's position.
|
||||
* @property {Uuid} otherEntityID=null - The ID of the other entity that is connected to the joint.
|
||||
* @property {Vec3} otherPivot=0,0,0 - The local offset of the joint relative to the other entity's position.
|
||||
*/
|
||||
QVariantMap ObjectConstraintBallSocket::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -261,6 +261,21 @@ bool ObjectConstraintConeTwist::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"cone-twist"</code> {@link Entities.ActionType|ActionType} connects two entities with a joint that can move
|
||||
* through a cone and can twist.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-ConeTwist
|
||||
* @property {Vec3} pivot=0,0,0 - The local offset of the joint relative to the entity's position.
|
||||
* @property {Vec3} axis=1,0,0 - The axis of the entity that moves through the cone. Must be a non-zero vector.
|
||||
* @property {Uuid} otherEntityID=null - The ID of the other entity that is connected to the joint.
|
||||
* @property {Vec3} otherPivot=0,0,0 - The local offset of the joint relative to the other entity's position.
|
||||
* @property {Vec3} otherAxis=1,0,0 - The axis of the other entity that moves through the cone. Must be a non-zero vector.
|
||||
* @property {number} swingSpan1=6.238 - The angle through which the joint can move in one axis of the cone, in radians.
|
||||
* @property {number} swingSpan2=6.238 - The angle through which the joint can move in the other axis of the cone, in radians.
|
||||
* @property {number} twistSpan=6.238 - The angle through with the joint can twist, in radians.
|
||||
*/
|
||||
QVariantMap ObjectConstraintConeTwist::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -245,6 +245,22 @@ bool ObjectConstraintHinge::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"hinge"</code> {@link Entities.ActionType|ActionType} lets an entity pivot about an axis or connects two entities
|
||||
* with a hinge joint.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-Hinge
|
||||
* @property {Vec3} pivot=0,0,0 - The local offset of the joint relative to the entity's position.
|
||||
* @property {Vec3} axis=1,0,0 - The axis of the entity that it pivots about. Must be a non-zero vector.
|
||||
* @property {Uuid} otherEntityID=null - The ID of the other entity that is connected to the joint, if any. If none is
|
||||
* specified then the first entity simply pivots about its specified <code>axis</code>.
|
||||
* @property {Vec3} otherPivot=0,0,0 - The local offset of the joint relative to the other entity's position.
|
||||
* @property {Vec3} otherAxis=1,0,0 - The axis of the other entity that it pivots about. Must be a non-zero vector.
|
||||
* @property {number} low=-6.283 - The most negative angle that the hinge can take, in radians.
|
||||
* @property {number} high=6.283 - The most positive angle that the hinge can take, in radians.
|
||||
* @property {number} angle=0 - The current angle of the hinge. <em>Read-only.</em>
|
||||
*/
|
||||
QVariantMap ObjectConstraintHinge::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -261,6 +261,31 @@ bool ObjectConstraintSlider::updateArguments(QVariantMap arguments) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* The <code>"slider"</code> {@link Entities.ActionType|ActionType} lets an entity slide and rotate along an axis, or connects
|
||||
* two entities that slide and rotate along a shared axis.
|
||||
* It has arguments in addition to the common {@link Entities.ActionArguments|ActionArguments}.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments-Slider
|
||||
* @property {Vec3} point=0,0,0 - The local position of a point in the entity that slides along the axis.
|
||||
* @property {Vec3} axis=1,0,0 - The axis of the entity that slides along the joint. Must be a non-zero vector.
|
||||
* @property {Uuid} otherEntityID=null - The ID of the other entity that is connected to the joint, if any. If non is
|
||||
* specified then the first entity simply slides and rotates about its specified <code>axis</code>.
|
||||
* @property {Vec3} otherPoint=0,0,0 - The local position of a point in the other entity that slides along the axis.
|
||||
* @property {Vec3} axis=1,0,0 - The axis of the other entity that slides along the joint. Must be a non-zero vector.
|
||||
* @property {number} linearLow=1.17e-38 - The most negative linear offset from the entity's initial point that the entity can
|
||||
* have along the slider.
|
||||
* @property {number} linearHigh=3.40e+38 - The most positive linear offset from the entity's initial point that the entity can
|
||||
* have along the slider.
|
||||
* @property {number} angularLow=-6.283 - The most negative angle that the entity can rotate about the axis if the action
|
||||
* involves only one entity, otherwise the most negative angle the rotation can be between the two entities. In radians.
|
||||
* @property {number} angularHigh=6.283 - The most positive angle that the entity can rotate about the axis if the action
|
||||
* involves only one entity, otherwise the most positive angle the rotation can be between the two entities. In radians.
|
||||
* @property {number} linearPosition=0 - The current linear offset the entity is from its initial point if the action involves
|
||||
* only one entity, otherwise the linear offset between the two entities' action points. <em>Read-only.</em>
|
||||
* @property {number} angularPosition=0 - The current angular offset of the entity from its initial rotation if the action
|
||||
* involves only one entity, otherwise the angular offset between the two entities. <em>Read-only.</em>
|
||||
*/
|
||||
QVariantMap ObjectConstraintSlider::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
|
|
|
@ -93,6 +93,38 @@ bool ObjectDynamic::updateArguments(QVariantMap arguments) {
|
|||
return somethingChanged;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* Different entity action types have different arguments: some common to all actions (listed below) and some specific to each
|
||||
* {@link Entities.ActionType|ActionType} (linked to below). The arguments are accessed as an object of property names and
|
||||
* values.
|
||||
*
|
||||
* @typedef {object} Entities.ActionArguments
|
||||
* @property {Entities.ActionType} type - The type of action.
|
||||
* @property {string} tag="" - A string that a script can use for its own purposes.
|
||||
* @property {number} ttl=0 - How long the action should exist, in seconds, before it is automatically deleted. A value of
|
||||
* <code>0</code> means that the action should not be deleted.
|
||||
* @property {boolean} isMine=true - Is <code>true</code> if you created the action during your current Interface session,
|
||||
* <code>false</code> otherwise. <em>Read-only.</em>
|
||||
* @property {boolean} ::no-motion-state - Is present when the entity hasn't been registered with the physics engine yet (e.g.,
|
||||
* if the action hasn't been properly configured), otherwise <code>undefined</code>. <em>Read-only.</em>
|
||||
* @property {boolean} ::active - Is <code>true</code> when the action is modifying the entity's motion, <code>false</code>
|
||||
* otherwise. Is present once the entity has been registered with the physics engine, otherwise <code>undefined</code>.
|
||||
* <em>Read-only.</em>
|
||||
* @property {Entities.PhysicsMotionType} ::motion-type - How the entity moves with the action. Is present once the entity has
|
||||
* been registered with the physics engine, otherwise <code>undefined</code>. <em>Read-only.</em>
|
||||
*
|
||||
* @see The different action types have additional arguments as follows:
|
||||
* @see {@link Entities.ActionArguments-FarGrab|ActionArguments-FarGrab}
|
||||
* @see {@link Entities.ActionArguments-Hold|ActionArguments-Hold}
|
||||
* @see {@link Entities.ActionArguments-Offset|ActionArguments-Offset}
|
||||
* @see {@link Entities.ActionArguments-Tractor|ActionArguments-Tractor}
|
||||
* @see {@link Entities.ActionArguments-TravelOriented|ActionArguments-TravelOriented}
|
||||
* @see {@link Entities.ActionArguments-Hinge|ActionArguments-Hinge}
|
||||
* @see {@link Entities.ActionArguments-Slider|ActionArguments-Slider}
|
||||
* @see {@link Entities.ActionArguments-ConeTwist|ActionArguments-ConeTwist}
|
||||
* @see {@link Entities.ActionArguments-BallSocket|ActionArguments-BallSocket}
|
||||
*/
|
||||
// Note: The "type" property is set in EntityItem::getActionArguments().
|
||||
QVariantMap ObjectDynamic::getArguments() {
|
||||
QVariantMap arguments;
|
||||
withReadLock([&]{
|
||||
|
|
|
@ -29,6 +29,23 @@ enum PhysicsMotionType {
|
|||
MOTION_TYPE_KINEMATIC // keyframed motion
|
||||
};
|
||||
|
||||
/**jsdoc
|
||||
* <p>An entity's physics motion type may be one of the following:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"static"</code></td><td>There is no motion because the entity is locked — its <code>locked</code>
|
||||
* property is set to <code>true</code>.</td></tr>
|
||||
* <tr><td><code>"kinematic"</code></td><td>Motion is applied without physical laws (e.g., damping) because the entity is
|
||||
* not locked and has its <code>dynamic</code> property set to <code>false</code>.</td></tr>
|
||||
* <tr><td><code>"dynamic"</code></td><td>Motion is applied according to physical laws (e.g., damping) because the entity
|
||||
* is not locked and has its <code>dynamic</code> property set to <code>true</code>.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Entities.PhysicsMotionType
|
||||
*/
|
||||
inline QString motionTypeToString(PhysicsMotionType motionType) {
|
||||
switch(motionType) {
|
||||
case MOTION_TYPE_STATIC: return QString("static");
|
||||
|
|
|
@ -75,32 +75,6 @@ static std::array<GeometryCache::Shape, (GeometryCache::NUM_SHAPES - 1)> MAPPING
|
|||
GeometryCache::Cylinder,
|
||||
} };
|
||||
|
||||
/**jsdoc
|
||||
* <p>{@link Entities} and {@link Overlays} may have the following geometrical shapes:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>Line</code></td><td>A 1D line oriented in 3 dimensions.</td></tr>
|
||||
* <tr><td><code>Triangle</code></td><td>A triangular prism.</td></tr>
|
||||
* <tr><td><code>Quad</code></td><td>A 2D square oriented in 3 dimensions.</tr>
|
||||
* <tr><td><code>Hexagon</code></td><td>A hexagonal prism.</td></tr>
|
||||
* <tr><td><code>Octagon</code></td><td>An octagonal prism.</td></tr>
|
||||
* <tr><td><code>Circle</code></td><td>A 2D circle oriented in 3 dimensions.</td></td></tr>
|
||||
* <tr><td><code>Cube</code></td><td>A cube.</td></tr>
|
||||
* <tr><td><code>Sphere</code></td><td>A sphere.</td></tr>
|
||||
* <tr><td><code>Tetrahedron</code></td><td>A tetrahedron.</td></tr>
|
||||
* <tr><td><code>Octahedron</code></td><td>An octahedron.</td></tr>
|
||||
* <tr><td><code>Dodecahedron</code></td><td>A dodecahedron.</td></tr>
|
||||
* <tr><td><code>Icosahedron</code></td><td>An icosahedron.</td></tr>
|
||||
* <tr><td><code>Torus</code></td><td>A torus. <em>Not implemented.</em></td></tr>
|
||||
* <tr><td><code>Cone</code></td><td>A cone.</td></tr>
|
||||
* <tr><td><code>Cylinder</code></td><td>A cylinder.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Shape
|
||||
*/
|
||||
static const std::array<const char * const, GeometryCache::NUM_SHAPES> GEOCACHE_SHAPE_STRINGS{ {
|
||||
"Line",
|
||||
"Triangle",
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* of gimbal lock.
|
||||
* @namespace Quat
|
||||
* @variation 0
|
||||
* @property IDENTITY {Quat} The identity rotation, i.e., no rotation.
|
||||
* @property IDENTITY {Quat} The identity rotation, i.e., no rotation. Its value is <code>{ x: 0, y: 0, z: 0, w: 1 }</code>.
|
||||
* @example <caption>Print the <code>IDENTITY</code> value.</caption>
|
||||
* print(JSON.stringify(Quat.IDENTITY)); // { x: 0, y: 0, z: 0, w: 1 }
|
||||
* print(JSON.stringify(Quat.safeEulerAngles(Quat.IDENTITY))); // { x: 0, y: 0, z: 0 }
|
||||
|
|
|
@ -25,27 +25,36 @@
|
|||
* A 2-dimensional vector.
|
||||
*
|
||||
* @typedef {object} Vec2
|
||||
* @property {float} x X-coordinate of the vector.
|
||||
* @property {float} y Y-coordinate of the vector.
|
||||
* @property {number} x - X-coordinate of the vector.
|
||||
* @property {number} y - Y-coordinate of the vector.
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* A 3-dimensional vector.
|
||||
*
|
||||
* @typedef {object} Vec3
|
||||
* @property {float} x X-coordinate of the vector.
|
||||
* @property {float} y Y-coordinate of the vector.
|
||||
* @property {float} z Z-coordinate of the vector.
|
||||
* @property {number} x - X-coordinate of the vector.
|
||||
* @property {number} y - Y-coordinate of the vector.
|
||||
* @property {number} z - Z-coordinate of the vector.
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* A 4-dimensional vector.
|
||||
*
|
||||
* @typedef {object} Vec4
|
||||
* @property {float} x X-coordinate of the vector.
|
||||
* @property {float} y Y-coordinate of the vector.
|
||||
* @property {float} z Z-coordinate of the vector.
|
||||
* @property {float} w W-coordinate of the vector.
|
||||
* @property {number} x - X-coordinate of the vector.
|
||||
* @property {number} y - Y-coordinate of the vector.
|
||||
* @property {number} z - Z-coordinate of the vector.
|
||||
* @property {number} w - W-coordinate of the vector.
|
||||
*/
|
||||
|
||||
/**jsdoc
|
||||
* A color vector.
|
||||
*
|
||||
* @typedef {object} Vec3Color
|
||||
* @property {number} x - Red component value. Integer in the range <code>0</code> - <code>255</code>.
|
||||
* @property {number} y - Green component value. Integer in the range <code>0</code> - <code>255</code>.
|
||||
* @property {number} z - Blue component value. Integer in the range <code>0</code> - <code>255</code>.
|
||||
*/
|
||||
|
||||
/// Scriptable interface a Vec3ernion helper class object. Used exclusively in the JavaScript API
|
||||
|
|
|
@ -64,6 +64,25 @@ const int16_t BULLET_COLLISION_MASK_OTHER_AVATAR = BULLET_COLLISION_MASK_DEFAULT
|
|||
// COLLISIONLESS gets an empty mask.
|
||||
const int16_t BULLET_COLLISION_MASK_COLLISIONLESS = 0;
|
||||
|
||||
/**jsdoc
|
||||
* <p>An entity may collide with the following types of items:</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>1</code></td><td>Static entities — non-dynamic entities with no velocity.</td></tr>
|
||||
* <tr><td><code>2</code></td><td>Dynamic entities — entities that have their <code>dynamic</code> property set to
|
||||
* <code>true</code>.</td></tr>
|
||||
* <tr><td><code>4</code></td><td>Kinematic entities — non-dynamic entities with velocity.</td></tr>
|
||||
* <tr><td><code>8</code></td><td>My avatar.</td></tr>
|
||||
* <tr><td><code>16</code></td><td>Other avatars.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* <p>The values for the collision types that are enabled are added together to give the CollisionMask value. For example, a
|
||||
* value of <code>31</code> means that an entity will collide with all item types.</p>
|
||||
* @typedef {number} Entities.CollisionMask
|
||||
*/
|
||||
|
||||
// The USER collision groups are exposed to script and can be used to generate per-object collision masks.
|
||||
// They are not necessarily the same as the BULLET_COLLISION_GROUPS, but we start them off with matching numbers.
|
||||
|
|
|
@ -689,6 +689,15 @@ QScriptValue qColorToScriptValue(QScriptEngine* engine, const QColor& color) {
|
|||
return object;
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* An axis-aligned cube, defined as the bottom right near (minimum axes values) corner of the cube plus the dimension of its
|
||||
* sides.
|
||||
* @typedef {object} AACube
|
||||
* @property {number} x - X coordinate of the brn corner of the cube.
|
||||
* @property {number} y - Y coordinate of the brn corner of the cube.
|
||||
* @property {number} z - Z coordinate of the brn corner of the cube.
|
||||
* @property {number} scale - The dimensions of each side of the cube.
|
||||
*/
|
||||
QScriptValue aaCubeToScriptValue(QScriptEngine* engine, const AACube& aaCube) {
|
||||
QScriptValue obj = engine->newObject();
|
||||
const glm::vec3& corner = aaCube.getCorner();
|
||||
|
@ -765,6 +774,15 @@ void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay) {
|
|||
}
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* @typedef {object} Collision
|
||||
* @property {ContactEventType} type - The contact type of the collision event.
|
||||
* @property {Uuid} idA - The ID of one of the entities in the collision.
|
||||
* @property {Uuid} idB - The ID of the other of the entities in the collision.
|
||||
* @property {Vec3} penetration - The amount of penetration between the two entities.
|
||||
* @property {Vec3} contactPoint - The point of contact.
|
||||
* @property {Vec3} velocityChange - The change in relative velocity of the two entities, in m/s.
|
||||
*/
|
||||
QScriptValue collisionToScriptValue(QScriptEngine* engine, const Collision& collision) {
|
||||
QScriptValue obj = engine->newObject();
|
||||
obj.setProperty("type", collision.type);
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
*
|
||||
* @typedef {object} PickRay
|
||||
* @property {Vec3} origin - The starting position of the PickRay.
|
||||
* @property {Quat} direction - The direction that the PickRay travels.
|
||||
* @property {Vec3} direction - The direction that the PickRay travels.
|
||||
*/
|
||||
class PickRay : public MathPick {
|
||||
public:
|
||||
|
@ -265,6 +265,20 @@ namespace std {
|
|||
};
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* <p>The type of a collision contact event.
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>0</code></td><td>Start of the collision.</td></tr>
|
||||
* <tr><td><code>1</code></td><td>Continuation of the collision.</td></tr>
|
||||
* <tr><td><code>2</code></td><td>End of the collision.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {number} ContactEventType
|
||||
*/
|
||||
enum ContactEventType {
|
||||
CONTACT_EVENT_TYPE_START,
|
||||
CONTACT_EVENT_TYPE_CONTINUE,
|
||||
|
@ -328,13 +342,32 @@ namespace graphics {
|
|||
|
||||
using MeshPointer = std::shared_ptr<graphics::Mesh>;
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* A handle for a mesh in an entity, such as returned by {@link Entities.getMeshes}.
|
||||
* @class MeshProxy
|
||||
* @deprecated Use the {@link Graphics} API instead.
|
||||
*/
|
||||
class MeshProxy : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual MeshPointer getMeshPointer() const = 0;
|
||||
|
||||
/**jsdoc
|
||||
* Get the number of vertices in the mesh.
|
||||
* @function MeshProxy#getNumVertices
|
||||
* @returns {number} Integer number of vertices in the mesh.
|
||||
* @deprecated Use the {@link Graphics} API instead.
|
||||
*/
|
||||
Q_INVOKABLE virtual int getNumVertices() const = 0;
|
||||
|
||||
/**jsdoc
|
||||
* Get the position of a vertex in the mesh.
|
||||
* @function MeshProxy#getPos3
|
||||
* @param {number} index - Integer index of the mesh vertex.
|
||||
* @returns {Vec3} Local position of the vertex relative to the mesh.
|
||||
* @deprecated Use the {@link Graphics} API instead.
|
||||
*/
|
||||
Q_INVOKABLE virtual glm::vec3 getPos3(int index) const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// ShapeInfo.cpp
|
||||
// libraries/physics/src
|
||||
// libraries/shared/src
|
||||
//
|
||||
// Created by Andrew Meadows 2014.10.29
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
|
@ -15,6 +15,33 @@
|
|||
|
||||
#include "NumericalConstants.h" // for MILLIMETERS_PER_METER
|
||||
|
||||
/**jsdoc
|
||||
* <p>A ShapeType defines the shape used for collisions or zones.</p>
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"none"</code></td><td>No shape.</td></tr>
|
||||
* <tr><td><code>"box"</code></td><td>A cube.</td></tr>
|
||||
* <tr><td><code>"sphere"</code></td><td>A sphere.</td></tr>
|
||||
* <tr><td><code>"capsule-x"</code></td><td>A capsule (cylinder with spherical ends) oriented on the x-axis.</td></tr>
|
||||
* <tr><td><code>"capsule-y"</code></td><td>A capsule (cylinder with spherical ends) oriented on the y-axis.</td></tr>
|
||||
* <tr><td><code>"capsule-z"</code></td><td>A capsule (cylinder with spherical ends) oriented on the z-axis.</td></tr>
|
||||
* <tr><td><code>"cylinder-x"</code></td><td>A cylinder oriented on the x-axis.</td></tr>
|
||||
* <tr><td><code>"cylinder-y"</code></td><td>A cylinder oriented on the y-axis.</td></tr>
|
||||
* <tr><td><code>"cylinder-z"</code></td><td>A cylinder oriented on the z-axis.</td></tr>
|
||||
* <tr><td><code>"hull"</code></td><td><em>Not used.</em></td></tr>
|
||||
* <tr><td><code>"compound"</code></td><td>A compound convex hull specified in an OBJ file.</td></tr>
|
||||
* <tr><td><code>"simple-hull"</code></td><td>A convex hull automatically generated from the model.</td></tr>
|
||||
* <tr><td><code>"simple-compound"</code></td><td>A compound convex hull automatically generated from the model, using
|
||||
* sub-meshes.</td></tr>
|
||||
* <tr><td><code>"static-mesh"</code></td><td>The exact shape of the model.</td></tr>
|
||||
* <tr><td><code>"plane"</code></td><td>A plane.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} ShapeType
|
||||
*/
|
||||
// Originally within EntityItemProperties.cpp
|
||||
const char* shapeTypeNames[] = {
|
||||
"none",
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
QObject* getFlags();
|
||||
signals:
|
||||
/** jsdoc
|
||||
/**jsdoc
|
||||
* Signaled when a tablet message or dialog is created
|
||||
* @function TabletProxy#tabletNotification
|
||||
* @returns {Signal}
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
|
||||
|
||||
|
||||
/** jsdoc
|
||||
/**jsdoc
|
||||
* Check if the tablet has a message dialog open
|
||||
* @function TabletProxy#isMessageDialogOpen
|
||||
*/
|
||||
|
@ -291,7 +291,7 @@ signals:
|
|||
*/
|
||||
void screenChanged(QVariant type, QVariant url);
|
||||
|
||||
/** jsdoc
|
||||
/**jsdoc
|
||||
* Signaled when the tablet becomes visible or becomes invisible
|
||||
* @function TabletProxy#isTabletShownChanged
|
||||
* @returns {Signal}
|
||||
|
|
|
@ -186,7 +186,7 @@
|
|||
var prevEntityID = null;
|
||||
for (var i = 0; i < 7; i++) {
|
||||
var newID = Entities.addEntity({
|
||||
name: "hinge test " + i,
|
||||
name: "slider test " + i,
|
||||
type: "Box",
|
||||
color: { blue: 128, green: 40 * i, red: 20 },
|
||||
dimensions: { x: 0.2, y: 0.1, z: 0.2 },
|
||||
|
|
|
@ -24,13 +24,16 @@ exports.handlers = {
|
|||
'../../libraries/animation/src',
|
||||
'../../libraries/avatars/src',
|
||||
'../../libraries/controllers/src/controllers/',
|
||||
'../../libraries/graphics-scripting/src/graphics-scripting/',
|
||||
'../../libraries/entities/src',
|
||||
'../../libraries/model-networking/src/model-networking/',
|
||||
'../../libraries/octree/src',
|
||||
'../../libraries/networking/src',
|
||||
'../../libraries/physics/src',
|
||||
'../../libraries/pointers/src',
|
||||
'../../libraries/render-utils/src',
|
||||
'../../libraries/script-engine/src',
|
||||
'../../libraries/shared/src',
|
||||
'../../libraries/shared/src/shared',
|
||||
'../../libraries/script-engine/src',
|
||||
];
|
||||
var exts = ['.h', '.cpp'];
|
||||
|
||||
|
|
Loading…
Reference in a new issue