Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them has been replaced with a symlink. Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still be present.
92 lines
No EOL
2.6 KiB
JavaScript
92 lines
No EOL
2.6 KiB
JavaScript
"use strict";
|
|
|
|
// Created by Sam Gondelman on 9/7/2017
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
(function() { // BEGIN LOCAL_SCOPE
|
|
|
|
var END_DIMENSIONS = {
|
|
x: 0.5,
|
|
y: 0.5,
|
|
z: 0.5
|
|
};
|
|
var COLOR = {red: 97, green: 247, blue: 255};
|
|
var end = {
|
|
type: "sphere",
|
|
dimensions: END_DIMENSIONS,
|
|
color: COLOR,
|
|
ignoreRayIntersection: true,
|
|
alpha: 1.0,
|
|
visible: true
|
|
}
|
|
|
|
var COLOR2 = {red: 247, green: 97, blue: 255};
|
|
var end2 = {
|
|
type: "sphere",
|
|
dimensions: END_DIMENSIONS,
|
|
color: COLOR2,
|
|
ignoreRayIntersection: true,
|
|
alpha: 1.0,
|
|
visible: true
|
|
}
|
|
|
|
var renderStates = [{name: "test", end: end}];
|
|
var defaultRenderStates = [{name: "test", distance: 20.0, end: end2}];
|
|
|
|
var ray = LaserPointers.createLaserPointer({
|
|
joint: "Mouse",
|
|
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS | RayPick.PICK_AVATARS | RayPick.PICK_INVISIBLE | RayPick.PICK_NONCOLLIDABLE,
|
|
renderStates: renderStates,
|
|
defaultRenderStates: defaultRenderStates,
|
|
enabled: true
|
|
});
|
|
|
|
function cleanup() {
|
|
LaserPointers.removeLaserPointer(ray);
|
|
}
|
|
Script.scriptEnding.connect(cleanup);
|
|
|
|
var prevID = 0;
|
|
var prevType = "";
|
|
function update() {
|
|
// you have to do this repeatedly because there's a bug but I'll fix it
|
|
LaserPointers.setRenderState(ray, "test");
|
|
|
|
var result = LaserPointers.getPrevRayPickResult(ray);
|
|
|
|
|
|
|
|
if (result.type != RayPick.INTERSECTED_NONE) {
|
|
if (result.objectID != prevID) {
|
|
if (prevID != 0) {
|
|
Selection.removeFromSelectedItemsList("contextOverlayHighlightList", prevType, prevID)
|
|
}
|
|
|
|
var typeName = ""
|
|
if (result.type == RayPick.INTERSECTED_ENTITY) {
|
|
typeName = "entity"
|
|
} else if (result.type == RayPick.INTERSECTED_OVERLAY) {
|
|
typeName = "overlay"
|
|
} else if (result.type == RayPick.INTERSECTED_AVATAR) {
|
|
typeName = "avatar"
|
|
}
|
|
|
|
Selection.addToSelectedItemsList("contextOverlayHighlightList", typeName, result.objectID)
|
|
print("type: " + result.type + ", id: " + result.objectID);
|
|
|
|
prevID = result.objectID;
|
|
prevType = typeName;
|
|
}
|
|
} else {
|
|
if (prevID != 0) {
|
|
Selection.removeFromSelectedItemsList("contextOverlayHighlightList", prevType, prevID)
|
|
}
|
|
prevID = 0;
|
|
}
|
|
}
|
|
Script.update.connect(update);
|
|
|
|
}()); // END LOCAL_SCOPE
|