mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 02:19:58 +02:00
Don't scale z-axis of text and Web entities
This commit is contained in:
parent
18f4a3bf35
commit
acf6a433a9
3 changed files with 32 additions and 21 deletions
|
@ -129,7 +129,7 @@ Handles = function (side) {
|
||||||
return FACE_HANDLE_OVERLAY_SCALE_AXES[faceHandleOverlays.indexOf(overlayID)];
|
return FACE_HANDLE_OVERLAY_SCALE_AXES[faceHandleOverlays.indexOf(overlayID)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function display(rootEntityID, boundingBox, isMultipleEntities) {
|
function display(rootEntityID, boundingBox, isMultipleEntities, isSuppressZAxis) {
|
||||||
var boundingBoxCenter,
|
var boundingBoxCenter,
|
||||||
boundingBoxOrientation,
|
boundingBoxOrientation,
|
||||||
cameraPosition,
|
cameraPosition,
|
||||||
|
@ -217,20 +217,22 @@ Handles = function (side) {
|
||||||
faceHandleDimensions = Vec3.multiply(distanceMultiplier, FACE_HANDLE_OVERLAY_DIMENSIONS);
|
faceHandleDimensions = Vec3.multiply(distanceMultiplier, FACE_HANDLE_OVERLAY_DIMENSIONS);
|
||||||
faceHandleOffsets = Vec3.multiply(distanceMultiplier, FACE_HANDLE_OVERLAY_OFFSETS);
|
faceHandleOffsets = Vec3.multiply(distanceMultiplier, FACE_HANDLE_OVERLAY_OFFSETS);
|
||||||
for (i = 0; i < NUM_FACE_HANDLES; i += 1) {
|
for (i = 0; i < NUM_FACE_HANDLES; i += 1) {
|
||||||
faceHandleOverlays[i] = Overlays.addOverlay("shape", {
|
if (!isSuppressZAxis || FACE_HANDLE_OVERLAY_AXES[i].z === 0) {
|
||||||
parentID: rootEntityID,
|
faceHandleOverlays[i] = Overlays.addOverlay("shape", {
|
||||||
localPosition: Vec3.sum(boundingBoxLocalCenter,
|
parentID: rootEntityID,
|
||||||
Vec3.multiplyVbyV(FACE_HANDLE_OVERLAY_AXES[i], Vec3.sum(boundingBoxDimensions, faceHandleOffsets))),
|
localPosition: Vec3.sum(boundingBoxLocalCenter,
|
||||||
localRotation: FACE_HANDLE_OVERLAY_ROTATIONS[i],
|
Vec3.multiplyVbyV(FACE_HANDLE_OVERLAY_AXES[i], Vec3.sum(boundingBoxDimensions, faceHandleOffsets))),
|
||||||
dimensions: faceHandleDimensions,
|
localRotation: FACE_HANDLE_OVERLAY_ROTATIONS[i],
|
||||||
shape: "Cone",
|
dimensions: faceHandleDimensions,
|
||||||
color: HANDLE_NORMAL_COLOR,
|
shape: "Cone",
|
||||||
alpha: HANDLE_NORMAL_ALPHA,
|
color: HANDLE_NORMAL_COLOR,
|
||||||
solid: true,
|
alpha: HANDLE_NORMAL_ALPHA,
|
||||||
drawInFront: true,
|
solid: true,
|
||||||
ignoreRayIntersection: false,
|
drawInFront: true,
|
||||||
visible: true
|
ignoreRayIntersection: false,
|
||||||
});
|
visible: true
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
faceHandleOverlays = [];
|
faceHandleOverlays = [];
|
||||||
|
|
|
@ -29,7 +29,8 @@ Selection = function (side) {
|
||||||
scaleRootOffset,
|
scaleRootOffset,
|
||||||
scaleRootOrientation,
|
scaleRootOrientation,
|
||||||
ENTITY_TYPE = "entity",
|
ENTITY_TYPE = "entity",
|
||||||
ENTITY_TYPES_WITH_COLOR = ["Box", "Sphere", "Shape", "PolyLine", "PolyVox"];
|
ENTITY_TYPES_WITH_COLOR = ["Box", "Sphere", "Shape", "PolyLine", "PolyVox"],
|
||||||
|
ENTITY_TYPES_2D = ["Text", "Web"];
|
||||||
|
|
||||||
|
|
||||||
if (!this instanceof Selection) {
|
if (!this instanceof Selection) {
|
||||||
|
@ -41,14 +42,15 @@ Selection = function (side) {
|
||||||
// The root entity is always the first entry.
|
// The root entity is always the first entry.
|
||||||
var children,
|
var children,
|
||||||
properties,
|
properties,
|
||||||
SELECTION_PROPERTIES = ["position", "registrationPoint", "rotation", "dimensions", "parentID", "localPosition",
|
SELECTION_PROPERTIES = ["type", "position", "registrationPoint", "rotation", "dimensions", "parentID",
|
||||||
"dynamic", "collisionless", "userData"],
|
"localPosition", "dynamic", "collisionless", "userData"],
|
||||||
i,
|
i,
|
||||||
length;
|
length;
|
||||||
|
|
||||||
properties = Entities.getEntityProperties(id, SELECTION_PROPERTIES);
|
properties = Entities.getEntityProperties(id, SELECTION_PROPERTIES);
|
||||||
result.push({
|
result.push({
|
||||||
id: id,
|
id: id,
|
||||||
|
type: properties.type,
|
||||||
position: properties.position,
|
position: properties.position,
|
||||||
parentID: properties.parentID,
|
parentID: properties.parentID,
|
||||||
localPosition: properties.localPosition,
|
localPosition: properties.localPosition,
|
||||||
|
@ -190,6 +192,10 @@ Selection = function (side) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is2D() {
|
||||||
|
return selection.length === 1 && ENTITY_TYPES_2D.indexOf(selection[0].type) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
function doKick(entityID) {
|
function doKick(entityID) {
|
||||||
var properties,
|
var properties,
|
||||||
NO_KICK_ENTITY_TYPES = ["Text", "Web"], // These entities don't respond to gravity so don't kick them.
|
NO_KICK_ENTITY_TYPES = ["Text", "Web"], // These entities don't respond to gravity so don't kick them.
|
||||||
|
@ -278,6 +284,7 @@ Selection = function (side) {
|
||||||
|
|
||||||
function directScale(factor, rotation, center) {
|
function directScale(factor, rotation, center) {
|
||||||
// Scale, position, and rotate selection.
|
// Scale, position, and rotate selection.
|
||||||
|
// We can get away with scaling the z size of 2D entities - incongruities are barely noticeable and things recover.
|
||||||
var i,
|
var i,
|
||||||
length;
|
length;
|
||||||
|
|
||||||
|
@ -308,7 +315,7 @@ Selection = function (side) {
|
||||||
// Update selection with final entity properties.
|
// Update selection with final entity properties.
|
||||||
var i,
|
var i,
|
||||||
length;
|
length;
|
||||||
// Final scale, position, and orientaation of root.
|
// Final scale, position, and orientation of root.
|
||||||
rootPosition = Vec3.sum(scaleCenter, Vec3.multiply(scaleFactor, Vec3.multiplyQbyV(scaleRotation, scaleRootOffset)));
|
rootPosition = Vec3.sum(scaleCenter, Vec3.multiply(scaleFactor, Vec3.multiplyQbyV(scaleRotation, scaleRootOffset)));
|
||||||
rootOrientation = Quat.multiply(scaleRotation, scaleRootOrientation);
|
rootOrientation = Quat.multiply(scaleRotation, scaleRootOrientation);
|
||||||
selection[0].dimensions = Vec3.multiply(scaleFactor, selection[0].dimensions);
|
selection[0].dimensions = Vec3.multiply(scaleFactor, selection[0].dimensions);
|
||||||
|
@ -329,6 +336,7 @@ Selection = function (side) {
|
||||||
|
|
||||||
function handleScale(factor, position, orientation) {
|
function handleScale(factor, position, orientation) {
|
||||||
// Scale and reposition and orient selection.
|
// Scale and reposition and orient selection.
|
||||||
|
// We can get away with scaling the z size of 2D entities - incongruities are barely noticeable and things recover.
|
||||||
var i,
|
var i,
|
||||||
length;
|
length;
|
||||||
|
|
||||||
|
@ -526,6 +534,7 @@ Selection = function (side) {
|
||||||
intersectedEntityIndex: getIntersectedEntityIndex,
|
intersectedEntityIndex: getIntersectedEntityIndex,
|
||||||
rootEntityID: getRootEntityID,
|
rootEntityID: getRootEntityID,
|
||||||
boundingBox: getBoundingBox,
|
boundingBox: getBoundingBox,
|
||||||
|
is2D: is2D,
|
||||||
getPositionAndOrientation: getPositionAndOrientation,
|
getPositionAndOrientation: getPositionAndOrientation,
|
||||||
setPositionAndOrientation: setPositionAndOrientation,
|
setPositionAndOrientation: setPositionAndOrientation,
|
||||||
startEditing: startEditing,
|
startEditing: startEditing,
|
||||||
|
|
|
@ -719,7 +719,7 @@
|
||||||
laser.disable();
|
laser.disable();
|
||||||
}
|
}
|
||||||
if (toolSelected === TOOL_SCALE) {
|
if (toolSelected === TOOL_SCALE) {
|
||||||
handles.display(rootEntityID, selection.boundingBox(), selection.count() > 1);
|
handles.display(rootEntityID, selection.boundingBox(), selection.count() > 1, selection.is2D());
|
||||||
otherEditor.setHandleOverlays(handles.overlays());
|
otherEditor.setHandleOverlays(handles.overlays());
|
||||||
}
|
}
|
||||||
startEditing();
|
startEditing();
|
||||||
|
@ -729,7 +729,7 @@
|
||||||
function updateEditorGrabbing() {
|
function updateEditorGrabbing() {
|
||||||
selection.select(intersectedEntityID);
|
selection.select(intersectedEntityID);
|
||||||
if (toolSelected === TOOL_SCALE) {
|
if (toolSelected === TOOL_SCALE) {
|
||||||
handles.display(rootEntityID, selection.boundingBox(), selection.count() > 1);
|
handles.display(rootEntityID, selection.boundingBox(), selection.count() > 1, selection.is2D());
|
||||||
otherEditor.setHandleOverlays(handles.overlays());
|
otherEditor.setHandleOverlays(handles.overlays());
|
||||||
} else {
|
} else {
|
||||||
handles.clear();
|
handles.clear();
|
||||||
|
|
Loading…
Reference in a new issue