mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 17:37:22 +02:00
Abstract out some common constants missing from the API
This commit is contained in:
parent
110355796c
commit
4d8226ac02
8 changed files with 34 additions and 35 deletions
|
@ -21,8 +21,6 @@ CreatePalette = function (side, leftInputs, rightInputs) {
|
|||
cubeHighlightOverlay,
|
||||
|
||||
LEFT_HAND = 0,
|
||||
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}",
|
||||
ZERO_ROTATION = Quat.fromVec3Radians(Vec3.ZERO),
|
||||
|
||||
controlJointName,
|
||||
|
||||
|
@ -37,7 +35,7 @@ CreatePalette = function (side, leftInputs, rightInputs) {
|
|||
localRotation: PALETTE_ROOT_ROTATION,
|
||||
color: { red: 255, blue: 0, green: 0 },
|
||||
alpha: 1.0,
|
||||
parentID: AVATAR_SELF_ID,
|
||||
parentID: Uuid.SELF,
|
||||
ignoreRayIntersection: true,
|
||||
visible: false
|
||||
},
|
||||
|
@ -45,7 +43,7 @@ CreatePalette = function (side, leftInputs, rightInputs) {
|
|||
PALETTE_PANEL_PROPERTIES = {
|
||||
dimensions: { x: CANVAS_SIZE.x, y: CANVAS_SIZE.y, z: 0.001 },
|
||||
localPosition: { x: CANVAS_SIZE.x / 2, y: CANVAS_SIZE.y / 2, z: 0 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
color: { red: 192, green: 192, blue: 192 },
|
||||
alpha: 0.3,
|
||||
solid: true,
|
||||
|
@ -56,7 +54,7 @@ CreatePalette = function (side, leftInputs, rightInputs) {
|
|||
CUBE_PROPERTIES = {
|
||||
dimensions: { x: 0.03, y: 0.03, z: 0.03 },
|
||||
localPosition: { x: 0.02, y: 0.02, z: 0.0 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
color: { red: 240, green: 0, blue: 0 },
|
||||
alpha: 1.0,
|
||||
solid: true,
|
||||
|
@ -67,7 +65,7 @@ CreatePalette = function (side, leftInputs, rightInputs) {
|
|||
CUBE_HIGHLIGHT_PROPERTIES = {
|
||||
dimensions: { x: 0.034, y: 0.034, z: 0.034 },
|
||||
localPosition: { x: 0.02, y: 0.02, z: 0.0 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
color: { red: 240, green: 240, blue: 0 },
|
||||
alpha: 0.8,
|
||||
solid: false,
|
||||
|
|
|
@ -106,8 +106,7 @@ Groups = function () {
|
|||
childrenIDs,
|
||||
childrenIDIndexes,
|
||||
i,
|
||||
count,
|
||||
NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
|
||||
count;
|
||||
|
||||
// Compile information on children.
|
||||
rootID = groupRootEntityIDs[0];
|
||||
|
@ -124,7 +123,7 @@ Groups = function () {
|
|||
// Unlink direct children from root entity.
|
||||
for (i = 0, count = childrenIDs.length; i < count; i += 1) {
|
||||
Entities.editEntity(childrenIDs[i], {
|
||||
parentID: NULL_UUID
|
||||
parentID: Uuid.NULL
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -132,7 +131,7 @@ Groups = function () {
|
|||
groupRootEntityIDs = groupRootEntityIDs.concat(childrenIDs);
|
||||
for (i = 0, count = childrenIDs.length; i < count; i += 1) {
|
||||
groupSelectionDetails.push(groupSelectionDetails[0].slice(childrenIDIndexes[i], childrenIDIndexes[i + 1]));
|
||||
groupSelectionDetails[i + 1][0].parentID = NULL_UUID;
|
||||
groupSelectionDetails[i + 1][0].parentID = Uuid.NULL;
|
||||
}
|
||||
groupSelectionDetails[0].splice(1, groupSelectionDetails[0].length - childrenIDIndexes[0]);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ Handles = function (side) {
|
|||
FACE_HANDLE_OVERLAY_OFFSETS,
|
||||
FACE_HANDLE_OVERLAY_ROTATIONS,
|
||||
FACE_HANDLE_OVERLAY_SCALE_AXES,
|
||||
ZERO_ROTATION = Quat.fromVec3Radians(Vec3.ZERO),
|
||||
DISTANCE_MULTIPLIER_MULTIPLIER = 0.5,
|
||||
hoveredOverlayID = null,
|
||||
isVisible = false,
|
||||
|
@ -154,7 +153,7 @@ Handles = function (side) {
|
|||
boundingBoxOverlay = Overlays.addOverlay("cube", {
|
||||
parentID: rootEntityID,
|
||||
localPosition: boundingBoxLocalCenter,
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
dimensions: boundingBoxDimensions,
|
||||
color: BOUNDING_BOX_COLOR,
|
||||
alpha: BOUNDING_BOX_ALPHA,
|
||||
|
@ -196,7 +195,7 @@ Handles = function (side) {
|
|||
parentID: rootEntityID,
|
||||
localPosition: Vec3.sum(boundingBoxLocalCenter,
|
||||
Vec3.multiplyVbyV(CORNER_HANDLE_OVERLAY_AXES[cornerIndexes[i]], boundingBoxDimensions)),
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
dimensions: cornerHandleDimensions,
|
||||
color: HANDLE_NORMAL_COLOR,
|
||||
alpha: HANDLE_NORMAL_ALPHA,
|
||||
|
|
|
@ -24,9 +24,7 @@ Highlights = function (side) {
|
|||
ENTITY_HIGHLIGHT_ALPHA = 0.8,
|
||||
HAND_HIGHLIGHT_DIMENSIONS = { x: 0.2, y: 0.2, z: 0.2 },
|
||||
HAND_HIGHLIGHT_OFFSET = { x: 0.0, y: 0.11, z: 0.02 },
|
||||
LEFT_HAND = 0,
|
||||
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}",
|
||||
ZERO_ROTATION = Quat.fromVec3Radians(Vec3.ZERO);
|
||||
LEFT_HAND = 0;
|
||||
|
||||
if (!this instanceof Highlights) {
|
||||
return new Highlights();
|
||||
|
@ -34,7 +32,7 @@ Highlights = function (side) {
|
|||
|
||||
handOverlay = Overlays.addOverlay("sphere", {
|
||||
dimensions: HAND_HIGHLIGHT_DIMENSIONS,
|
||||
parentID: AVATAR_SELF_ID,
|
||||
parentID: Uuid.SELF,
|
||||
parentJointIndex: MyAvatar.getJointIndex(side === LEFT_HAND
|
||||
? "_CONTROLLER_LEFTHAND"
|
||||
: "_CONTROLLER_RIGHTHAND"),
|
||||
|
@ -64,7 +62,7 @@ Highlights = function (side) {
|
|||
Overlays.editOverlay(entityOverlays[index], {
|
||||
parentID: details.id,
|
||||
localPosition: offset,
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
dimensions: details.dimensions,
|
||||
color: overlayColor,
|
||||
visible: true
|
||||
|
|
|
@ -46,7 +46,6 @@ Laser = function (side) {
|
|||
specifiedLaserLength = null,
|
||||
|
||||
LEFT_HAND = 0,
|
||||
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}",
|
||||
|
||||
uiEntityIDs = [],
|
||||
|
||||
|
@ -77,7 +76,7 @@ Laser = function (side) {
|
|||
glow: 1.0,
|
||||
ignoreRayIntersection: true,
|
||||
drawInFront: true,
|
||||
parentID: AVATAR_SELF_ID,
|
||||
parentID: Uuid.SELF,
|
||||
parentJointIndex: MyAvatar.getJointIndex(side === LEFT_HAND
|
||||
? "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND"
|
||||
: "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND"),
|
||||
|
|
|
@ -28,7 +28,6 @@ ToolIcon = function (side) {
|
|||
],
|
||||
|
||||
LEFT_HAND = 0,
|
||||
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}",
|
||||
|
||||
ICON_DIMENSIONS = { x: 0.1, y: 0.01, z: 0.1 },
|
||||
ICON_POSITION = { x: 0, y: 0.01, z: 0 },
|
||||
|
@ -41,7 +40,7 @@ ToolIcon = function (side) {
|
|||
localRotation: ICON_ROTATION,
|
||||
solid: true,
|
||||
alpha: 1.0,
|
||||
parentID: AVATAR_SELF_ID,
|
||||
parentID: Uuid.SELF,
|
||||
ignoreRayIntersection: false,
|
||||
visible: true
|
||||
},
|
||||
|
|
|
@ -28,8 +28,6 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
highlightOverlay,
|
||||
|
||||
LEFT_HAND = 0,
|
||||
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}",
|
||||
ZERO_ROTATION = Quat.fromVec3Radians(Vec3.ZERO),
|
||||
|
||||
CANVAS_SIZE = { x: 0.22, y: 0.13 },
|
||||
PANEL_ORIGIN_POSITION = { x: CANVAS_SIZE.x / 2, y: 0.15, z: -0.04 },
|
||||
|
@ -42,7 +40,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
localRotation: PANEL_ROOT_ROTATION,
|
||||
color: { red: 255, blue: 0, green: 0 },
|
||||
alpha: 1.0,
|
||||
parentID: AVATAR_SELF_ID,
|
||||
parentID: Uuid.SELF,
|
||||
ignoreRayIntersection: true,
|
||||
visible: false
|
||||
},
|
||||
|
@ -50,7 +48,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
MENU_PANEL_PROPERTIES = {
|
||||
dimensions: { x: CANVAS_SIZE.x, y: CANVAS_SIZE.y, z: 0.01 },
|
||||
localPosition: { x: CANVAS_SIZE.x / 2, y: CANVAS_SIZE.y / 2, z: 0.005 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
color: { red: 164, green: 164, blue: 164 },
|
||||
alpha: 1.0,
|
||||
solid: true,
|
||||
|
@ -63,7 +61,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
overlay: "cube",
|
||||
properties: {
|
||||
dimensions: { x: 0.10, y: 0.12, z: 0.01 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
color: { red: 192, green: 192, blue: 192 },
|
||||
alpha: 1.0,
|
||||
solid: true,
|
||||
|
@ -75,7 +73,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
overlay: "cube",
|
||||
properties: {
|
||||
dimensions: { x: 0.03, y: 0.03, z: 0.01 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
alpha: 1.0,
|
||||
solid: true,
|
||||
ignoreRayIntersection: false,
|
||||
|
@ -176,7 +174,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
zDimension: 0.001,
|
||||
properties: {
|
||||
localPosition: { x: 0, y: 0, z: -0.003 },
|
||||
localRotation: ZERO_ROTATION,
|
||||
localRotation: Quat.ZERO,
|
||||
color: { red: 255, green: 255, blue: 0 },
|
||||
alpha: 0.8,
|
||||
solid: false,
|
||||
|
|
|
@ -20,15 +20,26 @@ if (typeof Vec3.max !== "function") {
|
|||
};
|
||||
}
|
||||
|
||||
if (typeof Quat.ZERO !== "object") {
|
||||
Quat.ZERO = Quat.fromVec3Radians(Vec3.ZERO);
|
||||
}
|
||||
|
||||
if (typeof Uuid.NULL !== "string") {
|
||||
Uuid.NULL = "{00000000-0000-0000-0000-000000000000}";
|
||||
}
|
||||
|
||||
if (typeof Uuid.SELF !== "string") {
|
||||
Uuid.SELF = "{00000000-0000-0000-0000-000000000001}";
|
||||
}
|
||||
|
||||
if (typeof Entities.rootOf !== "function") {
|
||||
Entities.rootOf = function (entityID) {
|
||||
var rootEntityID,
|
||||
entityProperties,
|
||||
PARENT_PROPERTIES = ["parentID"],
|
||||
NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
|
||||
PARENT_PROPERTIES = ["parentID"];
|
||||
rootEntityID = entityID;
|
||||
entityProperties = Entities.getEntityProperties(rootEntityID, PARENT_PROPERTIES);
|
||||
while (entityProperties.parentID && entityProperties.parentID !== NULL_UUID) {
|
||||
while (entityProperties.parentID && entityProperties.parentID !== Uuid.NULL) {
|
||||
rootEntityID = entityProperties.parentID;
|
||||
entityProperties = Entities.getEntityProperties(rootEntityID, PARENT_PROPERTIES);
|
||||
}
|
||||
|
@ -40,10 +51,9 @@ if (typeof Entities.hasEditableRoot !== "function") {
|
|||
Entities.hasEditableRoot = function (entityID) {
|
||||
var EDITIBLE_ENTITY_QUERY_PROPERTYES = ["parentID", "visible", "locked", "type"],
|
||||
NONEDITABLE_ENTITY_TYPES = ["Unknown", "Zone", "Light"],
|
||||
NULL_UUID = "{00000000-0000-0000-0000-000000000000}",
|
||||
properties;
|
||||
properties = Entities.getEntityProperties(entityID, EDITIBLE_ENTITY_QUERY_PROPERTYES);
|
||||
while (properties.parentID && properties.parentID !== NULL_UUID) {
|
||||
while (properties.parentID && properties.parentID !== Uuid.NULL) {
|
||||
properties = Entities.getEntityProperties(properties.parentID, EDITIBLE_ENTITY_QUERY_PROPERTYES);
|
||||
}
|
||||
return properties.visible && !properties.locked && NONEDITABLE_ENTITY_TYPES.indexOf(properties.type) === -1;
|
||||
|
@ -63,4 +73,3 @@ if (typeof Object.merge !== "function") {
|
|||
return JSON.parse(a.slice(0, -1) + "," + b.slice(1));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue