content/hifi-content/rebecca/highlighting/testGrab.js
2022-02-14 02:04:11 +01:00

51 lines
No EOL
1.9 KiB
JavaScript

(function () {
print("hello");
var prevID = 0;
var LIST_NAME = "contextOverlayHighlightList1";
var listType = "entity";
var checkoutOutlineConfig;
var oldHighlight1 = Render.getConfig("RenderMainView.OutlineEffect1");
var changeHighlight1 = (function() {
checkoutOutlineConfig = Render.getConfig("RenderMainView.OutlineEffect1");
print("it was a different one...changing highlight");
checkoutOutlineConfig["glow"] = true;
print(checkoutOutlineConfig["glow"]);
checkoutOutlineConfig["width"] = 5;
checkoutOutlineConfig["intensity"] = 0.5;
checkoutOutlineConfig["colorR"] = 0.2;
checkoutOutlineConfig["colorG"] = 0.8;
checkoutOutlineConfig["colorB"] = 0.8;
checkoutOutlineConfig["unoccludedFillOpacity"] = 0.65;
});
function resetHighlight(config) {
config["width"] = 2;
config["glow"] = false;
print(checkoutOutlineConfig["glow"]);
config["intensity"] = 0.9;
config["colorR"] = 1;
config["colorG"] = 0.7;
config["colorB"] = 0.2;
config["unoccludedFillOpacity"] = 0.0;
config["occludedFillOpacity"] = 0.0;
}
this.startNearGrab = function(entityID) {
print("you grabbed the entity!!!");
if (prevID !== entityID) {
changeHighlight1();
Selection.addToSelectedItemsList("contextOverlayHighlightList", "entity", entityID);
Selection.addToSelectedItemsList(LIST_NAME, listType, entityID);
print("it should be highlighted now...will reset the highlight");
prevID = entityID;
}
};
this.releaseGrab = function() {
print("you released the entity!!!");
if (prevID !== 0) {
Selection.removeFromSelectedItemsList(LIST_NAME, listType, prevID);
prevID = 0;
}
};
});