From 9a0985ccc60fd736f2e5c012f03130861ecc805e Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 7 Sep 2018 13:54:25 +0200 Subject: [PATCH 01/71] =?UTF-8?q?Grundlage=20f=C3=BCr=20A-Frame-Portierung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Anlegen der aframe-spezifischen Dateien, sowie erstellen von Variablen (canvasId, visMode) für switch statements in Application.js. Ablauf in der Application.js funktioniert ungefähr bis zur activateController-Funktion. Test Setup "blank.js: enthält inzwischen zu Testzwecken den SearchController und DefaultLogger. AframeActionController: bubble-canceling auskommentiert, um Navigation zu erlauben. AframeCanvasManipulator.initialize() zur Zeit leer und daher Fehlerfrei. --- ui/aframe.html | 94 ++++ ui/index.html | 3 + ui/scripts/ActionController.js | 2 +- ui/scripts/AframeActionController.js | 611 ++++++++++++++++++++++++++ ui/scripts/AframeCanvasManipulator.js | 333 ++++++++++++++ ui/scripts/Application.js | 53 ++- ui/setups/test/blank.js | 55 +++ 7 files changed, 1131 insertions(+), 20 deletions(-) create mode 100644 ui/aframe.html create mode 100644 ui/scripts/AframeActionController.js create mode 100644 ui/scripts/AframeCanvasManipulator.js create mode 100644 ui/setups/test/blank.js diff --git a/ui/aframe.html b/ui/aframe.html new file mode 100644 index 000000000..1246c85fa --- /dev/null +++ b/ui/aframe.html @@ -0,0 +1,94 @@ + + + + + + + + + Getaviz-A-Frame + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + diff --git a/ui/index.html b/ui/index.html index f767d17ab..3dd34426d 100644 --- a/ui/index.html +++ b/ui/index.html @@ -8,6 +8,9 @@ var multipartX3dUrl = modelUrl + "/multiPart.x3d"; var multipartJsonUrl = modelUrl + "/multiPart.json"; var metaDataJsonUrl = modelUrl + "/metaData.json"; + + var canvasId = "x3dom-x3dElement-canvas"; + var visMode = "x3dom"; diff --git a/ui/scripts/ActionController.js b/ui/scripts/ActionController.js index cae7f67ce..9183a92ce 100644 --- a/ui/scripts/ActionController.js +++ b/ui/scripts/ActionController.js @@ -86,7 +86,7 @@ var actionController = (function() { function initialize(){ //canvas actions - var canvas = document.getElementById("x3dom-x3dElement-canvas"); + var canvas = document.getElementById(canvasId); //mousedown canvas.onmousedown = function(eventObject){ diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js new file mode 100644 index 000000000..bd8aef94a --- /dev/null +++ b/ui/scripts/AframeActionController.js @@ -0,0 +1,611 @@ +var aframeActionController = (function() { + + +//********************************* +// Constants +//********************************* + + var MOUSE_BUTTON_LEFT = 1; + var MOUSE_BUTTON_RIGHT = 2; + var MOUSE_BUTTON_MIDDLE = 3; + + +//********************************* +// Variables +//********************************* + + var defaultTickTime = 1; + + var multipartEvent = false; + + var hoveredEntity = null; + + //actions object + var actions = { + mouse : { + key : [], + down : createActionObject("mouseKeyDown"), + up : createActionObject("mouseKeyUp"), + during : createActionObject("mouseKeyDuring"), + move : createActionObject("mouseMove"), + doubleClick : createActionObject("mouseDoubleClick"), + scroll : createActionObject("mouseScroll"), + hover : createActionObject("mouseHover"), + unhover : createActionObject("mouseUnhover"), + }, + keyboard : { + key : [] + } + }; + + var mouseMovedEvent = {}; + + //create mouse action object for every key + for(let i=0; i < 5; i = i + 1){ + actions.mouse.key.push({ + pressed : false, + bubbles : false, + startTime : 0, + lastTick : 0, + down : createActionObject("mouseKeyDown"), + during : createActionObject("mouseKeyDuring"), + up : createActionObject("mouseKeyUp") + }); + } + + //create key action object for every key + for(let i=0; i < 200; i = i + 1){ + actions.keyboard.key.push({ + pressed : false, + bubbles : false, + startTime : 0, + lastTick : 0, + down : createActionObject("keyboardKeyDown"), + during : createActionObject("keyboardKeyDuring"), + up : createActionObject("keyboardKeyUp") + }); + } + + function createActionObject(type){ + var tickTimePerListener = new Map(); + + return { + type : type, + actionListeners : [], + tickTimePerListener : tickTimePerListener, + subscribe : function(listener, tickTime){ subscribeAction(this, listener, tickTime); }, + unsubscribe : function(listener){ unsubscribeAction(this, listener); } + }; + } + + +//********************************* +// Initialization +//********************************* + + function initialize(){ + + //canvas actions + var canvas = document.getElementById(canvasId); + + //mousedown + canvas.onmousedown = function(eventObject){ + if(multipartEvent){ + multipartEvent = false; + return; + } + + downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + downAction(actions.mouse, eventObject); + + if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ + return true; + } + + //eventObject.cancelBubble = true; + //eventObject.stopPropagation(); + return false; + }; + + //mouseup + canvas.onmouseup = function(eventObject){ + if(multipartEvent){ + multipartEvent = false; + return; + } + + upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + upAction(actions.mouse, eventObject); + + if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ + return true; + } + + //eventObject.cancelBubble = true; + //eventObject.stopPropagation(); + return false; + }; + + + //mousemove + canvas.onmousemove = function(eventObject){ + + moveAction(actions.mouse.move, eventObject); + + if(actions.mouse.move.bubbles){ + return true; + } + + //eventObject.cancelBubble = true; + //eventObject.stopPropagation(); + return false; + }; + + + + + //doubleClick + canvas.ondblclick = function(eventObject){ + + doubleClickAction(actions.mouse.doubleClick, eventObject); + + if(actions.mouse.doubleClick.bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }; + + + //scroll + canvas.addEventListener("onmousewheel", function(eventObject){ + + scrollAction(actions.mouse.scroll, eventObject); + + if(actions.mouse.scroll.bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.cancelable = false; + eventObject.stopPropagation(); + return false; + }, true); + + + //scroll FF + canvas.addEventListener("DOMMouseScroll", function(eventObject){ + + scrollAction(actions.mouse.scroll, eventObject); + + if(actions.mouse.scroll.bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }, true); + + + //mouseleave + canvas.addEventListener("onmouseleave", function(eventObject){ + + //general upAction for controllers + upAction(actions.mouse, eventObject); + + if(getMouseButton(eventObject) !== undefined) { + + if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { + return true; + } + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + + }, true); + + + //keydown + canvas.onkeydown = function(eventObject) { + + downAction(actions.keyboard.key[eventObject.which], eventObject); + + if(actions.keyboard.key[eventObject.which].bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }; + + //keyup + canvas.onkeyup = function(eventObject) { + + upAction(actions.keyboard.key[eventObject.which], eventObject); + + if(actions.keyboard.key[eventObject.which].bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }; + + + + + + //multipart events + var multiPart = document.getElementById("multiPart"); + + if(multiPart){ + //mousedown + multiPart.addEventListener("mousedown", function(eventObject){ + multipartEvent = true; + + downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + downAction(actions.mouse, eventObject); + + if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }, false); + + //mouseup + multiPart.addEventListener("mouseup", function(eventObject){ + multipartEvent = true; + + upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + upAction(actions.mouse, eventObject); + + if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }, false); + + + //hover + multiPart.addEventListener("mouseenter", function(eventObject){ + + hoverAction(actions.mouse, eventObject); + + if(actions.mouse.bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }, false); + + //unhover + multiPart.addEventListener("mouseleave", function(eventObject){ + + unhoverAction(actions.mouse, eventObject); + + if(actions.mouse.bubbles){ + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }, false); + } + + + } + + +//********************************* +// Helper +//********************************* + + function getMouseButton(eventObject){ + + if(eventObject.which){ + switch(eventObject.which) { + case 1: + return MOUSE_BUTTON_LEFT; + case 3: + return MOUSE_BUTTON_RIGHT; + case 2: + return MOUSE_BUTTON_MIDDLE; + default: + events.log.error.publish({ text: "mousebutton " + eventObject.button + " not implemented" }); + return; + } + } + + if(eventObject.button){ + switch(eventObject.button) { + case 1: + return MOUSE_BUTTON_LEFT; + case 2: + return MOUSE_BUTTON_RIGHT; + case 4: + return MOUSE_BUTTON_MIDDLE; + default: + events.log.error.publish({ text: "mousebutton " + eventObject.button + " not implemented" }); + return; + } + } + + } + +//********************************* +// Subscribe / Unsubscribe +//********************************* + + function subscribeAction(actionObject, listener, tickTime) { + + var actionListenerArray = actionObject.actionListeners; + + if(listener in actionListenerArray){ + events.log.error.publish({ text: "listener allready subscribes" }); + return; + } + + actionListenerArray.push(listener); + + if(tickTime){ + actionObject.tickTimePerListener.set(listener, tickTime); + } else { + actionObject.tickTimePerListener.set(listener, defaultTickTime); + } + } + + function unsubscribeAction(actionObject, listener){ + + var actionListenerArray = actionObject.actionListeners; + + if(!listener in actionListenerArray){ + events.log.error.publish({ text: "listener not subscribed" }); + return; + } + + actionListenerArray.splice(actionListenerArray.indexOf(listener), 1); + } + + + + +//********************************* +// Actions +//********************************* + + function downAction(action, eventObject){ + + if(action.pressed){ + return; + } + + events.log.action.publish({ actionObject: action.down, eventObject: eventObject}); + + action.pressed = true; + action.startTime = Date.now(); + action.lastTick = Date.now(); + + //identify entity + if(eventObject.partID){ + var entity = model.getEntityById(eventObject.partID); + eventObject.entity = entity; + } + + //activate registered down listeners + var downListeners = action.down.actionListeners; + if( downListeners === undefined ){ + return; + } + downListeners.forEach(function(downListener){ + try { + downListener(eventObject, action.startTime); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + + //activate loop for during listeners + var duringListeners = action.during.actionListeners; + duringListeners.forEach(function(duringListener){ + var tickTime = action.during.tickTimePerListener.get(duringListener); + setTimeout( function(){ duringAction(action, duringListener, tickTime); }, tickTime); + }); + } + + + + function duringAction(action, duringListener, tickTime){ + + if( !action.pressed ) { + return; + } + + events.log.action.publish({ actionObject: action.during, eventObject: {} }); + + var timestamp = Date.now(); + + var timeSinceStart = timestamp - action.startTime; + var timeSinceLastTick = timestamp - action.lastTick; + action.lastTick = timestamp; + + try { + duringListener(mouseMovedEvent, timestamp, timeSinceStart, timeSinceLastTick); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + + + + + setTimeout( function(){ duringAction(action, duringListener, tickTime); }, tickTime); + } + + + + function upAction(action, eventObject){ + + events.log.action.publish({ actionObject: action.up, eventObject: eventObject}); + + action.pressed = false; + + var timestamp = Date.now(); + + //identify entity + if(eventObject.partID){ + var entity = model.getEntityById(eventObject.partID); + eventObject.entity = entity; + } + + //activate registered up listeners + var upListeners = action.up.actionListeners; + if( upListeners === undefined ){ + return; + } + upListeners.forEach(function(upListener){ + try { + upListener(eventObject, timestamp); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + } + + + function hoverAction(action, eventObject){ + + events.log.action.publish({ actionObject: action.hover, eventObject: eventObject}); + + var timestamp = Date.now(); + + //identify entity + if(eventObject.partID){ + var entity = model.getEntityById(eventObject.partID); + eventObject.entity = entity; + + hoveredEntity = entity; + } + + + + + //activate registered hover listeners + var hoverListeners = action.hover.actionListeners; + if( hoverListeners === undefined ){ + return; + } + hoverListeners.forEach(function(hoverListener){ + try { + hoverListener(eventObject, timestamp); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + } + + function unhoverAction(action, eventObject){ + + events.log.action.publish({ actionObject: action.unhover, eventObject: eventObject}); + + action.pressed = false; + hoveredEntity = null; + + var timestamp = Date.now(); + + //activate registered up listeners + var unhoverListeners = action.unhover.actionListeners; + if( unhoverListeners === undefined ){ + return; + } + unhoverListeners.forEach(function(unhoverListener){ + try { + unhoverListener(eventObject, timestamp); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + } + + + + function moveAction(action, eventObject){ + + events.log.action.publish({ actionObject: action, eventObject: eventObject}); + + mouseMovedEvent = eventObject; + + var timestamp = Date.now(); + + var moveListeners = action.actionListeners; + + moveListeners.forEach(function(moveListener){ + try { + moveListener(eventObject, timestamp); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + } + + function doubleClickAction(action, eventObject){ + + events.log.action.publish({ actionObject: action, eventObject: eventObject}); + + var timestamp = Date.now(); + + var doubleClickListeners = action.actionListeners; + + doubleClickListeners.forEach(function(doubleClickListener){ + try { + doubleClickListener(eventObject, timestamp); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + } + + function scrollAction(action, eventObject){ + + events.log.action.publish({ actionObject: action, eventObject: eventObject}); + + var timestamp = Date.now(); + + //identify entity + if(hoveredEntity != null){ + eventObject.entity = hoveredEntity; + } + + var scrollListeners = action.actionListeners; + + scrollListeners.forEach(function(scrollListener){ + try { + scrollListener(eventObject, timestamp); + } catch(err) { + events.log.error.publish({ text: err.message }); + } + }); + } + + + + return { + initialize : initialize, + actions : actions + }; + +})(); \ No newline at end of file diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js new file mode 100644 index 000000000..e352c12ec --- /dev/null +++ b/ui/scripts/AframeCanvasManipulator.js @@ -0,0 +1,333 @@ +var aframeCanvasManipulator = (function() { + + var colors = { + darkred: "darkred", + black: "black", + orange: "orange", + darkorange: "darkorange" + } + + var x3domRuntime; + var viewarea; + var viewpoint; + + var initialCenterOfRotation; + + + function initialize(){ + + } + + function reset(){ + } + + + + //manipulate + function highlightEntities(entities, color){ + + var entitiyIds = new Array(); + entities.forEach(function(entity){ + entitiyIds.push(entity.id); + }); + + var parts = multiPart.getParts(entitiyIds); + if(parts === null){ + events.log.error.publish({ text: "CanvasManipualtor - highlightEntities - parts for entityIds not found"}); + return; + } + + parts.unhighlight(); + parts.highlight(color); + } + + + function unhighlightEntities(entities){ + + var entitiyIds = new Array(); + entities.forEach(function(entity){ + entitiyIds.push(entity.id); + }); + + var parts = multiPart.getParts(entitiyIds); + if(parts === null){ + events.log.error.publish({ text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); + return; + } + + parts.unhighlight(); + } + + + + function changeTransparencyOfEntities(entities, value){ + var entitiyIds = []; + entities.forEach(function(entity){ + var part = multiPart.getParts([entity.id]); + if(part == null){ + return; + } + entity.oldTransparency = part.getTransparency(); + + entitiyIds.push(entity.id); + }); + + var parts = multiPart.getParts(entitiyIds); + if(parts === null){ + events.log.error.publish({ text: "CanvasManipualtor - changeTransparencyOfEntities - parts for entityIds not found"}); + return; + } + setTransparency(parts, value); + } + + function resetTransparencyOfEntities(entities){ + + var oldTransparencyMap = new Map(); + + entities.forEach(function(entity){ + + if(!entity.oldTransparency){ + return; + } + var oldTransparency = entity.oldTransparency; + + if(oldTransparencyMap.has(oldTransparency)){ + oldTransparencyMap.get(oldTransparency).push(entity.id); + } else { + oldTransparencyMap.set(oldTransparency, [entity.id]); + } + }); + + oldTransparencyMap.forEach(function(entitiyIds, oldTransparency, map){ + var parts = multiPart.getParts(entitiyIds); + if(parts === null){ + events.log.error.publish({ text: "CanvasManipualtor - resetTransparencyOfEntities - parts for entityIds not found"}); + return; + } + setTransparency(parts, oldTransparency); + }); + } + + + + function changeColorOfEntities(entities, color){ + var entitiyIds = []; + entities.forEach(function(entity){ + var part = multiPart.getParts([entity.id]); + if(part == null){ + return; + } + if(!entity.oldColor){ + entity.oldColor = part.getDiffuseColor().toString(); + } + entitiyIds.push(entity.id); + }); + + var parts = multiPart.getParts(entitiyIds); + if(parts === null){ + events.log.error.publish({ text: "CanvasManipualtor - changeColorOfEntities - parts for entityIds not found"}); + return; + } + setColor(parts, color); + } + + + function resetColorOfEntities(entities){ + //sort each entity by its old color for performance + var oldColorMap = new Map(); + entities.forEach(function(entity){ + if(entity.oldColor == null){ + return; + } + var oldColor = entity.oldColor; + + if(oldColorMap.has(oldColor)){ + oldColorMap.get(oldColor).push(entity.id); + } else { + oldColorMap.set(oldColor, [entity.id]); + } + + entity.oldColor = null; + }); + + oldColorMap.forEach(function(entitiyIds, oldColor, map){ + var parts = multiPart.getParts(entitiyIds); + if(parts === undefined){ + events.log.error.publish({ text: "CanvasManipualtor - resetColorOfEntities - parts for entityIds not found"}); + return; + } + setColor(parts, oldColor); + }); + } + + function hideEntities(entities){ + var entitiyIds = new Array(); + entities.forEach(function(entity){ + entitiyIds.push(entity.id); + }); + + var parts = multiPart.getParts(entitiyIds); + if(parts === undefined){ + events.log.error.publish({ text: "CanvasManipualtor - hideEntities - parts for entityIds not found"}); + return; + } + setVisibility(parts, false); + } + + + function showEntities(entities){ + var entitiyIds = new Array(); + entities.forEach(function(entity){ + entitiyIds.push(entity.id); + }); + + var parts = multiPart.getParts(entitiyIds); + if(parts === undefined){ + events.log.error.publish({ text: "CanvasManipualtor - showEntities - parts for entityIds not found"}); + return; + } + setVisibility(parts, true); + } + + + + function flyToEntity(entity){ + var part = getPart(entity); + if (part == undefined) { + events.log.error.publish({ text: "CanvasManipualtor - resetColflyToEntityorOfEntities - parts for entityIds not found"}); + return; + } + + part.fit(); + } + + + + function addElement(element){ + var addedElements = document.getElementById("addedElements"); + addedElements.appendChild(element); + } + + function removeElement(element){ + var addedElements = document.getElementById("addedElements"); + addedElements.removeChild(element); + } + + + + //From X3dom coding + //x3dom.DefaultNavigation.prototype.onDoubleClick = function (view, x, y) + + function setCenterOfRotation(entity, setFocus){ + + var centerOfPart = getCenterOfEntity(entity); + + viewpoint.setCenterOfRotation(centerOfPart); + + if(setFocus){ + var mat = viewarea.getViewMatrix().inverse(); + + var from = mat.e3(); + var at = viewarea._pick; + var up = mat.e1(); + + var norm = mat.e0().cross(up).normalize(); + // get distance between look-at point and viewing plane + var dist = norm.dot(viewarea._pick.subtract(from)); + + from = at.addScaled(norm, -dist); + mat = x3dom.fields.SFMatrix4f.lookAt(from, at, up); + + viewarea.animateTo(mat.inverse(), viewpoint); + } + } + + + function getCenterOfEntity(entity){ + var entityPart = getPart(entity); + var volumeOfPart = entityPart.getVolume(); + var centerOfPart = volumeOfPart.center; + + return centerOfPart; + } + + + //Helper + function getPart(entity){ + if (entity.part == undefined){ + var part = multiPart.getParts([entity.id]); + entity.part = part; + } + + return entity.part; + } + + function setColor(parts, color){ + + //Fehler in Methode setDiffuseColor bei nur einem übergebenem Part + //->Heilung durch Dopplung + if(parts.ids.length == 1){ + parts.ids.push(parts.ids[0]); + } + + parts.setDiffuseColor(color); + } + + function setTransparency(parts, value) { + + //Fehler in Methode setTransparency bei nur einem übergebenem Part + //->Heilung durch Dopplung + if(parts.ids.length == 1){ + parts.ids.push(parts.ids[0]); + } + + parts.setTransparency(value); + } + + + function setVisibility(parts, visibility) { + //Fehler in Methode setVisibility bei nur einem übergebenem Part + //->Heilung durch Dopplung + if(parts.ids.length == 1){ + parts.ids.push(parts.ids[0]); + } + + parts.setVisibility(visibility); + } + + function getElementIds(){ + return multiPart.getIdList(); + } + + + + return { + initialize : initialize, + reset : reset, + colors : colors, + + highlightEntities : highlightEntities, + unhighlightEntities : unhighlightEntities, + + changeTransparencyOfEntities : changeTransparencyOfEntities, + resetTransparencyOfEntities : resetTransparencyOfEntities, + + changeColorOfEntities : changeColorOfEntities, + resetColorOfEntities : resetColorOfEntities, + + hideEntities : hideEntities, + showEntities : showEntities, + + flyToEntity : flyToEntity, + + addElement : addElement, + removeElement : removeElement, + + + setCenterOfRotation : setCenterOfRotation, + getCenterOfEntity : getCenterOfEntity, + + getElementIds : getElementIds, + }; + +})(); \ No newline at end of file diff --git a/ui/scripts/Application.js b/ui/scripts/Application.js index 66055bc39..f355cdae1 100644 --- a/ui/scripts/Application.js +++ b/ui/scripts/Application.js @@ -25,19 +25,34 @@ $(document).ready(function () { function initializeApplication(metaDataJson){ //wait for canvas to be loaded full here... - var canvas = document.getElementById("x3dom-x3dElement-canvas"); + var canvas = document.getElementById(canvasId); if(!canvas){ setTimeout(function(){initializeApplication(metaDataJson);}, 100); return; } + //create entity model model.initialize(metaDataJson); - //start action controller - actionController.initialize(); - - //initialize canvas manipulator - canvasManipulator.initialize(); + //switch to differentiate between x3dom and a-frame (specified in index.html/aframe.html) + if(visMode) { + switch (visMode) { + case "aframe": { + aframeActionController.initialize(); + aframeCanvasManipulator.initialize(); + break; + } + case "x3dom": + default: { + //start action controller + actionController.initialize(); + + //initialize canvas manipulator + canvasManipulator.initialize(); + break; + } + } + } //initialize application application.initialize(); @@ -73,8 +88,8 @@ var application = (function() { //initilize application //******************* - function initialize(){ - + function initialize(){ + //parse setup if defined if(!window["setup"]){ events.log.error.publish({ text: "No setup configured"}); @@ -95,12 +110,11 @@ var application = (function() { if( currentUIConfig === null){ events.log.error.publish({ text: "No UI config in setup found"}); return; - } - - + } + //initialize controllers - setup.controllers.forEach(function(controller){ - loadAndInitializeController(controller); + setup.controllers.forEach(function(controller){ + loadAndInitializeController(controller); }); //for ajax loading @@ -115,7 +129,7 @@ var application = (function() { setTimeout(startConfigParsingAfterControllerLoading, 1); return; } - + //get body and canvas elements bodyElement = document.body; canvasElement = document.getElementById("canvas"); @@ -134,7 +148,7 @@ var application = (function() { parseUIConfig(currentUIConfig.name, currentUIConfig, uiDIV); //activate controller - activateController(); + activateController(); events.log.info.publish({ text: "new config loaded: " + currentUIConfig.name }); } catch(err) { @@ -217,7 +231,7 @@ var application = (function() { //******************* function parseUIConfig(configName, configPart, parent){ - + //areas if(configPart.area !== undefined){ var area = configPart.area; @@ -318,7 +332,8 @@ var application = (function() { function loadAndInitializeController(controller){ var controllerName = controller.name; - + if(visMode == "aframe") console.debug("loadAndInitializeController("+controller.name+")"); + //controller allready loaded by html-file? if(window[controllerName]){ var controllerObject = window[controllerName]; @@ -337,7 +352,7 @@ var application = (function() { function setActivateController(controller, parent){ - var controllerName = controller.name; + var controllerName = controller.name; var controllerObject = controllers.get(controllerName); if(controllerObject === undefined){ @@ -374,7 +389,7 @@ var application = (function() { } function activateController(){ - + console.debug(arguments.callee.name); newActiveControllers.forEach(function(controllerObject){ if(controllerObject.activate){ var controllerDiv = activeControllers.get(controllerObject); diff --git a/ui/setups/test/blank.js b/ui/setups/test/blank.js new file mode 100644 index 000000000..e92288dce --- /dev/null +++ b/ui/setups/test/blank.js @@ -0,0 +1,55 @@ +var setup = { + + controllers: [ + { name: "defaultLogger", + logActionConsole : false, + logEventConsole : false + }, + + { name: "searchController", + }, + + ], + + + uis: [ + + + { name: "UI0", + + navigation: { + //examine, walk, fly, helicopter, lookAt, turntable, game + type: "examine", + //speed: 10 + }, + + + + area: { + name: "top", + orientation: "horizontal", + resizable: false, + first: { + size: "10%", + collapsible: false, + + controllers: [ + { name : "searchController" }, + ], + }, + second: { + size: "90%", + collapsible: false, + + canvas: {}, + + controllers: [ + { name: "defaultLogger" }, + ], + } + } + + } + + ] +}; \ No newline at end of file From cd444f06fe62f2d49793863ec9d3d7086f4ddc98 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 21 Sep 2018 14:11:18 +0200 Subject: [PATCH 02/71] First Working Version searchController loads long at initialization --- ui/aframe.html | 7 +- ui/scripts/AframeActionController.js | 4 +- ui/scripts/AframeCanvasManipulator.js | 2 +- ui/scripts/Application.js | 117 ++--- ui/scripts/Search/SearchController.js | 10 +- ui/scripts/aframe-orbit-camera-component.js | 552 ++++++++++++++++++++ ui/setups/test/blank.js | 20 +- 7 files changed, 625 insertions(+), 87 deletions(-) create mode 100644 ui/scripts/aframe-orbit-camera-component.js diff --git a/ui/aframe.html b/ui/aframe.html index 1246c85fa..9dfda5a2f 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -9,6 +9,7 @@ var metaDataJsonUrl = modelUrl + "/metaData.json"; var canvasId = "aframe-canvas"; + var visMode = "aframe"; @@ -23,8 +24,7 @@ - - + @@ -72,6 +72,7 @@ + @@ -84,7 +85,7 @@
diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index bd8aef94a..2191c15b4 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -1,4 +1,4 @@ -var aframeActionController = (function() { +var actionController = (function() { //********************************* @@ -84,7 +84,7 @@ var aframeActionController = (function() { //********************************* function initialize(){ - + console.debug(arguments.callee.name); //canvas actions var canvas = document.getElementById(canvasId); diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index e352c12ec..85ceacd57 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -1,4 +1,4 @@ -var aframeCanvasManipulator = (function() { +var canvasManipulator = (function() { var colors = { darkred: "darkred", diff --git a/ui/scripts/Application.js b/ui/scripts/Application.js index f355cdae1..1e5c454a7 100644 --- a/ui/scripts/Application.js +++ b/ui/scripts/Application.js @@ -23,7 +23,6 @@ $(document).ready(function () { }); function initializeApplication(metaDataJson){ - //wait for canvas to be loaded full here... var canvas = document.getElementById(canvasId); if(!canvas){ @@ -34,25 +33,9 @@ function initializeApplication(metaDataJson){ //create entity model model.initialize(metaDataJson); - //switch to differentiate between x3dom and a-frame (specified in index.html/aframe.html) - if(visMode) { - switch (visMode) { - case "aframe": { - aframeActionController.initialize(); - aframeCanvasManipulator.initialize(); - break; - } - case "x3dom": - default: { - //start action controller - actionController.initialize(); - - //initialize canvas manipulator - canvasManipulator.initialize(); - break; - } - } - } + console.debug("Initialize ActionController"); + actionController.initialize(); + canvasManipulator.initialize(); //initialize application application.initialize(); @@ -123,9 +106,9 @@ var application = (function() { function startConfigParsingAfterControllerLoading(){ - //check that all controllers loaded if(setup.controllers.length !== controllers.size){ + console.debug("controllers not loaded yet..."); setTimeout(startConfigParsingAfterControllerLoading, 1); return; } @@ -135,10 +118,15 @@ var application = (function() { canvasElement = document.getElementById("canvas"); //create ui div element - var uiDIV = document.createElement("DIV"); - uiDIV.id = "ui"; - bodyElement.appendChild(uiDIV); - currentUIConfig.uiDIV = uiDIV; + /* AFRAME-WORKAROUND + FÜR AFRAME - existierendes DIV statt neuem UI aus aframe.html + id von "ui" zu "canvas" geändert + var uiDIV = document.getElementById("canvas");*/ + + var uiDIV = document.createElement("DIV"); + uiDIV.id = "ui"; + bodyElement.appendChild(uiDIV); + currentUIConfig.uiDIV = uiDIV; //activate controller newActiveControllers = []; @@ -149,7 +137,6 @@ var application = (function() { //activate controller activateController(); - events.log.info.publish({ text: "new config loaded: " + currentUIConfig.name }); } catch(err) { events.log.error.publish({ text: err.message }); @@ -205,7 +192,7 @@ var application = (function() { currentUIConfig = nextUIConfig; currentUIConfig.uiDIV = uiDIV; - //collect old active controllers for deactivation + //collect old active controllers for deactivation oldActiveControllers = Array.from(activeControllers.keys()); newActiveControllers = []; @@ -214,16 +201,15 @@ var application = (function() { parseUIConfig(currentUIConfig.name, currentUIConfig, uiDIV); //deactive controller - deactivateController(oldActiveControllers); + deactivateController(oldActiveControllers); //activate controller - activateController(); + activateController(); events.log.info.publish({ text: "new config loaded: " + currentUIConfig.name }); } catch(err) { events.log.error.publish({ text: err.message }); } - } @@ -303,11 +289,18 @@ var application = (function() { //canvas if(configPart.canvas !== undefined){ - - var canvasParentElement = canvasElement.parentElement; - canvasParentElement.removeChild(canvasElement); - - parent.appendChild(canvasElement); + if(visMode != "aframe") { + var canvasParentElement = canvasElement.parentElement; + canvasParentElement.removeChild(canvasElement); + + parent.appendChild(canvasElement); + } else { + var canvasParentElement = canvasElement.parentElement; + canvasParentElement.removeChild(canvasElement); + + parent.appendChild(canvasElement.cloneNode(true)); + // evtl canvas löschen ?? + } } //controller @@ -332,7 +325,6 @@ var application = (function() { function loadAndInitializeController(controller){ var controllerName = controller.name; - if(visMode == "aframe") console.debug("loadAndInitializeController("+controller.name+")"); //controller allready loaded by html-file? if(window[controllerName]){ @@ -389,15 +381,14 @@ var application = (function() { } function activateController(){ - console.debug(arguments.callee.name); newActiveControllers.forEach(function(controllerObject){ if(controllerObject.activate){ var controllerDiv = activeControllers.get(controllerObject); + console.debug(controllerObject); controllerObject.activate(controllerDiv); } - }); - + }); } @@ -422,29 +413,31 @@ var application = (function() { //******************* function createNavigationMode(navigationObject){ - - var navigationInfoElement = document.getElementById("navigationInfo"); - - if(!navigationInfoElement){ - var scene = document.getElementById("scene"); - - navigationInfoElement = document.createElement("NAVIGATIONINFO"); - navigationInfoElement.id = "navigationInfo"; - - scene.appendChild(navigationInfoElement); - } - - if(navigationObject.type){ - navigationInfoElement.setAttribute("type", navigationObject.type); - } - if(navigationObject.speed){ - navigationInfoElement.setAttribute("speed", navigationObject.speed); - } - - //Turntable seems not to work with 1.7 and dynamic adding - if(navigationObject.typeParams){ - navigationInfoElement.setAttribute("typeParams", navigationObject.typeParams); - } + if(visMode == "x3dom") { + var navigationInfoElement = document.getElementById("navigationInfo"); + + if (!navigationInfoElement) { + var scene = document.getElementById("scene"); + + navigationInfoElement = document.createElement("NAVIGATIONINFO"); + navigationInfoElement.id = "navigationInfo"; + + scene.appendChild(navigationInfoElement); + } + + if (navigationObject.type) { + navigationInfoElement.setAttribute("type", navigationObject.type); + } + if (navigationObject.speed) { + navigationInfoElement.setAttribute("speed", navigationObject.speed); + } + + //Turntable seems not to work with 1.7 and dynamic adding + if (navigationObject.typeParams) { + navigationInfoElement.setAttribute("typeParams", navigationObject.typeParams); + } + } + else console.debug("No x3dom - no navigationInfoElement"); } function createPanel(areaPart){ diff --git a/ui/scripts/Search/SearchController.js b/ui/scripts/Search/SearchController.js index 2ebd4ce2c..846699d52 100644 --- a/ui/scripts/Search/SearchController.js +++ b/ui/scripts/Search/SearchController.js @@ -68,6 +68,8 @@ var searchController = (function() { } function initializeSearch() { + + console.debug("SearchController.js: initializeSearch() - begin"); suggestions = new Bloodhound({ datumTokenizer: function(entity) { @@ -114,10 +116,10 @@ var searchController = (function() { }); $(jQsearchInputID).on("typeahead:closed", function(event, suggestion, dataset) { rootDivElement.parentElement.style.overflow = "hidden"; - }); - - - + }); + + + console.debug("SearchController.js: initializeSearch() - end"); } function selectEntity(id) { diff --git a/ui/scripts/aframe-orbit-camera-component.js b/ui/scripts/aframe-orbit-camera-component.js new file mode 100644 index 000000000..4c12c0912 --- /dev/null +++ b/ui/scripts/aframe-orbit-camera-component.js @@ -0,0 +1,552 @@ +/** + * Example component for A-Frame. + */ +AFRAME.registerComponent('orbit-camera', { + dependencies: ['camera', 'position', 'rotation'], + schema: { + + enabled: { type: 'boolean', default: true }, + target: { type: 'vec3', default: { x: 0, y: 0, z: 0 } }, + + enableRotate: { type: 'boolean', default: true }, + rotateSpeed: { type: 'number', default: 1.0 }, + + enableZoom: { type: 'boolean', default: true }, + zoomSpeed: { type: 'number', default: 1.0 }, + + enablePan: { type: 'boolean', default: true }, + panSpeed: { type: 'number', default: 1.0 }, + + enableDamping: { type: 'boolean', default: false }, + dampingFactor: { type: 'number', default: 0.25 }, + + minAzimuthAngle: { type: 'number', default: -Infinity }, + maxAzimuthAngle: { type: 'number', default: Infinity }, + + minPolarAngle: { type: 'number', default: 0 }, + maxPolarAngle: { type: 'number', default: Math.PI }, + + minZoom: { type: 'number', default: 0 }, + maxZoom: { type: 'number', default: Infinity }, + + invertZoom: { type: 'boolean', default: false }, + + minDistance: { type: 'number', default: 0 }, + maxDistance: { type: 'number', default: Infinity }, + + logPosition: { type: 'boolean', default: false }, + }, + + /** + * Initial Setup + */ + init: function () { + this.sceneEl = this.el.sceneEl; + this.object = this.el.object3D; + this.canvasEl = this.sceneEl.canvas; + var targetVec = this.data.target; + this.target = new THREE.Vector3(targetVec.x, targetVec.y, targetVec.z); + + console.log('enabled: ', this.data.enabled); + + this.dolly = new THREE.Object3D(); + this.dolly.position.copy(this.object.position); + + this.savedPose = null; + + this.STATE = { + NONE: -1, + ROTATE: 0, + DOLLY: 1, + PAN: 2, + }; + + this.state = this.STATE.NONE; + + this.EPS = 0.000001; + this.lastPosition = new THREE.Vector3(); + this.lastQuaternion = new THREE.Quaternion(); + + this.spherical = new THREE.Spherical(); + this.sphericalDelta = new THREE.Spherical(); + + this.scale = 1.0; + this.zoomChanged = false; + + this.rotateStart = new THREE.Vector2(); + this.rotateEnd = new THREE.Vector2(); + this.rotateDelta = new THREE.Vector2(); + + this.panStart = new THREE.Vector2(); + this.panEnd = new THREE.Vector2(); + this.panDelta = new THREE.Vector2(); + this.panOffset = new THREE.Vector3(); + + this.dollyStart = new THREE.Vector2(); + this.dollyEnd = new THREE.Vector2(); + this.dollyDelta = new THREE.Vector2(); + + this.vector = new THREE.Vector3(); + this.desiredPosition = new THREE.Vector3(); + + this.mouseButtons = { + LEFT: THREE.MOUSE.LEFT, + MIDDLE: THREE.MOUSE.MIDDLE, + RIGHT: THREE.MOUSE.RIGHT + }; + + this.bindMethods(); + }, + + /** + * Called when component is attached and when component data changes. + * updates the entity based on the data. + */ + update: function (oldData) { + console.log('component update'); + this.updateView(); + this.addEventListeners(); + }, + + /** + * Called when a component is removed (e.g., via removeAttribute). + * Generally undoes all modifications to the entity. + */ + remove: function () { + this.removeEventListeners(); + }, + + /** + * Called on each scene tick. + */ + tick: function (t) { + var render = this.data.enabled ? this.updateView() : false; + if (render === true && this.data.logPosition === true) { + console.log(this.el.object3D.position); + } + }, + + /* + * Bind this to all event handlera + */ + bindMethods: function () { + this.onContextMenu = this.onContextMenu.bind(this); + this.onMouseDown = this.onMouseDown.bind(this); + this.onMouseWheel = this.onMouseWheel.bind(this); + this.onMouseMove = this.onMouseMove.bind(this); + this.onMouseUp = this.onMouseUp.bind(this); + }, + + /* + * Add event listeners + */ + addEventListeners: function () { + this.canvasEl.addEventListener('contextmenu', this.onContextMenu, false); + this.canvasEl.addEventListener('mousedown', this.onMouseDown, false); + this.canvasEl.addEventListener('mousewheel', this.onMouseWheel, false); + this.canvasEl.addEventListener('MozMousePixelScroll', this.onMouseWheel, false); // firefox + }, + + /* + * Remove event listeners + */ + removeEventListeners: function () { + if (this.canvasEl) { + this.canvasEl.removeEventListener('contextmenu', this.onContextMenu, false); + this.canvasEl.removeEventListener('mousedown', this.onMouseDown, false); + this.canvasEl.removeEventListener('mousewheel', this.onMouseWheel, false); + this.canvasEl.removeEventListener('MozMousePixelScroll', this.onMouseWheel, false); // firefox + + this.canvasEl.removeEventListener('mousemove', this.onMouseMove, false); + this.canvasEl.removeEventListener('mouseup', this.onMouseUp, false); + this.canvasEl.removeEventListener('mouseout', this.onMouseUp, false); + } + }, + + /* + * EVENT LISTENERS + */ + + /* + * Called when right clicking the A-Frame component + */ + onContextMenu: function (event) { + event.preventDefault(); + }, + + /* + * MOUSE CLICK EVENT LISTENERS + */ + + onMouseDown: function (event) { + + // console.log('onMouseDown'); + if (!this.data.enabled) return; + + event.preventDefault(); + + switch (event.button) { + case this.mouseButtons.LEFT: + if (event.ctrlKey || event.shiftKey) { + if (this.data.enablePan === false) return; + this.handleMouseDownPan(event); + this.state = this.STATE.PAN; + } else { + this.panOffset.set(0, 0, 0); + if (this.data.enableRotate === false) return; + this.handleMouseDownRotate(event); + this.state = this.STATE.ROTATE; + } + break; + case this.mouseButtons.RIGHT: + this.panOffset.set(0, 0, 0); + if (this.data.enableZoom === false) return; + this.handleMouseDownDolly(event); + this.state = this.STATE.DOLLY; + break; + case this.mouseButtons.MIDDLE: + if (this.data.enablePan === false) return; + this.handleMouseDownPan(event); + this.state = this.STATE.PAN; + break; + } + + if (this.state !== this.STATE.NONE) { + this.canvasEl.addEventListener('mousemove', this.onMouseMove, false); + this.canvasEl.addEventListener('mouseup', this.onMouseUp, false); + this.canvasEl.addEventListener('mouseout', this.onMouseUp, false); + + } + }, + + onMouseMove: function (event) { + + // console.log('onMouseMove'); + if (!this.data.enabled) return; + + event.preventDefault(); + + switch (this.state) { + case this.STATE.ROTATE: + if (this.data.enableRotate === false) return; + this.handleMouseMoveRotate(event); + break; + case this.STATE.DOLLY: + if (this.data.enableZoom === false) return; + this.handleMouseMoveDolly(event); + break; + case this.STATE.PAN: + if (this.data.enablePan === false) return; + this.handleMouseMovePan(event); + break; + } + + }, + + onMouseUp: function (event) { + + // console.log('onMouseUp'); + if (!this.data.enabled) return; + + event.preventDefault(); + event.stopPropagation(); + + this.handleMouseUp(event); + + this.canvasEl.removeEventListener('mousemove', this.onMouseMove, false); + this.canvasEl.removeEventListener('mouseup', this.onMouseUp, false); + this.canvasEl.removeEventListener('mouseout', this.onMouseUp, false); + + this.state = this.STATE.NONE; + + }, + + /* + * MOUSE WHEEL EVENT LISTENERS + */ + + onMouseWheel: function (event) { + + // console.log('onMouseWheel'); + if (!this.data.enabled || + this.data.enableZoom === false || + (this.state !== this.STATE.NONE && this.state !== this.STATE.ROTATE)) + return; + + event.preventDefault(); + event.stopPropagation(); + this.handleMouseWheel(event); + }, + + + /* + * EVENT HANDLERS + */ + + handleMouseDownRotate: function (event) { + // console.log( 'handleMouseDownRotate' ); + this.rotateStart.set(event.clientX, event.clientY); + }, + + handleMouseDownDolly: function (event) { + // console.log( 'handleMouseDownDolly' ); + this.dollyStart.set(event.clientX, event.clientY); + }, + + handleMouseDownPan: function (event) { + // console.log( 'handleMouseDownPan' ); + this.panStart.set(event.clientX, event.clientY); + }, + + handleMouseMoveRotate: function (event) { + + // console.log( 'handleMouseMoveRotate' ); + this.rotateEnd.set(event.clientX, event.clientY); + this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart); + + var canvas = + this.canvasEl === document ? this.canvasEl.body : this.canvasEl; + + // rotating across whole screen goes 360 degrees around + this.rotateLeft( + 2 * Math.PI * this.rotateDelta.x / canvas.clientWidth * + this.data.rotateSpeed); + + // rotating up and down along whole screen attempts to go 360, but limited + // to 180 + this.rotateUp( + 2 * Math.PI * this.rotateDelta.y / canvas.clientHeight * + this.data.rotateSpeed); + + this.rotateStart.copy(this.rotateEnd); + + this.updateView(); + }, + + handleMouseMoveDolly: function (event) { + + // console.log( 'handleMouseMoveDolly' ); + this.dollyEnd.set(event.clientX, event.clientY); + this.dollyDelta.subVectors(this.dollyEnd, this.dollyStart); + + if (this.dollyDelta.y > 0) { + !this.data.invertZoom ? this.dollyIn(this.getZoomScale()) : + this.dollyOut(this.getZoomScale()); + } else if (this.dollyDelta.y < 0) { + !this.data.invertZoom ? this.dollyOut(this.getZoomScale()) : + this.dollyIn(this.getZoomScale()); + } + + this.dollyStart.copy(this.dollyEnd); + + this.updateView(); + }, + + handleMouseMovePan: function (event) { + + // console.log( 'handleMouseMovePan' ); + this.panEnd.set(event.clientX, event.clientY); + this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.data.panSpeed); + this.pan(this.panDelta.x, this.panDelta.y); + this.panStart.copy(this.panEnd); + + this.updateView(); + }, + + handleMouseUp: function (event) { + // console.log( 'handleMouseUp' ); + }, + + handleMouseWheel: function (event) { + + // console.log( 'handleMouseWheel' ); + var delta = 0; + if (event.wheelDelta !== undefined) { + // WebKit / Opera / Explorer 9 + delta = event.wheelDelta; + } else if (event.detail !== undefined) { + // Firefox + delta = -event.detail; + } + + if (delta > 0) { + !this.data.invertZoom ? this.dollyOut(this.getZoomScale()) : + this.dollyIn(this.getZoomScale()); + } else if (delta < 0) { + !this.data.invertZoom ? this.dollyIn(this.getZoomScale()) : + this.dollyOut(this.getZoomScale()); + } + + this.updateView(); + }, + + /* + * Internal functions + */ + + getZoomScale: function () { + return Math.pow(0.95, this.data.zoomSpeed); + }, + + rotateLeft: function (angle) { + this.sphericalDelta.theta -= angle; + }, + + rotateUp: function (angle) { + this.sphericalDelta.phi -= angle; + }, + + panLeft: function (distance, objectMatrix) { + var v = new THREE.Vector3(); + v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix + v.multiplyScalar(-distance); + this.panOffset.add(v); + }, + + panUp: function (distance, objectMatrix) { + var v = new THREE.Vector3(); + v.setFromMatrixColumn(objectMatrix, 1); // get Y column of objectMatrix + v.multiplyScalar(distance); + this.panOffset.add(v); + }, + + pan: function (deltaX, deltaY) { // deltaX and deltaY are in pixels; right and down are positive + + var offset = new THREE.Vector3(); + var canvas = this.canvasEl === document ? this.canvasEl.body : this.canvasEl; + + var position = this.object.position; + offset.copy(position).sub(this.target); + var targetDistance = offset.length(); + // half of the fov is center to top of screen + targetDistance *= Math.tan((this.el.components.camera.data.fov / 2) * Math.PI / 180.0); + // we actually don't use screenWidth, since + this.panLeft(2 * deltaX * targetDistance / canvas.clientHeight, this.object.matrix); + // perspective camera is fixed to screen height + this.panUp(2 * deltaY * targetDistance / canvas.clientHeight, this.object.matrix); + }, + + dollyIn: function (dollyScale) { + this.scale *= dollyScale; + }, + + dollyOut: function (dollyScale) { + this.scale /= dollyScale; + }, + + lookAtTarget: function (object, target) { + var v = new THREE.Vector3(); + v.subVectors(object.position, target).add(object.position); + object.lookAt(v); + }, + + /* + * VIEW UPDATE + */ + updateView: function () { + + var offset = new THREE.Vector3(); + + // so camera.up is the orbit axis + var quat = new THREE.Quaternion().setFromUnitVectors(this.dolly.up, new THREE.Vector3(0, 1, 0)); + var quatInverse = quat.clone().inverse(); + + offset.copy(this.dolly.position).sub(this.target); + offset.applyQuaternion(quat); // rotate offset to "y-axis-is-up" space + this.spherical.setFromVector3(offset); // angle from z-axis around y-axis + + this.spherical.theta += this.sphericalDelta.theta; + this.spherical.phi += this.sphericalDelta.phi; + + // restrict theta to be inside desired limits + this.spherical.theta = Math.max( + this.data.minAzimuthAngle, + Math.min( + this.data.maxAzimuthAngle, + this.spherical.theta)); + + // restrict phi to be inside desired limits + this.spherical.phi = Math.max( + this.data.minPolarAngle, + Math.min( + this.data.maxPolarAngle, + this.spherical.phi)); + + this.spherical.makeSafe(); + + + this.spherical.radius *= this.scale; + + // restrict radius to be inside desired limits + this.spherical.radius = Math.max( + this.data.minDistance, + Math.min( + this.data.maxDistance, + this.spherical.radius)); + + this.target.add(this.panOffset); // move target to panned location + + offset.setFromSpherical(this.spherical); + + // rotate offset back to "camera-up-vector-is-up" space + offset.applyQuaternion(quatInverse); + + this.dolly.position.copy(this.target).add(offset); + + this.lookAtTarget(this.dolly, this.target); + + if (this.data.enableDamping === true) { + this.sphericalDelta.theta *= (1 - this.data.dampingFactor); + this.sphericalDelta.phi *= (1 - this.data.dampingFactor); + this.panOffset.multiplyScalar(1 - this.data.dampingFactor); + } else { + this.sphericalDelta.set(0, 0, 0); + this.panOffset.set(0, 0, 0); + } + + this.scale = 1; + + // update condition is: + // min(camera displacement, camera rotation in radians)^2 > EPS + // using small-angle approximation cos(x/2) = 1 - x^2 / 8 + + if (this.zoomChanged || + this.lastPosition.distanceToSquared(this.dolly.position) > this.EPS || + 8 * (1 - this.lastQuaternion.dot(this.dolly.quaternion)) > this.EPS) { + + var hmdQuaternion = this.calculateHMDQuaternion(); + var hmdEuler = new THREE.Euler(); + hmdEuler.setFromQuaternion(hmdQuaternion, 'YXZ'); + + this.el.setAttribute('position', { + x: this.dolly.position.x, + y: this.dolly.position.y, + z: this.dolly.position.z + }); + + this.el.setAttribute('rotation', { + x: THREE.Math.radToDeg(hmdEuler.x), + y: THREE.Math.radToDeg(hmdEuler.y), + z: THREE.Math.radToDeg(hmdEuler.z) + }); + + this.lastPosition.copy(this.dolly.position); + this.lastQuaternion.copy(this.dolly.quaternion); + + this.zoomChanged = false; + + return true; + } + + return false; + }, + + calculateHMDQuaternion: (function () { + var hmdQuaternion = new THREE.Quaternion(); + return function () { + hmdQuaternion.copy(this.dolly.quaternion); + return hmdQuaternion; + }; + })() + +}); diff --git a/ui/setups/test/blank.js b/ui/setups/test/blank.js index e92288dce..d4d5d8683 100644 --- a/ui/setups/test/blank.js +++ b/ui/setups/test/blank.js @@ -5,9 +5,9 @@ var setup = { logActionConsole : false, logEventConsole : false }, - - { name: "searchController", - }, + { + name: "searchController", + } ], @@ -16,15 +16,6 @@ var setup = { { name: "UI0", - - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "examine", - //speed: 10 - }, - - - area: { name: "top", orientation: "horizontal", @@ -32,10 +23,9 @@ var setup = { first: { size: "10%", collapsible: false, - controllers: [ - { name : "searchController" }, - ], + { name: "searchController"}, + ] }, second: { size: "90%", From ce0da72fd817137411a0ba520bf9a3e524ec136b Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 21 Sep 2018 15:41:27 +0200 Subject: [PATCH 03/71] Aframe-Lib added --- ui/aframe.html | 7 +- ui/libs/aframe/aframe-v0.8.2.min.js | 422 ++++++++++++++++++++++++++++ 2 files changed, 426 insertions(+), 3 deletions(-) create mode 100644 ui/libs/aframe/aframe-v0.8.2.min.js diff --git a/ui/aframe.html b/ui/aframe.html index 9dfda5a2f..02e5369f7 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -5,7 +5,7 @@ TODO in application auslagern --> - + + @@ -85,7 +86,7 @@
diff --git a/ui/libs/aframe/aframe-v0.8.2.min.js b/ui/libs/aframe/aframe-v0.8.2.min.js new file mode 100644 index 000000000..06b3cafa5 --- /dev/null +++ b/ui/libs/aframe/aframe-v0.8.2.min.js @@ -0,0 +1,422 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.AFRAME = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0;){this._tweensAddedDuringUpdate={};for(var i=0;i1?1:e,i=this._easingFunction(e);for(n in this._valuesEnd)if(void 0!==this._valuesStart[n]){var r=this._valuesStart[n]||0,a=this._valuesEnd[n];a instanceof Array?this._object[n]=this._interpolationFunction(a,i):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?r+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[n]=r+(a-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._object,i),1===e){if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(n in this._valuesStartRepeat){if("string"==typeof this._valuesEnd[n]&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo){var s=this._valuesStartRepeat[n];this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=s}this._valuesStart[n]=this._valuesStartRepeat[n]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,!0}null!==this._onCompleteCallback&&this._onCompleteCallback.call(this._object,this._object);for(var o=0,u=this._chainedTweens.length;o1?a(t[e],t[e-1],e-i):a(t[r],t[r+1>e?e:r+1],i-r)},Bezier:function(t,n){for(var e=0,i=t.length-1,r=Math.pow,a=TWEEN.Interpolation.Utils.Bernstein,s=0;s<=i;s++)e+=r(1-n,i-s)*r(n,s)*t[s]*a(i,s);return e},CatmullRom:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),a=TWEEN.Interpolation.Utils.CatmullRom;return t[0]===t[e]?(n<0&&(r=Math.floor(i=e*(1+n))),a(t[(r-1+e)%e],t[r],t[(r+1)%e],t[(r+2)%e],i-r)):n<0?t[0]-(a(t[0],t[0],t[1],t[1],-i)-t[0]):n>1?t[e]-(a(t[e],t[e],t[e-1],t[e-1],i-e)-t[e]):a(t[r?r-1:0],t[r],t[e1;i--)e*=i;return t[n]=e,e}}(),CatmullRom:function(t,n,e,i,r){var a=.5*(e-t),s=.5*(i-n),o=r*r;return(2*n-2*e+a+s)*(r*o)+(-3*n+3*e-2*a-s)*o+a*r+n}}},function(t){"function"==typeof define&&define.amd?define([],function(){return TWEEN}):"undefined"!=typeof module&&"object"==typeof exports?module.exports=TWEEN:void 0!==t&&(t.TWEEN=TWEEN)}(this); +}).call(this,_dereq_('_process')) + +},{"_process":6}],2:[function(_dereq_,module,exports){ +function anArray(r){return r.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===str.call(r.buffer)||Array.isArray(r)}var str=Object.prototype.toString;module.exports=anArray; +},{}],3:[function(_dereq_,module,exports){ +module.exports=function(e,n){return"number"==typeof e?e:"number"==typeof n?n:0}; +},{}],4:[function(_dereq_,module,exports){ +"use strict";function placeHoldersCount(o){var r=o.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===o[r-2]?2:"="===o[r-1]?1:0}function byteLength(o){return 3*o.length/4-placeHoldersCount(o)}function toByteArray(o){var r,e,t,u,n,p=o.length;u=placeHoldersCount(o),n=new Arr(3*p/4-u),e=u>0?p-4:p;var a=0;for(r=0;r>16&255,n[a++]=t>>8&255,n[a++]=255&t;return 2===u?(t=revLookup[o.charCodeAt(r)]<<2|revLookup[o.charCodeAt(r+1)]>>4,n[a++]=255&t):1===u&&(t=revLookup[o.charCodeAt(r)]<<10|revLookup[o.charCodeAt(r+1)]<<4|revLookup[o.charCodeAt(r+2)]>>2,n[a++]=t>>8&255,n[a++]=255&t),n}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,u=[],n=r;na?a:p+16383));return 1===t?(r=o[e-1],u+=lookup[r>>2],u+=lookup[r<<4&63],u+="=="):2===t&&(r=(o[e-2]<<8)+o[e-1],u+=lookup[r>>10],u+=lookup[r>>4&63],u+=lookup[r<<2&63],u+="="),n.push(u),n.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i1)for(var r=1;r=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function SlowBuffer(t){return+t!=t&&(t=0),Buffer.alloc(+t)}function byteLength(t,e){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,f){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=f?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(f)return-1;r=t.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof e&&(e=Buffer.from(e,n)),Buffer.isBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,f);if("number"==typeof e)return e&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,f){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,u/=2,s/=2,r/=2}var a;if(f){var h=-1;for(a=r;au&&(r=u-s),a=r;a>=0;a--){for(var c=!0,l=0;lf&&(n=f):n=f;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(f+u<=r){var s,a,h,c;switch(u){case 1:i<128&&(o=i);break;case 2:s=t[f+1],128==(192&s)&&(c=(31&i)<<6|63&s)>127&&(o=c);break;case 3:s=t[f+1],a=t[f+2],128==(192&s)&&128==(192&a)&&(c=(15&i)<<12|(63&s)<<6|63&a)>2047&&(c<55296||c>57343)&&(o=c);break;case 4:s=t[f+1],a=t[f+2],h=t[f+3],128==(192&s)&&128==(192&a)&&128==(192&h)&&(c=(15&i)<<18|(63&s)<<12|(63&a)<<6|63&h)>65535&&c<1114112&&(o=c)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),f+=u}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var f="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,f,i){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>f||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var f=0,i=Math.min(t.length-r,2);f>>8*(n?f:1-f)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var f=0,i=Math.min(t.length-r,4);f>>8*(n?f:3-f)&255}function checkIEEE754(t,e,r,n,f,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(t,e,r,n,f){return f||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,f){return f||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(t,e,r,n,52,8),r+8}function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,f=null,i=[],o=0;o55295&&r<57344){if(!f){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),f=r;continue}r=65536+(f-55296<<10|r-56320)}else f&&(e-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(t){for(var e=[],r=0;r>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(t){return base64.toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var f=0;f=e.length||f>=t.length);++f)e[f+r]=t[f];return f}function isnan(t){return t!==t}var base64=_dereq_("base64-js"),ieee754=_dereq_("ieee754"),isArray=_dereq_("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,e,r){return from(null,t,e,r)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,e){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,f=0,i=Math.min(r,n);f0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer.prototype.compare=function(t,e,r,n,f){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),e<0||r>t.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&e>=r)return 0;if(n>=f)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,f>>>=0,this===t)return 0;for(var i=f-n,o=r-e,u=Math.min(i,o),s=this.slice(n,f),a=t.slice(e,r),h=0;hf)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(f*=256);)n+=this[t+--e]*f;return n},Buffer.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i=f&&(n-=Math.pow(2,8*e)),n},Buffer.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=e,f=1,i=this[t+--n];n>0&&(f*=256);)i+=this[t+--n]*f;return f*=128,i>=f&&(i-=Math.pow(2,8*e)),i},Buffer.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){checkInt(this,t,e,r,Math.pow(2,8*r)-1,0)}var f=1,i=0;for(this[e]=255&t;++i=0&&(i*=256);)this[e+f]=t/i&255;return e+r},Buffer.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=0,o=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},Buffer.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/o>>0)-u&255;return e+r},Buffer.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--f)t[f+e]=this[f+r];else if(i<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(f=0;f>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;i=31}function formatArgs(){var o=arguments,e=this.useColors;if(o[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+o[0]+(e?"%c ":" "),!e)return o;var r="color: "+this.color;o=[o[0],r,"color: inherit"].concat(Array.prototype.slice.call(o,1));var t=0,s=0;return o[0].replace(/%[a-z%]/g,function(o){"%%"!==o&&(t++,"%c"===o&&(s=t))}),o.splice(s,0,r),o}function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(o){try{null==o?exports.storage.removeItem("debug"):exports.storage.debug=o}catch(o){}}function load(){var o;try{o=exports.storage.debug}catch(o){}return o}function localstorage(){try{return window.localStorage}catch(o){}}exports=module.exports=_dereq_("./debug"),exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:localstorage(),exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],exports.formatters.j=function(o){return JSON.stringify(o)},exports.enable(load()); +},{"./debug":11}],11:[function(_dereq_,module,exports){ +function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(e){function r(){}function o(){var e=o;null==e.useColors&&(e.useColors=exports.useColors()),null==e.color&&e.useColors&&(e.color=selectColor());var r=Array.prototype.slice.call(arguments);r[0]=exports.coerce(r[0]),"string"!=typeof r[0]&&(r=["%o"].concat(r));var s=0;r[0]=r[0].replace(/%([a-z%])/g,function(o,t){if("%%"===o)return o;s++;var n=exports.formatters[t];if("function"==typeof n){var l=r[s];o=n.call(e,l),r.splice(s,1),s--}return o}),"function"==typeof exports.formatArgs&&(r=exports.formatArgs.apply(e,r)),(o.log||exports.log||console.log.bind(console)).apply(e,r)}r.enabled=!1,o.enabled=!0;var s=exports.enabled(e)?o:r;return s.namespace=e,s}function enable(e){exports.save(e);for(var r=(e||"").split(/[\s,]+/),o=r.length,s=0;s>0),L="attached",T="detached",M="extends",F="ADDITION",V="MODIFICATION",I="REMOVAL",D="DOMAttrModified",P="DOMContentLoaded",R="DOMSubtreeModified",_="<",k="=",q=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,S=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],U=[],H=[],x="",Z=r.documentElement,G=U.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},j=n.prototype,z=j.hasOwnProperty,K=j.isPrototypeOf,W=n.defineProperty,X=n.getOwnPropertyDescriptor,Y=n.getOwnPropertyNames,$=n.getPrototypeOf,B=n.setPrototypeOf,J=!!n.__proto__,Q=n.create||function e(t){return t?(e.prototype=t,new e):this},ee=B||(J?function(e,t){return e.__proto__=t,e}:Y&&X?function(){function e(e,t){for(var r,n=Y(t),a=0,l=n.length;a>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; +},{}],19:[function(_dereq_,module,exports){ +"function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}; +},{}],20:[function(_dereq_,module,exports){ +function isBuffer(f){return!!f.constructor&&"function"==typeof f.constructor.isBuffer&&f.constructor.isBuffer(f)}function isSlowBuffer(f){return"function"==typeof f.readFloatLE&&"function"==typeof f.slice&&isBuffer(f.slice(0,0))}module.exports=function(f){return null!=f&&(isBuffer(f)||isSlowBuffer(f)||!!f._isBuffer)}; +},{}],21:[function(_dereq_,module,exports){ +function isFunction(o){var t=toString.call(o);return"[object Function]"===t||"function"==typeof o&&"[object RegExp]"!==t||"undefined"!=typeof window&&(o===window.setTimeout||o===window.alert||o===window.confirm||o===window.prompt)}module.exports=isFunction;var toString=Object.prototype.toString; +},{}],22:[function(_dereq_,module,exports){ +"use strict";module.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}; +},{}],23:[function(_dereq_,module,exports){ +function TextLayout(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function addGetter(t){Object.defineProperty(TextLayout.prototype,t,{get:wrapper(t),configurable:!0})}function wrapper(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function getGlyphById(t,e){if(!t.chars||0===t.chars.length)return null;var r=findChar(t.chars,e);return r>=0?t.chars[r]:null}function getXHeight(t){for(var e=0;e=0)return t.chars[n].height}return 0}function getMGlyph(t){for(var e=0;e=0)return t.chars[n]}return 0}function getCapHeight(t){for(var e=0;e=0)return t.chars[n].height}return 0}function getKerning(t,e,r){if(!t.kernings||0===t.kernings.length)return 0;for(var n=t.kernings,i=0;i=n||f>=n)break;s=f,c=d,a=i}u++}return a&&(c+=a.xoffset),{start:e,end:e+u,width:c}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach(addGetter); +},{"as-number":3,"word-wrapper":47,"xtend":50}],24:[function(_dereq_,module,exports){ +(function (Buffer){ +function isArrayBuffer(r){return"[object ArrayBuffer]"===Object.prototype.toString.call(r)}function getBinaryOpts(r){if(xml2)return xtend(r,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),xtend({xhr:e},r)}var xhr=_dereq_("xhr"),noop=function(){},parseASCII=_dereq_("parse-bmfont-ascii"),parseXML=_dereq_("parse-bmfont-xml"),readBinary=_dereq_("parse-bmfont-binary"),isBinaryFormat=_dereq_("./lib/is-binary"),xtend=_dereq_("xtend"),xml2=function(){return self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}();module.exports=function(r,e){e="function"==typeof e?e:noop,"string"==typeof r?r={uri:r}:r||(r={}),r.binary&&(r=getBinaryOpts(r)),xhr(r,function(t,n,i){if(t)return e(t);if(!/^2/.test(n.statusCode))return e(new Error("http status code: "+n.statusCode));if(!i)return e(new Error("no body result"));var o=!1;if(isArrayBuffer(i)){var a=new Uint8Array(i);i=new Buffer(a,"binary")}isBinaryFormat(i)&&(o=!0,"string"==typeof i&&(i=new Buffer(i,"binary"))),o||(Buffer.isBuffer(i)&&(i=i.toString(r.encoding)),i=i.trim());var s;try{var u=n.headers["content-type"];s=o?readBinary(i):/json/.test(u)||"{"===i.charAt(0)?JSON.parse(i):/xml/.test(u)||"<"===i.charAt(0)?parseXML(i):parseASCII(i)}catch(r){e(new Error("error parsing font "+r.message)),e=noop}e(null,s)})}; +}).call(this,_dereq_("buffer").Buffer) + +},{"./lib/is-binary":25,"buffer":8,"parse-bmfont-ascii":27,"parse-bmfont-binary":28,"parse-bmfont-xml":29,"xhr":48,"xtend":50}],25:[function(_dereq_,module,exports){ +(function (Buffer){ +var equal=_dereq_("buffer-equal"),HEADER=new Buffer([66,77,70,3]);module.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&equal(e.slice(0,4),HEADER)}; +}).call(this,_dereq_("buffer").Buffer) + +},{"buffer":8,"buffer-equal":7}],26:[function(_dereq_,module,exports){ +"use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;ae.length-1)return 0;var a=e.readUInt8(n++),t=e.readInt32LE(n);switch(n+=4,a){case 1:r.info=readInfo(e,n);break;case 2:r.common=readCommon(e,n);break;case 3:r.pages=readPages(e,n,t);break;case 4:r.chars=readChars(e,n,t);break;case 5:r.kernings=readKernings(e,n,t)}return 5+t}function readInfo(r,e){var n={};n.size=r.readInt16LE(e);var a=r.readUInt8(e+2);return n.smooth=a>>7&1,n.unicode=a>>6&1,n.italic=a>>5&1,n.bold=a>>4&1,a>>3&1&&(n.fixedHeight=1),n.charset=r.readUInt8(e+3)||"",n.stretchH=r.readUInt16LE(e+4),n.aa=r.readUInt8(e+6),n.padding=[r.readInt8(e+7),r.readInt8(e+8),r.readInt8(e+9),r.readInt8(e+10)],n.spacing=[r.readInt8(e+11),r.readInt8(e+12)],n.outline=r.readUInt8(e+13),n.face=readStringNT(r,e+14),n}function readCommon(r,e){var n={};n.lineHeight=r.readUInt16LE(e),n.base=r.readUInt16LE(e+2),n.scaleW=r.readUInt16LE(e+4),n.scaleH=r.readUInt16LE(e+6),n.pages=r.readUInt16LE(e+8);r.readUInt8(e+10);return n.packed=0,n.alphaChnl=r.readUInt8(e+11),n.redChnl=r.readUInt8(e+12),n.greenChnl=r.readUInt8(e+13),n.blueChnl=r.readUInt8(e+14),n}function readPages(r,e,n){for(var a=[],t=readNameNT(r,e),d=t.length+1,o=n/d,i=0;i3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var n={kernings:[],chars:[]},a=0;a<5;a++)e+=readBlock(n,r,e);return n}; +},{}],29:[function(_dereq_,module,exports){ +function getAttribs(e){return getAttribList(e).reduce(function(e,t){return e[mapName(t.nodeName)]=t.nodeValue,e},{})}function getAttribList(e){for(var t=[],r=0;r element");for(var n=a.getElementsByTagName("page"),i=0;i0});this.visibleGlyphs=s;var n=vertices.positions(s),u=vertices.uvs(s,r,o,t),a=createIndices({clockwise:!0,type:"uint16",count:s.length});if(buffer.index(this,a,1,"uint16"),buffer.attr(this,"position",n,2),buffer.attr(this,"uv",u,2),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var h=vertices.pages(s);buffer.attr(this,"page",h,1)}},TextGeometry.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);utils.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')},TextGeometry.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,i=this.attributes.position.itemSize;if(!t||!i||t.length<2)return void e.makeEmpty();utils.computeBox(t,e)}; +},{"./lib/utils":37,"./lib/vertices":38,"inherits":19,"layout-bmfont-text":23,"object-assign":26,"quad-indices":34,"three-buffer-vertex-data":39}],37:[function(_dereq_,module,exports){ +function bounds(x){var m=x.length/itemSize;box.min[0]=x[0],box.min[1]=x[1],box.max[0]=x[0],box.max[1]=x[1];for(var o=0;o0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function n(t,e,i,r){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==r?r:1}function a(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function o(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function s(t,e,r,n,a,c,h,l,u,p){Object.defineProperty(this,"id",{value:uc++}),this.uuid=lc.generateUUID(),this.name="",this.image=void 0!==t?t:s.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:s.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:$o,this.wrapT=void 0!==n?n:$o,this.magFilter=void 0!==a?a:ns,this.minFilter=void 0!==c?c:os,this.anisotropy=void 0!==u?u:1,this.format=void 0!==h?h:_s,this.type=void 0!==l?l:ss,this.offset=new i(0,0),this.repeat=new i(1,1),this.center=new i(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==p?p:ec,this.version=0,this.onUpdate=null}function c(t,e,i,r){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==r?r:1}function h(t,e,i){this.uuid=lc.generateUUID(),this.width=t,this.height=e,this.scissor=new c(0,0,t,e),this.scissorTest=!1,this.viewport=new c(0,0,t,e),i=i||{},void 0===i.minFilter&&(i.minFilter=ns),this.texture=new s(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function l(t,e,i){h.call(this,t,e,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function u(t,e,i,r,n,a,o,c,h,l,u,p){s.call(this,null,a,o,c,h,l,r,n,u,p),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:es,this.minFilter=void 0!==l?l:es,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function p(t,e,i,r,n,a,o,c,h,l){t=void 0!==t?t:[],e=void 0!==e?e:Wo,s.call(this,t,e,i,r,n,a,o,c,h,l),this.flipY=!1}function d(){this.seq=[],this.map={}}function f(t,e,i){var r=t[0];if(r<=0||r>0)return t;var n=e*i,a=fc[n];if(void 0===a&&(a=new Float32Array(n),fc[n]=a),0!==e){r.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function m(t,e){var i=mc[e];void 0===i&&(i=new Int32Array(e),mc[e]=i);for(var r=0;r!==e;++r)i[r]=t.allocTextureUnit();return i}function v(t,e){t.uniform1f(this.addr,e)}function g(t,e){t.uniform1i(this.addr,e)}function y(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function x(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function b(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function _(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function w(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(gc.set(e.elements),t.uniformMatrix3fv(this.addr,!1,gc))}function M(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(vc.set(e.elements),t.uniformMatrix4fv(this.addr,!1,vc))}function E(t,e,i){var r=i.allocTextureUnit();t.uniform1i(this.addr,r),i.setTexture2D(e||pc,r)}function T(t,e,i){var r=i.allocTextureUnit();t.uniform1i(this.addr,r),i.setTextureCube(e||dc,r)}function S(t,e){t.uniform2iv(this.addr,e)}function A(t,e){t.uniform3iv(this.addr,e)}function L(t,e){t.uniform4iv(this.addr,e)}function R(t){switch(t){case 5126:return v;case 35664:return y;case 35665:return x;case 35666:return b;case 35674:return _;case 35675:return w;case 35676:return M;case 35678:case 36198:return E;case 35680:return T;case 5124:case 35670:return g;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return L}}function C(t,e){t.uniform1fv(this.addr,e)}function P(t,e){t.uniform1iv(this.addr,e)}function I(t,e){t.uniform2fv(this.addr,f(e,this.size,2))}function O(t,e){t.uniform3fv(this.addr,f(e,this.size,3))}function N(t,e){t.uniform4fv(this.addr,f(e,this.size,4))}function U(t,e){t.uniformMatrix2fv(this.addr,!1,f(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,f(e,this.size,9))}function B(t,e){t.uniformMatrix4fv(this.addr,!1,f(e,this.size,16))}function F(t,e,i){var r=e.length,n=m(i,r);t.uniform1iv(this.addr,n);for(var a=0;a!==r;++a)i.setTexture2D(e[a]||pc,n[a])}function z(t,e,i){var r=e.length,n=m(i,r);t.uniform1iv(this.addr,n);for(var a=0;a!==r;++a)i.setTextureCube(e[a]||dc,n[a])}function G(t){switch(t){case 5126:return C;case 35664:return I;case 35665:return O;case 35666:return N;case 35674:return U;case 35675:return D;case 35676:return B;case 35678:return F;case 35680:return z;case 5124:case 35670:return P;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return L}}function H(t,e,i){this.id=t,this.addr=i,this.setValue=R(e.type)}function V(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=G(e.type)}function k(t){this.id=t,d.call(this)}function j(t,e){t.seq.push(e),t.map[e.id]=e}function W(t,e,i){var r=t.name,n=r.length;for(yc.lastIndex=0;;){var a=yc.exec(r),o=yc.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===n){j(i,void 0===h?new H(s,t,e):new V(s,t,e));break}var l=i.map,u=l[s];void 0===u&&(u=new k(s),j(i,u)),i=u}}function X(t,e,i){d.call(this),this.renderer=i;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),n=0;n 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),e.compileShader(i),e.compileShader(r),e.attachShader(t,i),e.attachShader(t,r),e.linkProgram(t),t}function h(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var l,u,p,d,f,m,v=new a,g=new n,y=new a;this.render=function(n,a,o){if(0!==n.length){void 0===p&&s(),i.useProgram(p),i.initAttributes(),i.enableAttribute(d.position),i.enableAttribute(d.uv),i.disableUnusedAttributes(),i.disable(e.CULL_FACE),i.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,l),e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u),e.uniformMatrix4fv(f.projectionMatrix,!1,o.projectionMatrix.elements),i.activeTexture(e.TEXTURE0),e.uniform1i(f.map,0);var c=0,x=0,b=a.fog;b?(e.uniform3f(f.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(e.uniform1f(f.fogNear,b.near),e.uniform1f(f.fogFar,b.far),e.uniform1i(f.fogType,1),c=1,x=1):b.isFogExp2&&(e.uniform1f(f.fogDensity,b.density),e.uniform1i(f.fogType,2),c=2,x=2)):(e.uniform1i(f.fogType,0),c=0,x=0);for(var _=0,w=n.length;_0:s&&s.isGeometry&&(u=s.morphTargets&&s.morphTargets.length>0)),e.isSkinnedMesh&&!1===i.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var p=e.isSkinnedMesh&&i.skinning,d=0;u&&(d|=v),p&&(d|=g),c=h[d]}if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var f=c.uuid,m=i.uuid,y=_[f];void 0===y&&(y={},_[f]=y);var M=y[m];void 0===M&&(M=c.clone(),y[m]=M),c=M}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=null!=i.shadowSide?i.shadowSide:w[i.side],c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,r&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(n),c.nearDistance=a,c.farDistance=o),c}function s(i,r,n,a){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&i.castShadow&&(!i.frustumCulled||l.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,i.matrixWorld);var c=e.update(i),h=i.material;if(Array.isArray(h))for(var u=c.groups,p=0,d=u.length;pe&&(e=t[i]);return e}function Et(){Object.defineProperty(this,"id",{value:Ac+=2}),this.uuid=lc.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Tt(t,e,i,r,n,a){ut.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:r,heightSegments:n,depthSegments:a},this.fromBufferGeometry(new St(t,e,i,r,n,a)),this.mergeVertices()}function St(t,e,i,r,n,o){function s(t,e,i,r,n,o,s,m,v,g,y){var x,b,_=o/v,w=s/g,M=o/2,E=s/2,T=m/2,S=v+1,A=g+1,L=0,R=0,C=new a;for(b=0;b0?1:-1,u.push(C.x,C.y,C.z),p.push(x/v),p.push(1-b/g),L+=1}}for(b=0;b1&&a.sort(Dt),o.length>1&&o.sort(Bt)}var r=[],n=0,a=[],o=[];return{opaque:a,transparent:o,init:t,push:e,sort:i}}function zt(){function t(t,e){var r=t.id+","+e.id,n=i[r];return void 0===n&&(n=new Ft,i[r]=n),n}function e(){i={}}var i={};return{get:t,dispose:e}}function Gt(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ht(t){function e(e,n,a,o){var s=e.morphTargetInfluences,c=s.length,h=i[n.id];if(void 0===h){h=[];for(var l=0;l65535?xt:gt)(n,1),e.update(r,t.ELEMENT_ARRAY_BUFFER),c[i.id]=r,r}var s={},c={};return{get:n,update:a,getWireframeAttribute:o}}function Wt(t,e){function i(i){var r=e.frame,a=i.geometry,o=t.get(i,a);return n[o.id]!==r&&(a.isGeometry&&o.updateFromObject(i),t.update(o),n[o.id]=r),o}function r(){n={}}var n={};return{update:i,dispose:r}}function Xt(t){for(var e=t.split("\n"),i=0;i");return ne(i)}var i=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(i,e)}function ae(t){function e(t,e,i,r){for(var n="",a=parseInt(e);a0?t.gammaFactor:1,g=Kt(r.extensions,a,e),y=$t(s),x=o.createProgram();r.isRawShaderMaterial?(f=[y].filter(ee).join("\n"),f.length>0&&(f+="\n"),m=[g,y].filter(ee).join("\n"),m.length>0&&(m+="\n")):(f=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+n.name,y,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+v,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+l:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ee).join("\n"),m=[g,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+n.name,y,a.alphaTest?"#define ALPHATEST "+a.alphaTest:"","#define GAMMA_FACTOR "+v,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+u:"",a.envMap?"#define "+p:"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+l:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&e.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==Go?"#define TONE_MAPPING":"",a.toneMapping!==Go?wc.tonemapping_pars_fragment:"",a.toneMapping!==Go?Qt("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?wc.encodings_pars_fragment:"",a.mapEncoding?Zt("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?Zt("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Zt("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?Jt("linearToOutputTexel",a.outputEncoding):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(ee).join("\n")),c=ne(c),c=ie(c,a),c=re(c,a),h=ne(h),h=ie(h,a),h=re(h,a),c=ae(c),h=ae(h);var b=f+c,_=m+h,w=qt(o,o.VERTEX_SHADER,b),M=qt(o,o.FRAGMENT_SHADER,_);o.attachShader(x,w),o.attachShader(x,M),void 0!==r.index0AttributeName?o.bindAttribLocation(x,0,r.index0AttributeName):!0===a.morphTargets&&o.bindAttribLocation(x,0,"position"),o.linkProgram(x);var E=o.getProgramInfoLog(x).trim(),T=o.getShaderInfoLog(w).trim(),S=o.getShaderInfoLog(M).trim(),A=!0,L=!0;!1===o.getProgramParameter(x,o.LINK_STATUS)?(A=!1,console.error("THREE.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(x,o.VALIDATE_STATUS),"gl.getProgramInfoLog",E,T,S)):""!==E?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",E):""!==T&&""!==S||(L=!1),L&&(this.diagnostics={runnable:A,material:r,programLog:E,vertexShader:{log:T,prefix:f},fragmentShader:{log:S,prefix:m}}),o.deleteShader(w),o.deleteShader(M);var R;this.getUniforms=function(){return void 0===R&&(R=new X(o,x,t)),R};var C;return this.getAttributes=function(){return void 0===C&&(C=te(o,x)),C},this.destroy=function(){o.deleteProgram(x),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Lc++,this.code=i,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=M,this}function se(t,e,i){function r(t){var e=t.skeleton,r=e.bones;if(i.floatVertexTextures)return 1024;var n=i.maxVertexUniforms,a=Math.floor((n-20)/4),o=Math.min(a,r.length);return o0,maxBones:d,useVertexTexture:i.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:h,numClipIntersection:l,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.receiveShadow&&s.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===io,flipSided:e.side===eo,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,i){var r=[];if(i.shaderID?r.push(i.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)r.push(n),r.push(e.defines[n]);for(var a=0;ae||t.height>e){var i=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*i),r.height=Math.floor(t.height*i);return r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function h(t){return lc.isPowerOfTwo(t.width)&&lc.isPowerOfTwo(t.height)}function l(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap){void 0===C&&(C=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),C.width=lc.floorPowerOfTwo(t.width),C.height=lc.floorPowerOfTwo(t.height);return C.getContext("2d").drawImage(t,0,0,C.width,C.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+C.width+"x"+C.height,t),C}return t}function u(t){return t.wrapS!==$o||t.wrapT!==$o||t.minFilter!==es&&t.minFilter!==ns}function p(t,e){return t.generateMipmaps&&e&&t.minFilter!==es&&t.minFilter!==ns}function d(e){return e===es||e===is||e===rs?t.NEAREST:t.LINEAR}function f(t){var e=t.target;e.removeEventListener("dispose",f),v(e),e.isVideoTexture&&delete I[e.id],o.textures--}function m(t){var e=t.target;e.removeEventListener("dispose",m),g(e),o.textures--}function v(e){var i=r.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}r.remove(e)}function g(e){var i=r.get(e),n=r.get(e.texture);if(e){if(void 0!==n.__webglTexture&&t.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);r.remove(e.texture),r.remove(e)}}function y(e,n){var a=r.get(e);if(e.isVideoTexture&&R(e),e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==o.complete)return void w(a,e,n);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+n),i.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function x(e,s){var l=r.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",f),l.__image__webglTextureCube=t.createTexture(),o.textures++),i.activeTexture(t.TEXTURE0+s),i.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var u=e&&e.isCompressedTexture,d=e.image[0]&&e.image[0].isDataTexture,m=[],v=0;v<6;v++)m[v]=u||d?d?e.image[v].image:e.image[v]:c(e.image[v],n.maxCubemapSize);var g=m[0],y=h(g),x=a.convert(e.format),b=a.convert(e.type);_(t.TEXTURE_CUBE_MAP,e,y);for(var v=0;v<6;v++)if(u)for(var w,M=m[v].mipmaps,E=0,T=M.length;E-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,E,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,E,x,w.width,w.height,0,x,b,w.data);else d?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,x,m[v].width,m[v].height,0,x,b,m[v].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,x,x,b,m[v]);p(e,y)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+s),i.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function b(e,n){i.activeTexture(t.TEXTURE0+n),i.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function _(i,o,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,a.convert(o.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,a.convert(o.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,a.convert(o.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,a.convert(o.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),o.wrapS===$o&&o.wrapT===$o||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),t.texParameteri(i,t.TEXTURE_MAG_FILTER,d(o.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,d(o.minFilter)),o.minFilter!==es&&o.minFilter!==ns&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),c=e.get("EXT_texture_filter_anisotropic")){if(o.type===ds&&null===e.get("OES_texture_float_linear"))return;if(o.type===fs&&null===e.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,n.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function w(e,r,s){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),o.textures++),i.activeTexture(t.TEXTURE0+s),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var d=c(r.image,n.maxTextureSize);u(r)&&!1===h(d)&&(d=l(d));var m=h(d),v=a.convert(r.format),g=a.convert(r.type);_(t.TEXTURE_2D,r,m);var y,x=r.mipmaps;if(r.isDepthTexture){var b=t.DEPTH_COMPONENT;if(r.type===ds){if(!P)throw new Error("Float Depth Texture only supported in WebGL2.0");b=t.DEPTH_COMPONENT32F}else P&&(b=t.DEPTH_COMPONENT16);r.format===Ts&&b===t.DEPTH_COMPONENT&&r.type!==ls&&r.type!==ps&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=ls,g=a.convert(r.type)),r.format===Ss&&(b=t.DEPTH_STENCIL,r.type!==ys&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ys,g=a.convert(r.type))),i.texImage2D(t.TEXTURE_2D,0,b,d.width,d.height,0,v,g,null)}else if(r.isDataTexture)if(x.length>0&&m){for(var w=0,M=x.length;w-1?i.compressedTexImage2D(t.TEXTURE_2D,w,v,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,w,v,y.width,y.height,0,v,g,y.data);else if(x.length>0&&m){for(var w=0,M=x.length;w=1):-1!==it.indexOf("OpenGL ES")&&(et=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(it)[1]),tt=et>=2);var rt=null,nt={},at=new c,ot=new c,st={};return st[t.TEXTURE_2D]=o(t.TEXTURE_2D,t.TEXTURE_2D,1),st[t.TEXTURE_CUBE_MAP]=o(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),C.setClear(0,0,0,1),P.setClear(1),I.setClear(0),p(t.DEPTH_TEST),P.setFunc(Io),y(!1),x(Ja),p(t.CULL_FACE),p(t.BLEND),v(so),{buffers:{color:C,depth:P,stencil:I},initAttributes:s,enableAttribute:h,enableAttributeAndDivisor:l,disableUnusedAttributes:u,enable:p,disable:d,getCompressedTextureFormats:f,useProgram:m,setBlending:v,setMaterial:g,setFlipSided:y,setCullFace:x,setLineWidth:b,setPolygonOffset:_,setScissorTest:w,activeTexture:M,bindTexture:E,compressedTexImage2D:T,texImage2D:S,scissor:A,viewport:L,reset:R}}function ue(t,e,i){function r(){if(void 0!==a)return a;var i=e.get("EXT_texture_filter_anisotropic");return a=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function n(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==i.precision?i.precision:"highp",s=n(o) +;s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===i.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:n,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function pe(t,e,i,r){ct.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function de(t){pe.call(this),this.cameras=t||[]}function fe(t){function e(){if(null!==o&&o.isPresenting){var e=o.getEyeParameters("left"),r=e.renderWidth,n=e.renderHeight;x=t.getPixelRatio(),y=t.getSize(),t.setDrawingBufferSize(2*r,n,1)}else i.enabled&&t.setDrawingBufferSize(y.width,y.height,x)}var i=this,o=null,s=null,h=null,l=new r,u=new r;"undefined"!=typeof window&&"VRFrameData"in window&&(s=new window.VRFrameData);var p=new r,d=new n,f=new a,m=new pe;m.bounds=new c(0,0,.5,1),m.layers.enable(1);var v=new pe;v.bounds=new c(.5,0,.5,1),v.layers.enable(2);var g=new de([m,v]);g.layers.enable(1),g.layers.enable(2);var y,x;"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",e,!1),this.enabled=!1,this.userHeight=1.6,this.getDevice=function(){return o},this.setDevice=function(t){void 0!==t&&(o=t)},this.setPoseTarget=function(t){void 0!==t&&(h=t)},this.getCamera=function(t){if(null===o)return t;o.depthNear=t.near,o.depthFar=t.far,o.getFrameData(s);var e=o.stageParameters;e?l.fromArray(e.sittingToStandingTransform):l.makeTranslation(0,i.userHeight,0);var r=s.pose,n=null!==h?h:t;if(n.matrix.copy(l),n.matrix.decompose(n.position,n.quaternion,n.scale),null!==r.orientation&&(d.fromArray(r.orientation),n.quaternion.multiply(d)),null!==r.position&&(d.setFromRotationMatrix(l),f.fromArray(r.position),f.applyQuaternion(d),n.position.add(f)),n.updateMatrixWorld(),!1===o.isPresenting)return t;m.near=t.near,v.near=t.near,m.far=t.far,v.far=t.far,g.matrixWorld.copy(t.matrixWorld),g.matrixWorldInverse.copy(t.matrixWorldInverse),m.matrixWorldInverse.fromArray(s.leftViewMatrix),v.matrixWorldInverse.fromArray(s.rightViewMatrix),u.getInverse(l),m.matrixWorldInverse.multiply(u),v.matrixWorldInverse.multiply(u);var a=n.parent;null!==a&&(p.getInverse(a.matrixWorld),m.matrixWorldInverse.multiply(p),v.matrixWorldInverse.multiply(p)),m.matrixWorld.getInverse(m.matrixWorldInverse),v.matrixWorld.getInverse(v.matrixWorldInverse),m.projectionMatrix.fromArray(s.leftProjectionMatrix),v.projectionMatrix.fromArray(s.rightProjectionMatrix),g.projectionMatrix.copy(m.projectionMatrix);var c=o.getLayers();if(c.length){var y=c[0];null!==y.leftBounds&&4===y.leftBounds.length&&m.bounds.fromArray(y.leftBounds),null!==y.rightBounds&&4===y.rightBounds.length&&v.bounds.fromArray(y.rightBounds)}return g},this.getStandingMatrix=function(){return l},this.submitFrame=function(){o&&o.isPresenting&&o.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function me(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var r;switch(i){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(i)}return null===r&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=r,r}}}function ve(){function t(){l.value!==r&&(l.value=r,l.needsUpdate=n>0),i.numPlanes=n,i.numIntersection=0}function e(t,e,r,n){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=l.value,!0!==n||null===o){var s=r+4*a,u=e.matrixWorldInverse;h.getNormalMatrix(u),(null===o||o.length=0){var h=n[s];if(void 0!==h){var l=h.normalized,u=h.itemSize,p=Nt.get(h);if(void 0===p)continue;var d=p.buffer,f=p.type,m=p.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,g=v.stride,y=h.offset;v&&v.isInstancedInterleavedBuffer?(Pt.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):Pt.enableAttribute(c),At.bindBuffer(At.ARRAY_BUFFER,d),At.vertexAttribPointer(c,u,f,l,g*m,(r*g+y)*m)}else h.isInstancedBufferAttribute?(Pt.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):Pt.enableAttribute(c),At.bindBuffer(At.ARRAY_BUFFER,d),At.vertexAttribPointer(c,u,f,l,0,r*u*m)}else if(void 0!==o){var x=o[s];if(void 0!==x)switch(x.length){case 2:At.vertexAttrib2fv(c,x);break;case 3:At.vertexAttrib3fv(c,x);break;case 4:At.vertexAttrib4fv(c,x);break;default:At.vertexAttrib1fv(c,x)}}}}Pt.disableUnusedAttributes()}function m(){ee||(g(),ee=!0)}function v(){ee=!1}function g(){var t=$t.getDevice();t&&t.isPresenting?t.requestAnimationFrame(y):window.requestAnimationFrame(y)}function y(t){!1!==ee&&(ie(t),g())}function x(t,e,i){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isLight)Q.pushLight(t),t.castShadow&&Q.pushShadow(t);else if(t.isSprite)t.frustumCulled&&!xt.intersectsSprite(t)||Q.pushSprite(t);else if(t.isImmediateRenderObject)i&&Et.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Mt),J.push(t,null,t.material,Et.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||xt.intersectsObject(t))){i&&Et.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Mt);var r=Bt.update(t),n=t.material;if(Array.isArray(n))for(var a=r.groups,o=0,s=a.length;o=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var f=0;f=0&&t.numSupportedMorphNormals++}var m=r.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=bt.numPlanes,r.numIntersection=bt.numIntersection,m.clippingPlanes=bt.uniform),r.fog=e,r.lightsHash=n.state.hash,t.lights&&(m.ambientLightColor.value=n.state.ambient,m.directionalLights.value=n.state.directional,m.spotLights.value=n.state.spot,m.rectAreaLights.value=n.state.rectArea,m.pointLights.value=n.state.point,m.hemisphereLights.value=n.state.hemi,m.directionalShadowMap.value=n.state.directionalShadowMap,m.directionalShadowMatrix.value=n.state.directionalShadowMatrix,m.spotShadowMap.value=n.state.spotShadowMap,m.spotShadowMatrix.value=n.state.spotShadowMatrix,m.pointShadowMap.value=n.state.pointShadowMap,m.pointShadowMatrix.value=n.state.pointShadowMatrix);var v=r.program.getUniforms(),g=X.seqWithValue(v.seq,m);r.uniformsList=g}function M(t,e,i,r){pt=0;var n=It.get(i),a=Q.state.lights;if(_t&&(wt||t!==st)){var o=t===st&&i.id===at;bt.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,n,o)}!1===i.needsUpdate&&(void 0===n.program?i.needsUpdate=!0:i.fog&&n.fog!==e?i.needsUpdate=!0:i.lights&&n.lightsHash!==a.state.hash?i.needsUpdate=!0:void 0===n.numClippingPlanes||n.numClippingPlanes===bt.numPlanes&&n.numIntersection===bt.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(w(i,e,r),i.needsUpdate=!1);var s=!1,c=!1,h=!1,l=n.program,p=l.getUniforms(),d=n.shader.uniforms;if(Pt.useProgram(l.program)&&(s=!0,c=!0,h=!0),i.id!==at&&(at=i.id,c=!0),s||t!==st){if(p.setValue(At,"projectionMatrix",t.projectionMatrix),Ct.logarithmicDepthBuffer&&p.setValue(At,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),st!==(ct||t)&&(st=ct||t,c=!0,h=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var f=p.map.cameraPosition;void 0!==f&&f.setValue(At,Et.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&p.setValue(At,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){p.setOptional(At,r,"bindMatrix"),p.setOptional(At,r,"bindMatrixInverse");var m=r.skeleton;if(m){var v=m.bones;if(Ct.floatVertexTextures){if(void 0===m.boneTexture){var g=Math.sqrt(4*v.length);g=lc.ceilPowerOfTwo(g),g=Math.max(g,4);var y=new Float32Array(g*g*4);y.set(m.boneMatrices);var x=new u(y,g,g,_s,ds);x.needsUpdate=!0,m.boneMatrices=y,m.boneTexture=x,m.boneTextureSize=g}p.setValue(At,"boneTexture",m.boneTexture),p.setValue(At,"boneTextureSize",m.boneTextureSize)}else p.setOptional(At,m,"boneMatrices")}}return c&&(p.setValue(At,"toneMappingExposure",K.toneMappingExposure),p.setValue(At,"toneMappingWhitePoint",K.toneMappingWhitePoint),i.lights&&B(d,h),e&&i.fog&&L(d,e),i.isMeshBasicMaterial?E(d,i):i.isMeshLambertMaterial?(E(d,i),R(d,i)):i.isMeshPhongMaterial?(E(d,i),i.isMeshToonMaterial?P(d,i):C(d,i)):i.isMeshStandardMaterial?(E(d,i),i.isMeshPhysicalMaterial?O(d,i):I(d,i)):i.isMeshDepthMaterial?(E(d,i),N(d,i)):i.isMeshDistanceMaterial?(E(d,i),U(d,i)):i.isMeshNormalMaterial?(E(d,i),D(d,i)):i.isLineBasicMaterial?(T(d,i),i.isLineDashedMaterial&&S(d,i)):i.isPointsMaterial?A(d,i):i.isShadowMaterial&&(d.color.value=i.color,d.opacity.value=i.opacity),void 0!==d.ltc_1&&(d.ltc_1.value=bc.LTC_1),void 0!==d.ltc_2&&(d.ltc_2.value=bc.LTC_2),X.upload(At,n.uniformsList,d,K)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(X.upload(At,n.uniformsList,d,K),i.uniformsNeedUpdate=!1),p.setValue(At,"modelViewMatrix",r.modelViewMatrix),p.setValue(At,"normalMatrix",r.normalMatrix),p.setValue(At,"modelMatrix",r.matrixWorld),l}function E(t,e){t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){if(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate){var r=i.offset,n=i.repeat,a=i.rotation,o=i.center;i.matrix.setUvTransform(r.x,r.y,n.x,n.y,a,o.x,o.y)}t.uvTransform.value.copy(i.matrix)}}function T(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function S(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function A(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*mt,t.scale.value=.5*ft,t.map.value=e.map,null!==e.map){if(!0===e.map.matrixAutoUpdate){var i=e.map.offset,r=e.map.repeat,n=e.map.rotation,a=e.map.center;e.map.matrix.setUvTransform(i.x,i.y,r.x,r.y,n,a.x,a.y)}t.uvTransform.value.copy(e.map.matrix)}}function L(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function R(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function C(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function P(t,e){C(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function I(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function O(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,I(t,e)}function N(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function U(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}function D(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function B(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function F(){var t=pt;return t>=Ct.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+Ct.maxTextures),pt+=1,t}console.log("THREE.WebGLRenderer",qa),t=t||{};var z=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),G=void 0!==t.context?t.context:null,H=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,j=void 0!==t.antialias&&t.antialias,W=void 0===t.premultipliedAlpha||t.premultipliedAlpha,q=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,Y=void 0!==t.powerPreference?t.powerPreference:"default",J=null,Q=null;this.domElement=z,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Ho,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var K=this,$=!1,tt=null,et=null,at=-1,ot="",st=null,ct=null,ht=new c,lt=new c,ut=null,pt=0,dt=z.width,ft=z.height,mt=1,vt=new c(0,0,dt,ft),gt=new c(0,0,dt,ft),yt=!1,xt=new it,bt=new ve,_t=!1,wt=!1,Mt=new r,Et=new a,Tt={geometries:0,textures:0},St={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:St,memory:Tt,programs:null,autoReset:!0,reset:e};var At;try{var Lt={alpha:H,depth:V,stencil:k,antialias:j,premultipliedAlpha:W,preserveDrawingBuffer:q,powerPreference:Y};if(z.addEventListener("webglcontextlost",o,!1),z.addEventListener("webglcontextrestored",s,!1),null===(At=G||z.getContext("webgl",Lt)||z.getContext("experimental-webgl",Lt)))throw null!==z.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===At.getShaderPrecisionFormat&&(At.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){console.error("THREE.WebGLRenderer: "+t.message)}var Rt,Ct,Pt,It,Ot,Nt,Dt,Bt,Ft,Gt,Xt,qt,Yt,Zt,Jt,Qt,Kt;n();var $t=new fe(K);this.vr=$t;var te=new rt(K,Bt,Ct.maxTextureSize);this.shadowMap=te,this.getContext=function(){return At},this.getContextAttributes=function(){return At.getContextAttributes()},this.forceContextLoss=function(){var t=Rt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=Rt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return mt},this.setPixelRatio=function(t){void 0!==t&&(mt=t,this.setSize(dt,ft,!1))},this.getSize=function(){return{width:dt,height:ft}},this.setSize=function(t,e,i){var r=$t.getDevice();if(r&&r.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");dt=t,ft=e,z.width=t*mt,z.height=e*mt,!1!==i&&(z.style.width=t+"px",z.style.height=e+"px"),this.setViewport(0,0,t,e)},this.getDrawingBufferSize=function(){return{width:dt*mt,height:ft*mt}},this.setDrawingBufferSize=function(t,e,i){dt=t,ft=e,mt=i,z.width=t*i,z.height=e*i,this.setViewport(0,0,t,e)},this.getCurrentViewport=function(){return ht},this.setViewport=function(t,e,i,r){vt.set(t,ft-e-r,i,r),Pt.viewport(ht.copy(vt).multiplyScalar(mt))},this.setScissor=function(t,e,i,r){gt.set(t,ft-e-r,i,r),Pt.scissor(lt.copy(gt).multiplyScalar(mt))},this.setScissorTest=function(t){Pt.setScissorTest(yt=t)},this.getClearColor=function(){return qt.getClearColor()},this.setClearColor=function(){qt.setClearColor.apply(qt,arguments)},this.getClearAlpha=function(){return qt.getClearAlpha()},this.setClearAlpha=function(){qt.setClearAlpha.apply(qt,arguments)},this.clear=function(t,e,i){var r=0;(void 0===t||t)&&(r|=At.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=At.DEPTH_BUFFER_BIT),(void 0===i||i)&&(r|=At.STENCIL_BUFFER_BIT),At.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,r){this.setRenderTarget(t),this.clear(e,i,r)},this.dispose=function(){z.removeEventListener("webglcontextlost",o,!1),z.removeEventListener("webglcontextrestored",s,!1),Gt.dispose(),Xt.dispose(),It.dispose(),Bt.dispose(),$t.dispose(),v()},this.renderBufferImmediate=function(t,e,i){Pt.initAttributes();var r=It.get(t);t.hasPositions&&!r.position&&(r.position=At.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=At.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=At.createBuffer()),t.hasColors&&!r.color&&(r.color=At.createBuffer());var n=e.getAttributes();if(t.hasPositions&&(At.bindBuffer(At.ARRAY_BUFFER,r.position),At.bufferData(At.ARRAY_BUFFER,t.positionArray,At.DYNAMIC_DRAW),Pt.enableAttribute(n.position),At.vertexAttribPointer(n.position,3,At.FLOAT,!1,0,0)),t.hasNormals){if(At.bindBuffer(At.ARRAY_BUFFER,r.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&!i.isMeshNormalMaterial&&!0===i.flatShading)for(var a=0,o=3*t.count;a0&&v.renderInstances(r,w,T):v.render(w,T)}},this.compile=function(t,e){Q=Xt.get(t,e),Q.init(),t.traverse(function(t){t.isLight&&(Q.pushLight(t),t.castShadow&&Q.pushShadow(t))}),Q.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var i=0;i=0&&e<=t.width-r&&i>=0&&i<=t.height-n&&At.readPixels(e,i,r,n,Kt.convert(h),Kt.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&At.bindFramebuffer(At.FRAMEBUFFER,et)}}},this.copyFramebufferToTexture=function(t,e,i){var r=e.image.width,n=e.image.height,a=Kt.convert(e.format);this.setTexture2D(e,0),At.copyTexImage2D(At.TEXTURE_2D,i||0,a,t.x,t.y,r,n,0)}}function Me(t,e){this.name="",this.color=new q(t),this.density=void 0!==e?e:25e-5}function Ee(t,e,i){this.name="",this.color=new q(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Te(){st.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Se(t){J.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ae(t){st.call(this),this.type="Sprite",this.material=void 0!==t?t:new Se,this.center=new i(.5,.5)}function Le(){st.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Re(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i=0?(p=t(g-1e-5,v,p),d.subVectors(u,p)):(p=t(g+1e-5,v,p),d.subVectors(p,u)),v-1e-5>=0?(p=t(g,v-1e-5,p),f.subVectors(u,p)):(p=t(g,v+1e-5,p),f.subVectors(p,u)),l.crossVectors(d,f).normalize(),c.push(l.x,l.y,l.z),h.push(g,v)}}for(r=0;r.9&&a<.1&&(e<.2&&(m[t+0]+=1),i<.2&&(m[t+2]+=1),r<.2&&(m[t+4]+=1))}}function c(t){f.push(t.x,t.y,t.z)}function h(e,i){var r=3*e;i.x=t[r+0],i.y=t[r+1],i.z=t[r+2]}function l(){for(var t=new a,e=new a,r=new a,n=new a,o=new i,s=new i,c=new i,h=0,l=0;h0)for(a=e;a=e;a-=r)o=Pi(a,t[a],t[a+1],o);return o&&Ti(o,o.next)&&(Ii(o),o=o.next),o}function ci(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Ti(r,r.next)&&0!==Ei(r.prev,r,r.next))r=r.next;else{if(Ii(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function hi(t,e,i,r,n,a,o){if(t){!o&&a&&yi(t,r,n,a);for(var s,c,h=t;t.prev!==t.next;)if(s=t.prev,c=t.next,a?ui(t,r,n,a):li(t))e.push(s.i/i),e.push(t.i/i),e.push(c.i/i),Ii(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?(t=pi(t,e,i),hi(t,e,i,r,n,a,2)):2===o&&di(t,e,i,r,n,a):hi(ci(t),e,i,r,n,a,1);break}}}function li(t){var e=t.prev,i=t,r=t.next;if(Ei(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(wi(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&Ei(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function ui(t,e,i,r){var n=t.prev,a=t,o=t.next;if(Ei(n,a,o)>=0)return!1;for(var s=n.xa.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,l=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,u=bi(s,c,e,i,r),p=bi(h,l,e,i,r),d=t.nextZ;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&wi(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ei(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&wi(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ei(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function pi(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!Ti(n,a)&&Si(n,r,r.next,a)&&Li(n,a)&&Li(a,n)&&(e.push(n.i/i),e.push(r.i/i),e.push(a.i/i),Ii(r),Ii(r.next),r=t=a),r=r.next}while(r!==t);return r}function di(t,e,i,r,n,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Mi(o,s)){var c=Ci(o,s);return o=ci(o,o.next),c=ci(c,c.next),hi(o,e,i,r,n,a),void hi(c,e,i,r,n,a)}s=s.next}o=o.next}while(o!==t)}function fi(t,e,i,r){var n,a,o,s,c,h=[];for(n=0,a=e.length;n=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o){if(o=s,s===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x=r.x&&r.x>=l&&n!==r.x&&wi(ai.x)&&Li(r,t)&&(i=r,p=c),r=r.next;return i}function yi(t,e,i,r){var n=t;do{null===n.z&&(n.z=bi(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,xi(n)}function xi(t){var e,i,r,n,a,o,s,c,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e0||c>0&&r;)0!==s&&(0===c||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,c--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(o>1);return t}function bi(t,e,i,r,n){return t=32767*(t-i)*n,e=32767*(e-r)*n,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function _i(t){var e=t,i=t;do{e.x=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function Mi(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Ai(t,e)&&Li(t,e)&&Li(e,t)&&Ri(t,e)}function Ei(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ti(t,e){return t.x===e.x&&t.y===e.y}function Si(t,e,i,r){return!!(Ti(t,e)&&Ti(i,r)||Ti(t,r)&&Ti(i,e))||Ei(t,e,i)>0!=Ei(t,e,r)>0&&Ei(i,r,t)>0!=Ei(i,r,e)>0}function Ai(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Si(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function Li(t,e){return Ei(t.prev,t,t.next)<0?Ei(t,e,t.next)>=0&&Ei(t,t.prev,e)>=0:Ei(t,e,t.prev)<0||Ei(t,t.next,e)<0}function Ri(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}function Ci(t,e){var i=new Oi(t.i,t.x,t.y),r=new Oi(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Pi(t,e,i,r){var n=new Oi(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Ii(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Oi(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ni(t,e,i,r){for(var n=0,a=e,o=i-r;a2&&t[e-1].equals(t[0])&&t.pop()}function Di(t,e){for(var i=0;i0)&&m.push(w,M,T),(h!==i-1||l0&&l(!0),e>0&&l(!1)),this.setIndex(p),this.addAttribute("position",new bt(d,3)),this.addAttribute("normal",new bt(f,3)),this.addAttribute("uv",new bt(m,2))}function $i(t,e,i,r,n,a,o){Qi.call(this,0,t,e,i,r,n,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o}}function tr(t,e,i,r,n,a,o){Ki.call(this,0,t,e,i,r,n,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o}}function er(t,e,i,r){ut.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:r},this.fromBufferGeometry(new ir(t,e,i,r)),this.mergeVertices()}function ir(t,e,r,n){Et.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var o,s,c=[],h=[],l=[],u=[],p=new a,d=new i;for(h.push(0,0,0),l.push(0,0,1),u.push(.5,.5),s=0,o=3;s<=e;s++,o+=3){var f=r+s/e*n;p.x=t*Math.cos(f),p.y=t*Math.sin(f),h.push(p.x,p.y,p.z),l.push(0,0,1),d.x=(h[o]/t+1)/2,d.y=(h[o+1]/t+1)/2,u.push(d.x,d.y)}for(o=1;o<=e;o++)c.push(o,o+1,0);this.setIndex(c),this.addAttribute("position",new bt(h,3)),this.addAttribute("normal",new bt(l,3)),this.addAttribute("uv",new bt(u,2))}function rr(t){J.call(this),this.type="ShadowMaterial",this.color=new q(0),this.opacity=1, +this.lights=!0,this.transparent=!0,this.setValues(t)}function nr(t){Ct.call(this,t),this.type="RawShaderMaterial"}function ar(t){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new q(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function or(t){ar.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function sr(t){J.call(this),this.type="MeshPhongMaterial",this.color=new q(16777215),this.specular=new q(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Bo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function cr(t){sr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function hr(t){J.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function lr(t){J.call(this),this.type="MeshLambertMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Bo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ur(t){Ie.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function pr(t,e,i){var r=this,n=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===n&&void 0!==r.onStart&&r.onStart(t,a,o),n=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this}}function dr(t){this.manager=void 0!==t?t:Uc}function fr(t){this.manager=void 0!==t?t:Uc,this._parser=null}function mr(t){this.manager=void 0!==t?t:Uc,this._parser=null}function vr(t){this.manager=void 0!==t?t:Uc}function gr(t){this.manager=void 0!==t?t:Uc}function yr(t){this.manager=void 0!==t?t:Uc}function xr(){this.type="Curve",this.arcLengthDivisions=200}function br(t,e,i,r,n,a,o,s){xr.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=i||1,this.yRadius=r||1,this.aStartAngle=n||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function _r(t,e,i,r,n,a){br.call(this,t,e,i,i,r,n,a),this.type="ArcCurve"}function wr(){function t(t,a,o,s){e=t,i=o,r=-3*t+3*a-2*o-s,n=2*t-2*a+o+s}var e=0,i=0,r=0,n=0;return{initCatmullRom:function(e,i,r,n,a){t(i,r,a*(r-e),a*(n-i))},initNonuniformCatmullRom:function(e,i,r,n,a,o,s){var c=(i-e)/a-(r-e)/(a+o)+(r-i)/o,h=(r-i)/o-(n-i)/(o+s)+(n-r)/s;c*=o,h*=o,t(i,r,c,h)},calc:function(t){var a=t*t;return e+i*t+r*a+n*(a*t)}}}function Mr(t,e,i,r){xr.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=i||"centripetal",this.tension=r||.5}function Er(t,e,i,r,n){var a=.5*(r-e),o=.5*(n-i),s=t*t;return(2*i-2*r+a+o)*(t*s)+(-3*i+3*r-2*a-o)*s+a*t+i}function Tr(t,e){var i=1-t;return i*i*e}function Sr(t,e){return 2*(1-t)*t*e}function Ar(t,e){return t*t*e}function Lr(t,e,i,r){return Tr(t,e)+Sr(t,i)+Ar(t,r)}function Rr(t,e){var i=1-t;return i*i*i*e}function Cr(t,e){var i=1-t;return 3*i*i*t*e}function Pr(t,e){return 3*(1-t)*t*t*e}function Ir(t,e){return t*t*t*e}function Or(t,e,i,r,n){return Rr(t,e)+Cr(t,i)+Pr(t,r)+Ir(t,n)}function Nr(t,e,r,n){xr.call(this),this.type="CubicBezierCurve",this.v0=t||new i,this.v1=e||new i,this.v2=r||new i,this.v3=n||new i}function Ur(t,e,i,r){xr.call(this),this.type="CubicBezierCurve3",this.v0=t||new a,this.v1=e||new a,this.v2=i||new a,this.v3=r||new a}function Dr(t,e){xr.call(this),this.type="LineCurve",this.v1=t||new i,this.v2=e||new i}function Br(t,e){xr.call(this),this.type="LineCurve3",this.v1=t||new a,this.v2=e||new a}function Fr(t,e,r){xr.call(this),this.type="QuadraticBezierCurve",this.v0=t||new i,this.v1=e||new i,this.v2=r||new i}function zr(t,e,i){xr.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new a,this.v1=e||new a,this.v2=i||new a}function Gr(t){xr.call(this),this.type="SplineCurve",this.points=t||[]}function Hr(){xr.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Vr(t){Hr.call(this),this.type="Path",this.currentPoint=new i,t&&this.setFromPoints(t)}function kr(t){Vr.call(this,t),this.uuid=lc.generateUUID(),this.type="Shape",this.holes=[]}function jr(t,e){st.call(this),this.type="Light",this.color=new q(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Wr(t,e,i){jr.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(st.DefaultUp),this.updateMatrix(),this.groundColor=new q(e)}function Xr(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new r}function qr(){Xr.call(this,new pe(50,1,.5,500))}function Yr(t,e,i,r,n,a){jr.call(this,t,e),this.type="SpotLight",this.position.copy(st.DefaultUp),this.updateMatrix(),this.target=new st,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==n?n:0,this.decay=void 0!==a?a:1,this.shadow=new qr}function Zr(t,e,i,r){jr.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==r?r:1,this.shadow=new Xr(new pe(90,1,.5,500))}function Jr(){Xr.call(this,new ht(-5,5,5,-5,.5,500))}function Qr(t,e){jr.call(this,t,e),this.type="DirectionalLight",this.position.copy(st.DefaultUp),this.updateMatrix(),this.target=new st,this.shadow=new Jr}function Kr(t,e){jr.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function $r(t,e,i,r){jr.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==r?r:10}function tn(t,e,i,r){un.call(this,t,e,i,r)}function en(t,e,i){un.call(this,t,e,i)}function rn(t,e,i,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function nn(t,e,i,r){rn.call(this,t,e,i,r)}function an(t,e,i,r){un.call(this,t,e,i,r)}function on(t,e,i,r){un.call(this,t,e,i,r)}function sn(t,e,i,r){un.call(this,t,e,i,r)}function cn(t,e,i,r){rn.call(this,t,e,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function hn(t,e,i,r){rn.call(this,t,e,i,r)}function ln(t,e,i,r){rn.call(this,t,e,i,r)}function un(t,e,i,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Vc.convertArray(e,this.TimeBufferType),this.values=Vc.convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function pn(t,e,i,r){un.call(this,t,e,i,r)}function dn(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=lc.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function fn(t){this.manager=void 0!==t?t:Uc,this.textures={}}function mn(t){this.manager=void 0!==t?t:Uc}function vn(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function gn(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Uc,this.withCredentials=!1}function yn(t){this.manager=void 0!==t?t:Uc,this.texturePath=""}function xn(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==t?t:Uc,this.options=void 0}function bn(){this.type="ShapePath",this.subPaths=[],this.currentPath=null}function _n(t){this.type="Font",this.data=t}function wn(t,e,i,r){for(var n=String(t).split(""),a=e/r.resolution,o=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,s=[],c=0,h=0,l=0;l0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&r|128]+t[r>>8&255]+"-"+t[r>>16&255]+t[r>>24&255]+t[255&n]+t[n>>8&255]+t[n>>16&255]+t[n>>24&255]}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,r,n){return r+(t-e)*(n-r)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*lc.DEG2RAD},radToDeg:function(t){return t*lc.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};Object.defineProperties(i.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}), +Object.assign(i.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new i,e=new i;return function(i,r){return t.set(i,i),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),r=Math.sin(e),n=this.x-t.x,a=this.y-t.y;return this.x=n*i-a*r+t.x,this.y=n*r+a*i+t.y,this}}),Object.assign(r.prototype,{isMatrix4:!0,set:function(t,e,i,r,n,a,o,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new r).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t=new a;return function(e){var i=this.elements,r=e.elements,n=1/t.setFromMatrixColumn(e,0).length(),a=1/t.setFromMatrixColumn(e,1).length(),o=1/t.setFromMatrixColumn(e,2).length();return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[4]=r[4]*a,i[5]=r[5]*a,i[6]=r[6]*a,i[8]=r[8]*o,i[9]=r[9]*o,i[10]=r[10]*o,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,r=t.y,n=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(r),c=Math.sin(r),h=Math.cos(n),l=Math.sin(n);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*h,e[4]=w-x*l,e[8]=_*l+b,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=b*l+_,e[10]=x-w*l}else if("XZY"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+w,e[5]=a*h,e[9]=b*l-_,e[2]=_*l-b,e[6]=o*h,e[10]=w*l+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t._x,r=t._y,n=t._z,a=t._w,o=i+i,s=r+r,c=n+n,h=i*o,l=i*s,u=i*c,p=r*s,d=r*c,f=n*c,m=a*o,v=a*s,g=a*c;return e[0]=1-(p+f),e[4]=l-g,e[8]=u+v,e[1]=l+g,e[5]=1-(h+f),e[9]=d-m,e[2]=u-v,e[6]=d+m,e[10]=1-(h+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new a,e=new a,i=new a;return function(r,n,a){var o=this.elements;return i.subVectors(r,n),0===i.lengthSq()&&(i.z=1),i.normalize(),t.crossVectors(a,i),0===t.lengthSq()&&(1===Math.abs(a.z)?i.x+=1e-4:i.z+=1e-4,i.normalize(),t.crossVectors(a,i)),t.normalize(),e.crossVectors(i,t),o[0]=t.x,o[4]=e.x,o[8]=i.x,o[1]=t.y,o[5]=e.y,o[9]=i.y,o[2]=t.z,o[6]=e.z,o[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],_=r[0],w=r[4],M=r[8],E=r[12],T=r[1],S=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],I=r[14],O=r[3],N=r[7],U=r[11],D=r[15];return n[0]=a*_+o*T+s*R+c*O,n[4]=a*w+o*S+s*C+c*N,n[8]=a*M+o*A+s*P+c*U,n[12]=a*E+o*L+s*I+c*D,n[1]=h*_+l*T+u*R+p*O,n[5]=h*w+l*S+u*C+p*N,n[9]=h*M+l*A+u*P+p*U,n[13]=h*E+l*L+u*I+p*D,n[2]=d*_+f*T+m*R+v*O,n[6]=d*w+f*S+m*C+v*N,n[10]=d*M+f*A+m*P+v*U,n[14]=d*E+f*L+m*I+v*D,n[3]=g*_+y*T+x*R+b*O,n[7]=g*w+y*S+x*C+b*N,n[11]=g*M+y*A+x*P+b*U,n[15]=g*E+y*L+x*I+b*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new a;return function(e){for(var i=0,r=e.count;i=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var _=o*g;if(s=s*m+u*_,c=c*m+p*_,h=h*m+d*_,l=l*m+f*_,m===1-o){var w=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=w,c*=w,h*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),Object.defineProperties(n.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(n.prototype,{set:function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,r=t._y,n=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(i/2),h=o(r/2),l=o(n/2),u=s(i/2),p=s(r/2),d=s(n/2);return"XYZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===a&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=r+s+u;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-n)*e):r>s&&r>u?(e=2*Math.sqrt(1+r-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(n+o)/e,this._z=(a+h)/e):s>u?(e=2*Math.sqrt(1+s-r-u),this._w=(a-h)/e,this._x=(n+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-r-s),this._w=(o-n)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new a;return function(i,r){return void 0===e&&(e=new a),t=i.dot(r)+1,t<1e-6?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,r=t._y,n=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+r*c-n*s,this._y=r*h+a*s+n*o-i*c,this._z=n*h+a*c+i*s-r*o,this._w=a*h-i*o-r*s-n*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,r=this._y,n=this._z,a=this._w,o=a*t._w+i*t._x+r*t._y+n*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=a*h+this._w*l,this._x=i*h+this._x*l,this._y=r*h+this._y*l,this._z=n*h+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(a.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new n;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new n;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,r=this.z,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6]*r,this.y=n[1]*e+n[4]*i+n[7]*r,this.z=n[2]*e+n[5]*i+n[8]*r,this},applyMatrix4:function(t){var e=this.x,i=this.y,r=this.z,n=t.elements,a=1/(n[3]*e+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*e+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*e+n[6]*i+n[10]*r+n[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,r=this.z,n=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*r-o*i,h=s*i+o*e-n*r,l=s*r+n*i-a*e,u=-n*e-a*i-o*r;return this.x=c*s+u*-n+h*-o-l*-a,this.y=h*s+u*-a+l*-n-c*-o,this.z=l*s+u*-o+c*-a-h*-n,this},project:function(){var t=new r;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new r;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,r=this.z,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*r,this.y=n[1]*e+n[5]*i+n[9]*r,this.z=n[2]*e+n[6]*i+n[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new a,e=new a;return function(i,r){return t.set(i,i,i),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new a;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new a;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(lc.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(o.prototype,{isMatrix3:!0,set:function(t,e,i,r,n,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=r,h[2]=o,h[3]=e,h[4]=n,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new a;return function(e){for(var i=0,r=e.count;i2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(r)}),i.image=r.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ko:t.x=t.x-Math.floor(t.x);break;case $o:t.x=t.x<0?0:1;break;case ts:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Ko:t.y=t.y-Math.floor(t.y);break;case $o:t.y=t.y<0?0:1;break;case ts:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.defineProperty(s.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(c.prototype,{isVector4:!0,set:function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t, +this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,r=this.z,n=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*e+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*e+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*e+a[7]*i+a[11]*r+a[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,r,n,a=t.elements,o=a[0],s=a[4],c=a[8],h=a[1],l=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-h)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,v=(l+1)/2,g=(f+1)/2,y=(s+h)/4,x=(c+p)/4,b=(u+d)/4;return m>v&&m>g?m<.01?(i=0,r=.707106781,n=.707106781):(i=Math.sqrt(m),r=y/i,n=x/i):v>g?v<.01?(i=.707106781,r=0,n=.707106781):(r=Math.sqrt(v),i=y/r,n=b/r):g<.01?(i=.707106781,r=.707106781,n=0):(n=Math.sqrt(g),i=x/n,r=b/n),this.set(i,r,n,e),this}var _=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(h-s)*(h-s));return Math.abs(_)<.001&&(_=1),this.x=(d-u)/_,this.y=(c-p)/_,this.z=(h-s)/_,this.w=Math.acos((o+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(i,r){return void 0===t&&(t=new c,e=new c),t.set(i,i,i,i),e.set(r,r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),h.prototype=Object.assign(Object.create(e.prototype),{constructor:h,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),l.prototype=Object.create(h.prototype),l.prototype.constructor=l,l.prototype.isWebGLRenderTargetCube=!0,u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isDataTexture=!0,p.prototype=Object.create(s.prototype),p.prototype.constructor=p,p.prototype.isCubeTexture=!0,Object.defineProperty(p.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var pc=new s,dc=new p,fc=[],mc=[],vc=new Float32Array(16),gc=new Float32Array(9);k.prototype.setValue=function(t,e){for(var i=this.seq,r=0,n=i.length;r!==n;++r){var a=i[r];a.setValue(t,e[a.id])}};var yc=/([\w\d_]+)(\])?(\[|\.)?/g;X.prototype.setValue=function(t,e,i){var r=this.map[e];void 0!==r&&r.setValue(t,i,this.renderer)},X.prototype.setOptional=function(t,e,i){var r=e[i];void 0!==r&&this.setValue(t,i,r)},X.upload=function(t,e,i,r){for(var n=0,a=e.length;n!==a;++n){var o=e[n],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,r)}},X.seqWithValue=function(t,e){for(var i=[],r=0,n=t.length;r!==n;++r){var a=t[r];a.id in e&&i.push(a)}return i};var xc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(q.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,r){if(e=lc.euclideanModulo(e,1),i=lc.clamp(i,0,1),r=lc.clamp(r,0,1),0===i)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+i):r+i-r*i,a=2*r-n;this.r=t(a,n,e+1/3),this.g=t(a,n,e),this.b=t(a,n,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h=i[1],l=h.length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(t&&t.length>0){var h=xc[t];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,r=t||{h:0,s:0,l:0},n=this.r,a=this.g,o=this.b,s=Math.max(n,a,o),c=Math.min(n,a,o),h=(c+s)/2;if(c===s)e=0,i=0;else{var l=s-c;switch(i=h<=.5?l/(s+c):l/(2-s-c),s){case n:e=(a-o)/l+(a 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n", +cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n", +lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},Mc={basic:{uniforms:_c.merge([bc.common,bc.specularmap,bc.envmap,bc.aomap,bc.lightmap,bc.fog]),vertexShader:wc.meshbasic_vert,fragmentShader:wc.meshbasic_frag},lambert:{uniforms:_c.merge([bc.common,bc.specularmap,bc.envmap,bc.aomap,bc.lightmap,bc.emissivemap,bc.fog,bc.lights,{emissive:{value:new q(0)}}]),vertexShader:wc.meshlambert_vert,fragmentShader:wc.meshlambert_frag},phong:{uniforms:_c.merge([bc.common,bc.specularmap,bc.envmap,bc.aomap,bc.lightmap,bc.emissivemap,bc.bumpmap,bc.normalmap,bc.displacementmap,bc.gradientmap,bc.fog,bc.lights,{emissive:{value:new q(0)},specular:{value:new q(1118481)},shininess:{value:30}}]),vertexShader:wc.meshphong_vert,fragmentShader:wc.meshphong_frag},standard:{uniforms:_c.merge([bc.common,bc.envmap,bc.aomap,bc.lightmap,bc.emissivemap,bc.bumpmap,bc.normalmap,bc.displacementmap,bc.roughnessmap,bc.metalnessmap,bc.fog,bc.lights,{emissive:{value:new q(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:wc.meshphysical_vert,fragmentShader:wc.meshphysical_frag},points:{uniforms:_c.merge([bc.points,bc.fog]),vertexShader:wc.points_vert,fragmentShader:wc.points_frag},dashed:{uniforms:_c.merge([bc.common,bc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wc.linedashed_vert,fragmentShader:wc.linedashed_frag},depth:{uniforms:_c.merge([bc.common,bc.displacementmap]),vertexShader:wc.depth_vert,fragmentShader:wc.depth_frag},normal:{uniforms:_c.merge([bc.common,bc.bumpmap,bc.normalmap,bc.displacementmap,{opacity:{value:1}}]),vertexShader:wc.normal_vert,fragmentShader:wc.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wc.cube_vert,fragmentShader:wc.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wc.equirect_vert,fragmentShader:wc.equirect_frag},distanceRGBA:{uniforms:_c.merge([bc.common,bc.displacementmap,{referencePosition:{value:new a},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wc.distanceRGBA_vert,fragmentShader:wc.distanceRGBA_frag},shadow:{uniforms:_c.merge([bc.lights,bc.fog,{color:{value:new q(0)},opacity:{value:1}}]),vertexShader:wc.shadow_vert,fragmentShader:wc.shadow_frag}};Mc.physical={uniforms:_c.merge([Mc.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:wc.meshphysical_vert,fragmentShader:wc.meshphysical_frag},Y.prototype=Object.create(s.prototype),Y.prototype.constructor=Y;var Ec=0;J.prototype=Object.assign(Object.create(e.prototype),{constructor:J,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[e]="overdraw"===e?Number(i):i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var i in t){var r=t[i];delete r.metadata,e.push(r)}return e}var i=void 0===t||"string"==typeof t;i&&(t={textures:{},images:{}});var r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearCoat&&(r.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(r.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==so&&(r.blending=this.blending),!0===this.flatShading&&(r.flatShading=this.flatShading),this.side!==to&&(r.side=this.side),this.vertexColors!==ro&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,0!==this.rotation&&(r.rotation=this.rotation),1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(r.morphTargets=!0),!0===this.skinning&&(r.skinning=!0),!1===this.visible&&(r.visible=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),i){var n=e(t.textures),a=e(t.images);n.length>0&&(r.textures=n),a.length>0&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var r=e.length;i=new Array(r);for(var n=0;n!==r;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Q.prototype=Object.create(J.prototype),Q.prototype.constructor=Q,Q.prototype.isMeshDepthMaterial=!0,Q.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},K.prototype=Object.create(J.prototype),K.prototype.constructor=K,K.prototype.isMeshDistanceMaterial=!0,K.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Object.assign($.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;sn&&(n=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,i,r),this.max.set(n,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,r=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;sn&&(n=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,i,r),this.max.set(n,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new a).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t=new a;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},intersectsTriangle:function(){function t(t){var n,a;for(n=0,a=t.length-3;n<=a;n+=3){c.fromArray(t,n);var o=l.x*Math.abs(c.x)+l.y*Math.abs(c.y)+l.z*Math.abs(c.z),s=e.dot(c),h=i.dot(c),u=r.dot(c);if(Math.max(-Math.max(s,h,u),Math.min(s,h,u))>o)return!1}return!0}var e=new a,i=new a,r=new a,n=new a,o=new a,s=new a,c=new a,h=new a,l=new a,u=new a;return function(a){if(this.isEmpty())return!1;this.getCenter(h),l.subVectors(this.max,h),e.subVectors(a.a,h),i.subVectors(a.b,h),r.subVectors(a.c,h),n.subVectors(i,e),o.subVectors(r,i),s.subVectors(e,r);var c=[0,-n.z,n.y,0,-o.z,o.y,0,-s.z,s.y,n.z,0,-n.x,o.z,0,-o.x,s.z,0,-s.x,-n.y,n.x,0,-o.y,o.x,0,-s.y,s.x,0];return!!t(c)&&(c=[1,0,0,0,1,0,0,0,1],!!t(c)&&(u.crossVectors(n,o),c=[u.x,u.y,u.z],t(c)))}}(),clampPoint:function(t,e){return(e||new a).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new a;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new a;return function(e){var i=e||new tt;return this.getCenter(i.center),i.radius=.5*this.getSize(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new a,new a,new a,new a,new a,new a,new a,new a];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(tt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new $;return function(e,i){var r=this.center;void 0!==i?r.copy(i):t.setFromPoints(e).getCenter(r);for(var n=0,a=0,o=e.length;athis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new $;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(et.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new a,e=new a;return function(i,r,n){var a=t.subVectors(n,r).cross(e.subVectors(i,r)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return(e||new a).copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new a;return function(e,i){var r=i||new a,n=e.delta(t),o=this.normal.dot(n);if(0!==o){var s=-(e.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return r.copy(n).multiplyScalar(s).add(e.start)}else if(0===this.distanceToPoint(e.start))return r.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new a).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new a,e=new o;return function(i,r){var n=r||e.getNormalMatrix(i),a=this.coplanarPoint(t).applyMatrix4(i),o=this.normal.applyMatrix3(n).normalize();return this.constant=-a.dot(o),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this}, +equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(it.prototype,{set:function(t,e,i,r,n,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,r=i[0],n=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return e[0].setComponents(o-r,l-s,f-u,y-m).normalize(),e[1].setComponents(o+r,l+s,f+u,y+m).normalize(),e[2].setComponents(o+n,l+c,f+p,y+v).normalize(),e[3].setComponents(o-n,l-c,f-p,y-v).normalize(),e[4].setComponents(o-a,l-h,f-d,y-g).normalize(),e[5].setComponents(o+a,l+h,f+d,y+g).normalize(),this},intersectsObject:function(){var t=new tt;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new tt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,r=-t.radius,n=0;n<6;n++){if(e[n].distanceToPoint(i)0?i.min.x:i.max.x,e.x=a.normal.x>0?i.max.x:i.min.x,t.y=a.normal.y>0?i.min.y:i.max.y,e.y=a.normal.y>0?i.max.y:i.min.y,t.z=a.normal.z>0?i.min.z:i.max.z,e.z=a.normal.z>0?i.max.z:i.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}}),at.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],at.DefaultOrder="XYZ",Object.defineProperties(at.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(at.prototype,{isEuler:!0,set:function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var r=lc.clamp,n=t.elements,a=n[0],o=n[4],s=n[8],c=n[1],h=n[5],l=n[9],u=n[2],p=n[6],d=n[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new r;return function(e,i,r){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new n;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new a(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(ot.prototype,{set:function(t){this.mask=1<1){for(var e=0;e1){for(var e=0;e0){a.children=[];for(var c=0;c0&&(n.geometries=p),d.length>0&&(n.materials=d),f.length>0&&(n.textures=f),m.length>0&&(n.images=m),s.length>0&&(n.shapes=s)}return n.object=a,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,r,n;for(i=0,r=this.faces.length;i=0;i--){var f=p[i];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o0,b=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,!0),M=t(M,2,!1),M=t(M,3,y),M=t(M,4,x),M=t(M,5,b),M=t(M,6,_),M=t(M,7,w),l.push(M),l.push(g.a,g.b,g.c),l.push(g.materialIndex),y){var E=this.faceVertexUvs[0][c];l.push(r(E[0]),r(E[1]),r(E[2]))}if(x&&l.push(e(g.normal)),b){var T=g.vertexNormals;l.push(e(T[0]),e(T[1]),e(T[2]))}if(_&&l.push(i(g.color)),w){var S=g.vertexColors;l.push(i(S[0]),i(S[1]),i(S[2]))}}return n.data={},n.data.vertices=s,n.data.normals=u,d.length>0&&(n.data.colors=d),m.length>0&&(n.data.uvs=[m]),n.data.faces=l,n},clone:function(){return(new ut).copy(this)},copy:function(t){var e,i,r,n,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e0,s=a[1]&&a[1].length>0,c=t.morphTargets,h=c.length;if(h>0){e=[];for(var l=0;l0){u=[];for(var l=0;l65535?xt:gt)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new pt(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){(new o).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new r;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new r;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new r;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new r;return function(e,i,r){return t.makeTranslation(e,i,r),this.applyMatrix(t),this}}(),scale:function(){var t=new r;return function(e,i,r){return t.makeScale(e,i,r),this.applyMatrix(t),this}}(),lookAt:function(){var t=new st;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new bt(3*e.vertices.length,3),r=new bt(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var n=new bt(e.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,r=t.length;i0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new pt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new pt(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var n=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new pt(n,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new pt(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=Mt(t.indices)>65535?Uint32Array:Uint16Array,s=new o(3*t.indices.length);this.setIndex(new pt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var h=[],l=t.morphTargets[c],u=0,p=l.length;u0){var m=new bt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new bt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new $);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new $,e=new a;return function(){null===this.boundingSphere&&(this.boundingSphere=new tt);var i=this.attributes.position;if(i){var r=this.boundingSphere.center;t.setFromBufferAttribute(i),t.getCenter(r);for(var n=0,a=0,o=i.count;a0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Et).copy(this)},copy:function(t){var e,i,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(i=0,r=h.length;i0)if(s=p*f-d,c=p*d-f,l=u*v,s>=0)if(c>=-l)if(c<=l){var g=1/v;s*=g,c*=g,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):c<=l?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(c).add(t),h}}(),intersectSphere:function(){var t=new a;return function(e,i){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),n=t.dot(t)-r*r,a=e.radius*e.radius;if(n>a)return null;var o=Math.sqrt(a-n),s=r-o,c=r+o;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,r,n,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(t.min.x-u.x)*c,r=(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,r=(t.min.x-u.x)*c),h>=0?(n=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(n=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),i>a||n>r?null:((n>i||i!==i)&&(i=n),(a=0?(o=(t.min.z-u.z)*l,s=(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,s=(t.min.z-u.z)*l),i>s||o>r?null:((o>i||i!==i)&&(i=o),(s=0?i:r,e)))},intersectsBox:function(){var t=new a;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new a,e=new a,i=new a,r=new a;return function(n,a,o,s,c){e.subVectors(a,n),i.subVectors(o,n),r.crossVectors(e,i);var h,l=this.direction.dot(r);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}t.subVectors(this.origin,n);var u=h*this.direction.dot(i.crossVectors(t,i));if(u<0)return null;var p=h*this.direction.dot(e.cross(t));if(p<0)return null;if(u+p>l)return null;var d=-h*t.dot(r);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(It.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new a).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new a).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new a;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new a,e=new a;return function(i,r){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var n=e.dot(e),a=e.dot(t),o=a/n;return r&&(o=lc.clamp(o,0,1)),o}}(),closestPointToPoint:function(t,e,i){var r=this.closestPointToPointParameter(t,e),n=i||new a;return this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(Ot,{normal:function(){var t=new a;return function(e,i,r,n){var o=n||new a;o.subVectors(r,i),t.subVectors(e,i),o.cross(t);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new a,e=new a,i=new a;return function(r,n,o,s,c){t.subVectors(s,n),e.subVectors(o,n),i.subVectors(r,n);var h=t.dot(t),l=t.dot(e),u=t.dot(i),p=e.dot(e),d=e.dot(i),f=h*p-l*l,m=c||new a;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(p*u-l*d)*v,y=(h*d-l*u)*v;return m.set(1-g-y,y,g)}}(),containsPoint:function(){var t=new a;return function(e,i,r,n){var a=Ot.barycoordFromPoint(e,i,r,n,t);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}()}),Object.assign(Ot.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,r){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new a,e=new a;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new a).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return Ot.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new et).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return Ot.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Ot.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(){var t=new et,e=[new It,new It,new It],i=new a,r=new a;return function(n,o){var s=o||new a,c=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(n,i),!0===this.containsPoint(i))s.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var h=0;h0){var o=n[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;ti.far?null:{distance:c,point:b.clone(),object:t}}function n(i,r,n,a,o,s,c,p){h.fromBufferAttribute(a,s),l.fromBufferAttribute(a,c),u.fromBufferAttribute(a,p);var d=e(i,i.material,r,n,h,l,u,x);return d&&(o&&(m.fromBufferAttribute(o,s),v.fromBufferAttribute(o,c),g.fromBufferAttribute(o,p),d.uv=t(x,h,l,u,m,v,g)),d.face=new lt(s,c,p,Ot.normal(h,l,u)),d.faceIndex=s),d}var o=new r,s=new Pt,c=new tt,h=new a,l=new a,u=new a,p=new a,d=new a,f=new a,m=new i,v=new i,g=new i,y=new a,x=new a,b=new a;return function(i,r){var a=this.geometry,y=this.material,b=this.matrixWorld;if(void 0!==y&&(null===a.boundingSphere&&a.computeBoundingSphere(),c.copy(a.boundingSphere),c.applyMatrix4(b),!1!==i.ray.intersectsSphere(c)&&(o.getInverse(b),s.copy(i.ray).applyMatrix4(o),null===a.boundingBox||!1!==s.intersectsBox(a.boundingBox)))){var _;if(a.isBufferGeometry){var w,M,E,T,S,A=a.index,L=a.attributes.position,R=a.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(O=B);for(var F=0,z=D.length;Fa)){var o=r.ray.origin.distanceTo(t);or.far||n.push({distance:o,point:t.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return st.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),Le.prototype=Object.assign(Object.create(st.prototype),{constructor:Le,copy:function(t){st.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,r=e.length;i1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var n=t.distanceTo(e);r[0].object.visible=!0;for(var a=1,o=r.length;a=r[a].distance;a++)r[a-1].object.visible=!1,r[a].object.visible=!0;for(;as)){d.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(d);Er.far||n.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=g.length/3-1;xs)){d.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(d);Er.far||n.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(c.isGeometry)for(var T=c.vertices,S=T.length,x=0;xs)){d.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(d);Er.far||n.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ne.prototype=Object.assign(Object.create(Oe.prototype),{constructor:Ne,isLineSegments:!0,computeLineDistances:function(){var t=new a,e=new a;return function(){var i=this.geometry;if(i.isBufferGeometry)if(null===i.index){for(var r=i.attributes.position,n=[],a=0,o=r.count;ar.far)return;n.push({distance:c,distanceToRay:Math.sqrt(a),point:o.clone(),index:i,face:null,object:s})}}var s=this,c=this.geometry,h=this.matrixWorld,l=r.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),i.copy(c.boundingSphere),i.applyMatrix4(h),i.radius+=l,!1!==r.ray.intersectsSphere(i)){t.getInverse(h),e.copy(r.ray).applyMatrix4(t);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new a;if(c.isBufferGeometry){var f=c.index,m=c.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,x=g.length;y=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Ge.prototype=Object.create(s.prototype),Ge.prototype.constructor=Ge,Ge.prototype.isCompressedTexture=!0,He.prototype=Object.create(s.prototype),He.prototype.constructor=He,He.prototype.isDepthTexture=!0,Ve.prototype=Object.create(Et.prototype),Ve.prototype.constructor=Ve,ke.prototype=Object.create(ut.prototype),ke.prototype.constructor=ke,je.prototype=Object.create(Et.prototype),je.prototype.constructor=je,We.prototype=Object.create(ut.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(Et.prototype),Xe.prototype.constructor=Xe,qe.prototype=Object.create(ut.prototype),qe.prototype.constructor=qe,Ye.prototype=Object.create(Xe.prototype),Ye.prototype.constructor=Ye,Ze.prototype=Object.create(ut.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(Xe.prototype),Je.prototype.constructor=Je,Qe.prototype=Object.create(ut.prototype),Qe.prototype.constructor=Qe,Ke.prototype=Object.create(Xe.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(ut.prototype),$e.prototype.constructor=$e,ti.prototype=Object.create(Xe.prototype),ti.prototype.constructor=ti,ei.prototype=Object.create(ut.prototype),ei.prototype.constructor=ei,ii.prototype=Object.create(Et.prototype),ii.prototype.constructor=ii,ri.prototype=Object.create(ut.prototype),ri.prototype.constructor=ri,ni.prototype=Object.create(Et.prototype),ni.prototype.constructor=ni,ai.prototype=Object.create(ut.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(Et.prototype),oi.prototype.constructor=oi;var Cc={triangulate:function(t,e,i){i=i||2;var r=e&&e.length,n=r?e[0]*i:t.length,a=si(t,0,n,i,!0),o=[];if(!a)return o;var s,c,h,l,u,p,d;if(r&&(a=fi(t,e,a,i)),t.length>80*i){s=h=t[0],c=l=t[1];for(var f=i;fh&&(h=u),p>l&&(l=p);d=Math.max(h-s,l-c),d=0!==d?1/d:0}return hi(a,o,i,s,c,d),o}},Pc={area:function(t){for(var e=t.length,i=0,r=e-1,n=0;nNumber.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=e.x-c/d,v=e.y+s/d,g=r.x-l/f,y=r.y+h/f,x=((g-m)*l-(y-v)*h)/(s*l-c*h);n=m+s*x-t.x,a=v+c*x-t.y;var b=n*n+a*a;if(b<=2)return new i(n,a);o=Math.sqrt(b/2)}else{var _=!1;s>Number.EPSILON?h>Number.EPSILON&&(_=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(_=!0):Math.sign(c)===Math.sign(l)&&(_=!0),_?(n=-c,a=s,o=Math.sqrt(u)):(n=s,a=c,o=Math.sqrt(u/2))}return new i(n/o,a/o)}function o(t,e){var i,r;for(J=t.length;--J>=0;){i=J,r=J-1,r<0&&(r=t.length-1);var n=0,a=L+2*T;for(n=0;n=0;H--){for(k=H/T,j=M*Math.cos(k*Math.PI/2),V=E*Math.sin(k*Math.PI/2),J=0,Q=G.length;J0||0===t.search(/^data\:image\/jpeg/);n.format=r?bs:_s,n.needsUpdate=!0,void 0!==e&&e(n)},i,r),n},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(xr.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,r=[],n=this.getPoint(0),a=0;for(r.push(0),i=1;i<=t;i++)e=this.getPoint(i/t),a+=e.distanceTo(n),r.push(a),n=e;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,r=this.getLengths(),n=0,a=r.length;i=e||t*r[a-1];for(var o,s=0,c=a-1;s<=c;)if(n=Math.floor(s+(c-s)/2),(o=r[n]-i)<0)s=n+1;else{if(!(o>0)){c=n;break}c=n-1}if(n=c,r[n]===i)return n/(a-1);var h=r[n];return(n+(i-h)/(r[n+1]-h))/(a-1)},getTangent:function(t){var e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);var r=this.getPoint(e);return this.getPoint(i).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,o,s=new a,c=[],h=[],l=[],u=new a,p=new r;for(i=0;i<=t;i++)n=i/t,c[i]=this.getTangentAt(n),c[i].normalize();h[0]=new a,l[0]=new a;var d=Number.MAX_VALUE,f=Math.abs(c[0].x),m=Math.abs(c[0].y),v=Math.abs(c[0].z);for(f<=d&&(d=f,s.set(1,0,0)),m<=d&&(d=m,s.set(0,1,0)),v<=d&&s.set(0,0,1),u.crossVectors(c[0],s).normalize(),h[0].crossVectors(c[0],u),l[0].crossVectors(c[0],h[0]),i=1;i<=t;i++)h[i]=h[i-1].clone(),l[i]=l[i-1].clone(),u.crossVectors(c[i-1],c[i]),u.length()>Number.EPSILON&&(u.normalize(),o=Math.acos(lc.clamp(c[i-1].dot(c[i]),-1,1)),h[i].applyMatrix4(p.makeRotationAxis(u,o))),l[i].crossVectors(c[i],h[i]);if(!0===e)for(o=Math.acos(lc.clamp(h[0].dot(h[t]),-1,1)),o/=t,c[0].dot(u.crossVectors(h[0],h[t]))>0&&(o=-o),i=1;i<=t;i++)h[i].applyMatrix4(p.makeRotationAxis(c[i],o*i)),l[i].crossVectors(c[i],h[i]);return{tangents:c,normals:h,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),br.prototype=Object.create(xr.prototype),br.prototype.constructor=br,br.prototype.isEllipseCurve=!0,br.prototype.getPoint=function(t,e){for(var r=e||new i,n=2*Math.PI,a=this.aEndAngle-this.aStartAngle,o=Math.abs(a)n;)a-=n;a0?0:(Math.floor(Math.abs(s)/r.length)+1)*r.length:0===c&&s===n-1&&(s=n-2,c=1);var h,l,u,p;if(this.closed||s>0?h=r[(s-1)%n]:(Bc.subVectors(r[0],r[1]).add(r[0]),h=Bc),l=r[s%n],u=r[(s+1)%n],this.closed||s+2n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return r.set(Er(s,c.x,h.x,l.x,u.x),Er(s,c.y,h.y,l.y,u.y)),r},Gr.prototype.copy=function(t){xr.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e=e){var n=i[r]-e,a=this.curves[r],o=a.getLength(),s=0===o?0:1-n/o;return a.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,r=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(t){xr.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)},copy:function(t){return Hr.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Hr.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Hr.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),kr.prototype=Object.assign(Object.create(Vr.prototype),{constructor:kr,getPointsHoles:function(t){for(var e=[],i=0,r=this.holes.length;i=n)break t;var s=e[1];t=n)break e}a=i,i=0}}for(;i>>1;te;)--a;if(++a,0!==n||a!==r){n>=a&&(a=Math.max(a,1),n=a-1);var o=this.getValueSize();this.times=Vc.arraySlice(i,n,a),this.values=Vc.arraySlice(this.values,n*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==n;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==r&&Vc.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var h=r[o];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),r=2302===this.getInterpolation(),n=1,a=t.length-1,o=1;o0){t[n]=t[a];for(var f=a*i,m=n*i,p=0;p!==i;++p)e[m+p]=e[f+p];++n}return n!==t.length&&(this.times=Vc.arraySlice(t,0,n),this.values=Vc.arraySlice(e,0,n*i)),this}}),pn.prototype=Object.assign(Object.create(un.prototype),{constructor:pn,ValueTypeName:"vector"}),Object.assign(dn,{parse:function(t){for(var e=[],i=t.tracks,r=1/(t.fps||1),n=0,a=i.length;n!==a;++n)e.push(un.parse(i[n]).scale(r));return new dn(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,r={name:t.name,duration:t.duration,tracks:e},n=0,a=i.length;n!==a;++n)e.push(un.toJSON(i[n]));return r},CreateFromMorphTargetSequence:function(t,e,i,r){for(var n=e.length,a=[],o=0;o1){var h=c[1],l=r[h];l||(r[h]=l=[]),l.push(s)}}var u=[];for(var h in r)u.push(dn.CreateFromMorphTargetSequence(h,r[h],e,i));return u},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(t,e,i,r,n){if(0!==i.length){var a=[],o=[];Vc.flattenJSON(i,a,o,r),0!==a.length&&n.push(new t(e,a,o))}},r=[],n=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c1?t.skinWeights[r+1]:0,s=i>2?t.skinWeights[r+2]:0,h=i>3?t.skinWeights[r+3]:0;e.skinWeights.push(new c(a,o,s,h))}if(t.skinIndices)for(var r=0,n=t.skinIndices.length;r1?t.skinIndices[r+1]:0,p=i>2?t.skinIndices[r+2]:0,d=i>3?t.skinIndices[r+3]:0;e.skinIndices.push(new c(l,u,p,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function r(t,e){var i=t.scale;if(void 0!==t.morphTargets)for(var r=0,n=t.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=e.faces,p=t.morphColors[0].colors,r=0,n=u.length;r0&&(e.animations=i)}return function(i,a){void 0!==i.data&&(i=i.data),void 0!==i.scale?i.scale=1/i.scale:i.scale=1;var o=new ut;return t(i,o),e(i,o),r(i,o),n(i,o),o.computeFaceNormals(),o.computeBoundingSphere(),void 0===i.materials||0===i.materials.length?{geometry:o}:{geometry:o,materials:vn.prototype.initMaterials(i.materials,a,this.crossOrigin)}}}()}),Object.assign(yn.prototype,{load:function(t,e,i,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this;new dr(n.manager).load(t,function(i){var a=null;try{a=JSON.parse(i)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");n.parse(a,e)},i,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseShape(t.shapes),r=this.parseGeometries(t.geometries,i),n=this.parseImages(t.images,function(){void 0!==e&&e(s)}),a=this.parseTextures(t.textures,n),o=this.parseMaterials(t.materials,a),s=this.parseObject(t.object,r,o);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var i=0,r=t.length;i0){var n=new pr(e),a=new vr(n);a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o0?new Pe(o,s):new Nt(o,s);break;case"LOD":a=new Le;break;case"Line":a=new Oe(r(t.geometry),n(t.material),t.mode);break;case"LineLoop":a=new Ue(r(t.geometry),n(t.material));break;case"LineSegments":a=new Ne(r(t.geometry),n(t.material));break;case"PointCloud":case"Points":a=new Be(r(t.geometry),n(t.material));break;case"Sprite":a=new Ae(n(t.material));break;case"Group":a=new Fe;break;default:a=new st}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(a.matrix.fromArray(t.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.quaternion&&a.quaternion.fromArray(t.quaternion),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(a.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(a.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&a.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(a.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.children)for(var c=t.children,h=0;h1){for(var g=!1,y=[],x=0,b=p.length;xNumber.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[n],h=-h),t.ys.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return r})(M.p,p[T].p)&&(x!==T&&y.push({froms:x,tos:T,hole:w}),E?(E=!1,u[T].push(M)):g=!0);E&&u[x].push(M)}y.length>0&&(g||(d=u))}for(var S,m=0,A=p.length;m0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var a=0;a!==n;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,r){n.slerpFlat(t,e,t,e,t,i,r)},_lerp:function(t,e,i,r,n){for(var a=1-r,o=0;o!==n;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*r}}});var Jc="\\[\\]\\.:\\/";Object.assign(On.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(Nn,{Composite:On,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new Nn.Composite(t,e,i):new Nn(t,e,i)},sanitizeNodeName:function(){var t=new RegExp("["+Jc+"]","g");return function(e){return e.replace(/\s/g,"_").replace(t,"")}}(),parseTrackName:function(){var t="[^"+Jc+"]",e="[^"+Jc.replace("\\.","")+"]",i=/((?:WC+[\/:])*)/.source.replace("WC",t),r=/(WCOD+)?/.source.replace("WCOD",e),n=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",t),a=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",t),o=new RegExp("^"+i+r+n+a+"$"),s=["material","materials","bones"];return function(t){var e=o.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=i.nodeName.substring(r+1);-1!==s.indexOf(n)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=n)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){var r=function(t){for(var i=0;i=e){var l=e++,u=t[l];i[u.uuid]=h,t[h]=u,i[c]=l,t[l]=s;for(var p=0,d=n;p!==d;++p){var f=r[p],m=f[l],v=f[h];f[h]=m,f[l]=v}}} +this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,a=n.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=r[h];if(void 0!==l)if(delete r[h],l0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(r,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(t)[0];e*=r,t>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var a=2202===r;if(-1===n&&(t>=0?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,n+=Math.abs(o);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&n))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=t?this.zeroSlopeAtStart?2401:Qs:2402,r.endingEnd=e?this.zeroSlopeAtEnd?2401:Qs:2402)},_scheduleFading:function(t,e,i){var r=this._mixer,n=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=n,s[0]=e,o[1]=n+t,s[1]=i,this}}),Bn.prototype=Object.assign(Object.create(e.prototype),{constructor:Bn,_bindAction:function(t,e){var i=t._localRoot||this._root,r=t._clip.tracks,n=r.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==n;++l){var u=r[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(void 0!==(d=a[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;d=new In(Nn.create(i,p,f),u.ValueTypeName,u.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,r=this._actionsByClip[i];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,i,e)}for(var n=t._propertyBindings,a=0,o=n.length;a!==o;++a){var s=n[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,r=e.length;i!==r;++i){var n=e[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Qn.prototype=Object.create(st.prototype),Qn.prototype.constructor=Qn,Qn.prototype.isImmediateRenderObject=!0,Kn.prototype=Object.create(Ne.prototype),Kn.prototype.constructor=Kn,Kn.prototype.update=function(){var t=new a,e=new a,i=new o;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,h=0,l=0,u=c.length;l.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),da.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},da.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},fa.prototype=Object.create(Ne.prototype),fa.prototype.constructor=fa;xr.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(xr.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Hr.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new ut,i=0,r=t.length;i0&&t.push(new THREE.VectorKeyframeTrack(a+".position",n,i)),s.length>0&&t.push(new THREE.QuaternionKeyframeTrack(a+".quaternion",n,s)),o.length>0&&t.push(new THREE.VectorKeyframeTrack(a+".scale",n,o)),t}function T(e,t,r){var a,n,i,s=!0;for(n=0,i=e.length;n=0;){var a=e[t];if(null!==a.value[r])return a;t--}return null}function k(e,t,r){for(;t0&&d.addAttribute("position",new THREE.Float32BufferAttribute(n.array,n.stride)),i.array.length>0&&d.addAttribute("normal",new THREE.Float32BufferAttribute(i.array,i.stride)),o.array.length>0&&d.addAttribute("color",new THREE.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&d.addAttribute("uv",new THREE.Float32BufferAttribute(s.array,s.stride)),c.array.length>0&&d.addAttribute("skinIndex",new THREE.Float32BufferAttribute(c.array,c.stride)),l.array.length>0&&d.addAttribute("skinWeight",new THREE.Float32BufferAttribute(l.array,l.stride)),a.data=d,a.type=e[0].type,a.materialKeys=u,a}function Te(e,t,r,a){function n(e){for(var t=i[e+r]*d,n=t+d;t0&&console.log("THREE.ColladaLoader: Geometry has faces with more than 4 vertices.")}else for(var f=0,h=i.length;f=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function _e(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},r=0;ra.limits.max||t","").replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include ",i).replace("#include ",o).replace("#include ",l).replace("#include ",p).replace("#include ",u);delete n.roughness,delete n.metalness,delete n.roughnessMap,delete n.metalnessMap,n.specular={value:(new THREE.Color).setHex(1118481)},n.glossiness={value:.5},n.specularMap={value:null},n.glossinessMap={value:null},e.vertexShader=s.vertexShader,e.fragmentShader=c,e.uniforms=n,e.defines={STANDARD:""},e.color=new THREE.Color(1,1,1),e.opacity=1;var d=[];if(Array.isArray(r.diffuseFactor)){var E=r.diffuseFactor;e.color.fromArray(E),e.opacity=E[3]}if(void 0!==r.diffuseTexture&&d.push(a.assignTexture(e,"map",r.diffuseTexture.index)),e.emissive=new THREE.Color(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new THREE.Color(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var m=r.specularGlossinessTexture.index;d.push(a.assignTexture(e,"glossinessMap",m)),d.push(a.assignTexture(e,"specularMap",m))}return Promise.all(d)},createMaterial:function(e){var t=new THREE.ShaderMaterial({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var a=this.specularGlossinessParams,r=0,s=a.length;r=2&&(r[s+1]=e.getY(s)),a>=3&&(r[s+2]=e.getZ(s)),a>=4&&(r[s+3]=e.getW(s));return new THREE.BufferAttribute(r,a,e.normalized)}return e.clone()}function d(e,a,r){this.json=e||{},this.extensions=a||{},this.options=r||{},this.cache=new t,this.primitiveCache=[],this.textureLoader=new THREE.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new THREE.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer")}e.prototype={constructor:e,crossOrigin:"Anonymous",load:function(e,t,a,r){var s=this,n=void 0!==this.path?this.path:THREE.LoaderUtils.extractUrlBase(e),i=new THREE.FileLoader(s.manager);i.setResponseType("arraybuffer"),i.load(e,function(e){try{s.parse(e,n,t,r)}catch(e){if(void 0===r)throw e;r(e)}},a,r)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},parse:function(e,t,n,i){var o,l={};if("string"==typeof e)o=e;else{if(THREE.LoaderUtils.decodeText(new Uint8Array(e,0,4))===m){try{l[E.KHR_BINARY_GLTF]=new r(e)}catch(e){return void(i&&i(e))}o=l[E.KHR_BINARY_GLTF].content}else o=THREE.LoaderUtils.decodeText(new Uint8Array(e))}var p=JSON.parse(o);if(void 0===p.asset||p.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead.")));p.extensionsUsed&&(p.extensionsUsed.indexOf(E.KHR_LIGHTS)>=0&&(l[E.KHR_LIGHTS]=new a(p)),p.extensionsUsed.indexOf(E.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS)>=0&&(l[E.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]=new s)),console.time("GLTFLoader"),new d(p,l,{path:t||this.path||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(function(e,t,a,r,s){console.timeEnd("GLTFLoader"),n({scene:e,scenes:t,cameras:a,animations:r,asset:s})},i)}};var E={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_LIGHTS:"KHR_lights",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness"},m="glTF",h=12,f={JSON:1313821514,BIN:5130562};n.prototype=Object.create(THREE.Interpolant.prototype),n.prototype.constructor=n,n.prototype.interpolate_=function(e,t,a,r){for(var s=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=2*i,l=3*i,p=r-t,u=(a-t)/p,c=u*u,d=c*u,E=e*l,m=E-l,h=2*d-3*c+1,f=d-2*c+u,v=-2*d+3*c,T=d-c,R=0;R!==i;R++){var g=n[m+R+i],S=n[m+R+o]*p,M=n[E+R+i],H=n[E+R]*p;s[R]=h*g+f*S+v*M+T*H}return s};var v={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},T=(Number,THREE.Matrix3,THREE.Matrix4,THREE.Vector2,THREE.Vector3,THREE.Vector4,THREE.Texture,{5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array}),R={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipMapNearestFilter,9985:THREE.LinearMipMapNearestFilter,9986:THREE.NearestMipMapLinearFilter,9987:THREE.LinearMipMapLinearFilter},g={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},S={6406:THREE.AlphaFormat,6407:THREE.RGBFormat,6408:THREE.RGBAFormat,6409:THREE.LuminanceFormat,6410:THREE.LuminanceAlphaFormat},M={5121:THREE.UnsignedByteType,32819:THREE.UnsignedShort4444Type,32820:THREE.UnsignedShort5551Type,33635:THREE.UnsignedShort565Type},H=(THREE.BackSide,THREE.FrontSide,THREE.NeverDepth,THREE.LessDepth,THREE.EqualDepth,THREE.LessEqualDepth,THREE.GreaterEqualDepth,THREE.NotEqualDepth,THREE.GreaterEqualDepth,THREE.AlwaysDepth,THREE.AddEquation,THREE.SubtractEquation,THREE.ReverseSubtractEquation,THREE.ZeroFactor,THREE.OneFactor,THREE.SrcColorFactor,THREE.OneMinusSrcColorFactor,THREE.SrcAlphaFactor,THREE.OneMinusSrcAlphaFactor,THREE.DstAlphaFactor,THREE.OneMinusDstAlphaFactor,THREE.DstColorFactor,THREE.OneMinusDstColorFactor,THREE.SrcAlphaSaturateFactor,{SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}),L={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},y={CUBICSPLINE:THREE.InterpolateSmooth,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},A={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};return d.prototype.parse=function(e,t){var a=this.json;this.cache.removeAll(),this.markDefs(),this.getMultiDependencies(["scene","animation","camera"]).then(function(t){var r=t.scenes||[],s=r[a.scene||0],n=t.animations||[],i=a.asset,o=t.cameras||[];e(s,r,o,n,i)}).catch(t)},d.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],a=this.json.meshes||[],r={},s={},n=0,i=t.length;n=2&&n.setY(A,M[L*o+1]),o>=3&&n.setZ(A,M[L*o+2]),o>=4&&n.setW(A,M[L*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return n})},d.prototype.loadTexture=function(e){var t=this,a=this.json,r=this.options,s=this.textureLoader,n=window.URL||window.webkitURL,o=a.textures[e],l=a.images[o.source],p=l.uri,u=!1;return void 0!==l.bufferView&&(p=t.getDependency("bufferView",l.bufferView).then(function(e){u=!0;var t=new Blob([e],{type:l.mimeType});return p=n.createObjectURL(t)})),Promise.resolve(p).then(function(e){var t=THREE.Loader.Handlers.get(e)||s;return new Promise(function(a,s){t.load(i(e,r.path),a,void 0,s)})}).then(function(e){!0===u&&n.revokeObjectURL(p),e.flipY=!1,void 0!==o.name&&(e.name=o.name),e.format=void 0!==o.format?S[o.format]:THREE.RGBAFormat,void 0!==o.internalFormat&&e.format!==S[o.internalFormat]&&console.warn("THREE.GLTFLoader: Three.js does not support texture internalFormat which is different from texture format. internalFormat will be forced to be the same value as format."),e.type=void 0!==o.type?M[o.type]:THREE.UnsignedByteType;var t=a.samplers||{},r=t[o.sampler]||{};return e.magFilter=R[r.magFilter]||THREE.LinearFilter,e.minFilter=R[r.minFilter]||THREE.LinearMipMapLinearFilter,e.wrapS=g[r.wrapS]||THREE.RepeatWrapping,e.wrapT=g[r.wrapT]||THREE.RepeatWrapping,e})},d.prototype.assignTexture=function(e,t,a){return this.getDependency("texture",a).then(function(a){e[t]=a})},d.prototype.loadMaterial=function(e){var t,a=this,r=(this.json,this.extensions),s=this.json.materials[e],n={},i=s.extensions||{},o=[];if(i[E.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var l=r[E.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=l.getMaterialType(s),o.push(l.extendParams(n,s,a))}else if(void 0!==s.pbrMetallicRoughness){t=THREE.MeshStandardMaterial;var p=s.pbrMetallicRoughness;if(n.color=new THREE.Color(1,1,1),n.opacity=1,Array.isArray(p.baseColorFactor)){var u=p.baseColorFactor;n.color.fromArray(u),n.opacity=u[3]}if(void 0!==p.baseColorTexture&&o.push(a.assignTexture(n,"map",p.baseColorTexture.index)),n.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,n.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture){var c=p.metallicRoughnessTexture.index;o.push(a.assignTexture(n,"metalnessMap",c)),o.push(a.assignTexture(n,"roughnessMap",c))}}else t=THREE.MeshPhongMaterial;!0===s.doubleSided&&(n.side=THREE.DoubleSide);var d=s.alphaMode||A.OPAQUE;return d===A.BLEND?n.transparent=!0:(n.transparent=!1,d===A.MASK&&(n.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&(o.push(a.assignTexture(n,"normalMap",s.normalTexture.index)),n.normalScale=new THREE.Vector2(1,1),void 0!==s.normalTexture.scale&&n.normalScale.set(s.normalTexture.scale,s.normalTexture.scale)),void 0!==s.occlusionTexture&&(o.push(a.assignTexture(n,"aoMap",s.occlusionTexture.index)),void 0!==s.occlusionTexture.strength&&(n.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&(t===THREE.MeshBasicMaterial?n.color=(new THREE.Color).fromArray(s.emissiveFactor):n.emissive=(new THREE.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&(t===THREE.MeshBasicMaterial?o.push(a.assignTexture(n,"map",s.emissiveTexture.index)):o.push(a.assignTexture(n,"emissiveMap",s.emissiveTexture.index))),Promise.all(o).then(function(){var e;return e=t===THREE.ShaderMaterial?r[E.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(n):new t(n),void 0!==s.name&&(e.name=s.name),e.normalScale&&(e.normalScale.x=-e.normalScale.x),e.map&&(e.map.encoding=THREE.sRGBEncoding),e.emissiveMap&&(e.emissiveMap.encoding=THREE.sRGBEncoding),s.extras&&(e.userData=s.extras),e})},d.prototype.loadGeometries=function(e){var t=this.primitiveCache;return this.getDependencies("accessor").then(function(a){for(var r=[],s=0,n=e.length;s1))return M;M.name+="_"+u,n.add(M)}return n})})},d.prototype.loadCamera=function(e){var t,a=this.json.cameras[e],r=a[a.type];if(!r)return void console.warn("THREE.GLTFLoader: Missing camera parameters.");if("perspective"===a.type){var s=r.aspectRatio||1,n=r.yfov*s;t=new THREE.PerspectiveCamera(THREE.Math.radToDeg(n),s,r.znear||1,r.zfar||2e6)}else"orthographic"===a.type&&(t=new THREE.OrthographicCamera(r.xmag/-2,r.xmag/2,r.ymag/2,r.ymag/-2,r.znear,r.zfar));return void 0!==a.name&&(t.name=a.name),a.extras&&(t.userData=a.extras),Promise.resolve(t)},d.prototype.loadSkin=function(e){var t=this.json.skins[e],a={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(a):this.getDependency("accessor",t.inverseBindMatrices).then(function(e){return a.inverseBindMatrices=e,a})},d.prototype.loadAnimation=function(e){var t=(this.json,this.json.animations[e]);return this.getMultiDependencies(["accessor","node"]).then(function(a){for(var r=[],s=0,i=t.channels.length;s1&&(n.name+="_instance_"+r[s.mesh]++)}else if(void 0!==s.camera)n=e.cameras[s.camera];else if(s.extensions&&s.extensions[E.KHR_LIGHTS]&&void 0!==s.extensions[E.KHR_LIGHTS].light){var u=t[E.KHR_LIGHTS].lights;n=u[s.extensions[E.KHR_LIGHTS].light]}else n=new THREE.Object3D;if(void 0!==s.name&&(n.name=THREE.PropertyBinding.sanitizeNodeName(s.name)),s.extras&&(n.userData=s.extras),void 0!==s.matrix){var c=new THREE.Matrix4;c.fromArray(s.matrix),n.applyMatrix(c)}else void 0!==s.translation&&n.position.fromArray(s.translation),void 0!==s.rotation&&n.quaternion.fromArray(s.rotation),void 0!==s.scale&&n.scale.fromArray(s.scale);return n})},d.prototype.loadScene=function(){function e(t,a,r,s,n){var i=s[t],o=r.nodes[t];if(void 0!==o.skin)for(var l=!0===i.isGroup?i.children:[i],p=0,u=l.length;p=0?o.substring(0,n):o;p=p.toLowerCase();var h=n>=0?o.substring(n+1):"";if(h=h.trim(),"newmtl"===p)e={name:h},s[h]=e;else if(e)if("ka"===p||"kd"===p||"ks"===p){var l=h.split(r,3);e[p]=[parseFloat(l[0]),parseFloat(l[1]),parseFloat(l[2])]}else e[p]=h}}var c=new THREE.MTLLoader.MaterialCreator(this.texturePath||this.path,this.materialOptions);return c.setCrossOrigin(this.crossOrigin),c.setManager(this.manager),c.setMaterials(s),c}},THREE.MTLLoader.MaterialCreator=function(t,a){this.baseUrl=t||"",this.options=a,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:THREE.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:THREE.RepeatWrapping},THREE.MTLLoader.MaterialCreator.prototype={constructor:THREE.MTLLoader.MaterialCreator,crossOrigin:"Anonymous",setCrossOrigin:function(t){this.crossOrigin=t},setManager:function(t){this.manager=t},setMaterials:function(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(t){if(!this.options)return t;var a={};for(var e in t){var r=t[e],s={};a[e]=s;for(var i in r){var o=!0,n=r[i],p=i.toLowerCase();switch(p){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(o=!1)}o&&(s[p]=n)}}return a},preload:function(){for(var t in this.materialsInfo)this.create(t)},getIndex:function(t){return this.nameLookup[t]},getAsArray:function(){var t=0;for(var a in this.materialsInfo)this.materialsArray[t]=this.create(a),this.nameLookup[a]=t,t++;return this.materialsArray},create:function(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]},createMaterial_:function(t){function a(t,a){return"string"!=typeof a||""===a?"":/^https?:\/\//i.test(a)?a:t+a}function e(t,e){if(!i[t]){var s=r.getTextureParams(e,i),o=r.loadTexture(a(r.baseUrl,s.url));o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=r.wrap,o.wrapT=r.wrap,i[t]=o}}var r=this,s=this.materialsInfo[t],i={name:t,side:this.side};for(var o in s){var n,p=s[o];if(""!==p)switch(o.toLowerCase()){case"kd":i.color=(new THREE.Color).fromArray(p);break;case"ks":i.specular=(new THREE.Color).fromArray(p);break;case"map_kd":e("map",p);break;case"map_ks":e("specularMap",p);break;case"norm":e("normalMap",p);break;case"map_bump":case"bump":e("bumpMap",p);break;case"ns":i.shininess=parseFloat(p);break;case"d":n=parseFloat(p),n<1&&(i.opacity=n,i.transparent=!0);break;case"tr":n=parseFloat(p),this.options&&this.options.invertTrProperty&&(n=1-n),n<1&&(i.opacity=n,i.transparent=!0)}}return this.materials[t]=new THREE.MeshPhongMaterial(i),this.materials[t]},getTextureParams:function(t,a){var e,r={scale:new THREE.Vector2(1,1),offset:new THREE.Vector2(0,0)},s=t.split(/\s+/);return e=s.indexOf("-bm"),e>=0&&(a.bumpScale=parseFloat(s[e+1]),s.splice(e,2)),e=s.indexOf("-s"),e>=0&&(r.scale.set(parseFloat(s[e+1]),parseFloat(s[e+2])),s.splice(e,4)),e=s.indexOf("-o"),e>=0&&(r.offset.set(parseFloat(s[e+1]),parseFloat(s[e+2])),s.splice(e,4)),r.url=s.join(" ").trim(),r},loadTexture:function(t,a,e,r,s){var i,o=THREE.Loader.Handlers.get(t),n=void 0!==this.manager?this.manager:THREE.DefaultLoadingManager;return null===o&&(o=new THREE.TextureLoader(n)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin),i=o.load(t,e,r,s),void 0!==a&&(i.mapping=a),i}}; +},{}],44:[function(_dereq_,module,exports){ +THREE.OBJLoader=function(){function t(){var t={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materialLibraries:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:!1!==e,geometry:{vertices:[],normals:[],colors:[],uvs:[]},materials:[],smooth:!0,startMaterial:function(t,e){var r=this._finalize(!1);r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1);var i={index:this.materials.length,name:t||"",mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==r?r.smooth:this.smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(t){var e={index:"number"==typeof t?t:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return e.clone=this.clone.bind(e),e}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){var e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(var r=this.materials.length-1;r>=0;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}},r&&r.name&&"function"==typeof r.clone){var i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(t,e){var r=parseInt(t,10);return 3*(r>=0?r-1:r+e/3)},parseNormalIndex:function(t,e){var r=parseInt(t,10);return 3*(r>=0?r-1:r+e/3)},parseUVIndex:function(t,e){var r=parseInt(t,10);return 2*(r>=0?r-1:r+e/2)},addVertex:function(t,e,r){var i=this.vertices,s=this.object.geometry.vertices;s.push(i[t+0],i[t+1],i[t+2]),s.push(i[e+0],i[e+1],i[e+2]),s.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(t){var e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){var e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,r){var i=this.normals,s=this.object.geometry.normals;s.push(i[t+0],i[t+1],i[t+2]),s.push(i[e+0],i[e+1],i[e+2]),s.push(i[r+0],i[r+1],i[r+2])},addColor:function(t,e,r){var i=this.colors,s=this.object.geometry.colors;s.push(i[t+0],i[t+1],i[t+2]),s.push(i[e+0],i[e+1],i[e+2]),s.push(i[r+0],i[r+1],i[r+2])},addUV:function(t,e,r){var i=this.uvs,s=this.object.geometry.uvs;s.push(i[t+0],i[t+1]),s.push(i[e+0],i[e+1]),s.push(i[r+0],i[r+1])},addUVLine:function(t){var e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,r,i,s,a,n,o,h){var l=this.vertices.length,u=this.parseVertexIndex(t,l),c=this.parseVertexIndex(e,l),p=this.parseVertexIndex(r,l);if(this.addVertex(u,c,p),void 0!==i){var m=this.uvs.length;u=this.parseUVIndex(i,m),c=this.parseUVIndex(s,m),p=this.parseUVIndex(a,m),this.addUV(u,c,p)}if(void 0!==n){var f=this.normals.length;u=this.parseNormalIndex(n,f),c=n===o?u:this.parseNormalIndex(o,f),p=n===h?u:this.parseNormalIndex(h,f),this.addNormal(u,c,p)}this.colors.length>0&&this.addColor(u,c,p)},addPointGeometry:function(t){this.object.geometry.type="Points";for(var e=this.vertices.length,r=0,i=t.length;r0){var x=E.split("/");v.push(x)}}for(var j=v[0],g=1,b=v.length-1;g1){var P=l[1].trim().toLowerCase();a.object.smooth="0"!==P&&"off"!==P}else a.object.smooth=!0;var A=a.object.currentMaterial();A&&(A.smooth=a.object.smooth)}a.finalize();var z=new THREE.Group;z.materialLibraries=[].concat(a.materialLibraries);for(var c=0,p=a.objects.length;c0?S.addAttribute("normal",new THREE.Float32BufferAttribute(C.normals,3)):S.computeVertexNormals(),C.colors.length>0&&(G=!0,S.addAttribute("color",new THREE.Float32BufferAttribute(C.colors,3))),C.uvs.length>0&&S.addAttribute("uv",new THREE.Float32BufferAttribute(C.uvs,2));for(var _=[],D=0,J=O.length;D1){for(var D=0,J=O.length;De.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),t.push(null,null);break}A||(A=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(N),t.push(e.getParameter(r),null);break;case e.ACTIVE_TEXTURE:A=e.getParameter(e.ACTIVE_TEXTURE),t.push(null);break;default:t.push(e.getParameter(r))}}i(e);for(var s=0;se.TEXTURE31)break;e.activeTexture(N),e.bindTexture(e.TEXTURE_2D,D);break;case e.TEXTURE_BINDING_CUBE_MAP:var N=M[++s];if(Ne.TEXTURE31)break;e.activeTexture(N),e.bindTexture(e.TEXTURE_CUBE_MAP,D);break;case e.VIEWPORT:e.viewport(D[0],D[1],D[2],D[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:D?e.enable(r):e.disable(r);break;default:console.log("No GL restore behavior for 0x"+r.toString(16))}A&&e.activeTexture(A)}}function i(e,M,i,t){this.gl=e,this.cardboardUI=M,this.bufferScale=i,this.dirtySubmitFrameBindings=t,this.ctxAttribs=e.getContextAttributes(),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,O()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=v(e,K,q,this.attribs),this.uniforms=b(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}function t(e){this.gl=e,this.attribs={position:0},this.program=v(e,$,ee,this.attribs),this.uniforms=b(e,this.program),this.vertexBuffer=e.createBuffer(),this.gearOffset=0,this.gearVertexCount=0,this.arrowOffset=0,this.arrowVertexCount=0,this.projMat=new Float32Array(16),this.listener=null,this.onResize()}function A(e){this.coefficients=e}function s(e){this.width=e.width||m(),this.height=e.height||k(),this.widthMeters=e.widthMeters,this.heightMeters=e.heightMeters,this.bevelMeters=e.bevelMeters}function r(e){this.viewer=ne.CardboardV2,this.updateDeviceParams(e),this.distortion=new A(this.viewer.distortionCoefficients)}function N(e){this.id=e.id,this.label=e.label,this.fov=e.fov,this.interLensDistance=e.interLensDistance,this.baselineLensDistance=e.baselineLensDistance,this.screenLensDistance=e.screenLensDistance,this.distortionCoefficients=e.distortionCoefficients,this.inverseCoefficients=e.inverseCoefficients}function D(e,M){if(this.dpdb=ae,this.recalculateDeviceParams_(),e){this.onDeviceParamsUpdated=M;var i=new XMLHttpRequest,t=this;i.open("GET",e,!0),i.addEventListener("load",function(){t.loading=!1,i.status>=200&&i.status<=299?(t.dpdb=JSON.parse(i.response),t.recalculateDeviceParams_()):console.error("Error loading online DPDB!")}),i.send()}}function n(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function u(e,M){this.set(e,M)}function a(e,M){this.kFilter=e,this.isDebug=M,this.currentAccelMeasurement=new u,this.currentGyroMeasurement=new u,this.previousGyroMeasurement=new u,O()?this.filterQ=new re(-1,0,0,1):this.filterQ=new re(1,0,0,1),this.previousFilterQ=new re,this.previousFilterQ.copy(this.filterQ),this.accelQ=new re,this.isOrientationInitialized=!1,this.estimatedGravity=new se,this.measuredGravity=new se,this.gyroIntegralQ=new re}function g(e,M){this.predictionTimeS=e,this.isDebug=M,this.previousQ=new re,this.previousTimestampS=null,this.deltaQ=new re,this.outQ=new re}function o(e,M,i,t){this.yawOnly=i,this.accelerometer=new se,this.gyroscope=new se,this.filter=new a(e,t),this.posePredictor=new g(M,t),this.isFirefoxAndroid=d(),this.isIOS=O();var A=C();this.isDeviceMotionInRadians=!this.isIOS&&A&&A<66,this.isWithoutDeviceMotion=S(),this.filterToWorldQ=new re,O()?this.filterToWorldQ.setFromAxisAngle(new se(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new se(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new re,this.worldToScreenQ=new re,this.originalPoseAdjustQ=new re,this.originalPoseAdjustQ.setFromAxisAngle(new se(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),p()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new re,this.orientationOut_=new Float32Array(4),this.start()}function L(){this.loadIcon_();var e=document.createElement("div"),M=e.style;M.position="fixed",M.top=0,M.right=0,M.bottom=0,M.left=0,M.backgroundColor="gray",M.fontFamily="sans-serif",M.zIndex=1e6;var i=document.createElement("img");i.src=this.icon;var M=i.style;M.marginLeft="25%",M.marginTop="25%",M.width="50%",e.appendChild(i);var t=document.createElement("div"),M=t.style;M.textAlign="center",M.fontSize="16px",M.lineHeight="24px",M.margin="24px 25%",M.width="50%",t.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(t);var A=document.createElement("div"),M=A.style;M.backgroundColor="#CFD8DC",M.position="fixed",M.bottom=0,M.width="100%",M.height="48px",M.padding="14px 24px",M.boxSizing="border-box",M.color="#656A6B",e.appendChild(A);var s=document.createElement("div");s.style.float="left",s.innerHTML="No Cardboard viewer?";var r=document.createElement("a");r.href="https://www.google.com/get/cardboard/get-cardboard/",r.innerHTML="get one",r.target="_blank";var M=r.style;M.float="right",M.fontWeight=600,M.textTransform="uppercase",M.borderLeft="1px solid gray",M.paddingLeft="24px",M.textDecoration="none",M.color="#656A6B",A.appendChild(s),A.appendChild(r),this.overlay=e,this.text=t,this.hide()}function I(){try{this.selectedKey=localStorage.getItem(ce)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=Te),this.dialog=this.createDialog_(r.Viewers),this.root=null,this.onChangeCallbacks_=[]}function j(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function T(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return X("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function c(e){e=e||{};var M=!("wakelock"in e)||e.wakelock;this.isPolyfilled=!0,this.displayId=ye++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return X("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new T({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,M&&R()&&(this.wakelock_=new we)}function E(e){var M=G({},xe);e=G(M,e||{}),c.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new T({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new je(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new D(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new r(this.dpdb_.getDeviceParams()),this.viewerSelector_=new I,this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new L),O()&&window.addEventListener("resize",this.onResize_.bind(this))}var w=function(e,M){if(!(e instanceof M))throw new TypeError("Cannot call a class as a function")},y=function(){function e(e,M){for(var i=0;i1))},m=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},k=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},U=function(e){if(x())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},B=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},Y=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},v=function(e,M,i,t){var A=e.createShader(e.VERTEX_SHADER);e.shaderSource(A,M),e.compileShader(A);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,i),e.compileShader(s);var r=e.createProgram();e.attachShader(r,A),e.attachShader(r,s);for(var N in t)e.bindAttribLocation(r,t[N],N);return e.linkProgram(r),e.deleteShader(A),e.deleteShader(s),r},b=function(e,M){for(var i={},t=e.getProgramParameter(M,e.ACTIVE_UNIFORMS),A="",s=0;s1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(e.w)},H=function(){var e={};return function(M,i){void 0===e[M]&&(console.warn("webvr-polyfill: "+i),e[M]=!0)}}(),X=function(e,M){H(e,e+" has been deprecated. This may not work on native WebVR displays. "+(M?"Please use "+M+" instead.":""))},J=e,K=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),q=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");i.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},i.prototype.onResize=function(){var e=this.gl,M=this,i=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];J(e,i,function(e){M.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),M.scissorTest&&M.realDisable.call(e,e.SCISSOR_TEST),M.realColorMask.call(e,!0,!0,!0,!0),M.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),M.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),M.realBindFramebuffer.call(e,e.FRAMEBUFFER,M.framebuffer),e.bindTexture(e.TEXTURE_2D,M.renderTarget),e.texImage2D(e.TEXTURE_2D,0,M.ctxAttribs.alpha?e.RGBA:e.RGB,M.bufferWidth,M.bufferHeight,0,M.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,M.renderTarget,0),M.ctxAttribs.depth&&M.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,M.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,M.bufferWidth,M.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,M.depthStencilBuffer)):M.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,M.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,M.bufferWidth,M.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,M.depthBuffer)):M.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,M.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,M.bufferWidth,M.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,M.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),M.realBindFramebuffer.call(e,e.FRAMEBUFFER,M.lastBoundFramebuffer),M.scissorTest&&M.realEnable.call(e,e.SCISSOR_TEST),M.realColorMask.apply(e,M.colorMask),M.realViewport.apply(e,M.viewport),M.realClearColor.apply(e,M.clearColor)}),this.cardboardUI&&this.cardboardUI.onResize()},i.prototype.patch=function(){if(!this.isPatched){var e=this,M=this.gl.canvas,i=this.gl;O()||(M.width=m()*this.bufferScale,M.height=k()*this.bufferScale,Object.defineProperty(M,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(i){e.bufferWidth=i,e.realCanvasWidth.set.call(M,i),e.onResize()}}),Object.defineProperty(M,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(i){e.bufferHeight=i,e.realCanvasHeight.set.call(M,i),e.onResize()}})),this.lastBoundFramebuffer=i.getParameter(i.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(i.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(M,t){e.lastBoundFramebuffer=t||e.framebuffer,e.realBindFramebuffer.call(i,M,e.lastBoundFramebuffer)},this.cullFace=i.getParameter(i.CULL_FACE),this.depthTest=i.getParameter(i.DEPTH_TEST),this.blend=i.getParameter(i.BLEND),this.scissorTest=i.getParameter(i.SCISSOR_TEST),this.stencilTest=i.getParameter(i.STENCIL_TEST),i.enable=function(M){switch(M){case i.CULL_FACE:e.cullFace=!0;break;case i.DEPTH_TEST:e.depthTest=!0;break;case i.BLEND:e.blend=!0;break;case i.SCISSOR_TEST:e.scissorTest=!0;break;case i.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(i,M)},i.disable=function(M){switch(M){case i.CULL_FACE:e.cullFace=!1;break;case i.DEPTH_TEST:e.depthTest=!1;break;case i.BLEND:e.blend=!1;break;case i.SCISSOR_TEST:e.scissorTest=!1;break;case i.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(i,M)},this.colorMask=i.getParameter(i.COLOR_WRITEMASK),i.colorMask=function(M,t,A,s){e.colorMask[0]=M,e.colorMask[1]=t,e.colorMask[2]=A,e.colorMask[3]=s,e.realColorMask.call(i,M,t,A,s)},this.clearColor=i.getParameter(i.COLOR_CLEAR_VALUE),i.clearColor=function(M,t,A,s){e.clearColor[0]=M,e.clearColor[1]=t,e.clearColor[2]=A,e.clearColor[3]=s,e.realClearColor.call(i,M,t,A,s)},this.viewport=i.getParameter(i.VIEWPORT),i.viewport=function(M,t,A,s){e.viewport[0]=M,e.viewport[1]=t,e.viewport[2]=A,e.viewport[3]=s,e.realViewport.call(i,M,t,A,s)},this.isPatched=!0,F(M)}},i.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,M=this.gl.canvas;O()||(Object.defineProperty(M,"width",this.realCanvasWidth),Object.defineProperty(M,"height",this.realCanvasHeight)),M.width=this.bufferWidth,M.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout(function(){F(M)},1)}},i.prototype.setTextureBounds=function(e,M){e||(e=[0,0,.5,1]),M||(M=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=M[0],this.viewportOffsetScale[5]=M[1],this.viewportOffsetScale[6]=M[2],this.viewportOffsetScale[7]=M[3]},i.prototype.submitFrame=function(){var e=this.gl,M=this,i=[];if(this.dirtySubmitFrameBindings||i.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),J(e,i,function(e){M.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),M.cullFace&&M.realDisable.call(e,e.CULL_FACE),M.depthTest&&M.realDisable.call(e,e.DEPTH_TEST),M.blend&&M.realDisable.call(e,e.BLEND),M.scissorTest&&M.realDisable.call(e,e.SCISSOR_TEST),M.stencilTest&&M.realDisable.call(e,e.STENCIL_TEST),M.realColorMask.call(e,!0,!0,!0,!0),M.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(M.ctxAttribs.alpha||O())&&(M.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(M.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,M.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,M.vertexBuffer),e.enableVertexAttribArray(M.attribs.position),e.enableVertexAttribArray(M.attribs.texCoord),e.vertexAttribPointer(M.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(M.attribs.texCoord,3,e.FLOAT,!1,20,8),e.activeTexture(e.TEXTURE0),e.uniform1i(M.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,M.renderTarget),e.uniform4fv(M.uniforms.viewportOffsetScale,M.viewportOffsetScale),e.drawElements(e.TRIANGLES,M.indexCount,e.UNSIGNED_SHORT,0),M.cardboardUI&&M.cardboardUI.renderNoState(),M.realBindFramebuffer.call(M.gl,e.FRAMEBUFFER,M.framebuffer),M.ctxAttribs.preserveDrawingBuffer||(M.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),M.dirtySubmitFrameBindings||M.realBindFramebuffer.call(e,e.FRAMEBUFFER,M.lastBoundFramebuffer),M.cullFace&&M.realEnable.call(e,e.CULL_FACE),M.depthTest&&M.realEnable.call(e,e.DEPTH_TEST),M.blend&&M.realEnable.call(e,e.BLEND),M.scissorTest&&M.realEnable.call(e,e.SCISSOR_TEST),M.stencilTest&&M.realEnable.call(e,e.STENCIL_TEST),M.realColorMask.apply(e,M.colorMask),M.realViewport.apply(e,M.viewport),!M.ctxAttribs.alpha&&M.ctxAttribs.preserveDrawingBuffer||M.realClearColor.apply(e,M.clearColor)}),O()){var t=e.canvas;t.width==M.bufferWidth&&t.height==M.bufferHeight||(M.bufferWidth=t.width,M.bufferHeight=t.height,M.onResize())}},i.prototype.updateDeviceInfo=function(e){var M=this.gl,i=this,t=[M.ARRAY_BUFFER_BINDING,M.ELEMENT_ARRAY_BUFFER_BINDING];J(M,t,function(M){var t=i.computeMeshVertices_(i.meshWidth,i.meshHeight,e);if(M.bindBuffer(M.ARRAY_BUFFER,i.vertexBuffer),M.bufferData(M.ARRAY_BUFFER,t,M.STATIC_DRAW),!i.indexCount){var A=i.computeMeshIndices_(i.meshWidth,i.meshHeight);M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,i.indexBuffer),M.bufferData(M.ELEMENT_ARRAY_BUFFER,A,M.STATIC_DRAW),i.indexCount=A.length}})},i.prototype.computeMeshVertices_=function(e,M,i){for(var t=new Float32Array(2*e*M*5),A=i.getLeftEyeVisibleTanAngles(),s=i.getLeftEyeNoLensTanAngles(),r=i.getLeftEyeVisibleScreenRect(s),N=0,D=0;D<2;D++){for(var n=0;nA-42&&t.clientXi.clientHeight-42?e(t):t.clientX<42&&t.clientY<42&&M(t)},i.addEventListener("click",this.listener,!1)},t.prototype.onResize=function(){var e=this.gl,M=this,i=[e.ARRAY_BUFFER_BINDING];J(e,i,function(e){function i(e,M){var i=(90-e)*Me,t=Math.cos(i),r=Math.sin(i);A.push(ie*t*a+s,ie*r*a+a),A.push(M*t*a+s,M*r*a+a)}function t(M,i){A.push(g+M,e.drawingBufferHeight-g-i)}var A=[],s=e.drawingBufferWidth/2,r=Math.max(screen.width,screen.height)*window.devicePixelRatio,N=e.drawingBufferWidth/r,D=N*window.devicePixelRatio,n=4*D/2,u=42*D,a=28*D/2,g=14*D;A.push(s-n,u),A.push(s-n,e.drawingBufferHeight),A.push(s+n,u),A.push(s+n,e.drawingBufferHeight),M.gearOffset=A.length/2;for(var o=0;o<=6;o++){var L=60*o;i(L,1),i(L+12,1),i(L+20,.75),i(L+40,.75),i(L+48,1)}M.gearVertexCount=A.length/2-M.gearOffset,M.arrowOffset=A.length/2;var I=n/Math.sin(45*Me);t(0,a),t(a,0),t(a+I,I),t(I,a+I),t(I,a-I),t(0,a),t(a,2*a),t(a+I,2*a-I),t(I,a-I),t(0,a),t(I,a-n),t(28*D,a-n),t(I,a+n),t(28*D,a+n),M.arrowVertexCount=A.length/2-M.arrowOffset,e.bindBuffer(e.ARRAY_BUFFER,M.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(A),e.STATIC_DRAW)})},t.prototype.render=function(){var e=this.gl,M=this,i=[e.CULL_FACE,e.DEPTH_TEST,e.BLEND,e.SCISSOR_TEST,e.STENCIL_TEST,e.COLOR_WRITEMASK,e.VIEWPORT,e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING];J(e,i,function(e){e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.BLEND),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.colorMask(!0,!0,!0,!0),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),M.renderNoState()})},t.prototype.renderNoState=function(){var e=this.gl;e.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.enableVertexAttribArray(this.attribs.position),e.vertexAttribPointer(this.attribs.position,2,e.FLOAT,!1,8,0),e.uniform4f(this.uniforms.color,1,1,1,1),_(this.projMat,0,e.drawingBufferWidth,0,e.drawingBufferHeight,.1,1024), +e.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.drawArrays(e.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),e.drawArrays(e.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},A.prototype.distortInverse=function(e){for(var M=0,i=1,t=e-this.distort(M);Math.abs(i-M)>1e-4;){var A=e-this.distort(i),s=i-A*((i-M)/(A-t));M=i,i=s,t=A}return i},A.prototype.distort=function(e){for(var M=e*e,i=0,t=0;t=1)return this.w=s,this.x=i,this.y=t,this.z=A,this;var N=Math.acos(r),D=Math.sqrt(1-r*r);if(Math.abs(D)<.001)return this.w=.5*(s+this.w),this.x=.5*(i+this.x),this.y=.5*(t+this.y),this.z=.5*(A+this.z),this;var n=Math.sin((1-M)*N)/D,u=Math.sin(M*N)/D;return this.w=s*n+this.w*u,this.x=i*n+this.x*u,this.y=t*n+this.y*u,this.z=A*n+this.z*u,this},setFromUnitVectors:function(){var e,M;return function(i,t){return void 0===e&&(e=new se),M=i.dot(t)+1,M<1e-6?(M=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,t),this.x=e.x,this.y=e.y,this.z=e.z,this.w=M,this.normalize(),this}}()};var Ne=new s({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),De=new s({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),ne={CardboardV1:new N({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new N({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};r.prototype.updateDeviceParams=function(e){this.device=this.determineDevice_(e)||this.device},r.prototype.getDevice=function(){return this.device},r.prototype.setViewer=function(e){this.viewer=e,this.distortion=new A(this.viewer.distortionCoefficients)},r.prototype.determineDevice_=function(e){if(!e)return O()?(console.warn("Using fallback iOS device measurements."),De):(console.warn("Using fallback Android device measurements."),Ne);var M=.0254/e.xdpi,i=.0254/e.ydpi;return new s({widthMeters:M*m(),heightMeters:i*k(),bevelMeters:.001*e.bevelMm})},r.prototype.getDistortedFieldOfViewLeftEye=function(){var e=this.viewer,M=this.device,i=this.distortion,t=e.screenLensDistance,A=(M.widthMeters-e.interLensDistance)/2,s=e.interLensDistance/2,r=e.baselineLensDistance-M.bevelMeters,N=M.heightMeters-r,D=Ae*Math.atan(i.distort(A/t)),n=Ae*Math.atan(i.distort(s/t)),u=Ae*Math.atan(i.distort(r/t)),a=Ae*Math.atan(i.distort(N/t));return{leftDegrees:Math.min(D,e.fov),rightDegrees:Math.min(n,e.fov),downDegrees:Math.min(u,e.fov),upDegrees:Math.min(a,e.fov)}},r.prototype.getLeftEyeVisibleTanAngles=function(){var e=this.viewer,M=this.device,i=this.distortion,t=Math.tan(-te*e.fov),A=Math.tan(te*e.fov),s=Math.tan(te*e.fov),r=Math.tan(-te*e.fov),N=M.widthMeters/4,D=M.heightMeters/2,n=e.baselineLensDistance-M.bevelMeters-D,u=e.interLensDistance/2-N,a=-n,g=e.screenLensDistance,o=i.distort((u-N)/g),L=i.distort((a+D)/g),I=i.distort((u+N)/g),j=i.distort((a-D)/g),T=new Float32Array(4);return T[0]=Math.max(t,o),T[1]=Math.min(A,L),T[2]=Math.min(s,I),T[3]=Math.max(r,j),T},r.prototype.getLeftEyeNoLensTanAngles=function(){var e=this.viewer,M=this.device,i=this.distortion,t=new Float32Array(4),A=i.distortInverse(Math.tan(-te*e.fov)),s=i.distortInverse(Math.tan(te*e.fov)),r=i.distortInverse(Math.tan(te*e.fov)),N=i.distortInverse(Math.tan(-te*e.fov)),D=M.widthMeters/4,n=M.heightMeters/2,u=e.baselineLensDistance-M.bevelMeters-n,a=e.interLensDistance/2-D,g=-u,o=e.screenLensDistance,L=(a-D)/o,I=(g+n)/o,j=(a+D)/o,T=(g-n)/o;return t[0]=Math.max(A,L),t[1]=Math.min(s,I),t[2]=Math.min(r,j),t[3]=Math.max(N,T),t},r.prototype.getLeftEyeVisibleScreenRect=function(e){var M=this.viewer,i=this.device,t=M.screenLensDistance,A=(i.widthMeters-M.interLensDistance)/2,s=M.baselineLensDistance-i.bevelMeters,r=(e[0]*t+A)/i.widthMeters,N=(e[1]*t+s)/i.heightMeters,D=(e[2]*t+A)/i.widthMeters,n=(e[3]*t+s)/i.heightMeters;return{x:r,y:n,width:D-r,height:N-n}},r.prototype.getFieldOfViewLeftEye=function(e){return e?this.getUndistortedFieldOfViewLeftEye():this.getDistortedFieldOfViewLeftEye()},r.prototype.getFieldOfViewRightEye=function(e){var M=this.getFieldOfViewLeftEye(e);return{leftDegrees:M.rightDegrees,rightDegrees:M.leftDegrees,upDegrees:M.upDegrees,downDegrees:M.downDegrees}},r.prototype.getUndistortedFieldOfViewLeftEye=function(){var e=this.getUndistortedParams_();return{leftDegrees:Ae*Math.atan(e.outerDist),rightDegrees:Ae*Math.atan(e.innerDist),downDegrees:Ae*Math.atan(e.bottomDist),upDegrees:Ae*Math.atan(e.topDist)}},r.prototype.getUndistortedViewportLeftEye=function(){var e=this.getUndistortedParams_(),M=this.viewer,i=this.device,t=M.screenLensDistance,A=i.widthMeters/t,s=i.heightMeters/t,r=i.width/A,N=i.height/s,D=Math.round((e.eyePosX-e.outerDist)*r),n=Math.round((e.eyePosY-e.bottomDist)*N);return{x:D,y:n,width:Math.round((e.eyePosX+e.innerDist)*r)-D,height:Math.round((e.eyePosY+e.topDist)*N)-n}},r.prototype.getUndistortedParams_=function(){var e=this.viewer,M=this.device,i=this.distortion,t=e.screenLensDistance,A=e.interLensDistance/2/t,s=M.widthMeters/t,r=M.heightMeters/t,N=s/2-A,D=(e.baselineLensDistance-M.bevelMeters)/t,n=e.fov,u=i.distortInverse(Math.tan(te*n)),a=Math.min(N,u),g=Math.min(A,u),o=Math.min(D,u);return{outerDist:a,innerDist:g,topDist:Math.min(r-D,u),bottomDist:o,eyePosX:N,eyePosY:D}},r.Viewers=ne;var ue=[{type:"android",rules:[{mdmh:"asus/*/Nexus 7/*"},{ua:"Nexus 7"}],dpi:[320.8,323],bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_Z00AD/*"},{ua:"ASUS_Z00AD"}],dpi:[403,404.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel XL/*"},{ua:"Pixel XL"}],dpi:[537.9,533],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel/*"},{ua:"Pixel"}],dpi:[432.6,436.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC6435LVW/*"},{ua:"HTC6435LVW"}],dpi:[449.7,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC One XL/*"},{ua:"HTC One XL"}],dpi:[315.3,314.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"htc/*/Nexus 9/*"},{ua:"Nexus 9"}],dpi:289,bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One M9/*"},{ua:"HTC One M9"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One_M8/*"},{ua:"HTC One_M8"}],dpi:[449.7,447.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One/*"},{ua:"HTC One"}],dpi:472.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/Nexus 6P/*"},{ua:"Nexus 6P"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LENOVO/*/Lenovo PB2-690Y/*"},{ua:"Lenovo PB2-690Y"}],dpi:[457.2,454.713],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5X/*"},{ua:"Nexus 5X"}],dpi:[422,419.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS345/*"},{ua:"LGMS345"}],dpi:[221.7,219.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D800/*"},{ua:"LG-D800"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D850/*"},{ua:"LG-D850"}],dpi:[537.9,541.9],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/VS985 4G/*"},{ua:"VS985 4G"}],dpi:[537.9,535.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5/*"},{ua:"Nexus 5 B"}],dpi:[442.4,444.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 4/*"},{ua:"Nexus 4"}],dpi:[319.8,318.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LG-P769/*"},{ua:"LG-P769"}],dpi:[240.6,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS323/*"},{ua:"LGMS323"}],dpi:[206.6,204.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGLS996/*"},{ua:"LGLS996"}],dpi:[403.4,401.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/4560MMX/*"},{ua:"4560MMX"}],dpi:[240,219.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/A250/*"},{ua:"Micromax A250"}],dpi:[480,446.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/Micromax AQ4501/*"},{ua:"Micromax AQ4501"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/G5/*"},{ua:"Moto G (5) Plus"}],dpi:[403.4,403],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/DROID RAZR/*"},{ua:"DROID RAZR"}],dpi:[368.1,256.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT830C/*"},{ua:"XT830C"}],dpi:[254,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1021/*"},{ua:"XT1021"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1023/*"},{ua:"XT1023"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1028/*"},{ua:"XT1028"}],dpi:[326.6,327.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1034/*"},{ua:"XT1034"}],dpi:[326.6,328.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1053/*"},{ua:"XT1053"}],dpi:[315.3,316.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1562/*"},{ua:"XT1562"}],dpi:[403.4,402.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/Nexus 6/*"},{ua:"Nexus 6 B"}],dpi:[494.3,489.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1063/*"},{ua:"XT1063"}],dpi:[295,296.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1064/*"},{ua:"XT1064"}],dpi:[295,295.6],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1092/*"},{ua:"XT1092"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1095/*"},{ua:"XT1095"}],dpi:[422,423.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/G4/*"},{ua:"Moto G (4)"}],dpi:401,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/A0001/*"},{ua:"A0001"}],dpi:[403.4,401],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1005/*"},{ua:"ONE E1005"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2005/*"},{ua:"ONE A2005"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A5000/*"},{ua:"ONEPLUS A5000 "}],dpi:[403.411,399.737],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A5010/*"},{ua:"ONEPLUS A5010"}],dpi:[403,400],bw:2,ac:1e3},{type:"android",rules:[{mdmh:"OPPO/*/X909/*"},{ua:"X909"}],dpi:[442.4,444.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9082/*"},{ua:"GT-I9082"}],dpi:[184.7,185.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G360P/*"},{ua:"SM-G360P"}],dpi:[196.7,205.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Nexus S/*"},{ua:"Nexus S"}],dpi:[234.5,229.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[304.8,303.9],bw:5,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-T230NU/*"},{ua:"SM-T230NU"}],dpi:216,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SGH-T399/*"},{ua:"SGH-T399"}],dpi:[217.7,231.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SGH-M919/*"},{ua:"SGH-M919"}],dpi:[440.8,437.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N9005/*"},{ua:"SM-N9005"}],dpi:[386.4,387],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SM-N900A/*"},{ua:"SAMSUNG-SM-N900A"}],dpi:[386.4,387.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9500/*"},{ua:"GT-I9500"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/GT-I9505/*"},{ua:"GT-I9505"}],dpi:439.4,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900F/*"},{ua:"SM-G900F"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900M/*"},{ua:"SM-G900M"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G800F/*"},{ua:"SM-G800F"}],dpi:326.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G906S/*"},{ua:"SM-G906S"}],dpi:[562.7,572.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[306.7,304.8],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-T535/*"},{ua:"SM-T535"}],dpi:[142.6,136.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-N920C/*"},{ua:"SM-N920C"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920P/*"},{ua:"SM-N920P"}],dpi:[386.3655,390.144],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920W8/*"},{ua:"SM-N920W8"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300I/*"},{ua:"GT-I9300I"}],dpi:[304.8,305.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9195/*"},{ua:"GT-I9195"}],dpi:[249.4,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SPH-L520/*"},{ua:"SPH-L520"}],dpi:[249.4,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SGH-I717/*"},{ua:"SAMSUNG-SGH-I717"}],dpi:285.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SPH-D710/*"},{ua:"SPH-D710"}],dpi:[217.7,204.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-N7100/*"},{ua:"GT-N7100"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SCH-I605/*"},{ua:"SCH-I605"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Galaxy Nexus/*"},{ua:"Galaxy Nexus"}],dpi:[315.3,314.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910H/*"},{ua:"SM-N910H"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910C/*"},{ua:"SM-N910C"}],dpi:[515.2,520.2],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G130M/*"},{ua:"SM-G130M"}],dpi:[165.9,164.8],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G928I/*"},{ua:"SM-G928I"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G920F/*"},{ua:"SM-G920F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G920P/*"},{ua:"SM-G920P"}],dpi:[522.5,577],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G925F/*"},{ua:"SM-G925F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G925V/*"},{ua:"SM-G925V"}],dpi:[522.5,576.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G930F/*"},{ua:"SM-G930F"}],dpi:576.6,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G935F/*"},{ua:"SM-G935F"}],dpi:533,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G950F/*"},{ua:"SM-G950F"}],dpi:[562.707,565.293],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955U/*"},{ua:"SM-G955U"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/C6903/*"},{ua:"C6903"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/D6653/*"},{ua:"D6653"}],dpi:[428.6,427.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6653/*"},{ua:"E6653"}],dpi:[428.6,425.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6853/*"},{ua:"E6853"}],dpi:[403.4,401.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/SGP321/*"},{ua:"SGP321"}],dpi:[224.7,224.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{ua:"ALCATEL ONE TOUCH Fierce"}],dpi:[240,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"THL/*/thl 5000/*"},{ua:"thl 5000"}],dpi:[480,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Fly/*/IQ4412/*"},{ua:"IQ4412"}],dpi:307.9,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"ZTE/*/ZTE Blade L2/*"},{ua:"ZTE Blade L2"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"BENEVE/*/VR518/*"},{ua:"VR518"}],dpi:480,bw:3,ac:500},{type:"ios",rules:[{res:[640,960]}],dpi:[325.1,328.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[640,1136]}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2001]}],dpi:[410.9,415.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2436]}],dpi:458,bw:4,ac:1e3}],ae={format:1,last_updated:"2018-02-20T22:55:10Z",devices:ue};D.prototype.getDeviceParams=function(){return this.deviceParams},D.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},D.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var M=navigator.userAgent||navigator.vendor||window.opera,i=m(),t=k();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var A=0;A1?(H("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=t)):(this.accelerometer.set(-M.x,-M.y,-M.z),Q()?this.gyroscope.set(-i.beta,i.alpha,i.gamma):this.gyroscope.set(i.alpha,i.beta,i.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,t),this.filter.addGyroMeasurement(this.gyroscope,t),void(this.previousTimestampS=t))},o.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},o.prototype.onMessage_=function(e){var M=e.data;if(M&&M.type){"devicemotion"===M.type.toLowerCase()&&this.updateDeviceMotion_(M.deviceMotionEvent)}},o.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new se(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new se(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},o.prototype.start=function(){this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),O()&&W()&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},o.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var ge=new se(1,0,0),oe=new se(0,0,1),Le={};screen.orientation?Le=screen.orientation:screen.msOrientation?Le=screen.msOrientation:Object.defineProperty(Le,"angle",{get:function(){return window.orientation||0}});var Ie=new re;Ie.setFromAxisAngle(ge,-Math.PI/2),Ie.multiply((new re).setFromAxisAngle(oe,Math.PI/2));var je=function(){function e(M){w(this,e),this.config=M,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new re,this._worldToScreenQ=new re,this._outQ=new re,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onOrientationChange(),this.init()}return y(e,[{key:"init",value:function(){var e=null;try{e=new RelativeOrientationSensor({frequency:60}),e.addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start()),window.addEventListener("orientationchange",this._onOrientationChange)}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new o(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var M=this._outQ;return M.copy(Ie),M.multiply(this._sensorQ),M.multiply(this._worldToScreenQ),this.config.YAW_ONLY&&(M.x=M.z=0,M.normalize()),this._out[0]=M.x,this._out[1]=M.y,this._out[2]=M.z,this._out[3]=M.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error)}},{key:"_onSensorRead",value:function(){}},{key:"_onOrientationChange",value:function(){var e=-Le.angle*Math.PI/180;this._worldToScreenQ.setFromAxisAngle(oe,e)}}]),e}();L.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var M=this.overlay.querySelector("img"),i=M.style;p()?(i.width="20%",i.marginLeft="40%",i.marginTop="3%"):(i.width="50%",i.marginLeft="25%",i.marginTop="25%")},L.prototype.hide=function(){this.overlay.style.display="none"},L.prototype.showTemporarily=function(e,M){this.show(M),this.timer=setTimeout(this.hide.bind(this),e)},L.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},L.prototype.update=function(){this.disableShowTemporarily(),!p()&&R()?this.show():this.hide()},L.prototype.loadIcon_=function(){ +this.icon=z("image/svg+xml","PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE5OHB4IiBoZWlnaHQ9IjI0MHB4IiB2aWV3Qm94PSIwIDAgMTk4IDI0MCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxuczpza2V0Y2g9Imh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaC9ucyI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDMuMy4zICgxMjA4MSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dHJhbnNpdGlvbjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ0cmFuc2l0aW9uIiBza2V0Y2g6dHlwZT0iTVNBcnRib2FyZEdyb3VwIj4KICAgICAgICAgICAgPGcgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTQtKy1JbXBvcnRlZC1MYXllcnMtQ29weS0rLUltcG9ydGVkLUxheWVycy1Db3B5LTItQ29weSIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iSW1wb3J0ZWQtTGF5ZXJzLUNvcHktNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDEwNy4wMDAwMDApIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTQ5LjYyNSwyLjUyNyBDMTQ5LjYyNSwyLjUyNyAxNTUuODA1LDYuMDk2IDE1Ni4zNjIsNi40MTggTDE1Ni4zNjIsNy4zMDQgQzE1Ni4zNjIsNy40ODEgMTU2LjM3NSw3LjY2NCAxNTYuNCw3Ljg1MyBDMTU2LjQxLDcuOTM0IDE1Ni40Miw4LjAxNSAxNTYuNDI3LDguMDk1IEMxNTYuNTY3LDkuNTEgMTU3LjQwMSwxMS4wOTMgMTU4LjUzMiwxMi4wOTQgTDE2NC4yNTIsMTcuMTU2IEwxNjQuMzMzLDE3LjA2NiBDMTY0LjMzMywxNy4wNjYgMTY4LjcxNSwxNC41MzYgMTY5LjU2OCwxNC4wNDIgQzE3MS4wMjUsMTQuODgzIDE5NS41MzgsMjkuMDM1IDE5NS41MzgsMjkuMDM1IEwxOTUuNTM4LDgzLjAzNiBDMTk1LjUzOCw4My44MDcgMTk1LjE1Miw4NC4yNTMgMTk0LjU5LDg0LjI1MyBDMTk0LjM1Nyw4NC4yNTMgMTk0LjA5NSw4NC4xNzcgMTkzLjgxOCw4NC4wMTcgTDE2OS44NTEsNzAuMTc5IEwxNjkuODM3LDcwLjIwMyBMMTQyLjUxNSw4NS45NzggTDE0MS42NjUsODQuNjU1IEMxMzYuOTM0LDgzLjEyNiAxMzEuOTE3LDgxLjkxNSAxMjYuNzE0LDgxLjA0NSBDMTI2LjcwOSw4MS4wNiAxMjYuNzA3LDgxLjA2OSAxMjYuNzA3LDgxLjA2OSBMMTIxLjY0LDk4LjAzIEwxMTMuNzQ5LDEwMi41ODYgTDExMy43MTIsMTAyLjUyMyBMMTEzLjcxMiwxMzAuMTEzIEMxMTMuNzEyLDEzMC44ODUgMTEzLjMyNiwxMzEuMzMgMTEyLjc2NCwxMzEuMzMgQzExMi41MzIsMTMxLjMzIDExMi4yNjksMTMxLjI1NCAxMTEuOTkyLDEzMS4wOTQgTDY5LjUxOSwxMDYuNTcyIEM2OC41NjksMTA2LjAyMyA2Ny43OTksMTA0LjY5NSA2Ny43OTksMTAzLjYwNSBMNjcuNzk5LDEwMi41NyBMNjcuNzc4LDEwMi42MTcgQzY3LjI3LDEwMi4zOTMgNjYuNjQ4LDEwMi4yNDkgNjUuOTYyLDEwMi4yMTggQzY1Ljg3NSwxMDIuMjE0IDY1Ljc4OCwxMDIuMjEyIDY1LjcwMSwxMDIuMjEyIEM2NS42MDYsMTAyLjIxMiA2NS41MTEsMTAyLjIxNSA2NS40MTYsMTAyLjIxOSBDNjUuMTk1LDEwMi4yMjkgNjQuOTc0LDEwMi4yMzUgNjQuNzU0LDEwMi4yMzUgQzY0LjMzMSwxMDIuMjM1IDYzLjkxMSwxMDIuMjE2IDYzLjQ5OCwxMDIuMTc4IEM2MS44NDMsMTAyLjAyNSA2MC4yOTgsMTAxLjU3OCA1OS4wOTQsMTAwLjg4MiBMMTIuNTE4LDczLjk5MiBMMTIuNTIzLDc0LjAwNCBMMi4yNDUsNTUuMjU0IEMxLjI0NCw1My40MjcgMi4wMDQsNTEuMDM4IDMuOTQzLDQ5LjkxOCBMNTkuOTU0LDE3LjU3MyBDNjAuNjI2LDE3LjE4NSA2MS4zNSwxNy4wMDEgNjIuMDUzLDE3LjAwMSBDNjMuMzc5LDE3LjAwMSA2NC42MjUsMTcuNjYgNjUuMjgsMTguODU0IEw2NS4yODUsMTguODUxIEw2NS41MTIsMTkuMjY0IEw2NS41MDYsMTkuMjY4IEM2NS45MDksMjAuMDAzIDY2LjQwNSwyMC42OCA2Ni45ODMsMjEuMjg2IEw2Ny4yNiwyMS41NTYgQzY5LjE3NCwyMy40MDYgNzEuNzI4LDI0LjM1NyA3NC4zNzMsMjQuMzU3IEM3Ni4zMjIsMjQuMzU3IDc4LjMyMSwyMy44NCA4MC4xNDgsMjIuNzg1IEM4MC4xNjEsMjIuNzg1IDg3LjQ2NywxOC41NjYgODcuNDY3LDE4LjU2NiBDODguMTM5LDE4LjE3OCA4OC44NjMsMTcuOTk0IDg5LjU2NiwxNy45OTQgQzkwLjg5MiwxNy45OTQgOTIuMTM4LDE4LjY1MiA5Mi43OTIsMTkuODQ3IEw5Ni4wNDIsMjUuNzc1IEw5Ni4wNjQsMjUuNzU3IEwxMDIuODQ5LDI5LjY3NCBMMTAyLjc0NCwyOS40OTIgTDE0OS42MjUsMi41MjcgTTE0OS42MjUsMC44OTIgQzE0OS4zNDMsMC44OTIgMTQ5LjA2MiwwLjk2NSAxNDguODEsMS4xMSBMMTAyLjY0MSwyNy42NjYgTDk3LjIzMSwyNC41NDIgTDk0LjIyNiwxOS4wNjEgQzkzLjMxMywxNy4zOTQgOTEuNTI3LDE2LjM1OSA4OS41NjYsMTYuMzU4IEM4OC41NTUsMTYuMzU4IDg3LjU0NiwxNi42MzIgODYuNjQ5LDE3LjE1IEM4My44NzgsMTguNzUgNzkuNjg3LDIxLjE2OSA3OS4zNzQsMjEuMzQ1IEM3OS4zNTksMjEuMzUzIDc5LjM0NSwyMS4zNjEgNzkuMzMsMjEuMzY5IEM3Ny43OTgsMjIuMjU0IDc2LjA4NCwyMi43MjIgNzQuMzczLDIyLjcyMiBDNzIuMDgxLDIyLjcyMiA2OS45NTksMjEuODkgNjguMzk3LDIwLjM4IEw2OC4xNDUsMjAuMTM1IEM2Ny43MDYsMTkuNjcyIDY3LjMyMywxOS4xNTYgNjcuMDA2LDE4LjYwMSBDNjYuOTg4LDE4LjU1OSA2Ni45NjgsMTguNTE5IDY2Ljk0NiwxOC40NzkgTDY2LjcxOSwxOC4wNjUgQzY2LjY5LDE4LjAxMiA2Ni42NTgsMTcuOTYgNjYuNjI0LDE3LjkxMSBDNjUuNjg2LDE2LjMzNyA2My45NTEsMTUuMzY2IDYyLjA1MywxNS4zNjYgQzYxLjA0MiwxNS4zNjYgNjAuMDMzLDE1LjY0IDU5LjEzNiwxNi4xNTggTDMuMTI1LDQ4LjUwMiBDMC40MjYsNTAuMDYxIC0wLjYxMyw1My40NDIgMC44MTEsNTYuMDQgTDExLjA4OSw3NC43OSBDMTEuMjY2LDc1LjExMyAxMS41MzcsNzUuMzUzIDExLjg1LDc1LjQ5NCBMNTguMjc2LDEwMi4yOTggQzU5LjY3OSwxMDMuMTA4IDYxLjQzMywxMDMuNjMgNjMuMzQ4LDEwMy44MDYgQzYzLjgxMiwxMDMuODQ4IDY0LjI4NSwxMDMuODcgNjQuNzU0LDEwMy44NyBDNjUsMTAzLjg3IDY1LjI0OSwxMDMuODY0IDY1LjQ5NCwxMDMuODUyIEM2NS41NjMsMTAzLjg0OSA2NS42MzIsMTAzLjg0NyA2NS43MDEsMTAzLjg0NyBDNjUuNzY0LDEwMy44NDcgNjUuODI4LDEwMy44NDkgNjUuODksMTAzLjg1MiBDNjUuOTg2LDEwMy44NTYgNjYuMDgsMTAzLjg2MyA2Ni4xNzMsMTAzLjg3NCBDNjYuMjgyLDEwNS40NjcgNjcuMzMyLDEwNy4xOTcgNjguNzAyLDEwNy45ODggTDExMS4xNzQsMTMyLjUxIEMxMTEuNjk4LDEzMi44MTIgMTEyLjIzMiwxMzIuOTY1IDExMi43NjQsMTMyLjk2NSBDMTE0LjI2MSwxMzIuOTY1IDExNS4zNDcsMTMxLjc2NSAxMTUuMzQ3LDEzMC4xMTMgTDExNS4zNDcsMTAzLjU1MSBMMTIyLjQ1OCw5OS40NDYgQzEyMi44MTksOTkuMjM3IDEyMy4wODcsOTguODk4IDEyMy4yMDcsOTguNDk4IEwxMjcuODY1LDgyLjkwNSBDMTMyLjI3OSw4My43MDIgMTM2LjU1Nyw4NC43NTMgMTQwLjYwNyw4Ni4wMzMgTDE0MS4xNCw4Ni44NjIgQzE0MS40NTEsODcuMzQ2IDE0MS45NzcsODcuNjEzIDE0Mi41MTYsODcuNjEzIEMxNDIuNzk0LDg3LjYxMyAxNDMuMDc2LDg3LjU0MiAxNDMuMzMzLDg3LjM5MyBMMTY5Ljg2NSw3Mi4wNzYgTDE5Myw4NS40MzMgQzE5My41MjMsODUuNzM1IDE5NC4wNTgsODUuODg4IDE5NC41OSw4NS44ODggQzE5Ni4wODcsODUuODg4IDE5Ny4xNzMsODQuNjg5IDE5Ny4xNzMsODMuMDM2IEwxOTcuMTczLDI5LjAzNSBDMTk3LjE3MywyOC40NTEgMTk2Ljg2MSwyNy45MTEgMTk2LjM1NSwyNy42MTkgQzE5Ni4zNTUsMjcuNjE5IDE3MS44NDMsMTMuNDY3IDE3MC4zODUsMTIuNjI2IEMxNzAuMTMyLDEyLjQ4IDE2OS44NSwxMi40MDcgMTY5LjU2OCwxMi40MDcgQzE2OS4yODUsMTIuNDA3IDE2OS4wMDIsMTIuNDgxIDE2OC43NDksMTIuNjI3IEMxNjguMTQzLDEyLjk3OCAxNjUuNzU2LDE0LjM1NyAxNjQuNDI0LDE1LjEyNSBMMTU5LjYxNSwxMC44NyBDMTU4Ljc5NiwxMC4xNDUgMTU4LjE1NCw4LjkzNyAxNTguMDU0LDcuOTM0IEMxNTguMDQ1LDcuODM3IDE1OC4wMzQsNy43MzkgMTU4LjAyMSw3LjY0IEMxNTguMDA1LDcuNTIzIDE1Ny45OTgsNy40MSAxNTcuOTk4LDcuMzA0IEwxNTcuOTk4LDYuNDE4IEMxNTcuOTk4LDUuODM0IDE1Ny42ODYsNS4yOTUgMTU3LjE4MSw1LjAwMiBDMTU2LjYyNCw0LjY4IDE1MC40NDIsMS4xMTEgMTUwLjQ0MiwxLjExMSBDMTUwLjE4OSwwLjk2NSAxNDkuOTA3LDAuODkyIDE0OS42MjUsMC44OTIiIGlkPSJGaWxsLTEiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOTYuMDI3LDI1LjYzNiBMMTQyLjYwMyw1Mi41MjcgQzE0My44MDcsNTMuMjIyIDE0NC41ODIsNTQuMTE0IDE0NC44NDUsNTUuMDY4IEwxNDQuODM1LDU1LjA3NSBMNjMuNDYxLDEwMi4wNTcgTDYzLjQ2LDEwMi4wNTcgQzYxLjgwNiwxMDEuOTA1IDYwLjI2MSwxMDEuNDU3IDU5LjA1NywxMDAuNzYyIEwxMi40ODEsNzMuODcxIEw5Ni4wMjcsMjUuNjM2IiBpZD0iRmlsbC0yIiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYzLjQ2MSwxMDIuMTc0IEM2My40NTMsMTAyLjE3NCA2My40NDYsMTAyLjE3NCA2My40MzksMTAyLjE3MiBDNjEuNzQ2LDEwMi4wMTYgNjAuMjExLDEwMS41NjMgNTguOTk4LDEwMC44NjMgTDEyLjQyMiw3My45NzMgQzEyLjM4Niw3My45NTIgMTIuMzY0LDczLjkxNCAxMi4zNjQsNzMuODcxIEMxMi4zNjQsNzMuODMgMTIuMzg2LDczLjc5MSAxMi40MjIsNzMuNzcgTDk1Ljk2OCwyNS41MzUgQzk2LjAwNCwyNS41MTQgOTYuMDQ5LDI1LjUxNCA5Ni4wODUsMjUuNTM1IEwxNDIuNjYxLDUyLjQyNiBDMTQzLjg4OCw1My4xMzQgMTQ0LjY4Miw1NC4wMzggMTQ0Ljk1Nyw1NS4wMzcgQzE0NC45Nyw1NS4wODMgMTQ0Ljk1Myw1NS4xMzMgMTQ0LjkxNSw1NS4xNjEgQzE0NC45MTEsNTUuMTY1IDE0NC44OTgsNTUuMTc0IDE0NC44OTQsNTUuMTc3IEw2My41MTksMTAyLjE1OCBDNjMuNTAxLDEwMi4xNjkgNjMuNDgxLDEwMi4xNzQgNjMuNDYxLDEwMi4xNzQgTDYzLjQ2MSwxMDIuMTc0IFogTTEyLjcxNCw3My44NzEgTDU5LjExNSwxMDAuNjYxIEM2MC4yOTMsMTAxLjM0MSA2MS43ODYsMTAxLjc4MiA2My40MzUsMTAxLjkzNyBMMTQ0LjcwNyw1NS4wMTUgQzE0NC40MjgsNTQuMTA4IDE0My42ODIsNTMuMjg1IDE0Mi41NDQsNTIuNjI4IEw5Ni4wMjcsMjUuNzcxIEwxMi43MTQsNzMuODcxIEwxMi43MTQsNzMuODcxIFoiIGlkPSJGaWxsLTMiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTQ4LjMyNyw1OC40NzEgQzE0OC4xNDUsNTguNDggMTQ3Ljk2Miw1OC40OCAxNDcuNzgxLDU4LjQ3MiBDMTQ1Ljg4Nyw1OC4zODkgMTQ0LjQ3OSw1Ny40MzQgMTQ0LjYzNiw1Ni4zNCBDMTQ0LjY4OSw1NS45NjcgMTQ0LjY2NCw1NS41OTcgMTQ0LjU2NCw1NS4yMzUgTDYzLjQ2MSwxMDIuMDU3IEM2NC4wODksMTAyLjExNSA2NC43MzMsMTAyLjEzIDY1LjM3OSwxMDIuMDk5IEM2NS41NjEsMTAyLjA5IDY1Ljc0MywxMDIuMDkgNjUuOTI1LDEwMi4wOTggQzY3LjgxOSwxMDIuMTgxIDY5LjIyNywxMDMuMTM2IDY5LjA3LDEwNC4yMyBMMTQ4LjMyNyw1OC40NzEiIGlkPSJGaWxsLTQiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNjkuMDcsMTA0LjM0NyBDNjkuMDQ4LDEwNC4zNDcgNjkuMDI1LDEwNC4zNCA2OS4wMDUsMTA0LjMyNyBDNjguOTY4LDEwNC4zMDEgNjguOTQ4LDEwNC4yNTcgNjguOTU1LDEwNC4yMTMgQzY5LDEwMy44OTYgNjguODk4LDEwMy41NzYgNjguNjU4LDEwMy4yODggQzY4LjE1MywxMDIuNjc4IDY3LjEwMywxMDIuMjY2IDY1LjkyLDEwMi4yMTQgQzY1Ljc0MiwxMDIuMjA2IDY1LjU2MywxMDIuMjA3IDY1LjM4NSwxMDIuMjE1IEM2NC43NDIsMTAyLjI0NiA2NC4wODcsMTAyLjIzMiA2My40NSwxMDIuMTc0IEM2My4zOTksMTAyLjE2OSA2My4zNTgsMTAyLjEzMiA2My4zNDcsMTAyLjA4MiBDNjMuMzM2LDEwMi4wMzMgNjMuMzU4LDEwMS45ODEgNjMuNDAyLDEwMS45NTYgTDE0NC41MDYsNTUuMTM0IEMxNDQuNTM3LDU1LjExNiAxNDQuNTc1LDU1LjExMyAxNDQuNjA5LDU1LjEyNyBDMTQ0LjY0Miw1NS4xNDEgMTQ0LjY2OCw1NS4xNyAxNDQuNjc3LDU1LjIwNCBDMTQ0Ljc4MSw1NS41ODUgMTQ0LjgwNiw1NS45NzIgMTQ0Ljc1MSw1Ni4zNTcgQzE0NC43MDYsNTYuNjczIDE0NC44MDgsNTYuOTk0IDE0NS4wNDcsNTcuMjgyIEMxNDUuNTUzLDU3Ljg5MiAxNDYuNjAyLDU4LjMwMyAxNDcuNzg2LDU4LjM1NSBDMTQ3Ljk2NCw1OC4zNjMgMTQ4LjE0Myw1OC4zNjMgMTQ4LjMyMSw1OC4zNTQgQzE0OC4zNzcsNTguMzUyIDE0OC40MjQsNTguMzg3IDE0OC40MzksNTguNDM4IEMxNDguNDU0LDU4LjQ5IDE0OC40MzIsNTguNTQ1IDE0OC4zODUsNTguNTcyIEw2OS4xMjksMTA0LjMzMSBDNjkuMTExLDEwNC4zNDIgNjkuMDksMTA0LjM0NyA2OS4wNywxMDQuMzQ3IEw2OS4wNywxMDQuMzQ3IFogTTY1LjY2NSwxMDEuOTc1IEM2NS43NTQsMTAxLjk3NSA2NS44NDIsMTAxLjk3NyA2NS45MywxMDEuOTgxIEM2Ny4xOTYsMTAyLjAzNyA2OC4yODMsMTAyLjQ2OSA2OC44MzgsMTAzLjEzOSBDNjkuMDY1LDEwMy40MTMgNjkuMTg4LDEwMy43MTQgNjkuMTk4LDEwNC4wMjEgTDE0Ny44ODMsNTguNTkyIEMxNDcuODQ3LDU4LjU5MiAxNDcuODExLDU4LjU5MSAxNDcuNzc2LDU4LjU4OSBDMTQ2LjUwOSw1OC41MzMgMTQ1LjQyMiw1OC4xIDE0NC44NjcsNTcuNDMxIEMxNDQuNTg1LDU3LjA5MSAxNDQuNDY1LDU2LjcwNyAxNDQuNTIsNTYuMzI0IEMxNDQuNTYzLDU2LjAyMSAxNDQuNTUyLDU1LjcxNiAxNDQuNDg4LDU1LjQxNCBMNjMuODQ2LDEwMS45NyBDNjQuMzUzLDEwMi4wMDIgNjQuODY3LDEwMi4wMDYgNjUuMzc0LDEwMS45ODIgQzY1LjQ3MSwxMDEuOTc3IDY1LjU2OCwxMDEuOTc1IDY1LjY2NSwxMDEuOTc1IEw2NS42NjUsMTAxLjk3NSBaIiBpZD0iRmlsbC01IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTIuMjA4LDU1LjEzNCBDMS4yMDcsNTMuMzA3IDEuOTY3LDUwLjkxNyAzLjkwNiw0OS43OTcgTDU5LjkxNywxNy40NTMgQzYxLjg1NiwxNi4zMzMgNjQuMjQxLDE2LjkwNyA2NS4yNDMsMTguNzM0IEw2NS40NzUsMTkuMTQ0IEM2NS44NzIsMTkuODgyIDY2LjM2OCwyMC41NiA2Ni45NDUsMjEuMTY1IEw2Ny4yMjMsMjEuNDM1IEM3MC41NDgsMjQuNjQ5IDc1LjgwNiwyNS4xNTEgODAuMTExLDIyLjY2NSBMODcuNDMsMTguNDQ1IEM4OS4zNywxNy4zMjYgOTEuNzU0LDE3Ljg5OSA5Mi43NTUsMTkuNzI3IEw5Ni4wMDUsMjUuNjU1IEwxMi40ODYsNzMuODg0IEwyLjIwOCw1NS4xMzQgWiIgaWQ9IkZpbGwtNiIgZmlsbD0iI0ZBRkFGQSI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMi40ODYsNzQuMDAxIEMxMi40NzYsNzQuMDAxIDEyLjQ2NSw3My45OTkgMTIuNDU1LDczLjk5NiBDMTIuNDI0LDczLjk4OCAxMi4zOTksNzMuOTY3IDEyLjM4NCw3My45NCBMMi4xMDYsNTUuMTkgQzEuMDc1LDUzLjMxIDEuODU3LDUwLjg0NSAzLjg0OCw0OS42OTYgTDU5Ljg1OCwxNy4zNTIgQzYwLjUyNSwxNi45NjcgNjEuMjcxLDE2Ljc2NCA2Mi4wMTYsMTYuNzY0IEM2My40MzEsMTYuNzY0IDY0LjY2NiwxNy40NjYgNjUuMzI3LDE4LjY0NiBDNjUuMzM3LDE4LjY1NCA2NS4zNDUsMTguNjYzIDY1LjM1MSwxOC42NzQgTDY1LjU3OCwxOS4wODggQzY1LjU4NCwxOS4xIDY1LjU4OSwxOS4xMTIgNjUuNTkxLDE5LjEyNiBDNjUuOTg1LDE5LjgzOCA2Ni40NjksMjAuNDk3IDY3LjAzLDIxLjA4NSBMNjcuMzA1LDIxLjM1MSBDNjkuMTUxLDIzLjEzNyA3MS42NDksMjQuMTIgNzQuMzM2LDI0LjEyIEM3Ni4zMTMsMjQuMTIgNzguMjksMjMuNTgyIDgwLjA1MywyMi41NjMgQzgwLjA2NCwyMi41NTcgODAuMDc2LDIyLjU1MyA4MC4wODgsMjIuNTUgTDg3LjM3MiwxOC4zNDQgQzg4LjAzOCwxNy45NTkgODguNzg0LDE3Ljc1NiA4OS41MjksMTcuNzU2IEM5MC45NTYsMTcuNzU2IDkyLjIwMSwxOC40NzIgOTIuODU4LDE5LjY3IEw5Ni4xMDcsMjUuNTk5IEM5Ni4xMzgsMjUuNjU0IDk2LjExOCwyNS43MjQgOTYuMDYzLDI1Ljc1NiBMMTIuNTQ1LDczLjk4NSBDMTIuNTI2LDczLjk5NiAxMi41MDYsNzQuMDAxIDEyLjQ4Niw3NC4wMDEgTDEyLjQ4Niw3NC4wMDEgWiBNNjIuMDE2LDE2Ljk5NyBDNjEuMzEyLDE2Ljk5NyA2MC42MDYsMTcuMTkgNTkuOTc1LDE3LjU1NCBMMy45NjUsNDkuODk5IEMyLjA4Myw1MC45ODUgMS4zNDEsNTMuMzA4IDIuMzEsNTUuMDc4IEwxMi41MzEsNzMuNzIzIEw5NS44NDgsMjUuNjExIEw5Mi42NTMsMTkuNzgyIEM5Mi4wMzgsMTguNjYgOTAuODcsMTcuOTkgODkuNTI5LDE3Ljk5IEM4OC44MjUsMTcuOTkgODguMTE5LDE4LjE4MiA4Ny40ODksMTguNTQ3IEw4MC4xNzIsMjIuNzcyIEM4MC4xNjEsMjIuNzc4IDgwLjE0OSwyMi43ODIgODAuMTM3LDIyLjc4NSBDNzguMzQ2LDIzLjgxMSA3Ni4zNDEsMjQuMzU0IDc0LjMzNiwyNC4zNTQgQzcxLjU4OCwyNC4zNTQgNjkuMDMzLDIzLjM0NyA2Ny4xNDIsMjEuNTE5IEw2Ni44NjQsMjEuMjQ5IEM2Ni4yNzcsMjAuNjM0IDY1Ljc3NCwxOS45NDcgNjUuMzY3LDE5LjIwMyBDNjUuMzYsMTkuMTkyIDY1LjM1NiwxOS4xNzkgNjUuMzU0LDE5LjE2NiBMNjUuMTYzLDE4LjgxOSBDNjUuMTU0LDE4LjgxMSA2NS4xNDYsMTguODAxIDY1LjE0LDE4Ljc5IEM2NC41MjUsMTcuNjY3IDYzLjM1NywxNi45OTcgNjIuMDE2LDE2Ljk5NyBMNjIuMDE2LDE2Ljk5NyBaIiBpZD0iRmlsbC03IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTQyLjQzNCw0OC44MDggTDQyLjQzNCw0OC44MDggQzM5LjkyNCw0OC44MDcgMzcuNzM3LDQ3LjU1IDM2LjU4Miw0NS40NDMgQzM0Ljc3MSw0Mi4xMzkgMzYuMTQ0LDM3LjgwOSAzOS42NDEsMzUuNzg5IEw1MS45MzIsMjguNjkxIEM1My4xMDMsMjguMDE1IDU0LjQxMywyNy42NTggNTUuNzIxLDI3LjY1OCBDNTguMjMxLDI3LjY1OCA2MC40MTgsMjguOTE2IDYxLjU3MywzMS4wMjMgQzYzLjM4NCwzNC4zMjcgNjIuMDEyLDM4LjY1NyA1OC41MTQsNDAuNjc3IEw0Ni4yMjMsNDcuNzc1IEM0NS4wNTMsNDguNDUgNDMuNzQyLDQ4LjgwOCA0Mi40MzQsNDguODA4IEw0Mi40MzQsNDguODA4IFogTTU1LjcyMSwyOC4xMjUgQzU0LjQ5NSwyOC4xMjUgNTMuMjY1LDI4LjQ2MSA1Mi4xNjYsMjkuMDk2IEwzOS44NzUsMzYuMTk0IEMzNi41OTYsMzguMDg3IDM1LjMwMiw0Mi4xMzYgMzYuOTkyLDQ1LjIxOCBDMzguMDYzLDQ3LjE3MyA0MC4wOTgsNDguMzQgNDIuNDM0LDQ4LjM0IEM0My42NjEsNDguMzQgNDQuODksNDguMDA1IDQ1Ljk5LDQ3LjM3IEw1OC4yODEsNDAuMjcyIEM2MS41NiwzOC4zNzkgNjIuODUzLDM0LjMzIDYxLjE2NCwzMS4yNDggQzYwLjA5MiwyOS4yOTMgNTguMDU4LDI4LjEyNSA1NS43MjEsMjguMTI1IEw1NS43MjEsMjguMTI1IFoiIGlkPSJGaWxsLTgiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTQ5LjU4OCwyLjQwNyBDMTQ5LjU4OCwyLjQwNyAxNTUuNzY4LDUuOTc1IDE1Ni4zMjUsNi4yOTcgTDE1Ni4zMjUsNy4xODQgQzE1Ni4zMjUsNy4zNiAxNTYuMzM4LDcuNTQ0IDE1Ni4zNjIsNy43MzMgQzE1Ni4zNzMsNy44MTQgMTU2LjM4Miw3Ljg5NCAxNTYuMzksNy45NzUgQzE1Ni41Myw5LjM5IDE1Ny4zNjMsMTAuOTczIDE1OC40OTUsMTEuOTc0IEwxNjUuODkxLDE4LjUxOSBDMTY2LjA2OCwxOC42NzUgMTY2LjI0OSwxOC44MTQgMTY2LjQzMiwxOC45MzQgQzE2OC4wMTEsMTkuOTc0IDE2OS4zODIsMTkuNCAxNjkuNDk0LDE3LjY1MiBDMTY5LjU0MywxNi44NjggMTY5LjU1MSwxNi4wNTcgMTY5LjUxNywxNS4yMjMgTDE2OS41MTQsMTUuMDYzIEwxNjkuNTE0LDEzLjkxMiBDMTcwLjc4LDE0LjY0MiAxOTUuNTAxLDI4LjkxNSAxOTUuNTAxLDI4LjkxNSBMMTk1LjUwMSw4Mi45MTUgQzE5NS41MDEsODQuMDA1IDE5NC43MzEsODQuNDQ1IDE5My43ODEsODMuODk3IEwxNTEuMzA4LDU5LjM3NCBDMTUwLjM1OCw1OC44MjYgMTQ5LjU4OCw1Ny40OTcgMTQ5LjU4OCw1Ni40MDggTDE0OS41ODgsMjIuMzc1IiBpZD0iRmlsbC05IiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE5NC41NTMsODQuMjUgQzE5NC4yOTYsODQuMjUgMTk0LjAxMyw4NC4xNjUgMTkzLjcyMiw4My45OTcgTDE1MS4yNSw1OS40NzYgQzE1MC4yNjksNTguOTA5IDE0OS40NzEsNTcuNTMzIDE0OS40NzEsNTYuNDA4IEwxNDkuNDcxLDIyLjM3NSBMMTQ5LjcwNSwyMi4zNzUgTDE0OS43MDUsNTYuNDA4IEMxNDkuNzA1LDU3LjQ1OSAxNTAuNDUsNTguNzQ0IDE1MS4zNjYsNTkuMjc0IEwxOTMuODM5LDgzLjc5NSBDMTk0LjI2Myw4NC4wNCAxOTQuNjU1LDg0LjA4MyAxOTQuOTQyLDgzLjkxNyBDMTk1LjIyNyw4My43NTMgMTk1LjM4NCw4My4zOTcgMTk1LjM4NCw4Mi45MTUgTDE5NS4zODQsMjguOTgyIEMxOTQuMTAyLDI4LjI0MiAxNzIuMTA0LDE1LjU0MiAxNjkuNjMxLDE0LjExNCBMMTY5LjYzNCwxNS4yMiBDMTY5LjY2OCwxNi4wNTIgMTY5LjY2LDE2Ljg3NCAxNjkuNjEsMTcuNjU5IEMxNjkuNTU2LDE4LjUwMyAxNjkuMjE0LDE5LjEyMyAxNjguNjQ3LDE5LjQwNSBDMTY4LjAyOCwxOS43MTQgMTY3LjE5NywxOS41NzggMTY2LjM2NywxOS4wMzIgQzE2Ni4xODEsMTguOTA5IDE2NS45OTUsMTguNzY2IDE2NS44MTQsMTguNjA2IEwxNTguNDE3LDEyLjA2MiBDMTU3LjI1OSwxMS4wMzYgMTU2LjQxOCw5LjQzNyAxNTYuMjc0LDcuOTg2IEMxNTYuMjY2LDcuOTA3IDE1Ni4yNTcsNy44MjcgMTU2LjI0Nyw3Ljc0OCBDMTU2LjIyMSw3LjU1NSAxNTYuMjA5LDcuMzY1IDE1Ni4yMDksNy4xODQgTDE1Ni4yMDksNi4zNjQgQzE1NS4zNzUsNS44ODMgMTQ5LjUyOSwyLjUwOCAxNDkuNTI5LDIuNTA4IEwxNDkuNjQ2LDIuMzA2IEMxNDkuNjQ2LDIuMzA2IDE1NS44MjcsNS44NzQgMTU2LjM4NCw2LjE5NiBMMTU2LjQ0Miw2LjIzIEwxNTYuNDQyLDcuMTg0IEMxNTYuNDQyLDcuMzU1IDE1Ni40NTQsNy41MzUgMTU2LjQ3OCw3LjcxNyBDMTU2LjQ4OSw3LjggMTU2LjQ5OSw3Ljg4MiAxNTYuNTA3LDcuOTYzIEMxNTYuNjQ1LDkuMzU4IDE1Ny40NTUsMTAuODk4IDE1OC41NzIsMTEuODg2IEwxNjUuOTY5LDE4LjQzMSBDMTY2LjE0MiwxOC41ODQgMTY2LjMxOSwxOC43MiAxNjYuNDk2LDE4LjgzNyBDMTY3LjI1NCwxOS4zMzYgMTY4LDE5LjQ2NyAxNjguNTQzLDE5LjE5NiBDMTY5LjAzMywxOC45NTMgMTY5LjMyOSwxOC40MDEgMTY5LjM3NywxNy42NDUgQzE2OS40MjcsMTYuODY3IDE2OS40MzQsMTYuMDU0IDE2OS40MDEsMTUuMjI4IEwxNjkuMzk3LDE1LjA2NSBMMTY5LjM5NywxMy43MSBMMTY5LjU3MiwxMy44MSBDMTcwLjgzOSwxNC41NDEgMTk1LjU1OSwyOC44MTQgMTk1LjU1OSwyOC44MTQgTDE5NS42MTgsMjguODQ3IEwxOTUuNjE4LDgyLjkxNSBDMTk1LjYxOCw4My40ODQgMTk1LjQyLDgzLjkxMSAxOTUuMDU5LDg0LjExOSBDMTk0LjkwOCw4NC4yMDYgMTk0LjczNyw4NC4yNSAxOTQuNTUzLDg0LjI1IiBpZD0iRmlsbC0xMCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNDUuNjg1LDU2LjE2MSBMMTY5LjgsNzAuMDgzIEwxNDMuODIyLDg1LjA4MSBMMTQyLjM2LDg0Ljc3NCBDMTM1LjgyNiw4Mi42MDQgMTI4LjczMiw4MS4wNDYgMTIxLjM0MSw4MC4xNTggQzExNi45NzYsNzkuNjM0IDExMi42NzgsODEuMjU0IDExMS43NDMsODMuNzc4IEMxMTEuNTA2LDg0LjQxNCAxMTEuNTAzLDg1LjA3MSAxMTEuNzMyLDg1LjcwNiBDMTEzLjI3LDg5Ljk3MyAxMTUuOTY4LDk0LjA2OSAxMTkuNzI3LDk3Ljg0MSBMMTIwLjI1OSw5OC42ODYgQzEyMC4yNiw5OC42ODUgOTQuMjgyLDExMy42ODMgOTQuMjgyLDExMy42ODMgTDcwLjE2Nyw5OS43NjEgTDE0NS42ODUsNTYuMTYxIiBpZD0iRmlsbC0xMSIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik05NC4yODIsMTEzLjgxOCBMOTQuMjIzLDExMy43ODUgTDY5LjkzMyw5OS43NjEgTDcwLjEwOCw5OS42NiBMMTQ1LjY4NSw1Ni4wMjYgTDE0NS43NDMsNTYuMDU5IEwxNzAuMDMzLDcwLjA4MyBMMTQzLjg0Miw4NS4yMDUgTDE0My43OTcsODUuMTk1IEMxNDMuNzcyLDg1LjE5IDE0Mi4zMzYsODQuODg4IDE0Mi4zMzYsODQuODg4IEMxMzUuNzg3LDgyLjcxNCAxMjguNzIzLDgxLjE2MyAxMjEuMzI3LDgwLjI3NCBDMTIwLjc4OCw4MC4yMDkgMTIwLjIzNiw4MC4xNzcgMTE5LjY4OSw4MC4xNzcgQzExNS45MzEsODAuMTc3IDExMi42MzUsODEuNzA4IDExMS44NTIsODMuODE5IEMxMTEuNjI0LDg0LjQzMiAxMTEuNjIxLDg1LjA1MyAxMTEuODQyLDg1LjY2NyBDMTEzLjM3Nyw4OS45MjUgMTE2LjA1OCw5My45OTMgMTE5LjgxLDk3Ljc1OCBMMTE5LjgyNiw5Ny43NzkgTDEyMC4zNTIsOTguNjE0IEMxMjAuMzU0LDk4LjYxNyAxMjAuMzU2LDk4LjYyIDEyMC4zNTgsOTguNjI0IEwxMjAuNDIyLDk4LjcyNiBMMTIwLjMxNyw5OC43ODcgQzEyMC4yNjQsOTguODE4IDk0LjU5OSwxMTMuNjM1IDk0LjM0LDExMy43ODUgTDk0LjI4MiwxMTMuODE4IEw5NC4yODIsMTEzLjgxOCBaIE03MC40MDEsOTkuNzYxIEw5NC4yODIsMTEzLjU0OSBMMTE5LjA4NCw5OS4yMjkgQzExOS42Myw5OC45MTQgMTE5LjkzLDk4Ljc0IDEyMC4xMDEsOTguNjU0IEwxMTkuNjM1LDk3LjkxNCBDMTE1Ljg2NCw5NC4xMjcgMTEzLjE2OCw5MC4wMzMgMTExLjYyMiw4NS43NDYgQzExMS4zODIsODUuMDc5IDExMS4zODYsODQuNDA0IDExMS42MzMsODMuNzM4IEMxMTIuNDQ4LDgxLjUzOSAxMTUuODM2LDc5Ljk0MyAxMTkuNjg5LDc5Ljk0MyBDMTIwLjI0Niw3OS45NDMgMTIwLjgwNiw3OS45NzYgMTIxLjM1NSw4MC4wNDIgQzEyOC43NjcsODAuOTMzIDEzNS44NDYsODIuNDg3IDE0Mi4zOTYsODQuNjYzIEMxNDMuMjMyLDg0LjgzOCAxNDMuNjExLDg0LjkxNyAxNDMuNzg2LDg0Ljk2NyBMMTY5LjU2Niw3MC4wODMgTDE0NS42ODUsNTYuMjk1IEw3MC40MDEsOTkuNzYxIEw3MC40MDEsOTkuNzYxIFoiIGlkPSJGaWxsLTEyIiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2Ny4yMywxOC45NzkgTDE2Ny4yMyw2OS44NSBMMTM5LjkwOSw4NS42MjMgTDEzMy40NDgsNzEuNDU2IEMxMzIuNTM4LDY5LjQ2IDEzMC4wMiw2OS43MTggMTI3LjgyNCw3Mi4wMyBDMTI2Ljc2OSw3My4xNCAxMjUuOTMxLDc0LjU4NSAxMjUuNDk0LDc2LjA0OCBMMTE5LjAzNCw5Ny42NzYgTDkxLjcxMiwxMTMuNDUgTDkxLjcxMiw2Mi41NzkgTDE2Ny4yMywxOC45NzkiIGlkPSJGaWxsLTEzIiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTkxLjcxMiwxMTMuNTY3IEM5MS42OTIsMTEzLjU2NyA5MS42NzIsMTEzLjU2MSA5MS42NTMsMTEzLjU1MSBDOTEuNjE4LDExMy41MyA5MS41OTUsMTEzLjQ5MiA5MS41OTUsMTEzLjQ1IEw5MS41OTUsNjIuNTc5IEM5MS41OTUsNjIuNTM3IDkxLjYxOCw2Mi40OTkgOTEuNjUzLDYyLjQ3OCBMMTY3LjE3MiwxOC44NzggQzE2Ny4yMDgsMTguODU3IDE2Ny4yNTIsMTguODU3IDE2Ny4yODgsMTguODc4IEMxNjcuMzI0LDE4Ljg5OSAxNjcuMzQ3LDE4LjkzNyAxNjcuMzQ3LDE4Ljk3OSBMMTY3LjM0Nyw2OS44NSBDMTY3LjM0Nyw2OS44OTEgMTY3LjMyNCw2OS45MyAxNjcuMjg4LDY5Ljk1IEwxMzkuOTY3LDg1LjcyNSBDMTM5LjkzOSw4NS43NDEgMTM5LjkwNSw4NS43NDUgMTM5Ljg3Myw4NS43MzUgQzEzOS44NDIsODUuNzI1IDEzOS44MTYsODUuNzAyIDEzOS44MDIsODUuNjcyIEwxMzMuMzQyLDcxLjUwNCBDMTMyLjk2Nyw3MC42ODIgMTMyLjI4LDcwLjIyOSAxMzEuNDA4LDcwLjIyOSBDMTMwLjMxOSw3MC4yMjkgMTI5LjA0NCw3MC45MTUgMTI3LjkwOCw3Mi4xMSBDMTI2Ljg3NCw3My4yIDEyNi4wMzQsNzQuNjQ3IDEyNS42MDYsNzYuMDgyIEwxMTkuMTQ2LDk3LjcwOSBDMTE5LjEzNyw5Ny43MzggMTE5LjExOCw5Ny43NjIgMTE5LjA5Miw5Ny43NzcgTDkxLjc3LDExMy41NTEgQzkxLjc1MiwxMTMuNTYxIDkxLjczMiwxMTMuNTY3IDkxLjcxMiwxMTMuNTY3IEw5MS43MTIsMTEzLjU2NyBaIE05MS44MjksNjIuNjQ3IEw5MS44MjksMTEzLjI0OCBMMTE4LjkzNSw5Ny41OTggTDEyNS4zODIsNzYuMDE1IEMxMjUuODI3LDc0LjUyNSAxMjYuNjY0LDczLjA4MSAxMjcuNzM5LDcxLjk1IEMxMjguOTE5LDcwLjcwOCAxMzAuMjU2LDY5Ljk5NiAxMzEuNDA4LDY5Ljk5NiBDMTMyLjM3Nyw2OS45OTYgMTMzLjEzOSw3MC40OTcgMTMzLjU1NCw3MS40MDcgTDEzOS45NjEsODUuNDU4IEwxNjcuMTEzLDY5Ljc4MiBMMTY3LjExMywxOS4xODEgTDkxLjgyOSw2Mi42NDcgTDkxLjgyOSw2Mi42NDcgWiIgaWQ9IkZpbGwtMTQiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTY4LjU0MywxOS4yMTMgTDE2OC41NDMsNzAuMDgzIEwxNDEuMjIxLDg1Ljg1NyBMMTM0Ljc2MSw3MS42ODkgQzEzMy44NTEsNjkuNjk0IDEzMS4zMzMsNjkuOTUxIDEyOS4xMzcsNzIuMjYzIEMxMjguMDgyLDczLjM3NCAxMjcuMjQ0LDc0LjgxOSAxMjYuODA3LDc2LjI4MiBMMTIwLjM0Niw5Ny45MDkgTDkzLjAyNSwxMTMuNjgzIEw5My4wMjUsNjIuODEzIEwxNjguNTQzLDE5LjIxMyIgaWQ9IkZpbGwtMTUiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOTMuMDI1LDExMy44IEM5My4wMDUsMTEzLjggOTIuOTg0LDExMy43OTUgOTIuOTY2LDExMy43ODUgQzkyLjkzMSwxMTMuNzY0IDkyLjkwOCwxMTMuNzI1IDkyLjkwOCwxMTMuNjg0IEw5Mi45MDgsNjIuODEzIEM5Mi45MDgsNjIuNzcxIDkyLjkzMSw2Mi43MzMgOTIuOTY2LDYyLjcxMiBMMTY4LjQ4NCwxOS4xMTIgQzE2OC41MiwxOS4wOSAxNjguNTY1LDE5LjA5IDE2OC42MDEsMTkuMTEyIEMxNjguNjM3LDE5LjEzMiAxNjguNjYsMTkuMTcxIDE2OC42NiwxOS4yMTIgTDE2OC42Niw3MC4wODMgQzE2OC42Niw3MC4xMjUgMTY4LjYzNyw3MC4xNjQgMTY4LjYwMSw3MC4xODQgTDE0MS4yOCw4NS45NTggQzE0MS4yNTEsODUuOTc1IDE0MS4yMTcsODUuOTc5IDE0MS4xODYsODUuOTY4IEMxNDEuMTU0LDg1Ljk1OCAxNDEuMTI5LDg1LjkzNiAxNDEuMTE1LDg1LjkwNiBMMTM0LjY1NSw3MS43MzggQzEzNC4yOCw3MC45MTUgMTMzLjU5Myw3MC40NjMgMTMyLjcyLDcwLjQ2MyBDMTMxLjYzMiw3MC40NjMgMTMwLjM1Nyw3MS4xNDggMTI5LjIyMSw3Mi4zNDQgQzEyOC4xODYsNzMuNDMzIDEyNy4zNDcsNzQuODgxIDEyNi45MTksNzYuMzE1IEwxMjAuNDU4LDk3Ljk0MyBDMTIwLjQ1LDk3Ljk3MiAxMjAuNDMxLDk3Ljk5NiAxMjAuNDA1LDk4LjAxIEw5My4wODMsMTEzLjc4NSBDOTMuMDY1LDExMy43OTUgOTMuMDQ1LDExMy44IDkzLjAyNSwxMTMuOCBMOTMuMDI1LDExMy44IFogTTkzLjE0Miw2Mi44ODEgTDkzLjE0MiwxMTMuNDgxIEwxMjAuMjQ4LDk3LjgzMiBMMTI2LjY5NSw3Ni4yNDggQzEyNy4xNCw3NC43NTggMTI3Ljk3Nyw3My4zMTUgMTI5LjA1Miw3Mi4xODMgQzEzMC4yMzEsNzAuOTQyIDEzMS41NjgsNzAuMjI5IDEzMi43Miw3MC4yMjkgQzEzMy42ODksNzAuMjI5IDEzNC40NTIsNzAuNzMxIDEzNC44NjcsNzEuNjQxIEwxNDEuMjc0LDg1LjY5MiBMMTY4LjQyNiw3MC4wMTYgTDE2OC40MjYsMTkuNDE1IEw5My4xNDIsNjIuODgxIEw5My4xNDIsNjIuODgxIFoiIGlkPSJGaWxsLTE2IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2OS44LDcwLjA4MyBMMTQyLjQ3OCw4NS44NTcgTDEzNi4wMTgsNzEuNjg5IEMxMzUuMTA4LDY5LjY5NCAxMzIuNTksNjkuOTUxIDEzMC4zOTMsNzIuMjYzIEMxMjkuMzM5LDczLjM3NCAxMjguNSw3NC44MTkgMTI4LjA2NCw3Ni4yODIgTDEyMS42MDMsOTcuOTA5IEw5NC4yODIsMTEzLjY4MyBMOTQuMjgyLDYyLjgxMyBMMTY5LjgsMTkuMjEzIEwxNjkuOCw3MC4wODMgWiIgaWQ9IkZpbGwtMTciIGZpbGw9IiNGQUZBRkEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOTQuMjgyLDExMy45MTcgQzk0LjI0MSwxMTMuOTE3IDk0LjIwMSwxMTMuOTA3IDk0LjE2NSwxMTMuODg2IEM5NC4wOTMsMTEzLjg0NSA5NC4wNDgsMTEzLjc2NyA5NC4wNDgsMTEzLjY4NCBMOTQuMDQ4LDYyLjgxMyBDOTQuMDQ4LDYyLjczIDk0LjA5Myw2Mi42NTIgOTQuMTY1LDYyLjYxMSBMMTY5LjY4MywxOS4wMSBDMTY5Ljc1NSwxOC45NjkgMTY5Ljg0NCwxOC45NjkgMTY5LjkxNywxOS4wMSBDMTY5Ljk4OSwxOS4wNTIgMTcwLjAzMywxOS4xMjkgMTcwLjAzMywxOS4yMTIgTDE3MC4wMzMsNzAuMDgzIEMxNzAuMDMzLDcwLjE2NiAxNjkuOTg5LDcwLjI0NCAxNjkuOTE3LDcwLjI4NSBMMTQyLjU5NSw4Ni4wNiBDMTQyLjUzOCw4Ni4wOTIgMTQyLjQ2OSw4Ni4xIDE0Mi40MDcsODYuMDggQzE0Mi4zNDQsODYuMDYgMTQyLjI5Myw4Ni4wMTQgMTQyLjI2Niw4NS45NTQgTDEzNS44MDUsNzEuNzg2IEMxMzUuNDQ1LDcwLjk5NyAxMzQuODEzLDcwLjU4IDEzMy45NzcsNzAuNTggQzEzMi45MjEsNzAuNTggMTMxLjY3Niw3MS4yNTIgMTMwLjU2Miw3Mi40MjQgQzEyOS41NCw3My41MDEgMTI4LjcxMSw3NC45MzEgMTI4LjI4Nyw3Ni4zNDggTDEyMS44MjcsOTcuOTc2IEMxMjEuODEsOTguMDM0IDEyMS43NzEsOTguMDgyIDEyMS43Miw5OC4xMTIgTDk0LjM5OCwxMTMuODg2IEM5NC4zNjIsMTEzLjkwNyA5NC4zMjIsMTEzLjkxNyA5NC4yODIsMTEzLjkxNyBMOTQuMjgyLDExMy45MTcgWiBNOTQuNTE1LDYyLjk0OCBMOTQuNTE1LDExMy4yNzkgTDEyMS40MDYsOTcuNzU0IEwxMjcuODQsNzYuMjE1IEMxMjguMjksNzQuNzA4IDEyOS4xMzcsNzMuMjQ3IDEzMC4yMjQsNzIuMTAzIEMxMzEuNDI1LDcwLjgzOCAxMzIuNzkzLDcwLjExMiAxMzMuOTc3LDcwLjExMiBDMTM0Ljk5NSw3MC4xMTIgMTM1Ljc5NSw3MC42MzggMTM2LjIzLDcxLjU5MiBMMTQyLjU4NCw4NS41MjYgTDE2OS41NjYsNjkuOTQ4IEwxNjkuNTY2LDE5LjYxNyBMOTQuNTE1LDYyLjk0OCBMOTQuNTE1LDYyLjk0OCBaIiBpZD0iRmlsbC0xOCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMDkuODk0LDkyLjk0MyBMMTA5Ljg5NCw5Mi45NDMgQzEwOC4xMiw5Mi45NDMgMTA2LjY1Myw5Mi4yMTggMTA1LjY1LDkwLjgyMyBDMTA1LjU4Myw5MC43MzEgMTA1LjU5Myw5MC42MSAxMDUuNjczLDkwLjUyOSBDMTA1Ljc1Myw5MC40NDggMTA1Ljg4LDkwLjQ0IDEwNS45NzQsOTAuNTA2IEMxMDYuNzU0LDkxLjA1MyAxMDcuNjc5LDkxLjMzMyAxMDguNzI0LDkxLjMzMyBDMTEwLjA0Nyw5MS4zMzMgMTExLjQ3OCw5MC44OTQgMTEyLjk4LDkwLjAyNyBDMTE4LjI5MSw4Ni45NiAxMjIuNjExLDc5LjUwOSAxMjIuNjExLDczLjQxNiBDMTIyLjYxMSw3MS40ODkgMTIyLjE2OSw2OS44NTYgMTIxLjMzMyw2OC42OTIgQzEyMS4yNjYsNjguNiAxMjEuMjc2LDY4LjQ3MyAxMjEuMzU2LDY4LjM5MiBDMTIxLjQzNiw2OC4zMTEgMTIxLjU2Myw2OC4yOTkgMTIxLjY1Niw2OC4zNjUgQzEyMy4zMjcsNjkuNTM3IDEyNC4yNDcsNzEuNzQ2IDEyNC4yNDcsNzQuNTg0IEMxMjQuMjQ3LDgwLjgyNiAxMTkuODIxLDg4LjQ0NyAxMTQuMzgyLDkxLjU4NyBDMTEyLjgwOCw5Mi40OTUgMTExLjI5OCw5Mi45NDMgMTA5Ljg5NCw5Mi45NDMgTDEwOS44OTQsOTIuOTQzIFogTTEwNi45MjUsOTEuNDAxIEMxMDcuNzM4LDkyLjA1MiAxMDguNzQ1LDkyLjI3OCAxMDkuODkzLDkyLjI3OCBMMTA5Ljg5NCw5Mi4yNzggQzExMS4yMTUsOTIuMjc4IDExMi42NDcsOTEuOTUxIDExNC4xNDgsOTEuMDg0IEMxMTkuNDU5LDg4LjAxNyAxMjMuNzgsODAuNjIxIDEyMy43OCw3NC41MjggQzEyMy43OCw3Mi41NDkgMTIzLjMxNyw3MC45MjkgMTIyLjQ1NCw2OS43NjcgQzEyMi44NjUsNzAuODAyIDEyMy4wNzksNzIuMDQyIDEyMy4wNzksNzMuNDAyIEMxMjMuMDc5LDc5LjY0NSAxMTguNjUzLDg3LjI4NSAxMTMuMjE0LDkwLjQyNSBDMTExLjY0LDkxLjMzNCAxMTAuMTMsOTEuNzQyIDEwOC43MjQsOTEuNzQyIEMxMDguMDgzLDkxLjc0MiAxMDcuNDgxLDkxLjU5MyAxMDYuOTI1LDkxLjQwMSBMMTA2LjkyNSw5MS40MDEgWiIgaWQ9IkZpbGwtMTkiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEzLjA5Nyw5MC4yMyBDMTE4LjQ4MSw4Ny4xMjIgMTIyLjg0NSw3OS41OTQgMTIyLjg0NSw3My40MTYgQzEyMi44NDUsNzEuMzY1IDEyMi4zNjIsNjkuNzI0IDEyMS41MjIsNjguNTU2IEMxMTkuNzM4LDY3LjMwNCAxMTcuMTQ4LDY3LjM2MiAxMTQuMjY1LDY5LjAyNiBDMTA4Ljg4MSw3Mi4xMzQgMTA0LjUxNyw3OS42NjIgMTA0LjUxNyw4NS44NCBDMTA0LjUxNyw4Ny44OTEgMTA1LDg5LjUzMiAxMDUuODQsOTAuNyBDMTA3LjYyNCw5MS45NTIgMTEwLjIxNCw5MS44OTQgMTEzLjA5Nyw5MC4yMyIgaWQ9IkZpbGwtMjAiIGZpbGw9IiNGQUZBRkEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTA4LjcyNCw5MS42MTQgTDEwOC43MjQsOTEuNjE0IEMxMDcuNTgyLDkxLjYxNCAxMDYuNTY2LDkxLjQwMSAxMDUuNzA1LDkwLjc5NyBDMTA1LjY4NCw5MC43ODMgMTA1LjY2NSw5MC44MTEgMTA1LjY1LDkwLjc5IEMxMDQuNzU2LDg5LjU0NiAxMDQuMjgzLDg3Ljg0MiAxMDQuMjgzLDg1LjgxNyBDMTA0LjI4Myw3OS41NzUgMTA4LjcwOSw3MS45NTMgMTE0LjE0OCw2OC44MTIgQzExNS43MjIsNjcuOTA0IDExNy4yMzIsNjcuNDQ5IDExOC42MzgsNjcuNDQ5IEMxMTkuNzgsNjcuNDQ5IDEyMC43OTYsNjcuNzU4IDEyMS42NTYsNjguMzYyIEMxMjEuNjc4LDY4LjM3NyAxMjEuNjk3LDY4LjM5NyAxMjEuNzEyLDY4LjQxOCBDMTIyLjYwNiw2OS42NjIgMTIzLjA3OSw3MS4zOSAxMjMuMDc5LDczLjQxNSBDMTIzLjA3OSw3OS42NTggMTE4LjY1Myw4Ny4xOTggMTEzLjIxNCw5MC4zMzggQzExMS42NCw5MS4yNDcgMTEwLjEzLDkxLjYxNCAxMDguNzI0LDkxLjYxNCBMMTA4LjcyNCw5MS42MTQgWiBNMTA2LjAwNiw5MC41MDUgQzEwNi43OCw5MS4wMzcgMTA3LjY5NCw5MS4yODEgMTA4LjcyNCw5MS4yODEgQzExMC4wNDcsOTEuMjgxIDExMS40NzgsOTAuODY4IDExMi45OCw5MC4wMDEgQzExOC4yOTEsODYuOTM1IDEyMi42MTEsNzkuNDk2IDEyMi42MTEsNzMuNDAzIEMxMjIuNjExLDcxLjQ5NCAxMjIuMTc3LDY5Ljg4IDEyMS4zNTYsNjguNzE4IEMxMjAuNTgyLDY4LjE4NSAxMTkuNjY4LDY3LjkxOSAxMTguNjM4LDY3LjkxOSBDMTE3LjMxNSw2Ny45MTkgMTE1Ljg4Myw2OC4zNiAxMTQuMzgyLDY5LjIyNyBDMTA5LjA3MSw3Mi4yOTMgMTA0Ljc1MSw3OS43MzMgMTA0Ljc1MSw4NS44MjYgQzEwNC43NTEsODcuNzM1IDEwNS4xODUsODkuMzQzIDEwNi4wMDYsOTAuNTA1IEwxMDYuMDA2LDkwLjUwNSBaIiBpZD0iRmlsbC0yMSIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNDkuMzE4LDcuMjYyIEwxMzkuMzM0LDE2LjE0IEwxNTUuMjI3LDI3LjE3MSBMMTYwLjgxNiwyMS4wNTkgTDE0OS4zMTgsNy4yNjIiIGlkPSJGaWxsLTIyIiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2OS42NzYsMTMuODQgTDE1OS45MjgsMTkuNDY3IEMxNTYuMjg2LDIxLjU3IDE1MC40LDIxLjU4IDE0Ni43ODEsMTkuNDkxIEMxNDMuMTYxLDE3LjQwMiAxNDMuMTgsMTQuMDAzIDE0Ni44MjIsMTEuOSBMMTU2LjMxNyw2LjI5MiBMMTQ5LjU4OCwyLjQwNyBMNjcuNzUyLDQ5LjQ3OCBMMTEzLjY3NSw3NS45OTIgTDExNi43NTYsNzQuMjEzIEMxMTcuMzg3LDczLjg0OCAxMTcuNjI1LDczLjMxNSAxMTcuMzc0LDcyLjgyMyBDMTE1LjAxNyw2OC4xOTEgMTE0Ljc4MSw2My4yNzcgMTE2LjY5MSw1OC41NjEgQzEyMi4zMjksNDQuNjQxIDE0MS4yLDMzLjc0NiAxNjUuMzA5LDMwLjQ5MSBDMTczLjQ3OCwyOS4zODggMTgxLjk4OSwyOS41MjQgMTkwLjAxMywzMC44ODUgQzE5MC44NjUsMzEuMDMgMTkxLjc4OSwzMC44OTMgMTkyLjQyLDMwLjUyOCBMMTk1LjUwMSwyOC43NSBMMTY5LjY3NiwxMy44NCIgaWQ9IkZpbGwtMjMiIGZpbGw9IiNGQUZBRkEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEzLjY3NSw3Ni40NTkgQzExMy41OTQsNzYuNDU5IDExMy41MTQsNzYuNDM4IDExMy40NDIsNzYuMzk3IEw2Ny41MTgsNDkuODgyIEM2Ny4zNzQsNDkuNzk5IDY3LjI4NCw0OS42NDUgNjcuMjg1LDQ5LjQ3OCBDNjcuMjg1LDQ5LjMxMSA2Ny4zNzQsNDkuMTU3IDY3LjUxOSw0OS4wNzMgTDE0OS4zNTUsMi4wMDIgQzE0OS40OTksMS45MTkgMTQ5LjY3NywxLjkxOSAxNDkuODIxLDIuMDAyIEwxNTYuNTUsNS44ODcgQzE1Ni43NzQsNi4wMTcgMTU2Ljg1LDYuMzAyIDE1Ni43MjIsNi41MjYgQzE1Ni41OTIsNi43NDkgMTU2LjMwNyw2LjgyNiAxNTYuMDgzLDYuNjk2IEwxNDkuNTg3LDIuOTQ2IEw2OC42ODcsNDkuNDc5IEwxMTMuNjc1LDc1LjQ1MiBMMTE2LjUyMyw3My44MDggQzExNi43MTUsNzMuNjk3IDExNy4xNDMsNzMuMzk5IDExNi45NTgsNzMuMDM1IEMxMTQuNTQyLDY4LjI4NyAxMTQuMyw2My4yMjEgMTE2LjI1OCw1OC4zODUgQzExOS4wNjQsNTEuNDU4IDEyNS4xNDMsNDUuMTQzIDEzMy44NCw0MC4xMjIgQzE0Mi40OTcsMzUuMTI0IDE1My4zNTgsMzEuNjMzIDE2NS4yNDcsMzAuMDI4IEMxNzMuNDQ1LDI4LjkyMSAxODIuMDM3LDI5LjA1OCAxOTAuMDkxLDMwLjQyNSBDMTkwLjgzLDMwLjU1IDE5MS42NTIsMzAuNDMyIDE5Mi4xODYsMzAuMTI0IEwxOTQuNTY3LDI4Ljc1IEwxNjkuNDQyLDE0LjI0NCBDMTY5LjIxOSwxNC4xMTUgMTY5LjE0MiwxMy44MjkgMTY5LjI3MSwxMy42MDYgQzE2OS40LDEzLjM4MiAxNjkuNjg1LDEzLjMwNiAxNjkuOTA5LDEzLjQzNSBMMTk1LjczNCwyOC4zNDUgQzE5NS44NzksMjguNDI4IDE5NS45NjgsMjguNTgzIDE5NS45NjgsMjguNzUgQzE5NS45NjgsMjguOTE2IDE5NS44NzksMjkuMDcxIDE5NS43MzQsMjkuMTU0IEwxOTIuNjUzLDMwLjkzMyBDMTkxLjkzMiwzMS4zNSAxOTAuODksMzEuNTA4IDE4OS45MzUsMzEuMzQ2IEMxODEuOTcyLDI5Ljk5NSAxNzMuNDc4LDI5Ljg2IDE2NS4zNzIsMzAuOTU0IEMxNTMuNjAyLDMyLjU0MyAxNDIuODYsMzUuOTkzIDEzNC4zMDcsNDAuOTMxIEMxMjUuNzkzLDQ1Ljg0NyAxMTkuODUxLDUyLjAwNCAxMTcuMTI0LDU4LjczNiBDMTE1LjI3LDYzLjMxNCAxMTUuNTAxLDY4LjExMiAxMTcuNzksNzIuNjExIEMxMTguMTYsNzMuMzM2IDExNy44NDUsNzQuMTI0IDExNi45OSw3NC42MTcgTDExMy45MDksNzYuMzk3IEMxMTMuODM2LDc2LjQzOCAxMTMuNzU2LDc2LjQ1OSAxMTMuNjc1LDc2LjQ1OSIgaWQ9IkZpbGwtMjQiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTUzLjMxNiwyMS4yNzkgQzE1MC45MDMsMjEuMjc5IDE0OC40OTUsMjAuNzUxIDE0Ni42NjQsMTkuNjkzIEMxNDQuODQ2LDE4LjY0NCAxNDMuODQ0LDE3LjIzMiAxNDMuODQ0LDE1LjcxOCBDMTQzLjg0NCwxNC4xOTEgMTQ0Ljg2LDEyLjc2MyAxNDYuNzA1LDExLjY5OCBMMTU2LjE5OCw2LjA5MSBDMTU2LjMwOSw2LjAyNSAxNTYuNDUyLDYuMDYyIDE1Ni41MTgsNi4xNzMgQzE1Ni41ODMsNi4yODQgMTU2LjU0Nyw2LjQyNyAxNTYuNDM2LDYuNDkzIEwxNDYuOTQsMTIuMTAyIEMxNDUuMjQ0LDEzLjA4MSAxNDQuMzEyLDE0LjM2NSAxNDQuMzEyLDE1LjcxOCBDMTQ0LjMxMiwxNy4wNTggMTQ1LjIzLDE4LjMyNiAxNDYuODk3LDE5LjI4OSBDMTUwLjQ0NiwyMS4zMzggMTU2LjI0LDIxLjMyNyAxNTkuODExLDE5LjI2NSBMMTY5LjU1OSwxMy42MzcgQzE2OS42NywxMy41NzMgMTY5LjgxMywxMy42MTEgMTY5Ljg3OCwxMy43MjMgQzE2OS45NDMsMTMuODM0IDE2OS45MDQsMTMuOTc3IDE2OS43OTMsMTQuMDQyIEwxNjAuMDQ1LDE5LjY3IEMxNTguMTg3LDIwLjc0MiAxNTUuNzQ5LDIxLjI3OSAxNTMuMzE2LDIxLjI3OSIgaWQ9IkZpbGwtMjUiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEzLjY3NSw3NS45OTIgTDY3Ljc2Miw0OS40ODQiIGlkPSJGaWxsLTI2IiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTExMy42NzUsNzYuMzQyIEMxMTMuNjE1LDc2LjM0MiAxMTMuNTU1LDc2LjMyNyAxMTMuNSw3Ni4yOTUgTDY3LjU4Nyw0OS43ODcgQzY3LjQxOSw0OS42OSA2Ny4zNjIsNDkuNDc2IDY3LjQ1OSw0OS4zMDkgQzY3LjU1Niw0OS4xNDEgNjcuNzcsNDkuMDgzIDY3LjkzNyw0OS4xOCBMMTEzLjg1LDc1LjY4OCBDMTE0LjAxOCw3NS43ODUgMTE0LjA3NSw3NiAxMTMuOTc4LDc2LjE2NyBDMTEzLjkxNCw3Ni4yNzkgMTEzLjc5Niw3Ni4zNDIgMTEzLjY3NSw3Ni4zNDIiIGlkPSJGaWxsLTI3IiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTY3Ljc2Miw0OS40ODQgTDY3Ljc2MiwxMDMuNDg1IEM2Ny43NjIsMTA0LjU3NSA2OC41MzIsMTA1LjkwMyA2OS40ODIsMTA2LjQ1MiBMMTExLjk1NSwxMzAuOTczIEMxMTIuOTA1LDEzMS41MjIgMTEzLjY3NSwxMzEuMDgzIDExMy42NzUsMTI5Ljk5MyBMMTEzLjY3NSw3NS45OTIiIGlkPSJGaWxsLTI4IiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTExMi43MjcsMTMxLjU2MSBDMTEyLjQzLDEzMS41NjEgMTEyLjEwNywxMzEuNDY2IDExMS43OCwxMzEuMjc2IEw2OS4zMDcsMTA2Ljc1NSBDNjguMjQ0LDEwNi4xNDIgNjcuNDEyLDEwNC43MDUgNjcuNDEyLDEwMy40ODUgTDY3LjQxMiw0OS40ODQgQzY3LjQxMiw0OS4yOSA2Ny41NjksNDkuMTM0IDY3Ljc2Miw0OS4xMzQgQzY3Ljk1Niw0OS4xMzQgNjguMTEzLDQ5LjI5IDY4LjExMyw0OS40ODQgTDY4LjExMywxMDMuNDg1IEM2OC4xMTMsMTA0LjQ0NSA2OC44MiwxMDUuNjY1IDY5LjY1NywxMDYuMTQ4IEwxMTIuMTMsMTMwLjY3IEMxMTIuNDc0LDEzMC44NjggMTEyLjc5MSwxMzAuOTEzIDExMywxMzAuNzkyIEMxMTMuMjA2LDEzMC42NzMgMTEzLjMyNSwxMzAuMzgxIDExMy4zMjUsMTI5Ljk5MyBMMTEzLjMyNSw3NS45OTIgQzExMy4zMjUsNzUuNzk4IDExMy40ODIsNzUuNjQxIDExMy42NzUsNzUuNjQxIEMxMTMuODY5LDc1LjY0MSAxMTQuMDI1LDc1Ljc5OCAxMTQuMDI1LDc1Ljk5MiBMMTE0LjAyNSwxMjkuOTkzIEMxMTQuMDI1LDEzMC42NDggMTEzLjc4NiwxMzEuMTQ3IDExMy4zNSwxMzEuMzk5IEMxMTMuMTYyLDEzMS41MDcgMTEyLjk1MiwxMzEuNTYxIDExMi43MjcsMTMxLjU2MSIgaWQ9IkZpbGwtMjkiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEyLjg2LDQwLjUxMiBDMTEyLjg2LDQwLjUxMiAxMTIuODYsNDAuNTEyIDExMi44NTksNDAuNTEyIEMxMTAuNTQxLDQwLjUxMiAxMDguMzYsMzkuOTkgMTA2LjcxNywzOS4wNDEgQzEwNS4wMTIsMzguMDU3IDEwNC4wNzQsMzYuNzI2IDEwNC4wNzQsMzUuMjkyIEMxMDQuMDc0LDMzLjg0NyAxMDUuMDI2LDMyLjUwMSAxMDYuNzU0LDMxLjUwNCBMMTE4Ljc5NSwyNC41NTEgQzEyMC40NjMsMjMuNTg5IDEyMi42NjksMjMuMDU4IDEyNS4wMDcsMjMuMDU4IEMxMjcuMzI1LDIzLjA1OCAxMjkuNTA2LDIzLjU4MSAxMzEuMTUsMjQuNTMgQzEzMi44NTQsMjUuNTE0IDEzMy43OTMsMjYuODQ1IDEzMy43OTMsMjguMjc4IEMxMzMuNzkzLDI5LjcyNCAxMzIuODQxLDMxLjA2OSAxMzEuMTEzLDMyLjA2NyBMMTE5LjA3MSwzOS4wMTkgQzExNy40MDMsMzkuOTgyIDExNS4xOTcsNDAuNTEyIDExMi44Niw0MC41MTIgTDExMi44Niw0MC41MTIgWiBNMTI1LjAwNywyMy43NTkgQzEyMi43OSwyMy43NTkgMTIwLjcwOSwyNC4yNTYgMTE5LjE0NiwyNS4xNTggTDEwNy4xMDQsMzIuMTEgQzEwNS42MDIsMzIuOTc4IDEwNC43NzQsMzQuMTA4IDEwNC43NzQsMzUuMjkyIEMxMDQuNzc0LDM2LjQ2NSAxMDUuNTg5LDM3LjU4MSAxMDcuMDY3LDM4LjQzNCBDMTA4LjYwNSwzOS4zMjMgMTEwLjY2MywzOS44MTIgMTEyLjg1OSwzOS44MTIgTDExMi44NiwzOS44MTIgQzExNS4wNzYsMzkuODEyIDExNy4xNTgsMzkuMzE1IDExOC43MjEsMzguNDEzIEwxMzAuNzYyLDMxLjQ2IEMxMzIuMjY0LDMwLjU5MyAxMzMuMDkyLDI5LjQ2MyAxMzMuMDkyLDI4LjI3OCBDMTMzLjA5MiwyNy4xMDYgMTMyLjI3OCwyNS45OSAxMzAuOCwyNS4xMzYgQzEyOS4yNjEsMjQuMjQ4IDEyNy4yMDQsMjMuNzU5IDEyNS4wMDcsMjMuNzU5IEwxMjUuMDA3LDIzLjc1OSBaIiBpZD0iRmlsbC0zMCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNjUuNjMsMTYuMjE5IEwxNTkuODk2LDE5LjUzIEMxNTYuNzI5LDIxLjM1OCAxNTEuNjEsMjEuMzY3IDE0OC40NjMsMTkuNTUgQzE0NS4zMTYsMTcuNzMzIDE0NS4zMzIsMTQuNzc4IDE0OC40OTksMTIuOTQ5IEwxNTQuMjMzLDkuNjM5IEwxNjUuNjMsMTYuMjE5IiBpZD0iRmlsbC0zMSIgZmlsbD0iI0ZBRkFGQSI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNTQuMjMzLDEwLjQ0OCBMMTY0LjIyOCwxNi4yMTkgTDE1OS41NDYsMTguOTIzIEMxNTguMTEyLDE5Ljc1IDE1Ni4xOTQsMjAuMjA2IDE1NC4xNDcsMjAuMjA2IEMxNTIuMTE4LDIwLjIwNiAxNTAuMjI0LDE5Ljc1NyAxNDguODE0LDE4Ljk0MyBDMTQ3LjUyNCwxOC4xOTkgMTQ2LjgxNCwxNy4yNDkgMTQ2LjgxNCwxNi4yNjkgQzE0Ni44MTQsMTUuMjc4IDE0Ny41MzcsMTQuMzE0IDE0OC44NSwxMy41NTYgTDE1NC4yMzMsMTAuNDQ4IE0xNTQuMjMzLDkuNjM5IEwxNDguNDk5LDEyLjk0OSBDMTQ1LjMzMiwxNC43NzggMTQ1LjMxNiwxNy43MzMgMTQ4LjQ2MywxOS41NSBDMTUwLjAzMSwyMC40NTUgMTUyLjA4NiwyMC45MDcgMTU0LjE0NywyMC45MDcgQzE1Ni4yMjQsMjAuOTA3IDE1OC4zMDYsMjAuNDQ3IDE1OS44OTYsMTkuNTMgTDE2NS42MywxNi4yMTkgTDE1NC4yMzMsOS42MzkiIGlkPSJGaWxsLTMyIiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE0NS40NDUsNzIuNjY3IEwxNDUuNDQ1LDcyLjY2NyBDMTQzLjY3Miw3Mi42NjcgMTQyLjIwNCw3MS44MTcgMTQxLjIwMiw3MC40MjIgQzE0MS4xMzUsNzAuMzMgMTQxLjE0NSw3MC4xNDcgMTQxLjIyNSw3MC4wNjYgQzE0MS4zMDUsNjkuOTg1IDE0MS40MzIsNjkuOTQ2IDE0MS41MjUsNzAuMDExIEMxNDIuMzA2LDcwLjU1OSAxNDMuMjMxLDcwLjgyMyAxNDQuMjc2LDcwLjgyMiBDMTQ1LjU5OCw3MC44MjIgMTQ3LjAzLDcwLjM3NiAxNDguNTMyLDY5LjUwOSBDMTUzLjg0Miw2Ni40NDMgMTU4LjE2Myw1OC45ODcgMTU4LjE2Myw1Mi44OTQgQzE1OC4xNjMsNTAuOTY3IDE1Ny43MjEsNDkuMzMyIDE1Ni44ODQsNDguMTY4IEMxNTYuODE4LDQ4LjA3NiAxNTYuODI4LDQ3Ljk0OCAxNTYuOTA4LDQ3Ljg2NyBDMTU2Ljk4OCw0Ny43ODYgMTU3LjExNCw0Ny43NzQgMTU3LjIwOCw0Ny44NCBDMTU4Ljg3OCw0OS4wMTIgMTU5Ljc5OCw1MS4yMiAxNTkuNzk4LDU0LjA1OSBDMTU5Ljc5OCw2MC4zMDEgMTU1LjM3Myw2OC4wNDYgMTQ5LjkzMyw3MS4xODYgQzE0OC4zNiw3Mi4wOTQgMTQ2Ljg1LDcyLjY2NyAxNDUuNDQ1LDcyLjY2NyBMMTQ1LjQ0NSw3Mi42NjcgWiBNMTQyLjQ3Niw3MSBDMTQzLjI5LDcxLjY1MSAxNDQuMjk2LDcyLjAwMiAxNDUuNDQ1LDcyLjAwMiBDMTQ2Ljc2Nyw3Mi4wMDIgMTQ4LjE5OCw3MS41NSAxNDkuNyw3MC42ODIgQzE1NS4wMSw2Ny42MTcgMTU5LjMzMSw2MC4xNTkgMTU5LjMzMSw1NC4wNjUgQzE1OS4zMzEsNTIuMDg1IDE1OC44NjgsNTAuNDM1IDE1OC4wMDYsNDkuMjcyIEMxNTguNDE3LDUwLjMwNyAxNTguNjMsNTEuNTMyIDE1OC42Myw1Mi44OTIgQzE1OC42Myw1OS4xMzQgMTU0LjIwNSw2Ni43NjcgMTQ4Ljc2NSw2OS45MDcgQzE0Ny4xOTIsNzAuODE2IDE0NS42ODEsNzEuMjgzIDE0NC4yNzYsNzEuMjgzIEMxNDMuNjM0LDcxLjI4MyAxNDMuMDMzLDcxLjE5MiAxNDIuNDc2LDcxIEwxNDIuNDc2LDcxIFoiIGlkPSJGaWxsLTMzIiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE0OC42NDgsNjkuNzA0IEMxNTQuMDMyLDY2LjU5NiAxNTguMzk2LDU5LjA2OCAxNTguMzk2LDUyLjg5MSBDMTU4LjM5Niw1MC44MzkgMTU3LjkxMyw0OS4xOTggMTU3LjA3NCw0OC4wMyBDMTU1LjI4OSw0Ni43NzggMTUyLjY5OSw0Ni44MzYgMTQ5LjgxNiw0OC41MDEgQzE0NC40MzMsNTEuNjA5IDE0MC4wNjgsNTkuMTM3IDE0MC4wNjgsNjUuMzE0IEMxNDAuMDY4LDY3LjM2NSAxNDAuNTUyLDY5LjAwNiAxNDEuMzkxLDcwLjE3NCBDMTQzLjE3Niw3MS40MjcgMTQ1Ljc2NSw3MS4zNjkgMTQ4LjY0OCw2OS43MDQiIGlkPSJGaWxsLTM0IiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE0NC4yNzYsNzEuMjc2IEwxNDQuMjc2LDcxLjI3NiBDMTQzLjEzMyw3MS4yNzYgMTQyLjExOCw3MC45NjkgMTQxLjI1Nyw3MC4zNjUgQzE0MS4yMzYsNzAuMzUxIDE0MS4yMTcsNzAuMzMyIDE0MS4yMDIsNzAuMzExIEMxNDAuMzA3LDY5LjA2NyAxMzkuODM1LDY3LjMzOSAxMzkuODM1LDY1LjMxNCBDMTM5LjgzNSw1OS4wNzMgMTQ0LjI2LDUxLjQzOSAxNDkuNyw0OC4yOTggQzE1MS4yNzMsNDcuMzkgMTUyLjc4NCw0Ni45MjkgMTU0LjE4OSw0Ni45MjkgQzE1NS4zMzIsNDYuOTI5IDE1Ni4zNDcsNDcuMjM2IDE1Ny4yMDgsNDcuODM5IEMxNTcuMjI5LDQ3Ljg1NCAxNTcuMjQ4LDQ3Ljg3MyAxNTcuMjYzLDQ3Ljg5NCBDMTU4LjE1Nyw0OS4xMzggMTU4LjYzLDUwLjg2NSAxNTguNjMsNTIuODkxIEMxNTguNjMsNTkuMTMyIDE1NC4yMDUsNjYuNzY2IDE0OC43NjUsNjkuOTA3IEMxNDcuMTkyLDcwLjgxNSAxNDUuNjgxLDcxLjI3NiAxNDQuMjc2LDcxLjI3NiBMMTQ0LjI3Niw3MS4yNzYgWiBNMTQxLjU1OCw3MC4xMDQgQzE0Mi4zMzEsNzAuNjM3IDE0My4yNDUsNzEuMDA1IDE0NC4yNzYsNzEuMDA1IEMxNDUuNTk4LDcxLjAwNSAxNDcuMDMsNzAuNDY3IDE0OC41MzIsNjkuNiBDMTUzLjg0Miw2Ni41MzQgMTU4LjE2Myw1OS4wMzMgMTU4LjE2Myw1Mi45MzkgQzE1OC4xNjMsNTEuMDMxIDE1Ny43MjksNDkuMzg1IDE1Ni45MDcsNDguMjIzIEMxNTYuMTMzLDQ3LjY5MSAxNTUuMjE5LDQ3LjQwOSAxNTQuMTg5LDQ3LjQwOSBDMTUyLjg2Nyw0Ny40MDkgMTUxLjQzNSw0Ny44NDIgMTQ5LjkzMyw0OC43MDkgQzE0NC42MjMsNTEuNzc1IDE0MC4zMDIsNTkuMjczIDE0MC4zMDIsNjUuMzY2IEMxNDAuMzAyLDY3LjI3NiAxNDAuNzM2LDY4Ljk0MiAxNDEuNTU4LDcwLjEwNCBMMTQxLjU1OCw3MC4xMDQgWiIgaWQ9IkZpbGwtMzUiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTUwLjcyLDY1LjM2MSBMMTUwLjM1Nyw2NS4wNjYgQzE1MS4xNDcsNjQuMDkyIDE1MS44NjksNjMuMDQgMTUyLjUwNSw2MS45MzggQzE1My4zMTMsNjAuNTM5IDE1My45NzgsNTkuMDY3IDE1NC40ODIsNTcuNTYzIEwxNTQuOTI1LDU3LjcxMiBDMTU0LjQxMiw1OS4yNDUgMTUzLjczMyw2MC43NDUgMTUyLjkxLDYyLjE3MiBDMTUyLjI2Miw2My4yOTUgMTUxLjUyNSw2NC4zNjggMTUwLjcyLDY1LjM2MSIgaWQ9IkZpbGwtMzYiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTE1LjkxNyw4NC41MTQgTDExNS41NTQsODQuMjIgQzExNi4zNDQsODMuMjQ1IDExNy4wNjYsODIuMTk0IDExNy43MDIsODEuMDkyIEMxMTguNTEsNzkuNjkyIDExOS4xNzUsNzguMjIgMTE5LjY3OCw3Ni43MTcgTDEyMC4xMjEsNzYuODY1IEMxMTkuNjA4LDc4LjM5OCAxMTguOTMsNzkuODk5IDExOC4xMDYsODEuMzI2IEMxMTcuNDU4LDgyLjQ0OCAxMTYuNzIyLDgzLjUyMSAxMTUuOTE3LDg0LjUxNCIgaWQ9IkZpbGwtMzciIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTE0LDEzMC40NzYgTDExNCwxMzAuMDA4IEwxMTQsNzYuMDUyIEwxMTQsNzUuNTg0IEwxMTQsNzYuMDUyIEwxMTQsMTMwLjAwOCBMMTE0LDEzMC40NzYiIGlkPSJGaWxsLTM4IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgICAgICA8ZyBpZD0iSW1wb3J0ZWQtTGF5ZXJzLUNvcHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYyLjAwMDAwMCwgMC4wMDAwMDApIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTkuODIyLDM3LjQ3NCBDMTkuODM5LDM3LjMzOSAxOS43NDcsMzcuMTk0IDE5LjU1NSwzNy4wODIgQzE5LjIyOCwzNi44OTQgMTguNzI5LDM2Ljg3MiAxOC40NDYsMzcuMDM3IEwxMi40MzQsNDAuNTA4IEMxMi4zMDMsNDAuNTg0IDEyLjI0LDQwLjY4NiAxMi4yNDMsNDAuNzkzIEMxMi4yNDUsNDAuOTI1IDEyLjI0NSw0MS4yNTQgMTIuMjQ1LDQxLjM3MSBMMTIuMjQ1LDQxLjQxNCBMMTIuMjM4LDQxLjU0MiBDOC4xNDgsNDMuODg3IDUuNjQ3LDQ1LjMyMSA1LjY0Nyw0NS4zMjEgQzUuNjQ2LDQ1LjMyMSAzLjU3LDQ2LjM2NyAyLjg2LDUwLjUxMyBDMi44Niw1MC41MTMgMS45NDgsNTcuNDc0IDEuOTYyLDcwLjI1OCBDMS45NzcsODIuODI4IDIuNTY4LDg3LjMyOCAzLjEyOSw5MS42MDkgQzMuMzQ5LDkzLjI5MyA2LjEzLDkzLjczNCA2LjEzLDkzLjczNCBDNi40NjEsOTMuNzc0IDYuODI4LDkzLjcwNyA3LjIxLDkzLjQ4NiBMODIuNDgzLDQ5LjkzNSBDODQuMjkxLDQ4Ljg2NiA4NS4xNSw0Ni4yMTYgODUuNTM5LDQzLjY1MSBDODYuNzUyLDM1LjY2MSA4Ny4yMTQsMTAuNjczIDg1LjI2NCwzLjc3MyBDODUuMDY4LDMuMDggODQuNzU0LDIuNjkgODQuMzk2LDIuNDkxIEw4Mi4zMSwxLjcwMSBDODEuNTgzLDEuNzI5IDgwLjg5NCwyLjE2OCA4MC43NzYsMi4yMzYgQzgwLjYzNiwyLjMxNyA0MS44MDcsMjQuNTg1IDIwLjAzMiwzNy4wNzIgTDE5LjgyMiwzNy40NzQiIGlkPSJGaWxsLTEiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNODIuMzExLDEuNzAxIEw4NC4zOTYsMi40OTEgQzg0Ljc1NCwyLjY5IDg1LjA2OCwzLjA4IDg1LjI2NCwzLjc3MyBDODcuMjEzLDEwLjY3MyA4Ni43NTEsMzUuNjYgODUuNTM5LDQzLjY1MSBDODUuMTQ5LDQ2LjIxNiA4NC4yOSw0OC44NjYgODIuNDgzLDQ5LjkzNSBMNy4yMSw5My40ODYgQzYuODk3LDkzLjY2NyA2LjU5NSw5My43NDQgNi4zMTQsOTMuNzQ0IEw2LjEzMSw5My43MzMgQzYuMTMxLDkzLjczNCAzLjM0OSw5My4yOTMgMy4xMjgsOTEuNjA5IEMyLjU2OCw4Ny4zMjcgMS45NzcsODIuODI4IDEuOTYzLDcwLjI1OCBDMS45NDgsNTcuNDc0IDIuODYsNTAuNTEzIDIuODYsNTAuNTEzIEMzLjU3LDQ2LjM2NyA1LjY0Nyw0NS4zMjEgNS42NDcsNDUuMzIxIEM1LjY0Nyw0NS4zMjEgOC4xNDgsNDMuODg3IDEyLjIzOCw0MS41NDIgTDEyLjI0NSw0MS40MTQgTDEyLjI0NSw0MS4zNzEgQzEyLjI0NSw0MS4yNTQgMTIuMjQ1LDQwLjkyNSAxMi4yNDMsNDAuNzkzIEMxMi4yNCw0MC42ODYgMTIuMzAyLDQwLjU4MyAxMi40MzQsNDAuNTA4IEwxOC40NDYsMzcuMDM2IEMxOC41NzQsMzYuOTYyIDE4Ljc0NiwzNi45MjYgMTguOTI3LDM2LjkyNiBDMTkuMTQ1LDM2LjkyNiAxOS4zNzYsMzYuOTc5IDE5LjU1NCwzNy4wODIgQzE5Ljc0NywzNy4xOTQgMTkuODM5LDM3LjM0IDE5LjgyMiwzNy40NzQgTDIwLjAzMywzNy4wNzIgQzQxLjgwNiwyNC41ODUgODAuNjM2LDIuMzE4IDgwLjc3NywyLjIzNiBDODAuODk0LDIuMTY4IDgxLjU4MywxLjcyOSA4Mi4zMTEsMS43MDEgTTgyLjMxMSwwLjcwNCBMODIuMjcyLDAuNzA1IEM4MS42NTQsMC43MjggODAuOTg5LDAuOTQ5IDgwLjI5OCwxLjM2MSBMODAuMjc3LDEuMzczIEM4MC4xMjksMS40NTggNTkuNzY4LDEzLjEzNSAxOS43NTgsMzYuMDc5IEMxOS41LDM1Ljk4MSAxOS4yMTQsMzUuOTI5IDE4LjkyNywzNS45MjkgQzE4LjU2MiwzNS45MjkgMTguMjIzLDM2LjAxMyAxNy45NDcsMzYuMTczIEwxMS45MzUsMzkuNjQ0IEMxMS40OTMsMzkuODk5IDExLjIzNiw0MC4zMzQgMTEuMjQ2LDQwLjgxIEwxMS4yNDcsNDAuOTYgTDUuMTY3LDQ0LjQ0NyBDNC43OTQsNDQuNjQ2IDIuNjI1LDQ1Ljk3OCAxLjg3Nyw1MC4zNDUgTDEuODcxLDUwLjM4NCBDMS44NjIsNTAuNDU0IDAuOTUxLDU3LjU1NyAwLjk2NSw3MC4yNTkgQzAuOTc5LDgyLjg3OSAxLjU2OCw4Ny4zNzUgMi4xMzcsOTEuNzI0IEwyLjEzOSw5MS43MzkgQzIuNDQ3LDk0LjA5NCA1LjYxNCw5NC42NjIgNS45NzUsOTQuNzE5IEw2LjAwOSw5NC43MjMgQzYuMTEsOTQuNzM2IDYuMjEzLDk0Ljc0MiA2LjMxNCw5NC43NDIgQzYuNzksOTQuNzQyIDcuMjYsOTQuNjEgNy43MSw5NC4zNSBMODIuOTgzLDUwLjc5OCBDODQuNzk0LDQ5LjcyNyA4NS45ODIsNDcuMzc1IDg2LjUyNSw0My44MDEgQzg3LjcxMSwzNS45ODcgODguMjU5LDEwLjcwNSA4Ni4yMjQsMy41MDIgQzg1Ljk3MSwyLjYwOSA4NS41MiwxLjk3NSA4NC44ODEsMS42MiBMODQuNzQ5LDEuNTU4IEw4Mi42NjQsMC43NjkgQzgyLjU1MSwwLjcyNSA4Mi40MzEsMC43MDQgODIuMzExLDAuNzA0IiBpZD0iRmlsbC0yIiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTY2LjI2NywxMS41NjUgTDY3Ljc2MiwxMS45OTkgTDExLjQyMyw0NC4zMjUiIGlkPSJGaWxsLTMiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIuMjAyLDkwLjU0NSBDMTIuMDI5LDkwLjU0NSAxMS44NjIsOTAuNDU1IDExLjc2OSw5MC4yOTUgQzExLjYzMiw5MC4wNTcgMTEuNzEzLDg5Ljc1MiAxMS45NTIsODkuNjE0IEwzMC4zODksNzguOTY5IEMzMC42MjgsNzguODMxIDMwLjkzMyw3OC45MTMgMzEuMDcxLDc5LjE1MiBDMzEuMjA4LDc5LjM5IDMxLjEyNyw3OS42OTYgMzAuODg4LDc5LjgzMyBMMTIuNDUxLDkwLjQ3OCBMMTIuMjAyLDkwLjU0NSIgaWQ9IkZpbGwtNCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMy43NjQsNDIuNjU0IEwxMy42NTYsNDIuNTkyIEwxMy43MDIsNDIuNDIxIEwxOC44MzcsMzkuNDU3IEwxOS4wMDcsMzkuNTAyIEwxOC45NjIsMzkuNjczIEwxMy44MjcsNDIuNjM3IEwxMy43NjQsNDIuNjU0IiBpZD0iRmlsbC01IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTguNTIsOTAuMzc1IEw4LjUyLDQ2LjQyMSBMOC41ODMsNDYuMzg1IEw3NS44NCw3LjU1NCBMNzUuODQsNTEuNTA4IEw3NS43NzgsNTEuNTQ0IEw4LjUyLDkwLjM3NSBMOC41Miw5MC4zNzUgWiBNOC43Nyw0Ni41NjQgTDguNzcsODkuOTQ0IEw3NS41OTEsNTEuMzY1IEw3NS41OTEsNy45ODUgTDguNzcsNDYuNTY0IEw4Ljc3LDQ2LjU2NCBaIiBpZD0iRmlsbC02IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTI0Ljk4Niw4My4xODIgQzI0Ljc1Niw4My4zMzEgMjQuMzc0LDgzLjU2NiAyNC4xMzcsODMuNzA1IEwxMi42MzIsOTAuNDA2IEMxMi4zOTUsOTAuNTQ1IDEyLjQyNiw5MC42NTggMTIuNyw5MC42NTggTDEzLjI2NSw5MC42NTggQzEzLjU0LDkwLjY1OCAxMy45NTgsOTAuNTQ1IDE0LjE5NSw5MC40MDYgTDI1LjcsODMuNzA1IEMyNS45MzcsODMuNTY2IDI2LjEyOCw4My40NTIgMjYuMTI1LDgzLjQ0OSBDMjYuMTIyLDgzLjQ0NyAyNi4xMTksODMuMjIgMjYuMTE5LDgyLjk0NiBDMjYuMTE5LDgyLjY3MiAyNS45MzEsODIuNTY5IDI1LjcwMSw4Mi43MTkgTDI0Ljk4Niw4My4xODIiIGlkPSJGaWxsLTciIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTMuMjY2LDkwLjc4MiBMMTIuNyw5MC43ODIgQzEyLjUsOTAuNzgyIDEyLjM4NCw5MC43MjYgMTIuMzU0LDkwLjYxNiBDMTIuMzI0LDkwLjUwNiAxMi4zOTcsOTAuMzk5IDEyLjU2OSw5MC4yOTkgTDI0LjA3NCw4My41OTcgQzI0LjMxLDgzLjQ1OSAyNC42ODksODMuMjI2IDI0LjkxOCw4My4wNzggTDI1LjYzMyw4Mi42MTQgQzI1LjcyMyw4Mi41NTUgMjUuODEzLDgyLjUyNSAyNS44OTksODIuNTI1IEMyNi4wNzEsODIuNTI1IDI2LjI0NCw4Mi42NTUgMjYuMjQ0LDgyLjk0NiBDMjYuMjQ0LDgzLjE2IDI2LjI0NSw4My4zMDkgMjYuMjQ3LDgzLjM4MyBMMjYuMjUzLDgzLjM4NyBMMjYuMjQ5LDgzLjQ1NiBDMjYuMjQ2LDgzLjUzMSAyNi4yNDYsODMuNTMxIDI1Ljc2Myw4My44MTIgTDE0LjI1OCw5MC41MTQgQzE0LDkwLjY2NSAxMy41NjQsOTAuNzgyIDEzLjI2Niw5MC43ODIgTDEzLjI2Niw5MC43ODIgWiBNMTIuNjY2LDkwLjUzMiBMMTIuNyw5MC41MzMgTDEzLjI2Niw5MC41MzMgQzEzLjUxOCw5MC41MzMgMTMuOTE1LDkwLjQyNSAxNC4xMzIsOTAuMjk5IEwyNS42MzcsODMuNTk3IEMyNS44MDUsODMuNDk5IDI1LjkzMSw4My40MjQgMjUuOTk4LDgzLjM4MyBDMjUuOTk0LDgzLjI5OSAyNS45OTQsODMuMTY1IDI1Ljk5NCw4Mi45NDYgTDI1Ljg5OSw4Mi43NzUgTDI1Ljc2OCw4Mi44MjQgTDI1LjA1NCw4My4yODcgQzI0LjgyMiw4My40MzcgMjQuNDM4LDgzLjY3MyAyNC4yLDgzLjgxMiBMMTIuNjk1LDkwLjUxNCBMMTIuNjY2LDkwLjUzMiBMMTIuNjY2LDkwLjUzMiBaIiBpZD0iRmlsbC04IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTEzLjI2Niw4OS44NzEgTDEyLjcsODkuODcxIEMxMi41LDg5Ljg3MSAxMi4zODQsODkuODE1IDEyLjM1NCw4OS43MDUgQzEyLjMyNCw4OS41OTUgMTIuMzk3LDg5LjQ4OCAxMi41NjksODkuMzg4IEwyNC4wNzQsODIuNjg2IEMyNC4zMzIsODIuNTM1IDI0Ljc2OCw4Mi40MTggMjUuMDY3LDgyLjQxOCBMMjUuNjMyLDgyLjQxOCBDMjUuODMyLDgyLjQxOCAyNS45NDgsODIuNDc0IDI1Ljk3OCw4Mi41ODQgQzI2LjAwOCw4Mi42OTQgMjUuOTM1LDgyLjgwMSAyNS43NjMsODIuOTAxIEwxNC4yNTgsODkuNjAzIEMxNCw4OS43NTQgMTMuNTY0LDg5Ljg3MSAxMy4yNjYsODkuODcxIEwxMy4yNjYsODkuODcxIFogTTEyLjY2Niw4OS42MjEgTDEyLjcsODkuNjIyIEwxMy4yNjYsODkuNjIyIEMxMy41MTgsODkuNjIyIDEzLjkxNSw4OS41MTUgMTQuMTMyLDg5LjM4OCBMMjUuNjM3LDgyLjY4NiBMMjUuNjY3LDgyLjY2OCBMMjUuNjMyLDgyLjY2NyBMMjUuMDY3LDgyLjY2NyBDMjQuODE1LDgyLjY2NyAyNC40MTgsODIuNzc1IDI0LjIsODIuOTAxIEwxMi42OTUsODkuNjAzIEwxMi42NjYsODkuNjIxIEwxMi42NjYsODkuNjIxIFoiIGlkPSJGaWxsLTkiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIuMzcsOTAuODAxIEwxMi4zNyw4OS41NTQgTDEyLjM3LDkwLjgwMSIgaWQ9IkZpbGwtMTAiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNi4xMyw5My45MDEgQzUuMzc5LDkzLjgwOCA0LjgxNiw5My4xNjQgNC42OTEsOTIuNTI1IEMzLjg2LDg4LjI4NyAzLjU0LDgzLjc0MyAzLjUyNiw3MS4xNzMgQzMuNTExLDU4LjM4OSA0LjQyMyw1MS40MjggNC40MjMsNTEuNDI4IEM1LjEzNCw0Ny4yODIgNy4yMSw0Ni4yMzYgNy4yMSw0Ni4yMzYgQzcuMjEsNDYuMjM2IDgxLjY2NywzLjI1IDgyLjA2OSwzLjAxNyBDODIuMjkyLDIuODg4IDg0LjU1NiwxLjQzMyA4NS4yNjQsMy45NCBDODcuMjE0LDEwLjg0IDg2Ljc1MiwzNS44MjcgODUuNTM5LDQzLjgxOCBDODUuMTUsNDYuMzgzIDg0LjI5MSw0OS4wMzMgODIuNDgzLDUwLjEwMSBMNy4yMSw5My42NTMgQzYuODI4LDkzLjg3NCA2LjQ2MSw5My45NDEgNi4xMyw5My45MDEgQzYuMTMsOTMuOTAxIDMuMzQ5LDkzLjQ2IDMuMTI5LDkxLjc3NiBDMi41NjgsODcuNDk1IDEuOTc3LDgyLjk5NSAxLjk2Miw3MC40MjUgQzEuOTQ4LDU3LjY0MSAyLjg2LDUwLjY4IDIuODYsNTAuNjggQzMuNTcsNDYuNTM0IDUuNjQ3LDQ1LjQ4OSA1LjY0Nyw0NS40ODkgQzUuNjQ2LDQ1LjQ4OSA4LjA2NSw0NC4wOTIgMTIuMjQ1LDQxLjY3OSBMMTMuMTE2LDQxLjU2IEwxOS43MTUsMzcuNzMgTDE5Ljc2MSwzNy4yNjkgTDYuMTMsOTMuOTAxIiBpZD0iRmlsbC0xMSIgZmlsbD0iI0ZBRkFGQSI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LjMxNyw5NC4xNjEgTDYuMTAyLDk0LjE0OCBMNi4xMDEsOTQuMTQ4IEw1Ljg1Nyw5NC4xMDEgQzUuMTM4LDkzLjk0NSAzLjA4NSw5My4zNjUgMi44ODEsOTEuODA5IEMyLjMxMyw4Ny40NjkgMS43MjcsODIuOTk2IDEuNzEzLDcwLjQyNSBDMS42OTksNTcuNzcxIDIuNjA0LDUwLjcxOCAyLjYxMyw1MC42NDggQzMuMzM4LDQ2LjQxNyA1LjQ0NSw0NS4zMSA1LjUzNSw0NS4yNjYgTDEyLjE2Myw0MS40MzkgTDEzLjAzMyw0MS4zMiBMMTkuNDc5LDM3LjU3OCBMMTkuNTEzLDM3LjI0NCBDMTkuNTI2LDM3LjEwNyAxOS42NDcsMzcuMDA4IDE5Ljc4NiwzNy4wMjEgQzE5LjkyMiwzNy4wMzQgMjAuMDIzLDM3LjE1NiAyMC4wMDksMzcuMjkzIEwxOS45NSwzNy44ODIgTDEzLjE5OCw0MS44MDEgTDEyLjMyOCw0MS45MTkgTDUuNzcyLDQ1LjcwNCBDNS43NDEsNDUuNzIgMy43ODIsNDYuNzcyIDMuMTA2LDUwLjcyMiBDMy4wOTksNTAuNzgyIDIuMTk4LDU3LjgwOCAyLjIxMiw3MC40MjQgQzIuMjI2LDgyLjk2MyAyLjgwOSw4Ny40MiAzLjM3Myw5MS43MjkgQzMuNDY0LDkyLjQyIDQuMDYyLDkyLjg4MyA0LjY4Miw5My4xODEgQzQuNTY2LDkyLjk4NCA0LjQ4Niw5Mi43NzYgNC40NDYsOTIuNTcyIEMzLjY2NSw4OC41ODggMy4yOTEsODQuMzcgMy4yNzYsNzEuMTczIEMzLjI2Miw1OC41MiA0LjE2Nyw1MS40NjYgNC4xNzYsNTEuMzk2IEM0LjkwMSw0Ny4xNjUgNy4wMDgsNDYuMDU5IDcuMDk4LDQ2LjAxNCBDNy4wOTQsNDYuMDE1IDgxLjU0MiwzLjAzNCA4MS45NDQsMi44MDIgTDgxLjk3MiwyLjc4NSBDODIuODc2LDIuMjQ3IDgzLjY5MiwyLjA5NyA4NC4zMzIsMi4zNTIgQzg0Ljg4NywyLjU3MyA4NS4yODEsMy4wODUgODUuNTA0LDMuODcyIEM4Ny41MTgsMTEgODYuOTY0LDM2LjA5MSA4NS43ODUsNDMuODU1IEM4NS4yNzgsNDcuMTk2IDg0LjIxLDQ5LjM3IDgyLjYxLDUwLjMxNyBMNy4zMzUsOTMuODY5IEM2Ljk5OSw5NC4wNjMgNi42NTgsOTQuMTYxIDYuMzE3LDk0LjE2MSBMNi4zMTcsOTQuMTYxIFogTTYuMTcsOTMuNjU0IEM2LjQ2Myw5My42OSA2Ljc3NCw5My42MTcgNy4wODUsOTMuNDM3IEw4Mi4zNTgsNDkuODg2IEM4NC4xODEsNDguODA4IDg0Ljk2LDQ1Ljk3MSA4NS4yOTIsNDMuNzggQzg2LjQ2NiwzNi4wNDkgODcuMDIzLDExLjA4NSA4NS4wMjQsNC4wMDggQzg0Ljg0NiwzLjM3NyA4NC41NTEsMi45NzYgODQuMTQ4LDIuODE2IEM4My42NjQsMi42MjMgODIuOTgyLDIuNzY0IDgyLjIyNywzLjIxMyBMODIuMTkzLDMuMjM0IEM4MS43OTEsMy40NjYgNy4zMzUsNDYuNDUyIDcuMzM1LDQ2LjQ1MiBDNy4zMDQsNDYuNDY5IDUuMzQ2LDQ3LjUyMSA0LjY2OSw1MS40NzEgQzQuNjYyLDUxLjUzIDMuNzYxLDU4LjU1NiAzLjc3NSw3MS4xNzMgQzMuNzksODQuMzI4IDQuMTYxLDg4LjUyNCA0LjkzNiw5Mi40NzYgQzUuMDI2LDkyLjkzNyA1LjQxMiw5My40NTkgNS45NzMsOTMuNjE1IEM2LjA4Nyw5My42NCA2LjE1OCw5My42NTIgNi4xNjksOTMuNjU0IEw2LjE3LDkzLjY1NCBMNi4xNyw5My42NTQgWiIgaWQ9IkZpbGwtMTIiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNy4zMTcsNjguOTgyIEM3LjgwNiw2OC43MDEgOC4yMDIsNjguOTI2IDguMjAyLDY5LjQ4NyBDOC4yMDIsNzAuMDQ3IDcuODA2LDcwLjczIDcuMzE3LDcxLjAxMiBDNi44MjksNzEuMjk0IDYuNDMzLDcxLjA2OSA2LjQzMyw3MC41MDggQzYuNDMzLDY5Ljk0OCA2LjgyOSw2OS4yNjUgNy4zMTcsNjguOTgyIiBpZD0iRmlsbC0xMyIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LjkyLDcxLjEzMyBDNi42MzEsNzEuMTMzIDYuNDMzLDcwLjkwNSA2LjQzMyw3MC41MDggQzYuNDMzLDY5Ljk0OCA2LjgyOSw2OS4yNjUgNy4zMTcsNjguOTgyIEM3LjQ2LDY4LjkgNy41OTUsNjguODYxIDcuNzE0LDY4Ljg2MSBDOC4wMDMsNjguODYxIDguMjAyLDY5LjA5IDguMjAyLDY5LjQ4NyBDOC4yMDIsNzAuMDQ3IDcuODA2LDcwLjczIDcuMzE3LDcxLjAxMiBDNy4xNzQsNzEuMDk0IDcuMDM5LDcxLjEzMyA2LjkyLDcxLjEzMyBNNy43MTQsNjguNjc0IEM3LjU1Nyw2OC42NzQgNy4zOTIsNjguNzIzIDcuMjI0LDY4LjgyMSBDNi42NzYsNjkuMTM4IDYuMjQ2LDY5Ljg3OSA2LjI0Niw3MC41MDggQzYuMjQ2LDcwLjk5NCA2LjUxNyw3MS4zMiA2LjkyLDcxLjMyIEM3LjA3OCw3MS4zMiA3LjI0Myw3MS4yNzEgNy40MTEsNzEuMTc0IEM3Ljk1OSw3MC44NTcgOC4zODksNzAuMTE3IDguMzg5LDY5LjQ4NyBDOC4zODksNjkuMDAxIDguMTE3LDY4LjY3NCA3LjcxNCw2OC42NzQiIGlkPSJGaWxsLTE0IiBmaWxsPSIjODA5N0EyIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYuOTIsNzAuOTQ3IEM2LjY0OSw3MC45NDcgNi42MjEsNzAuNjQgNi42MjEsNzAuNTA4IEM2LjYyMSw3MC4wMTcgNi45ODIsNjkuMzkyIDcuNDExLDY5LjE0NSBDNy41MjEsNjkuMDgyIDcuNjI1LDY5LjA0OSA3LjcxNCw2OS4wNDkgQzcuOTg2LDY5LjA0OSA4LjAxNSw2OS4zNTUgOC4wMTUsNjkuNDg3IEM4LjAxNSw2OS45NzggNy42NTIsNzAuNjAzIDcuMjI0LDcwLjg1MSBDNy4xMTUsNzAuOTE0IDcuMDEsNzAuOTQ3IDYuOTIsNzAuOTQ3IE03LjcxNCw2OC44NjEgQzcuNTk1LDY4Ljg2MSA3LjQ2LDY4LjkgNy4zMTcsNjguOTgyIEM2LjgyOSw2OS4yNjUgNi40MzMsNjkuOTQ4IDYuNDMzLDcwLjUwOCBDNi40MzMsNzAuOTA1IDYuNjMxLDcxLjEzMyA2LjkyLDcxLjEzMyBDNy4wMzksNzEuMTMzIDcuMTc0LDcxLjA5NCA3LjMxNyw3MS4wMTIgQzcuODA2LDcwLjczIDguMjAyLDcwLjA0NyA4LjIwMiw2OS40ODcgQzguMjAyLDY5LjA5IDguMDAzLDY4Ljg2MSA3LjcxNCw2OC44NjEiIGlkPSJGaWxsLTE1IiBmaWxsPSIjODA5N0EyIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTcuNDQ0LDg1LjM1IEM3LjcwOCw4NS4xOTggNy45MjEsODUuMzE5IDcuOTIxLDg1LjYyMiBDNy45MjEsODUuOTI1IDcuNzA4LDg2LjI5MiA3LjQ0NCw4Ni40NDQgQzcuMTgxLDg2LjU5NyA2Ljk2Nyw4Ni40NzUgNi45NjcsODYuMTczIEM2Ljk2Nyw4NS44NzEgNy4xODEsODUuNTAyIDcuNDQ0LDg1LjM1IiBpZD0iRmlsbC0xNiIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik03LjIzLDg2LjUxIEM3LjA3NCw4Ni41MSA2Ljk2Nyw4Ni4zODcgNi45NjcsODYuMTczIEM2Ljk2Nyw4NS44NzEgNy4xODEsODUuNTAyIDcuNDQ0LDg1LjM1IEM3LjUyMSw4NS4zMDUgNy41OTQsODUuMjg0IDcuNjU4LDg1LjI4NCBDNy44MTQsODUuMjg0IDcuOTIxLDg1LjQwOCA3LjkyMSw4NS42MjIgQzcuOTIxLDg1LjkyNSA3LjcwOCw4Ni4yOTIgNy40NDQsODYuNDQ0IEM3LjM2Nyw4Ni40ODkgNy4yOTQsODYuNTEgNy4yMyw4Ni41MSBNNy42NTgsODUuMDk4IEM3LjU1OCw4NS4wOTggNy40NTUsODUuMTI3IDcuMzUxLDg1LjE4OCBDNy4wMzEsODUuMzczIDYuNzgxLDg1LjgwNiA2Ljc4MSw4Ni4xNzMgQzYuNzgxLDg2LjQ4MiA2Ljk2Niw4Ni42OTcgNy4yMyw4Ni42OTcgQzcuMzMsODYuNjk3IDcuNDMzLDg2LjY2NiA3LjUzOCw4Ni42MDcgQzcuODU4LDg2LjQyMiA4LjEwOCw4NS45ODkgOC4xMDgsODUuNjIyIEM4LjEwOCw4NS4zMTMgNy45MjMsODUuMDk4IDcuNjU4LDg1LjA5OCIgaWQ9IkZpbGwtMTciIGZpbGw9IiM4MDk3QTIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNy4yMyw4Ni4zMjIgTDcuMTU0LDg2LjE3MyBDNy4xNTQsODUuOTM4IDcuMzMzLDg1LjYyOSA3LjUzOCw4NS41MTIgTDcuNjU4LDg1LjQ3MSBMNy43MzQsODUuNjIyIEM3LjczNCw4NS44NTYgNy41NTUsODYuMTY0IDcuMzUxLDg2LjI4MiBMNy4yMyw4Ni4zMjIgTTcuNjU4LDg1LjI4NCBDNy41OTQsODUuMjg0IDcuNTIxLDg1LjMwNSA3LjQ0NCw4NS4zNSBDNy4xODEsODUuNTAyIDYuOTY3LDg1Ljg3MSA2Ljk2Nyw4Ni4xNzMgQzYuOTY3LDg2LjM4NyA3LjA3NCw4Ni41MSA3LjIzLDg2LjUxIEM3LjI5NCw4Ni41MSA3LjM2Nyw4Ni40ODkgNy40NDQsODYuNDQ0IEM3LjcwOCw4Ni4yOTIgNy45MjEsODUuOTI1IDcuOTIxLDg1LjYyMiBDNy45MjEsODUuNDA4IDcuODE0LDg1LjI4NCA3LjY1OCw4NS4yODQiIGlkPSJGaWxsLTE4IiBmaWxsPSIjODA5N0EyIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTc3LjI3OCw3Ljc2OSBMNzcuMjc4LDUxLjQzNiBMMTAuMjA4LDkwLjE2IEwxMC4yMDgsNDYuNDkzIEw3Ny4yNzgsNy43NjkiIGlkPSJGaWxsLTE5IiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTEwLjA4Myw5MC4zNzUgTDEwLjA4Myw0Ni40MjEgTDEwLjE0Niw0Ni4zODUgTDc3LjQwMyw3LjU1NCBMNzcuNDAzLDUxLjUwOCBMNzcuMzQxLDUxLjU0NCBMMTAuMDgzLDkwLjM3NSBMMTAuMDgzLDkwLjM3NSBaIE0xMC4zMzMsNDYuNTY0IEwxMC4zMzMsODkuOTQ0IEw3Ny4xNTQsNTEuMzY1IEw3Ny4xNTQsNy45ODUgTDEwLjMzMyw0Ni41NjQgTDEwLjMzMyw0Ni41NjQgWiIgaWQ9IkZpbGwtMjAiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMjUuNzM3LDg4LjY0NyBMMTE4LjA5OCw5MS45ODEgTDExOC4wOTgsODQgTDEwNi42MzksODguNzEzIEwxMDYuNjM5LDk2Ljk4MiBMOTksMTAwLjMxNSBMMTEyLjM2OSwxMDMuOTYxIEwxMjUuNzM3LDg4LjY0NyIgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTIiIGZpbGw9IiM0NTVBNjQiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+") +};var Te="CardboardV1",ce="WEBVR_CARDBOARD_VIEWER";I.prototype.show=function(e){this.root=e,e.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},I.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},I.prototype.getCurrentViewer=function(){return r.Viewers[this.selectedKey]},I.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},I.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},I.prototype.fireOnChange_=function(e){for(var M=0;M.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return A(e,[{key:"enable",value:function(){r?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location.href="/",window.setTimeout(window.stop,0)},15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){r?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=N},function(e,M,i){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])})})),we=function(e){return e&&e.__esModule?e.default:e}(Ee),ye=1e3,le=[0,0,.5,1],ze=[.5,0,.5,1],he=window.requestAnimationFrame,Oe=window.cancelAnimationFrame;c.prototype.getFrameData=function(e){return P(e,this._getPose(),this)},c.prototype.getPose=function(){return X("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},c.prototype.resetPose=function(){return X("VRDisplay.prototype.resetPose"),this._resetPose()},c.prototype.getImmediatePose=function(){return X("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},c.prototype.requestAnimationFrame=function(e){return he(e)},c.prototype.cancelAnimationFrame=function(e){return Oe(e)},c.prototype.wrapForFullscreen=function(e){if(O())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var M=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",M.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var i=this.fullscreenElement_.parentElement;i.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),i.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var t=this;return function(){if(t.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];t.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}(),this.fullscreenWrapper_},c.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var M=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===M?M.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),M.removeChild(this.fullscreenWrapper_),e}},c.prototype.requestPresent=function(e){var M=this.isPresenting,i=this;return e instanceof Array||(X("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise(function(t,A){if(!i.capabilities.canPresent)return void A(new Error("VRDisplay is not capable of presenting."));if(0==e.length||e.length>i.capabilities.maxLayers)return void A(new Error("Invalid number of layers."));var s=e[0];if(!s.source)return void t();var r=s.leftBounds||le,N=s.rightBounds||ze;if(M){var D=i.layer_;D.source!==s.source&&(D.source=s.source);for(var n=0;n<4;n++)D.leftBounds[n]=r[n],D.rightBounds[n]=N[n];return i.wrapForFullscreen(i.layer_.source),i.updatePresent_(),void t()}if(i.layer_={predistorted:s.predistorted,source:s.source,leftBounds:r.slice(0),rightBounds:N.slice(0)},i.waitingForPresent_=!1,i.layer_&&i.layer_.source){var u=i.wrapForFullscreen(i.layer_.source),a=function(){var e=Y();i.isPresenting=u===e,i.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch(function(e){console.error("screen.orientation.lock() failed due to",e.message)}),i.waitingForPresent_=!1,i.beginPresent_(),t()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),i.removeFullscreenWrapper(),i.disableWakeLock(),i.endPresent_(),i.removeFullscreenListeners_()),i.fireVRDisplayPresentChange_()},g=function(){i.waitingForPresent_&&(i.removeFullscreenWrapper(),i.removeFullscreenListeners_(),i.disableWakeLock(),i.waitingForPresent_=!1,i.isPresenting=!1,A(new Error("Unable to present.")))};i.addFullscreenListeners_(u,a,g),U(u)?(i.enableWakeLock(),i.waitingForPresent_=!0):(O()||x())&&(i.enableWakeLock(),i.isPresenting=!0,i.beginPresent_(),i.fireVRDisplayPresentChange_(),t())}i.waitingForPresent_||O()||(B(),A(new Error("Unable to present.")))})},c.prototype.exitPresent=function(){var e=this.isPresenting,M=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise(function(i,t){e?(!B()&&O()&&(M.endPresent_(),M.fireVRDisplayPresentChange_()),x()&&(M.removeFullscreenWrapper(),M.removeFullscreenListeners_(),M.endPresent_(),M.fireVRDisplayPresentChange_()),i()):t(new Error("Was not presenting to VRDisplay."))})},c.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},c.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},c.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},c.prototype.addFullscreenListeners_=function(e,M,i){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=M,this.fullscreenErrorHandler_=i,M&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",M,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",M,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",M,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",M,!1)),i&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",i,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",i,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",i,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",i,!1))},c.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var M=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",M,!1),e.removeEventListener("webkitfullscreenchange",M,!1),document.removeEventListener("mozfullscreenchange",M,!1),e.removeEventListener("msfullscreenchange",M,!1)}if(this.fullscreenErrorHandler_){var i=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",i,!1),e.removeEventListener("webkitfullscreenerror",i,!1),document.removeEventListener("mozfullscreenerror",i,!1),e.removeEventListener("msfullscreenerror",i,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},c.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},c.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},c.prototype.beginPresent_=function(){},c.prototype.endPresent_=function(){},c.prototype.submitFrame=function(e){},c.prototype.getEyeParameters=function(e){return null};var xe={MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},de={LEFT:"left",RIGHT:"right"};return E.prototype=Object.create(c.prototype),E.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},E.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},E.prototype._getFieldOfView=function(e){var M;if(e==de.LEFT)M=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=de.RIGHT)return console.error("Invalid eye provided: %s",e),null;M=this.deviceInfo_.getFieldOfViewRightEye()}return M},E.prototype._getEyeOffset=function(e){var M;if(e==de.LEFT)M=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=de.RIGHT)return console.error("Invalid eye provided: %s",e),null;M=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return M},E.prototype.getEyeParameters=function(e){var M=this._getEyeOffset(e),i=this._getFieldOfView(e),t={offset:M,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(t,"fieldOfView",{enumerable:!0,get:function(){return X("VRFieldOfView","VRFrameData's projection matrices"),i}}),t},E.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},E.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},E.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=m()*this.bufferScale_,e.canvas.height=k()*this.bufferScale_,this.cardboardUI_=new t(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new t(e)),this.distorter_=new i(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(p()&&R()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},E.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},E.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},E.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var M=this.layer_.source.getContext("webgl").canvas;M.width==this.lastWidth&&M.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=M.width,this.lastHeight=M.height,this.cardboardUI_.render()}},E.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},E.prototype.onResize_=function(e){if(this.layer_){var M=this.layer_.source.getContext("webgl"),i=["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"];M.canvas.setAttribute("style",i.join("; ")+";"),F(M.canvas)}},E.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},E.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},E.VRFrameData=j,E.VRDisplay=c,E}()}()}),N=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(r),D={PROVIDE_MOBILE_VRDISPLAY:!0,GET_VR_DISPLAYS_TIMEOUT:1e3,MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,TOUCH_PANNER_DISABLED:!0,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1};e.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(t()){var e=new N({MOBILE_WAKE_LOCK:this.config.MOBILE_WAKE_LOCK,DEBUG:this.config.DEBUG,DPDB_URL:this.config.DPDB_URL,CARDBOARD_UI_DISABLED:this.config.CARDBOARD_UI_DISABLED,K_FILTER:this.config.K_FILTER,PREDICTION_TIME_S:this.config.PREDICTION_TIME_S,TOUCH_PANNER_DISABLED:this.config.TOUCH_PANNER_DISABLED,ROTATE_INSTRUCTIONS_DISABLED:this.config.ROTATE_INSTRUCTIONS_DISABLED,YAW_ONLY:this.config.YAW_ONLY,BUFFER_SCALE:this.config.BUFFER_SCALE,DIRTY_SUBMIT_FRAME_BINDINGS:this.config.DIRTY_SUBMIT_FRAME_BINDINGS});this.polyfillDisplays.push(e)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},e.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var e=this.native.VRFrameData,M=new this.native.VRFrameData,i=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(t){if(t instanceof e)return void i.call(this,t);i.call(this,M),t.pose=M.pose,A(M.leftProjectionMatrix,t.leftProjectionMatrix),A(M.rightProjectionMatrix,t.rightProjectionMatrix),A(M.leftViewMatrix,t.leftViewMatrix),A(M.rightViewMatrix,t.rightViewMatrix)}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=N.VRDisplay,window.VRFrameData=N.VRFrameData},e.prototype.getVRDisplays=function(){var e=this,M=this.config;if(!this.hasNative)return Promise.resolve(this.getPolyfillDisplays());var t,A=this.native.getVRDisplays.call(navigator),s=new Promise(function(e){t=setTimeout(function(){console.warn("Native WebVR implementation detected, but `getVRDisplays()` failed to resolve. Falling back to polyfill."),e([])},M.GET_VR_DISPLAYS_TIMEOUT)});return i([A,s]).then(function(M){return clearTimeout(t),M.length>0?M:e.getPolyfillDisplays()})},e.version="0.10.5",e.VRFrameData=N.VRFrameData,e.VRDisplay=N.VRDisplay;var n=Object.freeze({default:e}),u=n&&e||n;return void 0!==M&&M.window&&(M.document||(M.document=M.window.document),M.navigator||(M.navigator=M.window.navigator)),u}); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],47:[function(_dereq_,module,exports){ +function idxOf(e,n,r,t){var i=e.indexOf(n,r);return-1===i||i>t?t:i}function isWhitespace(e){return whitespace.test(e)}function pre(e,n,r,t,i){for(var a=[],o=r,s=r;sr&&!isWhitespace(n.charAt(f));)f--;if(f===r)p>r+newlineChar.length&&p--,f=p;else for(p=f;f>r&&isWhitespace(n.charAt(f-newlineChar.length));)f--}if(f>=r){var c=e(n,r,f,s);o.push(c)}r=p}return o}function monospace(e,n,r,t){return{start:n,end:n+Math.min(t,r-n)}}var newline=/\n/,newlineChar="\n",whitespace=/\s/;module.exports=function(e,n){return module.exports.lines(e,n).map(function(n){return e.substring(n.start,n.end)}).join("\n")},module.exports.lines=function(e,n){if(n=n||{},0===n.width&&"nowrap"!==n.mode)return[];e=e||"";var r="number"==typeof n.width?n.width:Number.MAX_VALUE,t=Math.max(0,n.start||0),i="number"==typeof n.end?n.end:e.length,a=n.mode,o=n.measure||monospace;return"pre"===a?pre(o,e,t,i,r):greedy(o,e,t,i,r,a)}; +},{}],48:[function(_dereq_,module,exports){ +"use strict";function forEachArray(e,t){for(var r=0;r0&&(d=setTimeout(function(){if(!c){c=!0,i.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}},e.timeout)),i.setRequestHeader)for(u in m)m.hasOwnProperty(u)&&i.setRequestHeader(u,m[u]);else if(e.headers&&!isEmpty(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(i.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(i),i.send(f||null),i}function getXml(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}function noop(){}var window=_dereq_("global/window"),isFunction=_dereq_("is-function"),parseHeaders=_dereq_("parse-headers"),xtend=_dereq_("xtend");module.exports=createXHR,createXHR.XMLHttpRequest=window.XMLHttpRequest||noop,createXHR.XDomainRequest="withCredentials"in new createXHR.XMLHttpRequest?createXHR.XMLHttpRequest:window.XDomainRequest,forEachArray(["get","put","post","patch","head","delete"],function(e){createXHR["delete"===e?"del":e]=function(t,r,n){return r=initParams(t,r,n),r.method=e.toUpperCase(),_createXHR(r)}}); +},{"global/window":17,"is-function":21,"parse-headers":31,"xtend":50}],49:[function(_dereq_,module,exports){ +module.exports=function(){return void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var n=new self.ActiveXObject("Microsoft.XMLDOM");return n.async="false",n.loadXML(e),n}:function(e){var n=document.createElement("div");return n.innerHTML=e,n}}(); +},{}],50:[function(_dereq_,module,exports){ +function extend(){for(var r={},e=0;e dist/aframe-v0.8.2.js","dist:min":"npm run browserify -s -- --debug -p [minifyify --map aframe-v0.8.2.min.js.map --output dist/aframe-v0.8.2.min.js.map] -o dist/aframe-v0.8.2.min.js","docs":"markserv --dir docs --port 9001","preghpages":"node ./scripts/preghpages.js","ghpages":"ghpages -p gh-pages/","lint":"semistandard -v | snazzy","lint:fix":"semistandard --fix","precommit":"npm run lint","prepush":"node scripts/testOnlyCheck.js","prerelease":"node scripts/release.js 0.7.1 0.8.0","start":"npm run dev","test":"karma start ./tests/karma.conf.js","test:docs":"node scripts/docsLint.js","test:firefox":"npm test -- --browsers Firefox","test:chrome":"npm test -- --browsers Chrome","test:node":"mocha --ui tdd tests/node"},"repository":"aframevr/aframe","license":"MIT","dependencies":{"@tweenjs/tween.js":"^16.8.0","browserify-css":"^0.8.2","debug":"ngokevin/debug#noTimestamp","deep-assign":"^2.0.0","document-register-element":"dmarcos/document-register-element#8ccc532b7","envify":"^3.4.1","load-bmfont":"^1.2.3","object-assign":"^4.0.1","present":"0.0.6","promise-polyfill":"^3.1.0","style-attr":"^1.0.2","three":"github:supermedium/three.js#r90fixMTLLoader","three-bmfont-text":"^2.1.0","webvr-polyfill":"^0.10.5"},"devDependencies":{"browserify":"^13.1.0","browserify-derequire":"^0.9.4","browserify-istanbul":"^2.0.0","budo":"^9.2.0","chai":"^3.5.0","chai-shallow-deep-equal":"^1.4.0","chalk":"^1.1.3","codecov":"^1.0.1","cross-env":"^5.0.1","exorcist":"^0.4.0","ghpages":"0.0.8","git-rev":"^0.2.1","glob":"^7.1.1","husky":"^0.11.7","istanbul":"^0.4.5","jsdom":"^9.11.0","karma":"1.4.1","karma-browserify":"^5.1.0","karma-chai-shallow-deep-equal":"0.0.4","karma-chrome-launcher":"^2.0.0","karma-coverage":"^1.1.1","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.1.1","karma-mocha-reporter":"^2.1.0","karma-sinon-chai":"1.2.4","lolex":"^1.5.1","markserv":"github:sukima/markserv#feature/fix-broken-websoketio-link","minifyify":"^7.3.3","mocha":"^3.0.2","mozilla-download":"^1.1.1","replace-in-file":"^2.5.3","semistandard":"^9.0.0","shelljs":"^0.7.7","shx":"^0.2.2","sinon":"^1.17.5","sinon-chai":"2.8.0","snazzy":"^5.0.0","too-wordy":"ngokevin/too-wordy","uglifyjs":"^2.4.10","write-good":"^0.9.1"},"link":true,"browserify":{"transform":["browserify-css","envify"]},"semistandard":{"ignore":["build/**","dist/**","examples/**/shaders/*.js","**/vendor/**"]},"keywords":["3d","aframe","cardboard","components","oculus","three","three.js","rift","vive","vr","web-components","webvr"],"browserify-css":{"minify":true},"engines":{"node":">= 4.6.0","npm":"^2.15.9"}} +},{}],52:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three");module.exports.Component=registerComponent("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new THREE.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,a=this.camera;a.aspect=t.aspect||window.innerWidth/window.innerHeight,a.far=t.far,a.fov=t.fov,a.near=t.near,a.zoom=t.zoom,a.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,a=this.el,r=this.system;e&&e.active===t.active||t.spectator||(t.active&&r.activeCameraEl!==a?r.setActiveCamera(a):t.active||r.activeCameraEl!==a||r.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,a=this.el,r=this.system;e&&e.spectator===t.spectator||(t.spectator&&r.spectatorCameraEl!==a?r.setSpectatorCamera(a):t.spectator||r.spectatorCameraEl!==a||r.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}}); +},{"../core/component":102,"../lib/three":150}],53:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three");module.exports.Component=registerComponent("collada-model",{schema:{type:"asset"},init:function(){this.model=null,this.loader=new THREE.ColladaLoader,this.loader.options.convertUpAxis=!0},update:function(){var e=this,o=this.el,t=this.data;t&&(this.remove(),this.loader.load(t,function(t){e.model=t.scene,o.setObject3D("mesh",e.model),o.emit("model-loaded",{format:"collada",model:e.model})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}}); +},{"../core/component":102,"../lib/three":150}],54:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,utils=_dereq_("../utils/"),bind=utils.bind,EVENTS={CLICK:"click",FUSING:"fusing",MOUSEENTER:"mouseenter",MOUSEDOWN:"mousedown",MOUSELEAVE:"mouseleave",MOUSEUP:"mouseup"},STATES={FUSING:"cursor-fusing",HOVERING:"cursor-hovering",HOVERED:"cursor-hovered"},CANVAS_EVENTS={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]};module.exports.Component=registerComponent("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:utils.device.isMobile()},fuseTimeout:{default:1500,min:0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity"]}},init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.updateCanvasBounds=utils.debounce(function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()},1e3),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=bind(this.onCursorDown,this),this.onCursorUp=bind(this.onCursorUp,this),this.onIntersection=bind(this.onIntersection,this),this.onIntersectionCleared=bind(this.onIntersectionCleared,this),this.onMouseMove=bind(this.onMouseMove,this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&this.updateMouseEventListeners()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(STATES.HOVERING),e.removeState(STATES.FUSING),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(STATES.HOVERED),this.removeEventListeners()},addEventListeners:function(){function e(){t=s.sceneEl.canvas,n.downEvents.length||n.upEvents.length||(CANVAS_EVENTS.DOWN.forEach(function(e){t.addEventListener(e,i.onCursorDown)}),CANVAS_EVENTS.UP.forEach(function(e){t.addEventListener(e,i.onCursorUp)}))}var t,n=this.data,s=this.el,i=this;t=s.sceneEl.canvas,t?e():s.sceneEl.addEventListener("render-target-loaded",e),n.downEvents.forEach(function(e){s.addEventListener(e,i.onCursorDown)}),n.upEvents.forEach(function(e){s.addEventListener(e,i.onCursorUp)}),s.addEventListener("raycaster-intersection",this.onIntersection),s.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),window.addEventListener("resize",this.updateCanvasBounds)},removeEventListeners:function(){var e,t=this.data,n=this.el,s=this;e=n.sceneEl.canvas,!e||t.downEvents.length||t.upEvents.length||(CANVAS_EVENTS.DOWN.forEach(function(t){e.removeEventListener(t,s.onCursorDown)}),CANVAS_EVENTS.UP.forEach(function(t){e.removeEventListener(t,s.onCursorUp)})),t.downEvents.forEach(function(e){n.removeEventListener(e,s.onCursorDown)}),t.upEvents.forEach(function(e){n.removeEventListener(e,s.onCursorUp)}),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),e.removeEventListener("resize",this.updateCanvasBounds)},updateMouseEventListeners:function(){var e,t=this.el;e=t.sceneEl.canvas,e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove,!1),e.addEventListener("touchmove",this.onMouseMove,!1),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},onMouseMove:function(){var e=new THREE.Vector3,t=new THREE.Vector2,n=new THREE.Vector3,s={origin:n,direction:e};return function(i){var o,r,a,c=this.canvasBounds,u=this.el.sceneEl.camera;u.parent.updateMatrixWorld(),r="touchmove"===i.type||"touchstart"===i.type?i.touches.item(0):i,o=r.clientX-c.left,a=r.clientY-c.top,t.x=o/c.width*2-1,t.y=-a/c.height*2+1,n.setFromMatrixPosition(u.matrixWorld),e.set(t.x,t.y,.5).unproject(u).sub(n).normalize(),this.el.setAttribute("raycaster",s),"touchmove"===i.type&&i.preventDefault()}}(),onCursorDown:function(e){"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),this.twoWayEmit(EVENTS.MOUSEDOWN),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){this.twoWayEmit(EVENTS.MOUSEUP),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(EVENTS.MOUSEUP,this.intersectedEventDetail)),!this.data.fuse&&this.intersectedEl&&this.cursorDownEl===this.intersectedEl&&this.twoWayEmit(EVENTS.CLICK),this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()},onIntersection:function(e){var t,n,s,i,o=this.el;n=e.detail.els[0]===o?1:0,i=e.detail.intersections[n],(s=e.detail.els[n])&&this.intersectedEl!==s&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl),t.distance<=i.distance)||(this.clearCurrentIntersection(!0),this.setIntersection(s,i)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},setIntersection:function(e,t){var n=this.el,s=this.data,i=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(STATES.HOVERING),e.addState(STATES.HOVERED),this.twoWayEmit(EVENTS.MOUSEENTER),0!==s.fuseTimeout&&s.fuse&&(n.addState(STATES.FUSING),this.twoWayEmit(EVENTS.FUSING),this.fuseTimeout=setTimeout(function(){n.removeState(STATES.FUSING),i.twoWayEmit(EVENTS.CLICK)},s.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,s,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(STATES.HOVERED),i.removeState(STATES.HOVERING),i.removeState(STATES.FUSING),this.twoWayEmit(EVENTS.MOUSELEAVE),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&(s=this.el.components.raycaster.intersections,0!==s.length&&(t=s[0].object.el===i?1:0,(n=s[t])&&this.setIntersection(n.object.el,n))))},twoWayEmit:function(e){var t,n=this.el,s=this.intersectedEl;t=this.el.components.raycaster.getIntersection(s),this.eventDetail.intersectedEl=s,this.eventDetail.intersection=t,n.emit(e,this.eventDetail),s&&(this.intersectedEventDetail.intersection=t,s.emit(e,this.intersectedEventDetail))}}); +},{"../core/component":102,"../utils/":172}],55:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),checkControllerPresentAndSetup=_dereq_("../utils/tracked-controls").checkControllerPresentAndSetup,trackedControlsUtils=_dereq_("../utils/tracked-controls"),emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,DAYDREAM_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/google/",DAYDREAM_CONTROLLER_MODEL_OBJ_URL=DAYDREAM_CONTROLLER_MODEL_BASE_URL+"vr_controller_daydream.obj",DAYDREAM_CONTROLLER_MODEL_OBJ_MTL=DAYDREAM_CONTROLLER_MODEL_BASE_URL+"vr_controller_daydream.mtl",GAMEPAD_ID_PREFIX="Daydream Controller";module.exports.Component=registerComponent("daydream-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#000000"},buttonTouchedColor:{type:"color",default:"#777777"},buttonHighlightColor:{type:"color",default:"#FFFFFF"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:{axes:{trackpad:[0,1]},buttons:["trackpad","menu","system"]},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.animationActive="pointing",this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.onAxisMoved=bind(this.onAxisMoved,this),this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods(),this.checkControllerPresentAndSetup=checkControllerPresentAndSetup,this.emitIfAxesChanged=emitIfAxesChanged},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){this.checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{hand:this.data.hand})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,hand:e.hand,idPrefix:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:DAYDREAM_CONTROLLER_MODEL_OBJ_URL,mtl:DAYDREAM_CONTROLLER_MODEL_OBJ_MTL})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,o=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.menu=o.getObjectByName("AppButton_AppButton_Cylinder.004"),e.system=o.getObjectByName("HomeButton_HomeButton_Cylinder.005"),e.trackpad=o.getObjectByName("TouchPad_TouchPad_Cylinder.003"),o.position.set(0,0,-.04))},onAxisMoved:function(t){this.emitIfAxesChanged(this,this.mapping.axes,t)},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var o=this.buttonMeshes;if(o&&o[t]){var n;switch(e){case"down":n=this.data.buttonHighlightColor;break;case"touchstart":n=this.data.buttonTouchedColor;break;default:n=this.data.buttonColor}o[t].material.color.set(n)}}}); +},{"../core/component":102,"../utils/bind":166,"../utils/tracked-controls":178}],56:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,GEARVR_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/samsung/",GEARVR_CONTROLLER_MODEL_OBJ_URL=GEARVR_CONTROLLER_MODEL_BASE_URL+"gear_vr_controller.obj",GEARVR_CONTROLLER_MODEL_OBJ_MTL=GEARVR_CONTROLLER_MODEL_BASE_URL+"gear_vr_controller.mtl",GAMEPAD_ID_PREFIX="Gear VR|GearVR|Oculus Go";module.exports.Component=registerComponent("gearvr-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#000000"},buttonTouchedColor:{type:"color",default:"#777777"},buttonHighlightColor:{type:"color",default:"#FFFFFF"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.animationActive="pointing",this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.onAxisMoved=bind(this.onAxisMoved,this),this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods(),this.checkControllerPresentAndSetup=checkControllerPresentAndSetup,this.emitIfAxesChanged=emitIfAxesChanged},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){this.checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,idPrefix:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:GEARVR_CONTROLLER_MODEL_OBJ_URL,mtl:GEARVR_CONTROLLER_MODEL_OBJ_MTL})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.trigger=n.children[2],e.trackpad=n.children[1])},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){this.emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes;if(n&&n[t]){var o;switch(e){case"down":o=this.data.buttonHighlightColor;break;case"touchstart":o=this.data.buttonTouchedColor;break;default:o=this.data.buttonColor}n[t].material.color.set(o)}}}); +},{"../core/component":102,"../utils/bind":166,"../utils/tracked-controls":178}],57:[function(_dereq_,module,exports){ +var geometries=_dereq_("../core/geometry").geometries,geometryNames=_dereq_("../core/geometry").geometryNames,registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),dummyGeometry=new THREE.Geometry;module.exports.Component=registerComponent("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:geometryNames},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,r=this.data,m=this.el,o=this.system;this.geometry&&(o.unuseGeometry(e),this.geometry=null),this.geometry=o.getOrCreateGeometry(r),t=m.getObject3D("mesh"),t?t.geometry=this.geometry:(t=new THREE.Mesh,t.geometry=this.geometry,m.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=dummyGeometry,this.geometry=null},updateSchema:function(e){var t=e.primitive,r=this.data&&this.data.primitive,m=geometries[t]&&geometries[t].schema;if(!m)throw new Error("Unknown geometry schema `"+t+"`");r&&r===t||this.extendSchema(m)}}); +},{"../core/component":102,"../core/geometry":103,"../lib/three":150}],58:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),warn=utils.debug("components:gltf-model:warn");module.exports.Component=registerComponent("gltf-model",{schema:{type:"model"},init:function(){this.model=null,this.loader=new THREE.GLTFLoader},update:function(){var e=this,o=this.el,t=this.data;t&&(this.remove(),this.loader.load(t,function(t){e.model=t.scene||t.scenes[0],e.model.animations=t.animations,o.setObject3D("mesh",e.model),o.emit("model-loaded",{format:"gltf",model:e.model})},void 0,function(e){var i=e&&e.message?e.message:"Failed to load glTF model";warn(i),o.emit("model-error",{format:"gltf",src:t})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}}); +},{"../core/component":102,"../lib/three":150,"../utils/":172}],59:[function(_dereq_,module,exports){ +function getGestureEventName(t,e){var n;if(t)return n=EVENTS[t],"grip"===n?n+(e?"close":"open"):"point"===n||"thumb"===n?n+(e?"up":"down"):"pointing"===n||"pistol"===n?n+(e?"start":"end"):void 0}function isViveController(t){var e=t&&t.controller&&t.controller.id;return e&&0===e.indexOf("OpenVR ")}var registerComponent=_dereq_("../core/component").registerComponent,MODEL_URLS={left:"https://cdn.aframe.io/controllers/oculus-hands/v2/leftHand.json",right:"https://cdn.aframe.io/controllers/oculus-hands/v2/rightHand.json"},ANIMATIONS={open:"Open",point:"Point",pointThumb:"Point + Thumb",fist:"Fist",hold:"Hold",thumbUp:"Thumb Up"},EVENTS={};EVENTS[ANIMATIONS.fist]="grip",EVENTS[ANIMATIONS.thumbUp]="pistol",EVENTS[ANIMATIONS.point]="pointing",EVENTS[ANIMATIONS.thumb]="thumb",module.exports.Component=registerComponent("hand-controls",{schema:{default:"left"},init:function(){var t=this,e=this.el;this.gesture=ANIMATIONS.open,this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.ObjectLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){t.handleButton("grip","down")},this.onGripUp=function(){t.handleButton("grip","up")},this.onTrackpadDown=function(){t.handleButton("trackpad","down")},this.onTrackpadUp=function(){t.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){t.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){t.handleButton("trackpad","touchend")},this.onTriggerDown=function(){t.handleButton("trigger","down")},this.onTriggerUp=function(){t.handleButton("trigger","up")},this.onTriggerTouchStart=function(){t.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){t.handleButton("trigger","touchend")},this.onGripTouchStart=function(){t.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){t.handleButton("grip","touchend")},this.onThumbstickDown=function(){t.handleButton("thumbstick","down")},this.onThumbstickUp=function(){t.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){t.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){t.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){t.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){t.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){t.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){t.handleButton("surface","touchend")},this.onControllerConnected=function(){t.setModelVisibility(!0)},this.onControllerDisconnected=function(){t.setModelVisibility(!1)},e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected)},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(e/1e3)},addEventListeners:function(){var t=this.el;t.addEventListener("gripdown",this.onGripDown),t.addEventListener("gripup",this.onGripUp),t.addEventListener("trackpaddown",this.onTrackpadDown),t.addEventListener("trackpadup",this.onTrackpadUp),t.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.addEventListener("triggerdown",this.onTriggerDown),t.addEventListener("triggerup",this.onTriggerUp),t.addEventListener("triggertouchstart",this.onTriggerTouchStart),t.addEventListener("triggertouchend",this.onTriggerTouchEnd),t.addEventListener("griptouchstart",this.onGripTouchStart),t.addEventListener("griptouchend",this.onGripTouchEnd),t.addEventListener("thumbstickdown",this.onThumbstickDown),t.addEventListener("thumbstickup",this.onThumbstickUp),t.addEventListener("abuttontouchstart",this.onAorXTouchStart),t.addEventListener("abuttontouchend",this.onAorXTouchEnd),t.addEventListener("bbuttontouchstart",this.onBorYTouchStart),t.addEventListener("bbuttontouchend",this.onBorYTouchEnd),t.addEventListener("xbuttontouchstart",this.onAorXTouchStart),t.addEventListener("xbuttontouchend",this.onAorXTouchEnd),t.addEventListener("ybuttontouchstart",this.onBorYTouchStart),t.addEventListener("ybuttontouchend",this.onBorYTouchEnd),t.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var t=this.el;t.removeEventListener("gripdown",this.onGripDown),t.removeEventListener("gripup",this.onGripUp),t.removeEventListener("trackpaddown",this.onTrackpadDown),t.removeEventListener("trackpadup",this.onTrackpadUp),t.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.removeEventListener("triggerdown",this.onTriggerDown),t.removeEventListener("triggerup",this.onTriggerUp),t.removeEventListener("triggertouchstart",this.onTriggerTouchStart),t.removeEventListener("triggertouchend",this.onTriggerTouchEnd),t.removeEventListener("griptouchstart",this.onGripTouchStart),t.removeEventListener("griptouchend",this.onGripTouchEnd),t.removeEventListener("thumbstickdown",this.onThumbstickDown),t.removeEventListener("thumbstickup",this.onThumbstickUp),t.removeEventListener("abuttontouchstart",this.onAorXTouchStart),t.removeEventListener("abuttontouchend",this.onAorXTouchEnd),t.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),t.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),t.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),t.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),t.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),t.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),t.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(t){var e,n=this.el,o=this.data;e={hand:o,model:!1,orientationOffset:{x:0,y:0,z:"left"===o?90:-90}},o!==t&&this.loader.load(MODEL_URLS[o],function(t){var o=t.getObjectByName("Hand");o.material.skinning=!0,o.mixer=new THREE.AnimationMixer(o),n.setObject3D("mesh",o),o.position.set(0,0,0),o.rotation.set(0,0,0),o.visible=!1,n.setAttribute("vive-controls",e),n.setAttribute("oculus-touch-controls",e),n.setAttribute("windows-motion-controls",e)})},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(t,e){var n,o="down"===e,i="touchstart"===e;if(0===e.indexOf("touch")){if(i===this.touchedButtons[t])return;this.touchedButtons[t]=i}else{if(o===this.pressedButtons[t])return;this.pressedButtons[t]=o}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var t,e=this.pressedButtons.grip,n=this.pressedButtons.surface||this.touchedButtons.surface,o=this.pressedButtons.trackpad||this.touchedButtons.trackpad,i=this.pressedButtons.trigger||this.touchedButtons.trigger,r=this.touchedButtons.AorX||this.touchedButtons.BorY,s=isViveController(this.el.components["tracked-controls"]);return e?t=s?ANIMATIONS.fist:n||r||o?i?ANIMATIONS.fist:ANIMATIONS.point:i?ANIMATIONS.thumbUp:ANIMATIONS.pointThumb:i?t=s?ANIMATIONS.fist:ANIMATIONS.hold:s&&o&&(t=ANIMATIONS.point),t},animateGesture:function(t,e){if(t)return void this.playAnimation(t||ANIMATIONS.open,e,!1);this.playAnimation(e,e,!0)},emitGestureEvents:function(t,e){var n,o=this.el;e!==t&&(n=getGestureEventName(e,!1),n&&o.emit(n),(n=getGestureEventName(t,!0))&&o.emit(n))},playAnimation:function(t,e,n){var o,i,r=this.el.getObject3D("mesh");if(r){if(i=r.mixer.clipAction(t),i.clampWhenFinished=!0,i.loop=THREE.LoopRepeat,i.repetitions=0,i.timeScale=n?-1:1,i.weight=1,!e||t===e)return r.mixer.stopAllAction(),void i.play();o=r.mixer.clipAction(e),r.mixer.stopAllAction(),o.weight=.15,o.play(),i.play(),o.crossFadeTo(i,.15,!0)}},setModelVisibility:function(t){var e=this.el.getObject3D("mesh");e&&(e.visible=t)}}); +},{"../core/component":102}],60:[function(_dereq_,module,exports){ +_dereq_("./camera"),_dereq_("./collada-model"),_dereq_("./cursor"),_dereq_("./daydream-controls"),_dereq_("./gearvr-controls"),_dereq_("./geometry"),_dereq_("./gltf-model"),_dereq_("./hand-controls"),_dereq_("./laser-controls"),_dereq_("./light"),_dereq_("./line"),_dereq_("./link"),_dereq_("./look-controls"),_dereq_("./material"),_dereq_("./obj-model"),_dereq_("./oculus-touch-controls"),_dereq_("./position"),_dereq_("./raycaster"),_dereq_("./rotation"),_dereq_("./scale"),_dereq_("./shadow"),_dereq_("./sound"),_dereq_("./text"),_dereq_("./tracked-controls"),_dereq_("./visible"),_dereq_("./vive-controls"),_dereq_("./wasd-controls"),_dereq_("./windows-motion-controls"),_dereq_("./scene/background"),_dereq_("./scene/debug"),_dereq_("./scene/embedded"),_dereq_("./scene/inspector"),_dereq_("./scene/fog"),_dereq_("./scene/keyboard-shortcuts"),_dereq_("./scene/pool"),_dereq_("./scene/renderer"),_dereq_("./scene/screenshot"),_dereq_("./scene/stats"),_dereq_("./scene/vr-mode-ui"); +},{"./camera":52,"./collada-model":53,"./cursor":54,"./daydream-controls":55,"./gearvr-controls":56,"./geometry":57,"./gltf-model":58,"./hand-controls":59,"./laser-controls":61,"./light":62,"./line":63,"./link":64,"./look-controls":65,"./material":66,"./obj-model":67,"./oculus-touch-controls":68,"./position":69,"./raycaster":70,"./rotation":71,"./scale":72,"./scene/background":73,"./scene/debug":74,"./scene/embedded":75,"./scene/fog":76,"./scene/inspector":77,"./scene/keyboard-shortcuts":78,"./scene/pool":79,"./scene/renderer":80,"./scene/screenshot":81,"./scene/stats":82,"./scene/vr-mode-ui":83,"./shadow":84,"./sound":85,"./text":86,"./tracked-controls":87,"./visible":88,"./vive-controls":89,"./wasd-controls":90,"./windows-motion-controls":91}],61:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,utils=_dereq_("../utils/");registerComponent("laser-controls",{schema:{hand:{default:"right"}},init:function(){function t(t){var r=e[t.detail.name];if(r){var n=utils.extend({showLine:!0},r.raycaster||{});t.detail.rayOrigin&&(n.origin=t.detail.rayOrigin.origin,n.direction=t.detail.rayOrigin.direction,n.showLine=!0),t.detail.rayOrigin||!i.modelReady?o.setAttribute("raycaster",n):o.setAttribute("raycaster","showLine",!0),o.setAttribute("cursor",utils.extend({fuse:!1},r.cursor))}}function r(){o.setAttribute("raycaster","showLine",!1)}var e=this.config,n=this.data,o=this.el,i=this;o.setAttribute("daydream-controls",{hand:n.hand}),o.setAttribute("gearvr-controls",{hand:n.hand}),o.setAttribute("oculus-touch-controls",{hand:n.hand}),o.setAttribute("vive-controls",{hand:n.hand}),o.setAttribute("windows-motion-controls",{hand:n.hand}),o.addEventListener("controllerconnected",t),o.addEventListener("controllerdisconnected",r),o.addEventListener("controllermodelready",function(r){t(r),i.modelReady=!0})},config:{"daydream-controls":{cursor:{downEvents:["trackpaddown"],upEvents:["trackpadup"]}},"gearvr-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"oculus-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}}); +},{"../core/component":102,"../utils/":172}],62:[function(_dereq_,module,exports){ +var bind=_dereq_("../utils/bind"),diff=_dereq_("../utils").diff,debug=_dereq_("../utils/debug"),registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad,warn=debug("components:light:warn");module.exports.Component=registerComponent("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color"},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:1,min:0,if:{type:["ambient","directional","hemisphere","point","spot"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot"]},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(e)},update:function(e){var a=this.data,t=diff(a,e),o=this.light,i=this;if(o&&!("type"in t)){var r=!1;return void Object.keys(t).forEach(function(e){var t=a[e];switch(e){case"color":o.color.set(t);break;case"groundColor":o.groundColor.set(t);break;case"angle":o.angle=degToRad(t);break;case"target":null===t?"spot"!==a.type&&"directional"!==a.type||(o.target=i.defaultTarget):t.hasLoaded?i.onSetTarget(t,o):t.addEventListener("loaded",bind(i.onSetTarget,i,t,o));break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":r||(i.updateShadow(),r=!0);break;default:o[e]=t}})}this.setLight(this.data),this.updateShadow()},setLight:function(e){var a=this.el,t=this.getLight(e);t&&(this.light&&a.removeObject3D("light"),this.light=t,this.light.el=a,a.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||a.getObject3D("light").translateY(-1),"spot"===e.type&&(a.setObject3D("light-target",this.defaultTarget),a.getObject3D("light-target").position.set(0,0,-1)))},updateShadow:function(){var e=this.el,a=this.data,t=this.light;t.castShadow=a.castShadow;var o=e.getObject3D("cameraHelper");if(a.shadowCameraVisible&&!o?e.setObject3D("cameraHelper",new THREE.CameraHelper(t.shadow.camera)):!a.shadowCameraVisible&&o&&e.removeObject3D("cameraHelper"),!a.castShadow)return t;t.shadow.bias=a.shadowBias,t.shadow.mapSize.height=a.shadowMapHeight,t.shadow.mapSize.width=a.shadowMapWidth,t.shadow.camera.near=a.shadowCameraNear,t.shadow.camera.far=a.shadowCameraFar,t.shadow.camera instanceof THREE.OrthographicCamera?(t.shadow.camera.top=a.shadowCameraTop,t.shadow.camera.right=a.shadowCameraRight,t.shadow.camera.bottom=a.shadowCameraBottom,t.shadow.camera.left=a.shadowCameraLeft):t.shadow.camera.fov=a.shadowCameraFov,t.shadow.camera.updateProjectionMatrix(),o&&o.update()},getLight:function(e){var a=e.angle,t=new THREE.Color(e.color).getHex(),o=e.decay,i=e.distance,r=new THREE.Color(e.groundColor).getHex(),s=e.intensity,d=e.type,h=e.target,n=null;switch(d.toLowerCase()){case"ambient":return new THREE.AmbientLight(t,s);case"directional":return n=new THREE.DirectionalLight(t,s),this.defaultTarget=n.target,h&&(h.hasLoaded?this.onSetTarget(h,n):h.addEventListener("loaded",bind(this.onSetTarget,this,h,n))),n;case"hemisphere":return new THREE.HemisphereLight(t,r,s);case"point":return new THREE.PointLight(t,s,i,o);case"spot":return n=new THREE.SpotLight(t,s,i,degToRad(a),e.penumbra,o),this.defaultTarget=n.target,h&&(h.hasLoaded?this.onSetTarget(h,n):h.addEventListener("loaded",bind(this.onSetTarget,this,h,n))),n;default:warn("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",d)}},onSetTarget:function(e,a){a.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}}); +},{"../core/component":102,"../lib/three":150,"../utils":172,"../utils/bind":166,"../utils/debug":168}],63:[function(_dereq_,module,exports){ +function isEqualVec3(t,e){return!(!t||!e)&&(t.x===e.x&&t.y===e.y&&t.z===e.z)}var registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var t,e,i=this.data;e=this.material=new THREE.LineBasicMaterial({color:i.color,opacity:i.opacity,transparent:i.opacity<1,visible:i.visible}),t=this.geometry=new THREE.BufferGeometry,t.addAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(t,e),this.el.setObject3D(this.attrName,this.line)},update:function(t){var e=this.data,i=this.geometry,r=!1,a=this.material,o=i.attributes.position.array;isEqualVec3(e.start,t.start)||(o[0]=e.start.x,o[1]=e.start.y,o[2]=e.start.z,r=!0),isEqualVec3(e.end,t.end)||(o[3]=e.end.x,o[4]=e.end.y,o[5]=e.end.z,r=!0),r&&(i.attributes.position.needsUpdate=!0,i.computeBoundingSphere()),a.color.setStyle(e.color),a.opacity=e.opacity,a.transparent=e.opacity<1,a.visible=e.visible},remove:function(){this.el.removeObject3D("line",this.line)}}); +},{"../core/component":102}],64:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,registerShader=_dereq_("../core/shader").registerShader,THREE=_dereq_("../lib/three");module.exports.Component=registerComponent("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!0}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new THREE.Quaternion,this.hiddenEls=[],this.initVisualAspect()},update:function(e){var t,i,r=this.data,o=this.el;t=r.highlighted?r.highlightedColor:r.backgroundColor,i=r.highlighted?r.highlightedColor:r.borderColor,o.setAttribute("material","backgroundColor",t),o.setAttribute("material","strokeColor",i),r.on!==e.on&&this.updateEventListener(),r.visualAspectEnabled&&void 0!==e.peekMode&&r.peekMode!==e.peekMode&&this.updatePeekMode(),r.image&&e.image!==r.image&&o.setAttribute("material","pano","string"==typeof r.image?r.image:r.image.src)},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,i,r=this.el;this.data.visualAspectEnabled&&(i=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),r.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),r.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double"}),i.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),i.setAttribute("position","0 1.5 0"),r.appendChild(i),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),r.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),t.setAttribute("visible",!1),r.appendChild(t))},navigate:function(){window.location=this.data.href},tick:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Quaternion,r=new THREE.Vector3;return function(){var o,a,n=this.el,s=n.object3D,l=n.sceneEl.camera,d=this.textEl;if(this.data.visualAspectEnabled)if(s.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),s.matrix.decompose(t,i,r),t.setFromMatrixPosition(s.matrixWorld),e.setFromMatrixPosition(l.matrixWorld),(a=t.distanceTo(e))>20)this.previousQuaternion||(this.quaternionClone.copy(i),this.previousQuaternion=this.quaternionClone),s.lookAt(e);else{if(o=this.calculateCameraPortalOrientation(),a<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;d.setAttribute("text","width",1.5),o<=0?(d.setAttribute("position","0 0 0.75"),d.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(d.setAttribute("position","0 0 -0.75"),d.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=o}else o<=0?d.setAttribute("rotation","0 180 0"):d.setAttribute("rotation","0 0 0"),d.setAttribute("text","width",5),d.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(s.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var e=this.el,t=this.hiddenEls,i=this;t.length>0||e.sceneEl.object3D.traverse(function(r){r&&r.el&&r.el.hasAttribute("link-controls")||r.el&&r!==e.sceneEl.object3D&&r.el!==e&&r.el!==i.sphereEl&&r.el!==e.sceneEl.cameraEl&&!1!==r.el.getAttribute("visible")&&r.el!==i.textEl&&r.el!==i.semiSphereEl&&(r.el.setAttribute("visible",!1),t.push(r.el))})},showAll:function(){this.hiddenEls.forEach(function(e){e.setAttribute("visible",!0)}),this.hiddenEls=[]},calculateCameraPortalOrientation:function(){var e=new THREE.Matrix4,t=new THREE.Vector3,i=new THREE.Vector3(0,0,1),r=new THREE.Vector3(0,0,0);return function(){var o=this.el,a=o.sceneEl.camera;return t.set(0,0,0),i.set(0,0,1),r.set(0,0,0),o.object3D.matrixWorld.extractRotation(e),i.applyMatrix4(e),o.object3D.updateMatrixWorld(),o.object3D.localToWorld(r),a.parent.parent.updateMatrixWorld(),a.parent.updateMatrixWorld(),a.updateMatrixWorld(),a.localToWorld(t),t.sub(r).normalize(),i.normalize(),Math.sign(i.dot(t))}}(),remove:function(){this.removeEventListener()}}),registerShader("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = saturate(direction.y * 0.5 + 0.5);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / 15.0), 2.0), 0.0, 1.0));","}","}"].join("\n")}); +},{"../core/component":102,"../core/shader":111,"../lib/three":150}],65:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),bind=utils.bind,PolyfillControls=_dereq_("../utils").device.PolyfillControls,GRABBING_CLASS="a-grabbing",PI_2=Math.PI/2,checkHasPositionalTracking=utils.device.checkHasPositionalTracking;module.exports.Component=registerComponent("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},hmdEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},touchEnabled:{default:!0}},init:function(){this.previousHMDPosition=new THREE.Vector3,this.hmdQuaternion=new THREE.Quaternion,this.hmdEuler=new THREE.Euler,this.position=new THREE.Vector3,this.savedRotation=new THREE.Vector3,this.savedPosition=new THREE.Vector3,this.polyfillObject=new THREE.Object3D,this.polyfillControls=new PolyfillControls(this.polyfillObject),this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.savedPose={position:new THREE.Vector3,rotation:new THREE.Euler},this.el.sceneEl.is("vr-mode")&&this.onEnterVR()},update:function(t){var e=this.data;e.enabled!==t.enabled&&this.updateGrabCursor(e.enabled),!t||e.hmdEnabled||t.hmdEnabled||(this.pitchObject.rotation.set(0,0,0),this.yawObject.rotation.set(0,0,0)),t&&!e.pointerLockEnabled!==t.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&document.exitPointerLock())},tick:function(t){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.removeEventListeners()},bindMethods:function(){this.onMouseDown=bind(this.onMouseDown,this),this.onMouseMove=bind(this.onMouseMove,this),this.onMouseUp=bind(this.onMouseUp,this),this.onTouchStart=bind(this.onTouchStart,this),this.onTouchMove=bind(this.onTouchMove,this),this.onTouchEnd=bind(this.onTouchEnd,this),this.onEnterVR=bind(this.onEnterVR,this),this.onExitVR=bind(this.onExitVR,this),this.onPointerLockChange=bind(this.onPointerLockChange,this),this.onPointerLockError=bind(this.onPointerLockError,this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new THREE.Object3D,this.yawObject=new THREE.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var t=this.el.sceneEl,e=t.canvas;if(!e)return void t.addEventListener("render-target-loaded",bind(this.addEventListeners,this));e.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),e.addEventListener("touchstart",this.onTouchStart),window.addEventListener("touchmove",this.onTouchMove),window.addEventListener("touchend",this.onTouchEnd),t.addEventListener("enter-vr",this.onEnterVR),t.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))},removeEventListeners:function(){var t=this.el.sceneEl,e=t&&t.canvas;e&&(e.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("enter-vr",this.onEnterVR),t.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var t=this.el,e=this.hmdEuler,o=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;i.is("vr-mode")&&i.checkHeadsetConnected()||(this.polyfillControls.update(),e.setFromQuaternion(this.polyfillObject.quaternion,"YXZ"),t.object3D.rotation.x=e.x+o.rotation.x,t.object3D.rotation.y=e.y+n.rotation.y,t.object3D.rotation.z=0)},onMouseMove:function(t){var e,o,n,i=this.pitchObject,s=this.previousMouseEvent,r=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(o=t.movementX||t.mozMovementX||0,n=t.movementY||t.mozMovementY||0):(o=t.screenX-s.screenX,n=t.screenY-s.screenY),this.previousMouseEvent=t,e=this.data.reverseMouseDrag?1:-1,r.rotation.y+=.002*o*e,i.rotation.x+=.002*n*e,i.rotation.x=Math.max(-PI_2,Math.min(PI_2,i.rotation.x)))},onMouseDown:function(t){if(this.data.enabled&&0===t.button){var e=this.el.sceneEl,o=e&&e.canvas;this.mouseDown=!0,this.previousMouseEvent=t,document.body.classList.add(GRABBING_CLASS),this.data.pointerLockEnabled&&!this.pointerLocked&&(o.requestPointerLock?o.requestPointerLock():o.mozRequestPointerLock&&o.mozRequestPointerLock())}},onMouseUp:function(){this.mouseDown=!1,document.body.classList.remove(GRABBING_CLASS)},onTouchStart:function(t){1===t.touches.length&&this.data.touchEnabled&&(this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(t){var e,o=this.el.sceneEl.canvas,n=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(e=2*Math.PI*(t.touches[0].pageX-this.touchStart.x)/o.clientWidth,n.rotation.y-=.5*e,this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){this.saveCameraPose()},onExitVR:function(){this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},updateGrabCursor:function(t){function e(){n.canvas.classList.add("a-grab-cursor")}function o(){n.canvas.classList.remove("a-grab-cursor")}var n=this.el.sceneEl;return n.canvas?t?void e():void o():void(t?n.addEventListener("render-target-loaded",e):n.addEventListener("render-target-loaded",o))},saveCameraPose:function(){var t=this.el,e=void 0!==this.hasPositionalTracking?this.hasPositionalTracking:checkHasPositionalTracking();!this.hasSavedPose&&e&&(this.savedPose.position.copy(t.object3D.position),this.savedPose.rotation.copy(t.object3D.rotation),this.hasSavedPose=!0)},restoreCameraPose:function(){var t=this.el,e=this.savedPose,o=void 0!==this.hasPositionalTracking?this.hasPositionalTracking:checkHasPositionalTracking();this.hasSavedPose&&o&&(t.object3D.position.copy(e.position),t.object3D.rotation.copy(e.rotation),this.hasSavedPose=!1)}}); +},{"../core/component":102,"../lib/three":150,"../utils":172,"../utils/":172}],66:[function(_dereq_,module,exports){ +function parseSide(e){switch(e){case"back":return THREE.BackSide;case"double":return THREE.DoubleSide;default:return THREE.FrontSide}}function parseVertexColors(e){switch(e){case"face":return THREE.FaceColors;case"vertex":return THREE.VertexColors;default:return THREE.NoColors}}function disposeMaterial(e,t){e.dispose(),t.unregisterMaterial(e)}var utils=_dereq_("../utils/"),component=_dereq_("../core/component"),THREE=_dereq_("../lib/three"),shader=_dereq_("../core/shader"),error=utils.debug("components:material:error"),registerComponent=component.registerComponent,shaders=shader.shaders,shaderNames=shader.shaderNames;module.exports.Component=registerComponent("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:shaderNames},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColors:{type:"string",default:"none",oneOf:["face","vertex"]},visible:{default:!0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t=e.shader,a=this.data&&this.data.shader,r=t||a,s=shaders[r]&&shaders[r].schema;s||error("Unknown shader schema "+r),a&&t===a||(this.extendSchema(s),this.updateBehavior())},updateBehavior:function(){var e=this.schema,t=this,a=this.el.sceneEl,r={},s=function(e,a){Object.keys(r).forEach(function(t){r[t]=e}),t.shader.update(r)};this.tick=void 0,Object.keys(e).forEach(function(a){"time"===e[a].type&&(t.tick=s,r[a]=!0)}),a&&(this.tick?a.addBehavior(this):a.removeBehavior(this))},updateShader:function(e){var t,a=this.data,r=shaders[e]&&shaders[e].Shader;if(!r)throw new Error("Unknown shader "+e);t=this.shader=new r,t.el=this.el,t.init(a),this.setMaterial(t.material),this.updateSchema(a)},updateMaterial:function(e){var t=this.data,a=this.material;a.alphaTest=t.alphaTest,a.depthTest=!1!==t.depthTest,a.depthWrite=!1!==t.depthWrite,a.opacity=t.opacity,a.flatShading=t.flatShading,a.side=parseSide(t.side),a.transparent=!1!==t.transparent||t.opacity<1,a.vertexColors=parseVertexColors(t.vertexColors),a.visible=t.visible,!Object.keys(e).length||e.alphaTest===t.alphaTest&&e.side===t.side&&e.vertexColors===t.vertexColors||(a.needsUpdate=!0)},remove:function(){var e=new THREE.MeshBasicMaterial,t=this.material,a=this.el.getObject3D("mesh");a&&(a.material=e),disposeMaterial(t,this.system)},setMaterial:function(e){var t,a=this.el,r=this.system;this.material&&disposeMaterial(this.material,r),this.material=e,r.registerMaterial(e),t=a.getObject3D("mesh"),t?t.material=e:a.addEventListener("object3dset",function t(r){"mesh"===r.detail.type&&r.target===a&&(a.getObject3D("mesh").material=e,a.removeEventListener("object3dset",t))})}}); +},{"../core/component":102,"../core/shader":111,"../lib/three":150,"../utils/":172}],67:[function(_dereq_,module,exports){ +var debug=_dereq_("../utils/debug"),registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),warn=debug("components:obj-model:warn");module.exports.Component=registerComponent("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){this.model=null,this.objLoader=new THREE.OBJLoader,this.mtlLoader=new THREE.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin=""},update:function(){var e=this.data;e.obj&&(this.remove(),this.loadObj(e.obj,e.mtl))},remove:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(e,o){var t=this,r=this.el,a=this.mtlLoader,i=this.objLoader;if(o)return r.hasAttribute("material")&&warn("Material component properties are ignored when a .MTL is provided"),a.setTexturePath(o.substr(0,o.lastIndexOf("/")+1)),void a.load(o,function(o){o.preload(),i.setMaterials(o),i.load(e,function(e){t.model=e,r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})})});i.load(e,function(e){var o=r.components.material;o&&e.traverse(function(e){e instanceof THREE.Mesh&&(e.material=o.material)}),t.model=e,r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})})}}); +},{"../core/component":102,"../lib/three":150,"../utils/debug":168}],68:[function(_dereq_,module,exports){ +var bind=_dereq_("../utils/bind"),registerComponent=_dereq_("../core/component").registerComponent,trackedControlsUtils=_dereq_("../utils/tracked-controls"),THREE=_dereq_("../lib/three"),onButtonEvent=trackedControlsUtils.onButtonEvent,TOUCH_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/oculus/oculus-touch-controller-",TOUCH_CONTROLLER_MODEL_OBJ_URL_L=TOUCH_CONTROLLER_MODEL_BASE_URL+"left.obj",TOUCH_CONTROLLER_MODEL_OBJ_MTL_L=TOUCH_CONTROLLER_MODEL_BASE_URL+"left.mtl",TOUCH_CONTROLLER_MODEL_OBJ_URL_R=TOUCH_CONTROLLER_MODEL_BASE_URL+"right.obj",TOUCH_CONTROLLER_MODEL_OBJ_MTL_R=TOUCH_CONTROLLER_MODEL_BASE_URL+"right.mtl",GAMEPAD_ID_PREFIX="Oculus Touch",DEFAULT_MODEL_PIVOT_OFFSET=new THREE.Vector3(0,0,-.053),RAY_ORIGIN={left:{origin:{x:.008,y:-.008,z:0},direction:{x:0,y:-.8,z:-1}},right:{origin:{x:-.008,y:-.008,z:0},direction:{x:0,y:-.8,z:-1}}};module.exports.Component=registerComponent("oculus-touch-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},orientationOffset:{type:"vec3",default:{x:43,y:0,z:0}}},mapping:{left:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","abutton","bbutton","surface"]}},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t,t.data.hand)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t,t.data.hand)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,this.checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){this.checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{hand:this.data.hand})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){var t,e;this.data.model&&("right"===this.data.hand?(t="url("+TOUCH_CONTROLLER_MODEL_OBJ_URL_R+")",e="url("+TOUCH_CONTROLLER_MODEL_OBJ_MTL_R+")"):(t="url("+TOUCH_CONTROLLER_MODEL_OBJ_URL_L+")",e="url("+TOUCH_CONTROLLER_MODEL_OBJ_MTL_L+")"),this.el.setAttribute("obj-model",{obj:t,mtl:e}))},injectTrackedControls:function(){var t=this.data;this.el.setAttribute("tracked-controls",{id:"right"===t.hand?"Oculus Touch (Right)":"Oculus Touch (Left)",controller:0,orientationOffset:t.orientationOffset}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,o=this.mapping[this.data.hand].buttons[t.detail.id],n=this.buttonMeshes;o&&("trigger"!==o&&"grip"!==o||(e=t.detail.state.value),n&&("trigger"===o&&n.trigger&&(n.trigger.rotation.x=-e*(Math.PI/24)),"grip"===o&&n.grip&&(n.grip.rotation.y=("left"===this.data.hand?-1:1)*e*(Math.PI/60))),this.el.emit(o+"changed",t.detail.state))},onModelLoaded:function(t){var e,o=t.detail.model;if(this.data.model){var n="left"===this.data.hand;e=this.buttonMeshes={},e.grip=o.getObjectByName(n?"buttonHand_oculus-touch-controller-left.004":"buttonHand_oculus-touch-controller-right.005"),e.thumbstick=o.getObjectByName(n?"stick_oculus-touch-controller-left.007":"stick_oculus-touch-controller-right.004"),e.trigger=o.getObjectByName(n?"buttonTrigger_oculus-touch-controller-left.005":"buttonTrigger_oculus-touch-controller-right.006"),e.xbutton=o.getObjectByName("buttonX_oculus-touch-controller-left.002"),e.abutton=o.getObjectByName("buttonA_oculus-touch-controller-right.002"),e.ybutton=o.getObjectByName("buttonY_oculus-touch-controller-left.001"),e.bbutton=o.getObjectByName("buttonB_oculus-touch-controller-right.003"),o.position.copy(DEFAULT_MODEL_PIVOT_OFFSET),this.el.emit("controllermodelready",{name:"oculus-touch-controls",model:this.data.model,rayOrigin:RAY_ORIGIN[this.data.hand]})}},onAxisMoved:function(t){this.emitIfAxesChanged(this,this.mapping[this.data.hand].axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var o="up"===e||"touchend"===e?this.data.buttonColor:"touchstart"===e?this.data.buttonTouchColor:this.data.buttonHighlightColor,n=this.buttonMeshes;this.data.model&&n&&n[t]&&n[t].material.color.set(o)}}); +},{"../core/component":102,"../lib/three":150,"../utils/bind":166,"../utils/tracked-controls":178}],69:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,o=this.data;e.position.set(o.x,o.y,o.z)},remove:function(){this.el.object3D.position.set(0,0,0)}}); +},{"../core/component":102}],70:[function(_dereq_,module,exports){ +function copyArray(e,t){var i;for(e.length=t.length,i=0;i")},remove:function(){var e=this.el.object3D.fog;e&&(e.far=0,e.near=.1)}}); +},{"../../core/component":102,"../../lib/three":150,"../../utils/debug":168}],77:[function(_dereq_,module,exports){ +(function (process){ +function getFuzzyPatchVersion(e){var n=e.split(".");return n[2]="x",n.join(".")}var AFRAME_INJECTED=_dereq_("../../constants").AFRAME_INJECTED,bind=_dereq_("../../utils/bind"),pkg=_dereq_("../../../package"),registerComponent=_dereq_("../../core/component").registerComponent,INSPECTOR_DEV_URL="https://aframe.io/aframe-inspector/dist/aframe-inspector.js",INSPECTOR_RELEASE_URL="https://unpkg.com/aframe-inspector@"+getFuzzyPatchVersion(pkg.version)+"/dist/aframe-inspector.min.js",INSPECTOR_URL="dev"===process.env.INSPECTOR_VERSION?INSPECTOR_DEV_URL:INSPECTOR_RELEASE_URL,LOADING_MESSAGE="Loading Inspector",LOADING_ERROR_MESSAGE="Error loading Inspector";module.exports.Component=registerComponent("inspector",{schema:{url:{default:INSPECTOR_URL}},init:function(){this.onKeydown=bind(this.onKeydown,this),this.onMessage=bind(this.onMessage,this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML=LOADING_MESSAGE+'...'},remove:function(){this.removeEventListeners()},onKeydown:function(e){var n=73===e.keyCode&&e.ctrlKey&&e.altKey;this.data&&n&&this.injectInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.injectInspector()},injectInspector:function(){var e,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected||(this.showLoader(),e=document.createElement("script"),e.src=this.data.url,e.setAttribute("data-name","aframe-inspector"),e.setAttribute(AFRAME_INJECTED,""),e.onload=function(){AFRAME.INSPECTOR.open(),n.hideLoader(),n.removeEventListeners()},e.onerror=function(){n.loadingMessageEl.innerHTML=LOADING_ERROR_MESSAGE},document.head.appendChild(e),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}}); +}).call(this,_dereq_('_process')) + +},{"../../../package":51,"../../constants":93,"../../core/component":102,"../../utils/bind":166,"_process":6}],78:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../../core/component").registerComponent,shouldCaptureKeyEvent=_dereq_("../../utils/").shouldCaptureKeyEvent;module.exports.Component=registerComponent("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},init:function(){this.onKeyup=this.onKeyup.bind(this)},update:function(e){var t=this.data;this.enterVREnabled=t.enterVR},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;shouldCaptureKeyEvent(e)&&(this.enterVREnabled&&70===e.keyCode&&t.enterVR(),this.enterVREnabled&&27===e.keyCode&&t.exitVR())}}); +},{"../../core/component":102,"../../utils/":172}],79:[function(_dereq_,module,exports){ +var debug=_dereq_("../../utils/debug"),registerComponent=_dereq_("../../core/component").registerComponent,warn=debug("components:pool:warn");module.exports.Component=registerComponent("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},multiple:!0,initPool:function(){var t;for(this.availableEls=[],this.usedEls=[],this.data.mixin||warn("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||warn("Container "+this.data.container+" not found.")),this.container=this.container||this.el,t=0;t")},update:function(e){var t=this.data,a=this.el,r=a.renderer,i=!1;a.time>0&&t.antialias!==e.antialias&&warn('Property "antialias" cannot be changed after scene initialization'),t.sortObjects!==e.sortObjects&&(r.sortObjects=t.sortObjects),t.gammaOutput!==e.gammaOutput&&(r.gammaOutput=t.gammaOutput,i=!0),t.physicallyCorrectLights!==e.physicallyCorrectLights&&(r.physicallyCorrectLights=t.physicallyCorrectLights,i=!0),i&&0!==a.time&&(warn("Modifying renderer properties at runtime requires shader update and may drop frames."),a.object3D.traverse(function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach(function(e){e.needsUpdate=!0}):e.material.needsUpdate=!0)}))}}); +},{"../../core/component":102,"../../utils/debug":168}],81:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../../core/component").registerComponent,THREE=_dereq_("../../lib/three"),VERTEX_SHADER=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),FRAGMENT_SHADER=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");module.exports.Component=registerComponent("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},init:function(){function e(){var e=t.renderer.getContext();e&&(a.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),a.material=new THREE.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:VERTEX_SHADER,fragmentShader:FRAGMENT_SHADER,side:THREE.DoubleSide}),a.quad=new THREE.Mesh(new THREE.PlaneBufferGeometry(1,1),a.material),a.quad.visible=!1,a.camera=new THREE.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),a.canvas=document.createElement("canvas"),a.ctx=a.canvas.getContext("2d"),t.camera&&t.camera.add(a.quad),a.onKeyDown=a.onKeyDown.bind(a),a.onCameraActive=a.onCameraActive.bind(a),t.addEventListener("camera-set-active",a.onCameraActive))}var t=this.el,a=this;t.renderer?e():t.addEventListener("render-target-loaded",e)},getRenderTarget:function(e,t){return new THREE.WebGLRenderTarget(e,t,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,wrapS:THREE.ClampToEdgeWrapping,wrapT:THREE.ClampToEdgeWrapping,format:THREE.RGBAFormat,type:THREE.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onCameraActive:function(e){var t=this.quad.parent;t&&t.remove(this.quad),e.detail.cameraEl.getObject3D("camera").add(this.quad)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var a=e.shiftKey?"equirectangular":"perspective";this.capture(a)}},setCapture:function(e){var t,a,i,r=this.el;return"perspective"===e?(this.quad.visible=!1,a=this.data.camera&&this.data.camera.components.camera.camera||r.camera,t={width:this.data.width,height:this.data.height}):(a=this.camera,a.position.copy(r.camera.getWorldPosition()),a.rotation.copy(r.camera.getWorldRotation()),i=new THREE.CubeCamera(r.camera.near,r.camera.far,Math.min(this.cubeMapSize,2048)),i.position.copy(r.camera.getWorldPosition()),i.rotation.copy(r.camera.getWorldRotation()),i.updateCubeMap(r.renderer,r.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:a,size:t,projection:e}},capture:function(e){var t=this.setCapture(e);this.renderCapture(t.camera,t.size,t.projection),this.saveCapture()},getCanvas:function(e){var t=this.setCapture(e);return this.renderCapture(t.camera,t.size,t.projection),this.canvas},renderCapture:function(e,t,a){var i,r,n,o=this.el.renderer.autoClear,c=this.el,d=this.el.renderer;r=this.getRenderTarget(t.width,t.height),n=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),d.autoClear=!0,d.render(c.object3D,e,r,!0),d.autoClear=o,d.readRenderTargetPixels(r,0,0,t.width,t.height,n),"perspective"===a&&(n=this.flipPixelsVertically(n,t.width,t.height)),i=new ImageData(new Uint8ClampedArray(n),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(e,t,a){for(var i=e.slice(0),r=0;r0&&(this.stopSound(),t.removeObject3D("sound"));var i=this.listener=o.audioListener||new THREE.AudioListener;o.audioListener=i,o.camera&&o.camera.add(i),o.addEventListener("camera-set-active",function(e){e.detail.cameraEl.getObject3D("camera").add(i)}),this.pool=new THREE.Group;for(var n=0;n=0&&(e=30),e&&i.chars.map(function(t){t.yoffset+=e}),r(i)})})}function loadTexture(t){return new Promise(function(e,r){(new THREE.ImageLoader).load(t,function(t){e(t)},void 0,function(){error("Error loading font image",t),r(null)})})}function createShader(t,e,r){var n,o;return o=new shaders[e].Shader,o.el=t,o.init(r),o.update(r),n=o.material,n.transparent=r.transparent,{material:n,shader:o}}function computeWidth(t,e,r){return t||(.5+e)*r}function computeFontWidthFactor(t){var e=0,r=0,n=0;return t.chars.map(function(t){e+=t.xadvance,t.id>=48&&t.id<=57&&(n++,r+=t.xadvance)}),n?r/n:e/t.chars.length}function PromiseCache(){var t=this.cache={};this.get=function(e,r){return e in t?t[e]:(t[e]=r(),t[e])}}var createTextGeometry=_dereq_("three-bmfont-text"),loadBMFont=_dereq_("load-bmfont"),registerComponent=_dereq_("../core/component").registerComponent,coreShader=_dereq_("../core/shader"),THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),error=utils.debug("components:text:error"),shaders=coreShader.shaders,warn=utils.debug("components:text:warn"),DEFAULT_WIDTH=1,MAX_ANISOTROPY=16,FONT_BASE_URL="https://cdn.aframe.io/fonts/",FONTS={aileronsemibold:FONT_BASE_URL+"Aileron-Semibold.fnt",dejavu:FONT_BASE_URL+"DejaVu-sdf.fnt",exo2bold:FONT_BASE_URL+"Exo2Bold.fnt",exo2semibold:FONT_BASE_URL+"Exo2SemiBold.fnt",kelsonsans:FONT_BASE_URL+"KelsonSans.fnt",monoid:FONT_BASE_URL+"Monoid.fnt",mozillavr:FONT_BASE_URL+"mozillavr.fnt",roboto:FONT_BASE_URL+"Roboto-msdf.json",sourcecodepro:FONT_BASE_URL+"SourceCodePro.fnt"},MSDF_FONTS=["roboto"],DEFAULT_FONT="roboto";module.exports.FONTS=FONTS;var cache=new PromiseCache,fontWidthFactors={},textures={};module.exports.Component=registerComponent("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:DEFAULT_FONT},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:shaders},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=createTextGeometry(),this.createOrUpdateMaterial(),this.mesh=new THREE.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh)},update:function(t){var e=coerceData(this.data),r=this.currentFont,n=this.getFontImageSrc();if(textures[n]?this.texture=textures[n]:(this.texture=textures[n]=new THREE.Texture,this.texture.anisotropy=MAX_ANISOTROPY),this.createOrUpdateMaterial(),t.font!==e.font)return void this.updateFont();r&&(this.updateGeometry(this.geometry,e,r),this.updateLayout(e))},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var t,e,r,n=this.data,o=this.material,i=this.shaderData;if(r=n.shader,-1!==MSDF_FONTS.indexOf(n.font)||n.font.indexOf("-msdf.")>=0?r="msdf":n.font in FONTS&&-1===MSDF_FONTS.indexOf(n.font)&&(r="sdf"),t=(this.shaderObject&&this.shaderObject.name)!==r,i.alphaTest=n.alphaTest,i.color=n.color,i.map=this.texture,i.opacity=n.opacity,i.side=parseSide(n.side),i.transparent=n.transparent,i.negate=n.negate,!t)return this.shaderObject.update(i),o.transparent=i.transparent,void(o.side=i.side);e=createShader(this.el,r,i),this.material=e.material,this.shaderObject=e.shader,this.material.side=i.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var t,e=this.data,r=this.el,n=this.geometry,o=this;e.font||warn("No font specified. Using the default font."),this.mesh.visible=!1,t=this.lookupFont(e.font||DEFAULT_FONT)||e.font,cache.get(t,function(){return loadFont(t,e.yOffset)}).then(function(i){var a,s;if(1!==i.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");fontWidthFactors[t]||(i.widthFactor=fontWidthFactors[i]=computeFontWidthFactor(i)),a=coerceData(e),o.updateGeometry(n,o.data,i),o.currentFont=i,o.updateLayout(a),s=o.getFontImageSrc(),cache.get(s,function(){return loadTexture(s)}).then(function(t){var n=o.texture;n.image=t,n.needsUpdate=!0,textures[s]=n,o.texture=n,o.mesh.visible=!0,r.emit("textfontset",{font:e.font,fontObj:i})}).catch(function(t){throw error(t),t})}).catch(function(t){throw error(t),t})},getFontImageSrc:function(){var t=this.lookupFont(this.data.font||DEFAULT_FONT)||this.data.font;return this.data.fontImage||t.replace(/(\.fnt)|(\.json)/,".png")},updateLayout:function(t){var e,r,n,o,i,a,s,h,d=this.el,u=this.geometry,l=d.getAttribute("geometry"),f=u.layout,c=this.mesh;if(l=d.getAttribute("geometry"),a=t.width||l&&l.width||DEFAULT_WIDTH,o=computeWidth(t.wrapPixels,t.wrapCount,this.currentFont.widthFactor),i=a/o,n=i*(f.height+f.descender),l&&(l.width||d.setAttribute("geometry","width",a),l.height||d.setAttribute("geometry","height",n)),"left"===(e="align"===t.anchor?t.align:t.anchor))s=0;else if("right"===e)s=-1*f.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);s=-1*f.width/2}if("bottom"===(r=t.baseline))h=0;else if("top"===r)h=-1*f.height+f.ascender;else{if("center"!==r)throw new TypeError("Invalid text.baseline property value",r);h=-1*f.height/2}c.position.x=s*i+t.xOffset,c.position.y=h*i,c.position.z=t.zOffset,c.scale.set(i,-1*i,i),this.geometry.computeBoundingSphere()},lookupFont:function(t){return FONTS[t]},updateGeometry:function(t,e,r){t.update(utils.extend({},e,{font:r,width:computeWidth(e.wrapPixels,e.wrapCount,r.widthFactor),text:e.value.toString().replace(/\\n/g,"\n").replace(/\\t/g,"\t"),lineHeight:e.lineHeight||r.common.lineHeight}))}}); +},{"../core/component":102,"../core/shader":111,"../lib/three":150,"../utils/":172,"load-bmfont":24,"three-bmfont-text":36}],87:[function(_dereq_,module,exports){ +var registerComponent=_dereq_("../core/component").registerComponent,controllerUtils=_dereq_("../utils/tracked-controls"),DEFAULT_CAMERA_HEIGHT=_dereq_("../constants").DEFAULT_CAMERA_HEIGHT,THREE=_dereq_("../lib/three"),DEFAULT_HANDEDNESS=_dereq_("../constants").DEFAULT_HANDEDNESS,EYES_TO_ELBOW={x:.175,y:-.3,z:-.03},FOREARM={x:0,y:0,z:-.175};module.exports.Component=registerComponent("tracked-controls",{schema:{controller:{default:0},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},orientationOffset:{type:"vec3"},armModel:{default:!0},headElement:{type:"selector"}},init:function(){this.axis=[0,0,0],this.buttonStates={},this.changedAxes=[],this.targetControllerNumber=this.data.controller,this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.deltaControllerPosition=new THREE.Vector3,this.controllerQuaternion=new THREE.Quaternion,this.controllerEuler=new THREE.Euler,this.updateGamepad(),this.el.object3D.matrixAutoUpdate=!1},tick:function(t,e){var i=this.el.getObject3D("mesh");i&&i.update&&i.update(e/1e3),this.updateGamepad(),this.updatePose(),this.updateButtons()},defaultUserHeight:function(){return DEFAULT_CAMERA_HEIGHT},getHeadElement:function(){return this.data.headElement||this.el.sceneEl.camera.el},updateGamepad:function(){var t=this.data,e=controllerUtils.findMatchingController(this.system.controllers,t.id,t.idPrefix,t.hand,t.controller);this.controller=e},applyArmModel:function(t){var e,i,o,n,r,s=this.controller,a=this.controllerEuler,l=this.controllerQuaternion,h=this.deltaControllerPosition;i=this.getHeadElement(),o=i.object3D,r=this.defaultUserHeight(),n=s.pose,e=(s?s.hand:void 0)||DEFAULT_HANDEDNESS,t.copy(o.position),h.set(EYES_TO_ELBOW.x*("left"===e?-1:"right"===e?1:0),EYES_TO_ELBOW.y,EYES_TO_ELBOW.z),h.multiplyScalar(r),h.applyAxisAngle(o.up,o.rotation.y),t.add(h),h.set(FOREARM.x,FOREARM.y,FOREARM.z),h.multiplyScalar(r),n.orientation?l.fromArray(n.orientation):l.copy(o.quaternion),a.setFromQuaternion(l),a.set(a.x,a.y,0),h.applyEuler(a),t.add(h)},updatePose:function(){var t,e,i=this.controller,o=this.data,n=this.el.object3D,r=this.system.vrDisplay;i&&(t=i.pose,t.position?n.position.fromArray(t.position):o.armModel&&this.applyArmModel(n.position),t.orientation&&n.quaternion.fromArray(t.orientation),r&&t.position&&(e=this.el.sceneEl.renderer.vr.getStandingMatrix(),n.matrixAutoUpdate=!1,n.matrix.compose(n.position,n.quaternion,n.scale),n.matrix.multiplyMatrices(e,n.matrix),n.matrix.decompose(n.position,n.quaternion,n.scale)),n.rotateX(this.data.orientationOffset.x*THREE.Math.DEG2RAD),n.rotateY(this.data.orientationOffset.y*THREE.Math.DEG2RAD),n.rotateZ(this.data.orientationOffset.z*THREE.Math.DEG2RAD),n.updateMatrix(),n.matrixWorldNeedsUpdate=!0)},updateButtons:function(){var t,e,i=this.controller;if(i){for(e=0;eMAX_DELTA)return d[i]=0,void(d[s]=0);0!==d[i]&&(d[i]-=d[i]*r.easing*e),0!==d[s]&&(d[s]-=d[s]*r.easing*e),Math.abs(d[i])1&&t.setAttribute(h[0],h[1],rgbVectorToHex(i)),t.setAttribute(e,rgbVectorToHex(i))}}var s,r,u,l,d,h=e.split("."),c={},p={};return 2===h.length?function(){var e=h[0],i=h[1],n=t.components[e],a=n&&n.schema;return a&&a[i]&&"color"===a[i].type}()?o():function(){l=h[0],u=h[1],r=t.components[l],r||(t.setAttribute(l,""),r=t.components[l]),s=r.schema,c[e]=void 0===i?getComponentProperty(t,e):i,c[e]=parseProperty(c[e],s[u]),p[e]=parseProperty(n,s[u]),d=function(i){e in i&&t.setAttribute(l,u,i[e])}}():n&&isCoordinates(n)?function(){c=i?coordinates.parse(i):a,p=coordinates.parse(n),d=function(i){t.setAttribute(e,i)}}():-1!==["true","false"].indexOf(n)?function(){c[e]=void 0!==i&&strToBool(i),c[e]=boolToNum(c[e]),p[e]=boolToNum(strToBool(n)),d=function(i){t.setAttribute(e,!!i[e])}}():isNaN(n)?o():function(){c[e]=void 0===i?parseFloat(t.getAttribute(e)):parseFloat(i),p[e]=parseFloat(n),d=function(i){t.setAttribute(e,i[e])}}(),{from:c,partialSetAttribute:d,to:p}}function strToBool(t){return"true"===t}function boolToNum(t){return t?1:0}function componentToHex(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function convertToIntegerColor(t){return Math.floor(255*Math.min(Math.abs(t),1))}function rgbVectorToHex(t){return"#"+["r","g","b"].map(function(e){return componentToHex(convertToIntegerColor(t[e]))}).join("")}var ANode=_dereq_("./a-node"),animationConstants=_dereq_("../constants/animation"),coordinates=_dereq_("../utils/").coordinates,parseProperty=_dereq_("./schema").parseProperty,registerElement=_dereq_("./a-register-element").registerElement,TWEEN=_dereq_("@tweenjs/tween.js"),THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),bind=utils.bind,getComponentProperty=utils.entity.getComponentProperty,DEFAULTS=animationConstants.defaults,DIRECTIONS=animationConstants.directions,EASING_FUNCTIONS=animationConstants.easingFunctions,FILLS=animationConstants.fills,REPEATS=animationConstants.repeats,isCoordinates=coordinates.isCoordinates,warn=utils.debug("core:a-animation:warn"),hasLoggedDeprecation=!1;module.exports.AAnimation=registerElement("a-animation",{prototype:Object.create(ANode.prototype,{createdCallback:{value:function(){this.bindMethods(),this.isRunning=!1,this.partialSetAttribute=function(){},this.tween=null,hasLoggedDeprecation||(warn(" has been deprecated and will be replaced by the animation component: https://www.npmjs.com/package/aframe-animation-component"),hasLoggedDeprecation=!0)}},attachedCallback:{value:function(){this.el=this.parentNode,this.handleMixinUpdate(),this.update(),this.load()}},attributeChangedCallback:{value:function(t,e,i){this.hasLoaded&&this.isRunning&&(this.stop(),this.handleMixinUpdate(),this.update())}},detachedCallback:{value:function(){this.isRunning&&this.stop()}},getTween:{value:function(){var t,e,i,n,a=this,o=a.data,s=a.el,r=o.attribute,u=parseInt(o.delay,10),l=getComponentProperty(s,r),d=a.getDirection(o.direction),h=EASING_FUNCTIONS[o.easing],c=o.fill,p=o.repeat===REPEATS.indefinite?1/0:0,v=!1;return t=getAnimationValues(s,r,o.from||a.initialValue,o.to,l),e=t.from,i=t.to,a.partialSetAttribute=t.partialSetAttribute,void 0===a.count&&(a.count=p===1/0?0:parseInt(o.repeat,10)),isNaN(u)&&(u=0),a.initialValue=a.initialValue||cloneValue(l),p===1/0&&c===FILLS.forwards&&-1!==[DIRECTIONS.alternate,DIRECTIONS.alternateReverse].indexOf(o.direction)&&(v=!0),d===DIRECTIONS.reverse&&(n=i,i=cloneValue(e),e=cloneValue(n)),-1!==[FILLS.backwards,FILLS.both].indexOf(c)&&a.partialSetAttribute(e),new TWEEN.Tween(cloneValue(e)).to(i,o.dur).delay(u).easing(h).repeat(p).yoyo(v).onUpdate(function(){a.partialSetAttribute(this)}).onComplete(bind(a.onCompleted,a))}},update:{value:function(){var t=this.data;"infinite"===t.repeat&&console.warn("Using 'infinite' as 'repeat' value is invalid. Use 'indefinite' instead."),""===t.begin||isNaN(t.begin)||(console.warn("Using 'begin' to specify a delay is deprecated. Use 'delay' instead."),t.delay=t.begin,t.begin="");var e=t.begin,i=t.end;this.evt&&this.removeEventListeners(this.evt),this.evt={begin:e,end:i},this.addEventListeners(this.evt),""===e&&(this.stop(),this.start())},writable:window.debug},onCompleted:{value:function(){var t=this.data;if(this.isRunning=!1,-1!==[FILLS.backwards,FILLS.none].indexOf(t.fill)&&this.partialSetAttribute(this.initialValue),0===this.count)return this.count=void 0,void this.emit("animationend");this.isRunning=!1,this.count--,this.start()}},start:{value:function(){var t=this;if(!this.el.hasLoaded)return void this.el.addEventListener("loaded",function(){t.start()});!this.isRunning&&this.el.isPlaying&&(this.tween=this.getTween(),this.isRunning=!0,this.tween.start(),this.emit("animationstart"))},writable:!0},stop:{value:function(){var t=this.tween;t&&(t.stop(),this.isRunning=!1,-1!==[FILLS.backwards,FILLS.none].indexOf(this.data.fill)&&this.partialSetAttribute(this.initialValue),this.emit("animationstop"))},writable:!0},getDirection:{value:function(t){return t===DIRECTIONS.alternate?(this.prevDirection=this.prevDirection===DIRECTIONS.normal?DIRECTIONS.reverse:DIRECTIONS.normal,this.prevDirection):t===DIRECTIONS.alternateReverse?(this.prevDirection=this.prevDirection===DIRECTIONS.reverse?DIRECTIONS.normal:DIRECTIONS.reverse,this.prevDirection):t}},bindMethods:{value:function(){this.start=bind(this.start,this),this.stop=bind(this.stop,this),this.onStateAdded=bind(this.onStateAdded,this),this.onStateRemoved=bind(this.onStateRemoved,this)}},addEventListeners:{value:function(t){var e=this.el,i=this;utils.splitString(t.begin).forEach(function(t){e.addEventListener(t,i.start)}),utils.splitString(t.end).forEach(function(t){e.addEventListener(t,i.stop)}),""===t.begin&&e.addEventListener("play",this.start),e.addEventListener("pause",this.stop),e.addEventListener("stateadded",this.onStateAdded),e.addEventListener("stateremoved",this.onStateRemoved)}},removeEventListeners:{value:function(t){var e=this.el,i=this.start,n=this.stop;utils.splitString(t.begin).forEach(function(t){e.removeEventListener(t,i)}),utils.splitString(t.end).forEach(function(t){e.removeEventListener(t,n)}),e.removeEventListener("stateadded",this.onStateAdded),e.removeEventListener("stateremoved",this.onStateRemoved)}},onStateAdded:{value:function(t){t.detail===this.data.begin&&this.start()},writable:!0},onStateRemoved:{value:function(t){t.detail===this.data.begin&&this.stop()},writable:!0},handleMixinUpdate:{value:function(){var t,e,i,n={};i=document.querySelector("#"+this.getAttribute("mixin")),e=i?utils.getElData(i,DEFAULTS):{},t=utils.getElData(this,DEFAULTS),utils.extend(n,DEFAULTS,e,t),this.data=n}}})}),module.exports.getAnimationValues=getAnimationValues; +},{"../constants/animation":92,"../lib/three":150,"../utils/":172,"./a-node":100,"./a-register-element":101,"./schema":110,"@tweenjs/tween.js":1}],96:[function(_dereq_,module,exports){ +function mediaElementLoaded(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise(function(t,r){function i(){for(var r=0,i=0;i=e.duration&&(THREE.Cache.files[e.getAttribute("src")]=e,t())}return 4===e.readyState?t():e.error?r():(e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),void e.addEventListener("error",r,!1))})}function fixUpMediaElement(e){var t=setCrossOrigin(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function setCrossOrigin(e){var t;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if(extractDomain(t)===window.location.host)return e}return warn('Cross-origin element (e.g., ) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., )',t),e.crossOrigin="anonymous",e.cloneNode(!0)}function extractDomain(e){var t=e.indexOf("://")>-1?e.split("/")[2]:e.split("/")[0];return t.substring(0,t.indexOf(":"))}function inferResponseType(e){var t=e.lastIndexOf(".");if(t>=0){var r=e.slice(t,e.length);if(".gltf"===r||".glb"===r)return"arraybuffer"}return"text"}var ANode=_dereq_("./a-node"),bind=_dereq_("../utils/bind"),debug=_dereq_("../utils/debug"),registerElement=_dereq_("./a-register-element").registerElement,THREE=_dereq_("../lib/three"),fileLoader=new THREE.FileLoader,warn=debug("core:a-assets:warn");module.exports=registerElement("a-assets",{prototype:Object.create(ANode.prototype,{createdCallback:{value:function(){this.isAssets=!0,this.fileLoader=fileLoader,this.timeout=null}},attachedCallback:{value:function(){var e,t,r,i,s,o,n=this,a=[];if(!this.parentNode.isScene)throw new Error(" must be a child of a .");for(s=this.querySelectorAll("img"),e=0;e did not contain exactly six elements each with a `src` attribute.")},writable:window.debug}})}); +},{"../utils/debug":168,"./a-register-element":101}],98:[function(_dereq_,module,exports){ +function checkComponentDefined(t,e){return!(!t.components[e]||!t.components[e].attrValue)||isComponentMixedIn(e,t.mixinEls)}function isComponentMixedIn(t,e){var i,n=!1;for(i=0;i0?t.substring(0,a):t,!COMPONENTS[s])return"mixin"===t&&this.mixinUpdate(e),void ANode.prototype.setAttribute.call(this,t,e);!this.components[t]&&this.hasAttribute(t)&&this.updateComponent(t,window.HTMLElement.prototype.getAttribute.call(this,t)),void 0!==i&&"string"==typeof e&&e.length>0&&"string"==typeof utils.styleParser.parse(e)?(n={},n[e]=i,o=!1):(n=e,o=!0===i),this.updateComponent(t,n,o),(r=this.sceneEl&&this.sceneEl.getAttribute("debug"))&&this.components[t].flushToDOM()},writable:window.debug},flushToDOM:{value:function(t){var e,i,n,o=this.components,s=this.children;for(n in o)o[n].flushToDOM();if(t)for(i=0;i outside of an A-Frame scene. Append this element to `` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)},writable:window.debug},attributeChangedCallback:{value:function(e,t,i){i!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(i,t))}},closestScene:{value:function(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}},closest:{value:function(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,i=this;i&&!t.call(i,e);)i=i.parentElement;return i}},detachedCallback:{value:function(){this.hasLoaded=!1}},load:{value:function(e,t){var i,n,s=this;this.hasLoaded||(t=t||isNode,i=this.getChildren(),n=i.filter(t).map(function(e){return new Promise(function(t){if(e.hasLoaded)return t();e.addEventListener("loaded",t)})}),Promise.all(n).then(function(){s.hasLoaded=!0,e&&e(),s.emit("loaded",void 0,!1)}))},writable:!0},getChildren:{value:function(){return Array.prototype.slice.call(this.children,0)}},updateMixins:{value:function(){var e=[],t=[];return function(i,n){var s,r,a;for(e.length=0,t.length=0,r=i?utils.split(i.trim(),/\s+/):e,a=n?utils.split(n.trim(),/\s+/):t,s=0;s tag after the scene. Component - + - + @@ -87,7 +87,6 @@
diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index 2191c15b4..b6b407149 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -1,611 +1,506 @@ -var actionController = (function() { - +var actionController = (function () { + //********************************* // Constants //********************************* - var MOUSE_BUTTON_LEFT = 1; - var MOUSE_BUTTON_RIGHT = 2; - var MOUSE_BUTTON_MIDDLE = 3; + var MOUSE_BUTTON_LEFT = 1; + var MOUSE_BUTTON_RIGHT = 2; + var MOUSE_BUTTON_MIDDLE = 3; //********************************* // Variables //********************************* - var defaultTickTime = 1; - - var multipartEvent = false; - - var hoveredEntity = null; - - //actions object - var actions = { - mouse : { - key : [], - down : createActionObject("mouseKeyDown"), - up : createActionObject("mouseKeyUp"), - during : createActionObject("mouseKeyDuring"), - move : createActionObject("mouseMove"), - doubleClick : createActionObject("mouseDoubleClick"), - scroll : createActionObject("mouseScroll"), - hover : createActionObject("mouseHover"), - unhover : createActionObject("mouseUnhover"), - }, - keyboard : { - key : [] - } - }; - - var mouseMovedEvent = {}; - - //create mouse action object for every key - for(let i=0; i < 5; i = i + 1){ - actions.mouse.key.push({ - pressed : false, - bubbles : false, - startTime : 0, - lastTick : 0, - down : createActionObject("mouseKeyDown"), - during : createActionObject("mouseKeyDuring"), - up : createActionObject("mouseKeyUp") - }); - } - - //create key action object for every key - for(let i=0; i < 200; i = i + 1){ - actions.keyboard.key.push({ - pressed : false, - bubbles : false, - startTime : 0, - lastTick : 0, - down : createActionObject("keyboardKeyDown"), - during : createActionObject("keyboardKeyDuring"), - up : createActionObject("keyboardKeyUp") - }); - } - - function createActionObject(type){ - var tickTimePerListener = new Map(); - - return { - type : type, - actionListeners : [], - tickTimePerListener : tickTimePerListener, - subscribe : function(listener, tickTime){ subscribeAction(this, listener, tickTime); }, - unsubscribe : function(listener){ unsubscribeAction(this, listener); } - }; - } - - + var defaultTickTime = 1; + + var hoveredEntity = null; + var latestMouseButtonPressed = null; + + //actions object + var actions = { + mouse: { + key: [], + down: createActionObject("mouseKeyDown"), + up: createActionObject("mouseKeyUp"), + during: createActionObject("mouseKeyDuring"), + move: createActionObject("mouseMove"), + doubleClick: createActionObject("mouseDoubleClick"), + scroll: createActionObject("mouseScroll"), + hover: createActionObject("mouseHover"), + unhover: createActionObject("mouseUnhover"), + }, + keyboard: { + key: [] + } + }; + + var mouseMovedEvent = {}; + + //create mouse action object for every key + for (let i = 0; i < 5; i = i + 1) { + actions.mouse.key.push({ + pressed: false, + bubbles: false, + startTime: 0, + lastTick: 0, + down: createActionObject("mouseKeyDown"), + during: createActionObject("mouseKeyDuring"), + up: createActionObject("mouseKeyUp") + }); + } + + //create key action object for every key + for (let i = 0; i < 200; i = i + 1) { + actions.keyboard.key.push({ + pressed: false, + bubbles: false, + startTime: 0, + lastTick: 0, + down: createActionObject("keyboardKeyDown"), + during: createActionObject("keyboardKeyDuring"), + up: createActionObject("keyboardKeyUp") + }); + } + + function createActionObject(type) { + var tickTimePerListener = new Map(); + + return { + type: type, + actionListeners: [], + tickTimePerListener: tickTimePerListener, + subscribe: function (listener, tickTime) { + subscribeAction(this, listener, tickTime); + }, + unsubscribe: function (listener) { + unsubscribeAction(this, listener); + } + }; + } + + //********************************* // Initialization //********************************* - - function initialize(){ - console.debug(arguments.callee.name); - //canvas actions - var canvas = document.getElementById(canvasId); - - //mousedown - canvas.onmousedown = function(eventObject){ - if(multipartEvent){ - multipartEvent = false; - return; - } - - downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - downAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - //eventObject.cancelBubble = true; - //eventObject.stopPropagation(); - return false; - }; - - //mouseup - canvas.onmouseup = function(eventObject){ - if(multipartEvent){ - multipartEvent = false; - return; - } - - upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - upAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - //eventObject.cancelBubble = true; - //eventObject.stopPropagation(); - return false; - }; - - - //mousemove - canvas.onmousemove = function(eventObject){ - - moveAction(actions.mouse.move, eventObject); - - if(actions.mouse.move.bubbles){ - return true; - } - - //eventObject.cancelBubble = true; - //eventObject.stopPropagation(); - return false; - }; - - - - - //doubleClick - canvas.ondblclick = function(eventObject){ - - doubleClickAction(actions.mouse.doubleClick, eventObject); - - if(actions.mouse.doubleClick.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }; - - - //scroll - canvas.addEventListener("onmousewheel", function(eventObject){ - - scrollAction(actions.mouse.scroll, eventObject); - - if(actions.mouse.scroll.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.cancelable = false; - eventObject.stopPropagation(); - return false; - }, true); - - - //scroll FF - canvas.addEventListener("DOMMouseScroll", function(eventObject){ - - scrollAction(actions.mouse.scroll, eventObject); - - if(actions.mouse.scroll.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, true); - - - //mouseleave - canvas.addEventListener("onmouseleave", function(eventObject){ - - //general upAction for controllers - upAction(actions.mouse, eventObject); - - if(getMouseButton(eventObject) !== undefined) { - - if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { - return true; - } + + + function initialize() { + var canvas = document.getElementById(canvasId); + AFRAME.registerComponent('mouselistener', { + init: function () { + this.el.addEventListener("mouseup", function (eventObject) { + //general upAction for controllers + eventObject.component = hoveredEntity; + eventObject.which = latestMouseButtonPressed; + upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + upAction(actions.mouse, eventObject); + + /*if (getMouseButton(eventObject) !== undefined) { + + if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { + return true; + } + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false;*/ + }); + this.el.addEventListener("mousedown", function (eventObject) { + // only process the event with mousebutton (.which-Attribut) + if (eventObject.which != null) { + + eventObject.component = hoveredEntity; + latestMouseButtonPressed = eventObject.which; + + downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + downAction(actions.mouse, eventObject); + + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + } + }, false); + this.el.addEventListener("mouseenter", function (eventObject) { + var component = document.getElementById(eventObject.target.id); + if (component != null) { + hoveredEntity = component; + } + hoverAction(actions.mouse, eventObject); + + if (actions.mouse.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + this.el.addEventListener("mouseleave", function (eventObject) { + unhoverAction(actions.mouse, eventObject); + + if (actions.mouse.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + // interrupts mousedown events somehow + this.el.addEventListener("mousemove", function (eventObject) { + moveAction(actions.mouse.move, eventObject); + + if (actions.mouse.move.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + this.el.addEventListener("dblclick", function (eventObject) { + eventObject.component = hoveredEntity; + + doubleClickAction(actions.mouse.doubleClick, eventObject); + + if (actions.mouse.doubleClick.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + this.el.addEventListener("wheel", function (eventObject) { + eventObject.component = hoveredEntity; + + scrollAction(actions.mouse.doubleClick, eventObject); + + if (actions.mouse.doubleClick.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + //keydown + this.el.addEventListener("onkeydown", function (eventObject) { + + downAction(actions.keyboard.key[eventObject.which], eventObject); + + if (actions.keyboard.key[eventObject.which].bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + //keyup + this.el.addEventListener("onkeyup", function (eventObject) { + + upAction(actions.keyboard.key[eventObject.which], eventObject); + + if (actions.keyboard.key[eventObject.which].bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); } + }); - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - - }, true); - - - //keydown - canvas.onkeydown = function(eventObject) { - - downAction(actions.keyboard.key[eventObject.which], eventObject); - - if(actions.keyboard.key[eventObject.which].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }; - - //keyup - canvas.onkeyup = function(eventObject) { - - upAction(actions.keyboard.key[eventObject.which], eventObject); - - if(actions.keyboard.key[eventObject.which].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }; - - - - - - //multipart events - var multiPart = document.getElementById("multiPart"); - - if(multiPart){ - //mousedown - multiPart.addEventListener("mousedown", function(eventObject){ - multipartEvent = true; - - downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - downAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - - //mouseup - multiPart.addEventListener("mouseup", function(eventObject){ - multipartEvent = true; - - upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - upAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - - - //hover - multiPart.addEventListener("mouseenter", function(eventObject){ - - hoverAction(actions.mouse, eventObject); - - if(actions.mouse.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - - //unhover - multiPart.addEventListener("mouseleave", function(eventObject){ - - unhoverAction(actions.mouse, eventObject); - - if(actions.mouse.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - } - - - } + canvas.setAttribute("mouselistener", ""); + canvas.querySelectorAll("a-box").forEach(function(box) { + box.setAttribute("mouselistener", ""); + }); + } //********************************* // Helper //********************************* - - function getMouseButton(eventObject){ - - if(eventObject.which){ - switch(eventObject.which) { - case 1: - return MOUSE_BUTTON_LEFT; - case 3: - return MOUSE_BUTTON_RIGHT; - case 2: - return MOUSE_BUTTON_MIDDLE; - default: - events.log.error.publish({ text: "mousebutton " + eventObject.button + " not implemented" }); - return; - } - } - - if(eventObject.button){ - switch(eventObject.button) { - case 1: - return MOUSE_BUTTON_LEFT; - case 2: - return MOUSE_BUTTON_RIGHT; - case 4: - return MOUSE_BUTTON_MIDDLE; - default: - events.log.error.publish({ text: "mousebutton " + eventObject.button + " not implemented" }); - return; - } - } - - } + + function getMouseButton(eventObject) { + + if (eventObject.which) { + switch (eventObject.which) { + case 1: + return MOUSE_BUTTON_LEFT; + case 3: + return MOUSE_BUTTON_RIGHT; + case 2: + return MOUSE_BUTTON_MIDDLE; + default: + events.log.error.publish({text: "mousebutton " + eventObject.button + " not implemented"}); + return; + } + } + + if (eventObject.button) { + switch (eventObject.button) { + case 1: + return MOUSE_BUTTON_LEFT; + case 2: + return MOUSE_BUTTON_RIGHT; + case 4: + return MOUSE_BUTTON_MIDDLE; + default: + events.log.error.publish({text: "mousebutton " + eventObject.button + " not implemented"}); + return; + } + } + + } //********************************* // Subscribe / Unsubscribe //********************************* - function subscribeAction(actionObject, listener, tickTime) { - - var actionListenerArray = actionObject.actionListeners; - - if(listener in actionListenerArray){ - events.log.error.publish({ text: "listener allready subscribes" }); - return; - } - - actionListenerArray.push(listener); + function subscribeAction(actionObject, listener, tickTime) { + + var actionListenerArray = actionObject.actionListeners; - if(tickTime){ - actionObject.tickTimePerListener.set(listener, tickTime); - } else { - actionObject.tickTimePerListener.set(listener, defaultTickTime); - } - } + if (listener in actionListenerArray) { + events.log.error.publish({text: "listener allready subscribes"}); + return; + } - function unsubscribeAction(actionObject, listener){ + actionListenerArray.push(listener); - var actionListenerArray = actionObject.actionListeners; + if (tickTime) { + actionObject.tickTimePerListener.set(listener, tickTime); + } else { + actionObject.tickTimePerListener.set(listener, defaultTickTime); + } + } - if(!listener in actionListenerArray){ - events.log.error.publish({ text: "listener not subscribed" }); - return; - } - - actionListenerArray.splice(actionListenerArray.indexOf(listener), 1); - } + function unsubscribeAction(actionObject, listener) { + var actionListenerArray = actionObject.actionListeners; + if (!listener in actionListenerArray) { + events.log.error.publish({text: "listener not subscribed"}); + return; + } + actionListenerArray.splice(actionListenerArray.indexOf(listener), 1); + } -//********************************* + +//********************************* // Actions //********************************* - function downAction(action, eventObject){ - - if(action.pressed){ - return; - } - - events.log.action.publish({ actionObject: action.down, eventObject: eventObject}); - - action.pressed = true; - action.startTime = Date.now(); - action.lastTick = Date.now(); - - //identify entity - if(eventObject.partID){ - var entity = model.getEntityById(eventObject.partID); - eventObject.entity = entity; - } - - //activate registered down listeners - var downListeners = action.down.actionListeners; - if( downListeners === undefined ){ - return; - } - downListeners.forEach(function(downListener){ - try { - downListener(eventObject, action.startTime); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - - //activate loop for during listeners - var duringListeners = action.during.actionListeners; - duringListeners.forEach(function(duringListener){ - var tickTime = action.during.tickTimePerListener.get(duringListener); - setTimeout( function(){ duringAction(action, duringListener, tickTime); }, tickTime); - }); - } - - - - function duringAction(action, duringListener, tickTime){ - - if( !action.pressed ) { - return; - } - - events.log.action.publish({ actionObject: action.during, eventObject: {} }); - - var timestamp = Date.now(); - - var timeSinceStart = timestamp - action.startTime; - var timeSinceLastTick = timestamp - action.lastTick; - action.lastTick = timestamp; - - try { - duringListener(mouseMovedEvent, timestamp, timeSinceStart, timeSinceLastTick); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - - - - - setTimeout( function(){ duringAction(action, duringListener, tickTime); }, tickTime); - } - - - - function upAction(action, eventObject){ - - events.log.action.publish({ actionObject: action.up, eventObject: eventObject}); - - action.pressed = false; - - var timestamp = Date.now(); - - //identify entity - if(eventObject.partID){ - var entity = model.getEntityById(eventObject.partID); - eventObject.entity = entity; - } - - //activate registered up listeners - var upListeners = action.up.actionListeners; - if( upListeners === undefined ){ - return; - } - upListeners.forEach(function(upListener){ - try { - upListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - - function hoverAction(action, eventObject){ - - events.log.action.publish({ actionObject: action.hover, eventObject: eventObject}); - - var timestamp = Date.now(); - - //identify entity - if(eventObject.partID){ - var entity = model.getEntityById(eventObject.partID); - eventObject.entity = entity; - - hoveredEntity = entity; - } - - - - - //activate registered hover listeners - var hoverListeners = action.hover.actionListeners; - if( hoverListeners === undefined ){ - return; - } - hoverListeners.forEach(function(hoverListener){ - try { - hoverListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - function unhoverAction(action, eventObject){ - - events.log.action.publish({ actionObject: action.unhover, eventObject: eventObject}); - - action.pressed = false; - hoveredEntity = null; - - var timestamp = Date.now(); - - //activate registered up listeners - var unhoverListeners = action.unhover.actionListeners; - if( unhoverListeners === undefined ){ - return; - } - unhoverListeners.forEach(function(unhoverListener){ - try { - unhoverListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - - - function moveAction(action, eventObject){ - - events.log.action.publish({ actionObject: action, eventObject: eventObject}); - - mouseMovedEvent = eventObject; - - var timestamp = Date.now(); - - var moveListeners = action.actionListeners; - - moveListeners.forEach(function(moveListener){ - try { - moveListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - function doubleClickAction(action, eventObject){ - - events.log.action.publish({ actionObject: action, eventObject: eventObject}); - - var timestamp = Date.now(); - - var doubleClickListeners = action.actionListeners; - - doubleClickListeners.forEach(function(doubleClickListener){ - try { - doubleClickListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - function scrollAction(action, eventObject){ - - events.log.action.publish({ actionObject: action, eventObject: eventObject}); - - var timestamp = Date.now(); - - //identify entity - if(hoveredEntity != null){ - eventObject.entity = hoveredEntity; - } - - var scrollListeners = action.actionListeners; - - scrollListeners.forEach(function(scrollListener){ - try { - scrollListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - - - return { - initialize : initialize, - actions : actions - }; - + function downAction(action, eventObject) { + events.log.action.publish({actionObject: action.down, eventObject: eventObject}); + + action.pressed = true; + action.startTime = Date.now(); + action.lastTick = Date.now(); + + if(eventObject.component != null && eventObject.component.id != "aframe-canvas") { + eventObject.entity = model.getEntityById(eventObject.component.id); + } + + //activate registered down listeners + var downListeners = action.down.actionListeners; + if (downListeners === undefined) { + return; + } + downListeners.forEach(function (downListener) { + try { + downListener(eventObject, action.startTime); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + + //activate loop for during listeners + var duringListeners = action.during.actionListeners; + duringListeners.forEach(function (duringListener) { + var tickTime = action.during.tickTimePerListener.get(duringListener); + setTimeout(function () { + duringAction(action, duringListener, tickTime); + }, tickTime); + }); + } + + + function duringAction(action, duringListener, tickTime) { + + if (!action.pressed) { + return; + } + + events.log.action.publish({actionObject: action.during, eventObject: {}}); + + var timestamp = Date.now(); + + var timeSinceStart = timestamp - action.startTime; + var timeSinceLastTick = timestamp - action.lastTick; + action.lastTick = timestamp; + + try { + duringListener(mouseMovedEvent, timestamp, timeSinceStart, timeSinceLastTick); + } catch (err) { + events.log.error.publish({text: err.message}); + } + + + setTimeout(function () { + duringAction(action, duringListener, tickTime); + }, tickTime); + } + + + function upAction(action, eventObject) { + + events.log.action.publish({actionObject: action.up, eventObject: eventObject}); + + action.pressed = false; + + var timestamp = Date.now(); + + //activate registered up listeners + var upListeners = action.up.actionListeners; + if (upListeners === undefined) { + return; + } + upListeners.forEach(function (upListener) { + try { + upListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + + function hoverAction(action, eventObject) { + + events.log.action.publish({actionObject: action.hover, eventObject: eventObject}); + + var timestamp = Date.now(); + + //identify entity + if (eventObject.component && eventObject.component.id != "aframe.canvas") { + eventObject.entity = model.getEntityById(eventObject.component); + } + + + //activate registered hover listeners + var hoverListeners = action.hover.actionListeners; + if (hoverListeners === undefined) { + return; + } + hoverListeners.forEach(function (hoverListener) { + try { + hoverListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + function unhoverAction(action, eventObject) { + + events.log.action.publish({actionObject: action.unhover, eventObject: eventObject}); + + action.pressed = false; + + var timestamp = Date.now(); + + //activate registered up listeners + var unhoverListeners = action.unhover.actionListeners; + if (unhoverListeners === undefined) { + return; + } + unhoverListeners.forEach(function (unhoverListener) { + try { + unhoverListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + + function moveAction(action, eventObject) { + + events.log.action.publish({actionObject: action, eventObject: eventObject}); + + mouseMovedEvent = eventObject; + + var timestamp = Date.now(); + + var moveListeners = action.actionListeners; + + moveListeners.forEach(function (moveListener) { + try { + moveListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + function doubleClickAction(action, eventObject) { + events.log.action.publish({actionObject: action, eventObject: eventObject}); + + var timestamp = Date.now(); + + var doubleClickListeners = action.actionListeners; + + doubleClickListeners.forEach(function (doubleClickListener) { + try { + doubleClickListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + function scrollAction(action, eventObject) { + + events.log.action.publish({actionObject: action, eventObject: eventObject}); + + var timestamp = Date.now(); + + //identify entity + if (hoveredEntity != null) { + eventObject.entity = hoveredEntity; + } + + var scrollListeners = action.actionListeners; + + scrollListeners.forEach(function (scrollListener) { + try { + scrollListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + + return { + initialize: initialize, + actions: actions + }; + })(); \ No newline at end of file diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index 85ceacd57..68d8463e7 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -1,333 +1,211 @@ -var canvasManipulator = (function() { - - var colors = { - darkred: "darkred", - black: "black", - orange: "orange", - darkorange: "darkorange" - } - - var x3domRuntime; - var viewarea; - var viewpoint; +var canvasManipulator = (function () { - var initialCenterOfRotation; + var colors = { + darkred: "darkred", + black: "black", + orange: "orange", + darkorange: "darkorange" + } + + var scene = {}; + var threeJSScene = {}; + + var camera; + var initialCameraView; + + function initialize() { + + scene = document.getElementById(canvasId); + threeJSScene = scene.object3D; + camera = document.getElementById("camera"); + + } + + function reset() { + + } + + // working - save old transparency in case it is not 0? + function changeTransparencyOfEntities(entities, value) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - changeTransparencyOfEntities - components for entityIds not found"}); + return; + } + setTransparency(component, value); + }); + } + + // working + function resetTransparencyOfEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - resetTransparencyOfEntities - components for entityIds not found"}); + return; + } + setTransparency(component, 1); + }); + } + + + // working + function changeColorOfEntities(entities, color) { + entities.forEach(function (entity) { + // in x3dom this function would get entities of the model to change the color of the related object + // for reference in canvasHoverController.js: var entity = model.getEntityById(multipartEvent.partID); + // this entity gets handed over to the ActionController.js as part of an ApplicationEvent + if (!(entity == undefined)) { + var component = document.getElementById(entity.id); + } + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - changeColorOfEntities - components for entityIds not found"}); + return; + } + setColor(component, color); + }); + } + + // working + function resetColorOfEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - resetColorOfEntities - components for entityIds not found"}); + return; + } + setColor(component, component.getAttribute("color")); + }); + } + + // working + function hideEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - hideEntities - components for entityIds not found"}); + return; + } + setVisibility(component, false) + }); + } + + // working + function showEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - showEntities - components for entityIds not found"}); + return; + } + setVisibility(component, true) + }); + } + + // after clicking an entity fit the camera to show this entity (angle stays the same) + // not working + function flyToEntity(entity) { + /*document.querySelector("#camera").object3D.position = {x: 1, y: 2, z: 3}; + console.debug(document.querySelector("#camera").object3D.position);*/ + } + + function addElement(element) { + var addedElements = document.getElementById("addedElements"); + addedElements.appendChild(element); + } + + function removeElement(element) { + var addedElements = document.getElementById("addedElements"); + addedElements.removeChild(element); + } + + + // not working yet + // gets called from Mark- and SelectController if specified in the config + function setCenterOfRotation(entity, setFocus) { + var centerOfPart = getCenterOfEntity(entity); + + viewpoint.setCenterOfRotation(centerOfPart); + + if (setFocus) { + var mat = viewarea.getViewMatrix().inverse(); + + var from = mat.e3(); + var at = viewarea._pick; + var up = mat.e1(); + + var norm = mat.e0().cross(up).normalize(); + // get distance between look-at point and viewing plane + var dist = norm.dot(viewarea._pick.subtract(from)); + + from = at.addScaled(norm, -dist); + mat = x3dom.fields.SFMatrix4f.lookAt(from, at, up); + + viewarea.animateTo(mat.inverse(), viewpoint); + } + } + + + function getCenterOfEntity(entity) { + var entityPart = getPart(entity); + var volumeOfPart = entityPart.getVolume(); + var centerOfPart = volumeOfPart.center; + + return centerOfPart; + } - - function initialize(){ - - } - - function reset(){ - } - - - - //manipulate - function highlightEntities(entities, color){ - - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - highlightEntities - parts for entityIds not found"}); - return; - } - - parts.unhighlight(); - parts.highlight(color); - } - - - function unhighlightEntities(entities){ - - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); - return; - } - - parts.unhighlight(); - } - - - - function changeTransparencyOfEntities(entities, value){ - var entitiyIds = []; - entities.forEach(function(entity){ - var part = multiPart.getParts([entity.id]); - if(part == null){ - return; - } - entity.oldTransparency = part.getTransparency(); - - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - changeTransparencyOfEntities - parts for entityIds not found"}); - return; - } - setTransparency(parts, value); - } - - function resetTransparencyOfEntities(entities){ - - var oldTransparencyMap = new Map(); - - entities.forEach(function(entity){ - - if(!entity.oldTransparency){ - return; - } - var oldTransparency = entity.oldTransparency; - - if(oldTransparencyMap.has(oldTransparency)){ - oldTransparencyMap.get(oldTransparency).push(entity.id); - } else { - oldTransparencyMap.set(oldTransparency, [entity.id]); - } - }); - - oldTransparencyMap.forEach(function(entitiyIds, oldTransparency, map){ - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - resetTransparencyOfEntities - parts for entityIds not found"}); - return; - } - setTransparency(parts, oldTransparency); - }); - } - - - - function changeColorOfEntities(entities, color){ - var entitiyIds = []; - entities.forEach(function(entity){ - var part = multiPart.getParts([entity.id]); - if(part == null){ - return; - } - if(!entity.oldColor){ - entity.oldColor = part.getDiffuseColor().toString(); - } - entitiyIds.push(entity.id); + + //Helper + function getPart(entity) { + if (entity.part == undefined) { + var part = multiPart.getParts([entity.id]); + entity.part = part; + } + + return entity.part; + } + + // working + function setColor(object, color) { + object.setAttribute('material', { + color: color }); + } + + function setTransparency(object, value) { + object.setAttribute('material', { + opacity: value + }); + } - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - changeColorOfEntities - parts for entityIds not found"}); - return; - } - setColor(parts, color); - } - - - function resetColorOfEntities(entities){ - //sort each entity by its old color for performance - var oldColorMap = new Map(); - entities.forEach(function(entity){ - if(entity.oldColor == null){ - return; - } - var oldColor = entity.oldColor; - - if(oldColorMap.has(oldColor)){ - oldColorMap.get(oldColor).push(entity.id); - } else { - oldColorMap.set(oldColor, [entity.id]); - } - - entity.oldColor = null; - }); - - oldColorMap.forEach(function(entitiyIds, oldColor, map){ - var parts = multiPart.getParts(entitiyIds); - if(parts === undefined){ - events.log.error.publish({ text: "CanvasManipualtor - resetColorOfEntities - parts for entityIds not found"}); - return; - } - setColor(parts, oldColor); - }); - } - - function hideEntities(entities){ - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === undefined){ - events.log.error.publish({ text: "CanvasManipualtor - hideEntities - parts for entityIds not found"}); - return; - } - setVisibility(parts, false); - } - - - function showEntities(entities){ - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === undefined){ - events.log.error.publish({ text: "CanvasManipualtor - showEntities - parts for entityIds not found"}); - return; - } - setVisibility(parts, true); - } - - - - function flyToEntity(entity){ - var part = getPart(entity); - if (part == undefined) { - events.log.error.publish({ text: "CanvasManipualtor - resetColflyToEntityorOfEntities - parts for entityIds not found"}); - return; - } - - part.fit(); - } - - - - function addElement(element){ - var addedElements = document.getElementById("addedElements"); - addedElements.appendChild(element); - } - - function removeElement(element){ - var addedElements = document.getElementById("addedElements"); - addedElements.removeChild(element); - } - - - - //From X3dom coding - //x3dom.DefaultNavigation.prototype.onDoubleClick = function (view, x, y) - - function setCenterOfRotation(entity, setFocus){ - - var centerOfPart = getCenterOfEntity(entity); - - viewpoint.setCenterOfRotation(centerOfPart); - - if(setFocus){ - var mat = viewarea.getViewMatrix().inverse(); - - var from = mat.e3(); - var at = viewarea._pick; - var up = mat.e1(); - - var norm = mat.e0().cross(up).normalize(); - // get distance between look-at point and viewing plane - var dist = norm.dot(viewarea._pick.subtract(from)); - - from = at.addScaled(norm, -dist); - mat = x3dom.fields.SFMatrix4f.lookAt(from, at, up); - - viewarea.animateTo(mat.inverse(), viewpoint); - } - } - - - function getCenterOfEntity(entity){ - var entityPart = getPart(entity); - var volumeOfPart = entityPart.getVolume(); - var centerOfPart = volumeOfPart.center; - - return centerOfPart; - } - - - //Helper - function getPart(entity){ - if (entity.part == undefined){ - var part = multiPart.getParts([entity.id]); - entity.part = part; - } - - return entity.part; - } - - function setColor(parts, color){ - - //Fehler in Methode setDiffuseColor bei nur einem übergebenem Part - //->Heilung durch Dopplung - if(parts.ids.length == 1){ - parts.ids.push(parts.ids[0]); - } - - parts.setDiffuseColor(color); - } - - function setTransparency(parts, value) { - - //Fehler in Methode setTransparency bei nur einem übergebenem Part - //->Heilung durch Dopplung - if(parts.ids.length == 1){ - parts.ids.push(parts.ids[0]); - } - - parts.setTransparency(value); + + function setVisibility(object, visibility) { + object.setAttribute("visible", visibility); } + return { + initialize: initialize, + reset: reset, + colors: colors, + + changeTransparencyOfEntities: changeTransparencyOfEntities, + resetTransparencyOfEntities: resetTransparencyOfEntities, + + changeColorOfEntities: changeColorOfEntities, + resetColorOfEntities: resetColorOfEntities, + + hideEntities: hideEntities, + showEntities: showEntities, + + flyToEntity: flyToEntity, + + addElement: addElement, + removeElement: removeElement, + + + setCenterOfRotation: setCenterOfRotation, + getCenterOfEntity: getCenterOfEntity, + }; - function setVisibility(parts, visibility) { - //Fehler in Methode setVisibility bei nur einem übergebenem Part - //->Heilung durch Dopplung - if(parts.ids.length == 1){ - parts.ids.push(parts.ids[0]); - } - - parts.setVisibility(visibility); - } - - function getElementIds(){ - return multiPart.getIdList(); - } - - - - return { - initialize : initialize, - reset : reset, - colors : colors, - - highlightEntities : highlightEntities, - unhighlightEntities : unhighlightEntities, - - changeTransparencyOfEntities : changeTransparencyOfEntities, - resetTransparencyOfEntities : resetTransparencyOfEntities, - - changeColorOfEntities : changeColorOfEntities, - resetColorOfEntities : resetColorOfEntities, - - hideEntities : hideEntities, - showEntities : showEntities, - - flyToEntity : flyToEntity, - - addElement : addElement, - removeElement : removeElement, - - - setCenterOfRotation : setCenterOfRotation, - getCenterOfEntity : getCenterOfEntity, - - getElementIds : getElementIds, - }; - })(); \ No newline at end of file diff --git a/ui/scripts/Application.js b/ui/scripts/Application.js index 1e5c454a7..e167779b8 100644 --- a/ui/scripts/Application.js +++ b/ui/scripts/Application.js @@ -33,7 +33,6 @@ function initializeApplication(metaDataJson){ //create entity model model.initialize(metaDataJson); - console.debug("Initialize ActionController"); actionController.initialize(); canvasManipulator.initialize(); @@ -384,7 +383,6 @@ var application = (function() { newActiveControllers.forEach(function(controllerObject){ if(controllerObject.activate){ var controllerDiv = activeControllers.get(controllerObject); - console.debug(controllerObject); controllerObject.activate(controllerDiv); } diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js new file mode 100644 index 000000000..d3170174f --- /dev/null +++ b/ui/scripts/CanvasHover/AframeCanvasHoverController.js @@ -0,0 +1,225 @@ +var canvasHoverController = (function() { + + var isInNavigation = false; + + function initialize(setupConfig){ + application.transferConfigParams(setupConfig, controllerConfig); + var cssLink = document.createElement("link"); + cssLink.type = "text/css"; + cssLink.rel = "stylesheet"; + cssLink.href = "scripts/CanvasHover/ho.css"; + document.getElementsByTagName("head")[0].appendChild(cssLink); + } + + //config parameters + var controllerConfig = { + hoverColor: "darkred", + showQualifiedName : false, + showVersion : false, + showIssues : false + }; + + function activate(){ + //createTooltipContainer(); + + events.hovered.on.subscribe(onEntityHover); + events.hovered.off.subscribe(onEntityUnhover); + } + + function reset(){ + var hoveredEntities = events.hovered.getEntities(); + + hoveredEntities.forEach(function(hoveredEntity){ + var unHoverEvent = { + sender: canvasHoverController, + entities: [hoveredEntity] + }; + + events.hovered.off.publish(unHoverEvent); + }); + } + + function createTooltipContainer(){ + + var canvas = document.getElementById("canvas"); + + var tooltipDivElement = document.createElement("DIV"); + tooltipDivElement.id = "tooltip"; + + var namePElement = document.createElement("P"); + namePElement.id = "tooltipName"; + tooltipDivElement.appendChild(namePElement); + + if(controllerConfig.showQualifiedName) { + var qualifiedNamePElement = document.createElement("P"); + qualifiedNamePElement.id = "tooltipQualifiedName"; + tooltipDivElement.appendChild(qualifiedNamePElement); + } + + if(controllerConfig.showVersion) { + var versionPElement = document.createElement("P"); + versionPElement.id = "tooltipVersion"; + tooltipDivElement.appendChild(versionPElement); + } + if(controllerConfig.showIssues) { + var openIssuesPElement = document.createElement("P"); + openIssuesPElement.id = "tooltipOpenIssues"; + tooltipDivElement.appendChild((openIssuesPElement)); + + var closedIssuesPElement = document.createElement("P"); + closedIssuesPElement.id = "tooltipClosedIssues"; + tooltipDivElement.appendChild((closedIssuesPElement)); + + var openSecurityIssuesPElement = document.createElement("P"); + openSecurityIssuesPElement.id = "tooltipOpenSecurityIssues"; + tooltipDivElement.appendChild((openSecurityIssuesPElement)); + + var closedSecurityIssuesPElement = document.createElement("P"); + closedSecurityIssuesPElement.id = "tooltipClosedSecurityIssues"; + tooltipDivElement.appendChild((closedSecurityIssuesPElement)); + } + canvas.appendChild(tooltipDivElement); + } + + function handleOnMousedown(canvasEvent) { + isInNavigation = true; + } + + function handleOnMouseup(canvasEvent) { + isInNavigation = false; + } + + function handleOnMouseEnter(multipartEvent) { + if(isInNavigation){ + return; + } + + var entity = model.getEntityById(multipartEvent.partID); + if(entity === undefined){ + entity = multipartEvent.target.id; + console.log("entity: " + entity); + events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + return; + } + + var applicationEvent = { + sender : canvasHoverController, + entities : [entity], + posX : multipartEvent.layerX, + posY : multipartEvent.layerY + }; + + events.hovered.on.publish(applicationEvent); + } + + function handleOnMouseLeave(multipartEvent) { + + var entity = model.getEntityById(multipartEvent.partID); + if(entity === undefined){ + events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + return; + } + + var applicationEvent = { + sender : canvasHoverController, + entities : [entity] + }; + + events.hovered.off.publish(applicationEvent); + } + + function onEntityHover(applicationEvent) { + console.debug("onEntityHover()"); + var entity = applicationEvent.entities[0]; + + if(entity === undefined){ + events.log.error.publish({ text: "Entity is not defined"}); + } + + if(entity.isTransparent === true) { + return; + } + + if(entity.type === "text"){ + return; + } + + if(entity.marked && entity.selected){ + canvasManipulator.unhighlightEntities([entity]); + } else { + canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); + } + + $("#tooltipName").text(getTooltipName(entity)); + if(controllerConfig.showQualifiedName) { + $("#tooltipQualifiedName").text(entity.qualifiedName); + } + if(controllerConfig.showVersion) { + $("#tooltipVersion").text("Version: " + entity.version); + } + if(controllerConfig.showIssues) { + let openIssuesSelector = $('#tooltipOpenIssues'); + let closedIssuesSelector = $('#tooltipClosedIssues'); + let openSecurityIssuesSelector = $('#tooltipOpenSecurityIssues'); + let closedSecurityIssuesSelector = $('#tooltipClosedSecurityIssues'); + if (entity.type === "Namespace") { + openIssuesSelector.css("display", "none"); + closedIssuesSelector.css("display", "none"); + openSecurityIssuesSelector.css("display", "none"); + closedSecurityIssuesSelector.css("display", "none"); + } else { + openIssuesSelector.text("Open Issues: " + entity.numberOfOpenIssues); + closedIssuesSelector.text("Closed Issues: " + entity.numberOfClosedIssues); + openSecurityIssuesSelector.text("Open Security Issues: " + entity.numberOfOpenSecurityIssues); + closedSecurityIssuesSelector.text("Closed Security Issues: " + entity.numberOfClosedSecurityIssues); + openIssuesSelector.css("display", "block"); + closedIssuesSelector.css("display", "block"); + openSecurityIssuesSelector.css("display", "block"); + closedSecurityIssuesSelector.css("display", "block"); + } + } + + var tooltip = $("#tooltip"); + tooltip.css("top", applicationEvent.posY + 50 + "px"); + tooltip.css("left", applicationEvent.posX + 50 + "px"); + tooltip.css("display", "block"); + } + + function onEntityUnhover(applicationEvent) { + var entity = applicationEvent.entities[0]; + + if(entity.marked && entity.selected){ + canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); + } else { + if(!entity.selected){ + canvasManipulator.unhighlightEntities([entity]); + } + if(entity.type === "Namespace"){ + canvasManipulator.unhighlightEntities([entity]); + } + } + + $("#tooltip").css("display", "none"); + + } + + function getTooltipName(entity) { + if(entity.type === "Method") { + return entity.type + ": " + entity.signature; + } + + if (entity.type === "Namespace") { + return "Package: " + entity.name; + } + + return entity.type + ": " + entity.name; + } + + return { + initialize: initialize, + activate: activate, + reset: reset, + handleOnMouseEnter: handleOnMouseEnter, + handleOnMouseLeave: handleOnMouseLeave + }; +})(); diff --git a/ui/scripts/CanvasManipulator.js b/ui/scripts/CanvasManipulator.js index 5154ef19b..9a82f8041 100644 --- a/ui/scripts/CanvasManipulator.js +++ b/ui/scripts/CanvasManipulator.js @@ -58,10 +58,10 @@ var canvasManipulator = (function() { }); var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); - return; - } + if(parts === null) { + events.log.error.publish({text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); + return; + } parts.unhighlight(); } @@ -231,7 +231,6 @@ var canvasManipulator = (function() { var centerOfPart = getCenterOfEntity(entity); viewpoint.setCenterOfRotation(centerOfPart); - if(setFocus){ var mat = viewarea.getViewMatrix().inverse(); @@ -255,7 +254,6 @@ var canvasManipulator = (function() { var entityPart = getPart(entity); var volumeOfPart = entityPart.getVolume(); var centerOfPart = volumeOfPart.center; - return centerOfPart; } @@ -266,7 +264,6 @@ var canvasManipulator = (function() { var part = multiPart.getParts([entity.id]); entity.part = part; } - return entity.part; } @@ -276,8 +273,7 @@ var canvasManipulator = (function() { //->Heilung durch Dopplung if(parts.ids.length == 1){ parts.ids.push(parts.ids[0]); - } - + } parts.setDiffuseColor(color); } @@ -287,8 +283,7 @@ var canvasManipulator = (function() { //->Heilung durch Dopplung if(parts.ids.length == 1){ parts.ids.push(parts.ids[0]); - } - + } parts.setTransparency(value); } @@ -298,8 +293,7 @@ var canvasManipulator = (function() { //->Heilung durch Dopplung if(parts.ids.length == 1){ parts.ids.push(parts.ids[0]); - } - + } parts.setVisibility(visibility); } diff --git a/ui/scripts/CanvasMark/AframeCanvasMarkController.js b/ui/scripts/CanvasMark/AframeCanvasMarkController.js new file mode 100644 index 000000000..9da0efd10 --- /dev/null +++ b/ui/scripts/CanvasMark/AframeCanvasMarkController.js @@ -0,0 +1,214 @@ +var canvasMarkController = (function() { + + + var SELECTION_MODES = { + UP: "UP", + DOWN: "DOWN", + DURATION: "DURATION" + }; + + //config parameters + var controllerConfig = { + setCenterOfRotation : false, + markingColor: "orange", + selectionMouseKey: 1, + selectionMode: "UP", + selectionDurationSeconds: 0.5, + selectionMoveAllowed: false, + showProgressBar: false + }; + + var downActionEventObject; + + function initialize(setupConfig){ + + application.transferConfigParams(setupConfig, controllerConfig); + + } + + function activate(){ + + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].down.subscribe(downAction); + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].up.subscribe(upAction); + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].during.subscribe(duringAction); + actionController.actions.mouse.move.subscribe(mouseMove); + + events.marked.on.subscribe(onEntityMarked); + events.marked.off.subscribe(onEntityUnmarked); + } + + function reset(){ + var markedEntities = events.marked.getEntities(); + + canvasManipulator.resetColorOfEntities(markedEntities); + } + + + + + function downAction(eventObject, timestamp){ + + downActionEventObject = eventObject; + + if(!eventObject.entity){ + return; + } + + if(controllerConfig.selectionMode === "DOWN"){ + handleOnClick(eventObject); + return; + } + + downActionEventObject = eventObject; + + // "progressBar.jqxProgressBar is not a function" + /*if(controllerConfig.selectionMode === "DURATION" && controllerConfig.showProgressBar){ + showProgressBar(eventObject); + }*/ + } + + function upAction(eventObject){ + + if(!downActionEventObject){ + return; + } + + if(controllerConfig.selectionMode === "UP"){ + handleOnClick(downActionEventObject); + return; + } + + /*if(controllerConfig.selectionMode === "DURATION" && controllerConfig.showProgressBar){ + hideProgressBar(); + }*/ + } + + function duringAction(eventObject, timestamp, timeSinceStart){ + + if(!downActionEventObject){ + return; + } + + if(controllerConfig.selectionMode !== "DURATION"){ + return; + } + + if(timeSinceStart > ( 1000 * controllerConfig.selectionDurationSeconds)){ + //hideProgressBar(); + handleOnClick(downActionEventObject); + downActionEventObject = null; + } + } + + function mouseMove(eventObject, timestamp){ + /*if(!downActionEventObject){ + return; + } + + if(!controllerConfig.selectionMoveAllowed){ + hideProgressBar(); + downActionEventObject = null; + }*/ + } + + + function handleOnClick(eventObject) { + if(eventObject.entity != null) { + var applicationEvent = { + sender: canvasMarkController, + entities: [eventObject.entity] + }; + + if (eventObject.entity.marked) { + events.marked.off.publish(applicationEvent); + } else { + events.marked.on.publish(applicationEvent); + } + + //center of rotation + /*if(controllerConfig.setCenterOfRotation){ + canvasManipulator.setCenterOfRotation(eventObject.entity); + }*/ + } + } + + + + + + function onEntityMarked(applicationEvent) { + var entity = applicationEvent.entities[0]; + if(entity == undefined) { + console.debug("no entity"); + return; + } + + if(entity.hovered){ + console.debug("Entity hovered"); + canvasManipulator.unhighlightEntities([entity]); + } + canvasManipulator.changeColorOfEntities([entity], controllerConfig.markingColor); + } + + function onEntityUnmarked(applicationEvent) { + var entity = applicationEvent.entities[0]; + canvasManipulator.resetColorOfEntities([entity]); + } + + + + function showProgressBar(eventObject){ + + var canvas = document.getElementById("canvas"); + + var progressBarDivElement = document.createElement("DIV"); + progressBarDivElement.id = "progressBarDiv"; + + canvas.appendChild(progressBarDivElement); + + var progressBar = $("#progressBarDiv"); + + progressBar.jqxProgressBar({ + width: 250, + height: 30, + value: 100, + animationDuration: controllerConfig.selectionDurationSeconds * 1000, + template: "success" + }); + + + progressBar.css("top", eventObject.layerY + 10 + "px"); + progressBar.css("left", eventObject.layerX + 10 + "px"); + + progressBar.css("z-index", "1"); + progressBar.css("position", "absolute"); + + progressBar.css("width", "250px"); + progressBar.css("height", "30px"); + + progressBar.css("display", "block"); + + } + + function hideProgressBar(){ + + var progressBarDivElement = document.getElementById("progressBarDiv"); + + if(!progressBarDivElement){ + return; + } + + var canvas = document.getElementById("canvas"); + canvas.removeChild(progressBarDivElement); + } + + + return { + initialize : initialize, + reset : reset, + activate : activate, + onEntityMarked : onEntityMarked, + onEntityUnmarked : onEntityUnmarked, + SELECTION_MODES : SELECTION_MODES + }; +})(); \ No newline at end of file diff --git a/ui/scripts/Search/SearchController.js b/ui/scripts/Search/SearchController.js index 846699d52..6ecda9939 100644 --- a/ui/scripts/Search/SearchController.js +++ b/ui/scripts/Search/SearchController.js @@ -68,8 +68,6 @@ var searchController = (function() { } function initializeSearch() { - - console.debug("SearchController.js: initializeSearch() - begin"); suggestions = new Bloodhound({ datumTokenizer: function(entity) { @@ -117,9 +115,6 @@ var searchController = (function() { $(jQsearchInputID).on("typeahead:closed", function(event, suggestion, dataset) { rootDivElement.parentElement.style.overflow = "hidden"; }); - - - console.debug("SearchController.js: initializeSearch() - end"); } function selectEntity(id) { diff --git a/ui/setups/test/blank.js b/ui/setups/test/blank.js index d4d5d8683..a81890f3a 100644 --- a/ui/setups/test/blank.js +++ b/ui/setups/test/blank.js @@ -5,10 +5,15 @@ var setup = { logActionConsole : false, logEventConsole : false }, + { name: "canvasMarkController", + selectionMode: "DURATION", //TODO Constants - UP - DOWN - DURATION + selectionDurationSeconds: 0.5, + selectionMoveAllowed: false, + showProgressBar: true, + }, { - name: "searchController", + name: "searchController" } - ], @@ -24,7 +29,7 @@ var setup = { size: "10%", collapsible: false, controllers: [ - { name: "searchController"}, + { name: "searchController"} ] }, second: { @@ -34,7 +39,8 @@ var setup = { canvas: {}, controllers: [ - { name: "defaultLogger" }, + { name: "canvasMarkController" }, + { name: "defaultLogger" } ], } } From b1589e8f09389de14ce4580049354892e556e7a9 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 30 Oct 2018 11:41:01 +0100 Subject: [PATCH 06/71] AframeCanvasManipulator (& more) -FlyToEntity-function not working yet -AframeActionController working with some workarounds -AframeCanvasMarkController working --- ui/aframe.html | 7 +- ui/scripts/AframeActionController.js | 1041 ++++++++--------- ui/scripts/AframeCanvasManipulator.js | 528 ++++----- ui/scripts/Application.js | 2 - .../AframeCanvasHoverController.js | 225 ++++ ui/scripts/CanvasManipulator.js | 20 +- .../CanvasMark/AframeCanvasMarkController.js | 214 ++++ ui/scripts/Search/SearchController.js | 5 - ui/setups/test/blank.js | 14 +- 9 files changed, 1130 insertions(+), 926 deletions(-) create mode 100644 ui/scripts/CanvasHover/AframeCanvasHoverController.js create mode 100644 ui/scripts/CanvasMark/AframeCanvasMarkController.js diff --git a/ui/aframe.html b/ui/aframe.html index 02e5369f7..5f7f21570 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -5,7 +5,7 @@ TODO in application auslagern --> - + - + @@ -87,7 +87,6 @@
diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index 2191c15b4..b6b407149 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -1,611 +1,506 @@ -var actionController = (function() { - +var actionController = (function () { + //********************************* // Constants //********************************* - var MOUSE_BUTTON_LEFT = 1; - var MOUSE_BUTTON_RIGHT = 2; - var MOUSE_BUTTON_MIDDLE = 3; + var MOUSE_BUTTON_LEFT = 1; + var MOUSE_BUTTON_RIGHT = 2; + var MOUSE_BUTTON_MIDDLE = 3; //********************************* // Variables //********************************* - var defaultTickTime = 1; - - var multipartEvent = false; - - var hoveredEntity = null; - - //actions object - var actions = { - mouse : { - key : [], - down : createActionObject("mouseKeyDown"), - up : createActionObject("mouseKeyUp"), - during : createActionObject("mouseKeyDuring"), - move : createActionObject("mouseMove"), - doubleClick : createActionObject("mouseDoubleClick"), - scroll : createActionObject("mouseScroll"), - hover : createActionObject("mouseHover"), - unhover : createActionObject("mouseUnhover"), - }, - keyboard : { - key : [] - } - }; - - var mouseMovedEvent = {}; - - //create mouse action object for every key - for(let i=0; i < 5; i = i + 1){ - actions.mouse.key.push({ - pressed : false, - bubbles : false, - startTime : 0, - lastTick : 0, - down : createActionObject("mouseKeyDown"), - during : createActionObject("mouseKeyDuring"), - up : createActionObject("mouseKeyUp") - }); - } - - //create key action object for every key - for(let i=0; i < 200; i = i + 1){ - actions.keyboard.key.push({ - pressed : false, - bubbles : false, - startTime : 0, - lastTick : 0, - down : createActionObject("keyboardKeyDown"), - during : createActionObject("keyboardKeyDuring"), - up : createActionObject("keyboardKeyUp") - }); - } - - function createActionObject(type){ - var tickTimePerListener = new Map(); - - return { - type : type, - actionListeners : [], - tickTimePerListener : tickTimePerListener, - subscribe : function(listener, tickTime){ subscribeAction(this, listener, tickTime); }, - unsubscribe : function(listener){ unsubscribeAction(this, listener); } - }; - } - - + var defaultTickTime = 1; + + var hoveredEntity = null; + var latestMouseButtonPressed = null; + + //actions object + var actions = { + mouse: { + key: [], + down: createActionObject("mouseKeyDown"), + up: createActionObject("mouseKeyUp"), + during: createActionObject("mouseKeyDuring"), + move: createActionObject("mouseMove"), + doubleClick: createActionObject("mouseDoubleClick"), + scroll: createActionObject("mouseScroll"), + hover: createActionObject("mouseHover"), + unhover: createActionObject("mouseUnhover"), + }, + keyboard: { + key: [] + } + }; + + var mouseMovedEvent = {}; + + //create mouse action object for every key + for (let i = 0; i < 5; i = i + 1) { + actions.mouse.key.push({ + pressed: false, + bubbles: false, + startTime: 0, + lastTick: 0, + down: createActionObject("mouseKeyDown"), + during: createActionObject("mouseKeyDuring"), + up: createActionObject("mouseKeyUp") + }); + } + + //create key action object for every key + for (let i = 0; i < 200; i = i + 1) { + actions.keyboard.key.push({ + pressed: false, + bubbles: false, + startTime: 0, + lastTick: 0, + down: createActionObject("keyboardKeyDown"), + during: createActionObject("keyboardKeyDuring"), + up: createActionObject("keyboardKeyUp") + }); + } + + function createActionObject(type) { + var tickTimePerListener = new Map(); + + return { + type: type, + actionListeners: [], + tickTimePerListener: tickTimePerListener, + subscribe: function (listener, tickTime) { + subscribeAction(this, listener, tickTime); + }, + unsubscribe: function (listener) { + unsubscribeAction(this, listener); + } + }; + } + + //********************************* // Initialization //********************************* - - function initialize(){ - console.debug(arguments.callee.name); - //canvas actions - var canvas = document.getElementById(canvasId); - - //mousedown - canvas.onmousedown = function(eventObject){ - if(multipartEvent){ - multipartEvent = false; - return; - } - - downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - downAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - //eventObject.cancelBubble = true; - //eventObject.stopPropagation(); - return false; - }; - - //mouseup - canvas.onmouseup = function(eventObject){ - if(multipartEvent){ - multipartEvent = false; - return; - } - - upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - upAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - //eventObject.cancelBubble = true; - //eventObject.stopPropagation(); - return false; - }; - - - //mousemove - canvas.onmousemove = function(eventObject){ - - moveAction(actions.mouse.move, eventObject); - - if(actions.mouse.move.bubbles){ - return true; - } - - //eventObject.cancelBubble = true; - //eventObject.stopPropagation(); - return false; - }; - - - - - //doubleClick - canvas.ondblclick = function(eventObject){ - - doubleClickAction(actions.mouse.doubleClick, eventObject); - - if(actions.mouse.doubleClick.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }; - - - //scroll - canvas.addEventListener("onmousewheel", function(eventObject){ - - scrollAction(actions.mouse.scroll, eventObject); - - if(actions.mouse.scroll.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.cancelable = false; - eventObject.stopPropagation(); - return false; - }, true); - - - //scroll FF - canvas.addEventListener("DOMMouseScroll", function(eventObject){ - - scrollAction(actions.mouse.scroll, eventObject); - - if(actions.mouse.scroll.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, true); - - - //mouseleave - canvas.addEventListener("onmouseleave", function(eventObject){ - - //general upAction for controllers - upAction(actions.mouse, eventObject); - - if(getMouseButton(eventObject) !== undefined) { - - if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { - return true; - } + + + function initialize() { + var canvas = document.getElementById(canvasId); + AFRAME.registerComponent('mouselistener', { + init: function () { + this.el.addEventListener("mouseup", function (eventObject) { + //general upAction for controllers + eventObject.component = hoveredEntity; + eventObject.which = latestMouseButtonPressed; + upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + upAction(actions.mouse, eventObject); + + /*if (getMouseButton(eventObject) !== undefined) { + + if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { + return true; + } + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false;*/ + }); + this.el.addEventListener("mousedown", function (eventObject) { + // only process the event with mousebutton (.which-Attribut) + if (eventObject.which != null) { + + eventObject.component = hoveredEntity; + latestMouseButtonPressed = eventObject.which; + + downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + downAction(actions.mouse, eventObject); + + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + if (actions.mouse.key[getMouseButton(eventObject)].bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + } + }, false); + this.el.addEventListener("mouseenter", function (eventObject) { + var component = document.getElementById(eventObject.target.id); + if (component != null) { + hoveredEntity = component; + } + hoverAction(actions.mouse, eventObject); + + if (actions.mouse.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + this.el.addEventListener("mouseleave", function (eventObject) { + unhoverAction(actions.mouse, eventObject); + + if (actions.mouse.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + // interrupts mousedown events somehow + this.el.addEventListener("mousemove", function (eventObject) { + moveAction(actions.mouse.move, eventObject); + + if (actions.mouse.move.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + this.el.addEventListener("dblclick", function (eventObject) { + eventObject.component = hoveredEntity; + + doubleClickAction(actions.mouse.doubleClick, eventObject); + + if (actions.mouse.doubleClick.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + this.el.addEventListener("wheel", function (eventObject) { + eventObject.component = hoveredEntity; + + scrollAction(actions.mouse.doubleClick, eventObject); + + if (actions.mouse.doubleClick.bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + //keydown + this.el.addEventListener("onkeydown", function (eventObject) { + + downAction(actions.keyboard.key[eventObject.which], eventObject); + + if (actions.keyboard.key[eventObject.which].bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); + //keyup + this.el.addEventListener("onkeyup", function (eventObject) { + + upAction(actions.keyboard.key[eventObject.which], eventObject); + + if (actions.keyboard.key[eventObject.which].bubbles) { + return true; + } + + eventObject.cancelBubble = true; + eventObject.stopPropagation(); + return false; + }); } + }); - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - - }, true); - - - //keydown - canvas.onkeydown = function(eventObject) { - - downAction(actions.keyboard.key[eventObject.which], eventObject); - - if(actions.keyboard.key[eventObject.which].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }; - - //keyup - canvas.onkeyup = function(eventObject) { - - upAction(actions.keyboard.key[eventObject.which], eventObject); - - if(actions.keyboard.key[eventObject.which].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }; - - - - - - //multipart events - var multiPart = document.getElementById("multiPart"); - - if(multiPart){ - //mousedown - multiPart.addEventListener("mousedown", function(eventObject){ - multipartEvent = true; - - downAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - downAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - - //mouseup - multiPart.addEventListener("mouseup", function(eventObject){ - multipartEvent = true; - - upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - upAction(actions.mouse, eventObject); - - if(actions.mouse.key[getMouseButton(eventObject)].bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - - - //hover - multiPart.addEventListener("mouseenter", function(eventObject){ - - hoverAction(actions.mouse, eventObject); - - if(actions.mouse.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - - //unhover - multiPart.addEventListener("mouseleave", function(eventObject){ - - unhoverAction(actions.mouse, eventObject); - - if(actions.mouse.bubbles){ - return true; - } - - eventObject.cancelBubble = true; - eventObject.stopPropagation(); - return false; - }, false); - } - - - } + canvas.setAttribute("mouselistener", ""); + canvas.querySelectorAll("a-box").forEach(function(box) { + box.setAttribute("mouselistener", ""); + }); + } //********************************* // Helper //********************************* - - function getMouseButton(eventObject){ - - if(eventObject.which){ - switch(eventObject.which) { - case 1: - return MOUSE_BUTTON_LEFT; - case 3: - return MOUSE_BUTTON_RIGHT; - case 2: - return MOUSE_BUTTON_MIDDLE; - default: - events.log.error.publish({ text: "mousebutton " + eventObject.button + " not implemented" }); - return; - } - } - - if(eventObject.button){ - switch(eventObject.button) { - case 1: - return MOUSE_BUTTON_LEFT; - case 2: - return MOUSE_BUTTON_RIGHT; - case 4: - return MOUSE_BUTTON_MIDDLE; - default: - events.log.error.publish({ text: "mousebutton " + eventObject.button + " not implemented" }); - return; - } - } - - } + + function getMouseButton(eventObject) { + + if (eventObject.which) { + switch (eventObject.which) { + case 1: + return MOUSE_BUTTON_LEFT; + case 3: + return MOUSE_BUTTON_RIGHT; + case 2: + return MOUSE_BUTTON_MIDDLE; + default: + events.log.error.publish({text: "mousebutton " + eventObject.button + " not implemented"}); + return; + } + } + + if (eventObject.button) { + switch (eventObject.button) { + case 1: + return MOUSE_BUTTON_LEFT; + case 2: + return MOUSE_BUTTON_RIGHT; + case 4: + return MOUSE_BUTTON_MIDDLE; + default: + events.log.error.publish({text: "mousebutton " + eventObject.button + " not implemented"}); + return; + } + } + + } //********************************* // Subscribe / Unsubscribe //********************************* - function subscribeAction(actionObject, listener, tickTime) { - - var actionListenerArray = actionObject.actionListeners; - - if(listener in actionListenerArray){ - events.log.error.publish({ text: "listener allready subscribes" }); - return; - } - - actionListenerArray.push(listener); + function subscribeAction(actionObject, listener, tickTime) { + + var actionListenerArray = actionObject.actionListeners; - if(tickTime){ - actionObject.tickTimePerListener.set(listener, tickTime); - } else { - actionObject.tickTimePerListener.set(listener, defaultTickTime); - } - } + if (listener in actionListenerArray) { + events.log.error.publish({text: "listener allready subscribes"}); + return; + } - function unsubscribeAction(actionObject, listener){ + actionListenerArray.push(listener); - var actionListenerArray = actionObject.actionListeners; + if (tickTime) { + actionObject.tickTimePerListener.set(listener, tickTime); + } else { + actionObject.tickTimePerListener.set(listener, defaultTickTime); + } + } - if(!listener in actionListenerArray){ - events.log.error.publish({ text: "listener not subscribed" }); - return; - } - - actionListenerArray.splice(actionListenerArray.indexOf(listener), 1); - } + function unsubscribeAction(actionObject, listener) { + var actionListenerArray = actionObject.actionListeners; + if (!listener in actionListenerArray) { + events.log.error.publish({text: "listener not subscribed"}); + return; + } + actionListenerArray.splice(actionListenerArray.indexOf(listener), 1); + } -//********************************* + +//********************************* // Actions //********************************* - function downAction(action, eventObject){ - - if(action.pressed){ - return; - } - - events.log.action.publish({ actionObject: action.down, eventObject: eventObject}); - - action.pressed = true; - action.startTime = Date.now(); - action.lastTick = Date.now(); - - //identify entity - if(eventObject.partID){ - var entity = model.getEntityById(eventObject.partID); - eventObject.entity = entity; - } - - //activate registered down listeners - var downListeners = action.down.actionListeners; - if( downListeners === undefined ){ - return; - } - downListeners.forEach(function(downListener){ - try { - downListener(eventObject, action.startTime); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - - //activate loop for during listeners - var duringListeners = action.during.actionListeners; - duringListeners.forEach(function(duringListener){ - var tickTime = action.during.tickTimePerListener.get(duringListener); - setTimeout( function(){ duringAction(action, duringListener, tickTime); }, tickTime); - }); - } - - - - function duringAction(action, duringListener, tickTime){ - - if( !action.pressed ) { - return; - } - - events.log.action.publish({ actionObject: action.during, eventObject: {} }); - - var timestamp = Date.now(); - - var timeSinceStart = timestamp - action.startTime; - var timeSinceLastTick = timestamp - action.lastTick; - action.lastTick = timestamp; - - try { - duringListener(mouseMovedEvent, timestamp, timeSinceStart, timeSinceLastTick); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - - - - - setTimeout( function(){ duringAction(action, duringListener, tickTime); }, tickTime); - } - - - - function upAction(action, eventObject){ - - events.log.action.publish({ actionObject: action.up, eventObject: eventObject}); - - action.pressed = false; - - var timestamp = Date.now(); - - //identify entity - if(eventObject.partID){ - var entity = model.getEntityById(eventObject.partID); - eventObject.entity = entity; - } - - //activate registered up listeners - var upListeners = action.up.actionListeners; - if( upListeners === undefined ){ - return; - } - upListeners.forEach(function(upListener){ - try { - upListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - - function hoverAction(action, eventObject){ - - events.log.action.publish({ actionObject: action.hover, eventObject: eventObject}); - - var timestamp = Date.now(); - - //identify entity - if(eventObject.partID){ - var entity = model.getEntityById(eventObject.partID); - eventObject.entity = entity; - - hoveredEntity = entity; - } - - - - - //activate registered hover listeners - var hoverListeners = action.hover.actionListeners; - if( hoverListeners === undefined ){ - return; - } - hoverListeners.forEach(function(hoverListener){ - try { - hoverListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - function unhoverAction(action, eventObject){ - - events.log.action.publish({ actionObject: action.unhover, eventObject: eventObject}); - - action.pressed = false; - hoveredEntity = null; - - var timestamp = Date.now(); - - //activate registered up listeners - var unhoverListeners = action.unhover.actionListeners; - if( unhoverListeners === undefined ){ - return; - } - unhoverListeners.forEach(function(unhoverListener){ - try { - unhoverListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - - - function moveAction(action, eventObject){ - - events.log.action.publish({ actionObject: action, eventObject: eventObject}); - - mouseMovedEvent = eventObject; - - var timestamp = Date.now(); - - var moveListeners = action.actionListeners; - - moveListeners.forEach(function(moveListener){ - try { - moveListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - function doubleClickAction(action, eventObject){ - - events.log.action.publish({ actionObject: action, eventObject: eventObject}); - - var timestamp = Date.now(); - - var doubleClickListeners = action.actionListeners; - - doubleClickListeners.forEach(function(doubleClickListener){ - try { - doubleClickListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - function scrollAction(action, eventObject){ - - events.log.action.publish({ actionObject: action, eventObject: eventObject}); - - var timestamp = Date.now(); - - //identify entity - if(hoveredEntity != null){ - eventObject.entity = hoveredEntity; - } - - var scrollListeners = action.actionListeners; - - scrollListeners.forEach(function(scrollListener){ - try { - scrollListener(eventObject, timestamp); - } catch(err) { - events.log.error.publish({ text: err.message }); - } - }); - } - - - - return { - initialize : initialize, - actions : actions - }; - + function downAction(action, eventObject) { + events.log.action.publish({actionObject: action.down, eventObject: eventObject}); + + action.pressed = true; + action.startTime = Date.now(); + action.lastTick = Date.now(); + + if(eventObject.component != null && eventObject.component.id != "aframe-canvas") { + eventObject.entity = model.getEntityById(eventObject.component.id); + } + + //activate registered down listeners + var downListeners = action.down.actionListeners; + if (downListeners === undefined) { + return; + } + downListeners.forEach(function (downListener) { + try { + downListener(eventObject, action.startTime); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + + //activate loop for during listeners + var duringListeners = action.during.actionListeners; + duringListeners.forEach(function (duringListener) { + var tickTime = action.during.tickTimePerListener.get(duringListener); + setTimeout(function () { + duringAction(action, duringListener, tickTime); + }, tickTime); + }); + } + + + function duringAction(action, duringListener, tickTime) { + + if (!action.pressed) { + return; + } + + events.log.action.publish({actionObject: action.during, eventObject: {}}); + + var timestamp = Date.now(); + + var timeSinceStart = timestamp - action.startTime; + var timeSinceLastTick = timestamp - action.lastTick; + action.lastTick = timestamp; + + try { + duringListener(mouseMovedEvent, timestamp, timeSinceStart, timeSinceLastTick); + } catch (err) { + events.log.error.publish({text: err.message}); + } + + + setTimeout(function () { + duringAction(action, duringListener, tickTime); + }, tickTime); + } + + + function upAction(action, eventObject) { + + events.log.action.publish({actionObject: action.up, eventObject: eventObject}); + + action.pressed = false; + + var timestamp = Date.now(); + + //activate registered up listeners + var upListeners = action.up.actionListeners; + if (upListeners === undefined) { + return; + } + upListeners.forEach(function (upListener) { + try { + upListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + + function hoverAction(action, eventObject) { + + events.log.action.publish({actionObject: action.hover, eventObject: eventObject}); + + var timestamp = Date.now(); + + //identify entity + if (eventObject.component && eventObject.component.id != "aframe.canvas") { + eventObject.entity = model.getEntityById(eventObject.component); + } + + + //activate registered hover listeners + var hoverListeners = action.hover.actionListeners; + if (hoverListeners === undefined) { + return; + } + hoverListeners.forEach(function (hoverListener) { + try { + hoverListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + function unhoverAction(action, eventObject) { + + events.log.action.publish({actionObject: action.unhover, eventObject: eventObject}); + + action.pressed = false; + + var timestamp = Date.now(); + + //activate registered up listeners + var unhoverListeners = action.unhover.actionListeners; + if (unhoverListeners === undefined) { + return; + } + unhoverListeners.forEach(function (unhoverListener) { + try { + unhoverListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + + function moveAction(action, eventObject) { + + events.log.action.publish({actionObject: action, eventObject: eventObject}); + + mouseMovedEvent = eventObject; + + var timestamp = Date.now(); + + var moveListeners = action.actionListeners; + + moveListeners.forEach(function (moveListener) { + try { + moveListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + function doubleClickAction(action, eventObject) { + events.log.action.publish({actionObject: action, eventObject: eventObject}); + + var timestamp = Date.now(); + + var doubleClickListeners = action.actionListeners; + + doubleClickListeners.forEach(function (doubleClickListener) { + try { + doubleClickListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + function scrollAction(action, eventObject) { + + events.log.action.publish({actionObject: action, eventObject: eventObject}); + + var timestamp = Date.now(); + + //identify entity + if (hoveredEntity != null) { + eventObject.entity = hoveredEntity; + } + + var scrollListeners = action.actionListeners; + + scrollListeners.forEach(function (scrollListener) { + try { + scrollListener(eventObject, timestamp); + } catch (err) { + events.log.error.publish({text: err.message}); + } + }); + } + + + return { + initialize: initialize, + actions: actions + }; + })(); \ No newline at end of file diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index 85ceacd57..68d8463e7 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -1,333 +1,211 @@ -var canvasManipulator = (function() { - - var colors = { - darkred: "darkred", - black: "black", - orange: "orange", - darkorange: "darkorange" - } - - var x3domRuntime; - var viewarea; - var viewpoint; +var canvasManipulator = (function () { - var initialCenterOfRotation; + var colors = { + darkred: "darkred", + black: "black", + orange: "orange", + darkorange: "darkorange" + } + + var scene = {}; + var threeJSScene = {}; + + var camera; + var initialCameraView; + + function initialize() { + + scene = document.getElementById(canvasId); + threeJSScene = scene.object3D; + camera = document.getElementById("camera"); + + } + + function reset() { + + } + + // working - save old transparency in case it is not 0? + function changeTransparencyOfEntities(entities, value) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - changeTransparencyOfEntities - components for entityIds not found"}); + return; + } + setTransparency(component, value); + }); + } + + // working + function resetTransparencyOfEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - resetTransparencyOfEntities - components for entityIds not found"}); + return; + } + setTransparency(component, 1); + }); + } + + + // working + function changeColorOfEntities(entities, color) { + entities.forEach(function (entity) { + // in x3dom this function would get entities of the model to change the color of the related object + // for reference in canvasHoverController.js: var entity = model.getEntityById(multipartEvent.partID); + // this entity gets handed over to the ActionController.js as part of an ApplicationEvent + if (!(entity == undefined)) { + var component = document.getElementById(entity.id); + } + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - changeColorOfEntities - components for entityIds not found"}); + return; + } + setColor(component, color); + }); + } + + // working + function resetColorOfEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - resetColorOfEntities - components for entityIds not found"}); + return; + } + setColor(component, component.getAttribute("color")); + }); + } + + // working + function hideEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - hideEntities - components for entityIds not found"}); + return; + } + setVisibility(component, false) + }); + } + + // working + function showEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - showEntities - components for entityIds not found"}); + return; + } + setVisibility(component, true) + }); + } + + // after clicking an entity fit the camera to show this entity (angle stays the same) + // not working + function flyToEntity(entity) { + /*document.querySelector("#camera").object3D.position = {x: 1, y: 2, z: 3}; + console.debug(document.querySelector("#camera").object3D.position);*/ + } + + function addElement(element) { + var addedElements = document.getElementById("addedElements"); + addedElements.appendChild(element); + } + + function removeElement(element) { + var addedElements = document.getElementById("addedElements"); + addedElements.removeChild(element); + } + + + // not working yet + // gets called from Mark- and SelectController if specified in the config + function setCenterOfRotation(entity, setFocus) { + var centerOfPart = getCenterOfEntity(entity); + + viewpoint.setCenterOfRotation(centerOfPart); + + if (setFocus) { + var mat = viewarea.getViewMatrix().inverse(); + + var from = mat.e3(); + var at = viewarea._pick; + var up = mat.e1(); + + var norm = mat.e0().cross(up).normalize(); + // get distance between look-at point and viewing plane + var dist = norm.dot(viewarea._pick.subtract(from)); + + from = at.addScaled(norm, -dist); + mat = x3dom.fields.SFMatrix4f.lookAt(from, at, up); + + viewarea.animateTo(mat.inverse(), viewpoint); + } + } + + + function getCenterOfEntity(entity) { + var entityPart = getPart(entity); + var volumeOfPart = entityPart.getVolume(); + var centerOfPart = volumeOfPart.center; + + return centerOfPart; + } - - function initialize(){ - - } - - function reset(){ - } - - - - //manipulate - function highlightEntities(entities, color){ - - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - highlightEntities - parts for entityIds not found"}); - return; - } - - parts.unhighlight(); - parts.highlight(color); - } - - - function unhighlightEntities(entities){ - - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); - return; - } - - parts.unhighlight(); - } - - - - function changeTransparencyOfEntities(entities, value){ - var entitiyIds = []; - entities.forEach(function(entity){ - var part = multiPart.getParts([entity.id]); - if(part == null){ - return; - } - entity.oldTransparency = part.getTransparency(); - - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - changeTransparencyOfEntities - parts for entityIds not found"}); - return; - } - setTransparency(parts, value); - } - - function resetTransparencyOfEntities(entities){ - - var oldTransparencyMap = new Map(); - - entities.forEach(function(entity){ - - if(!entity.oldTransparency){ - return; - } - var oldTransparency = entity.oldTransparency; - - if(oldTransparencyMap.has(oldTransparency)){ - oldTransparencyMap.get(oldTransparency).push(entity.id); - } else { - oldTransparencyMap.set(oldTransparency, [entity.id]); - } - }); - - oldTransparencyMap.forEach(function(entitiyIds, oldTransparency, map){ - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - resetTransparencyOfEntities - parts for entityIds not found"}); - return; - } - setTransparency(parts, oldTransparency); - }); - } - - - - function changeColorOfEntities(entities, color){ - var entitiyIds = []; - entities.forEach(function(entity){ - var part = multiPart.getParts([entity.id]); - if(part == null){ - return; - } - if(!entity.oldColor){ - entity.oldColor = part.getDiffuseColor().toString(); - } - entitiyIds.push(entity.id); + + //Helper + function getPart(entity) { + if (entity.part == undefined) { + var part = multiPart.getParts([entity.id]); + entity.part = part; + } + + return entity.part; + } + + // working + function setColor(object, color) { + object.setAttribute('material', { + color: color }); + } + + function setTransparency(object, value) { + object.setAttribute('material', { + opacity: value + }); + } - var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - changeColorOfEntities - parts for entityIds not found"}); - return; - } - setColor(parts, color); - } - - - function resetColorOfEntities(entities){ - //sort each entity by its old color for performance - var oldColorMap = new Map(); - entities.forEach(function(entity){ - if(entity.oldColor == null){ - return; - } - var oldColor = entity.oldColor; - - if(oldColorMap.has(oldColor)){ - oldColorMap.get(oldColor).push(entity.id); - } else { - oldColorMap.set(oldColor, [entity.id]); - } - - entity.oldColor = null; - }); - - oldColorMap.forEach(function(entitiyIds, oldColor, map){ - var parts = multiPart.getParts(entitiyIds); - if(parts === undefined){ - events.log.error.publish({ text: "CanvasManipualtor - resetColorOfEntities - parts for entityIds not found"}); - return; - } - setColor(parts, oldColor); - }); - } - - function hideEntities(entities){ - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === undefined){ - events.log.error.publish({ text: "CanvasManipualtor - hideEntities - parts for entityIds not found"}); - return; - } - setVisibility(parts, false); - } - - - function showEntities(entities){ - var entitiyIds = new Array(); - entities.forEach(function(entity){ - entitiyIds.push(entity.id); - }); - - var parts = multiPart.getParts(entitiyIds); - if(parts === undefined){ - events.log.error.publish({ text: "CanvasManipualtor - showEntities - parts for entityIds not found"}); - return; - } - setVisibility(parts, true); - } - - - - function flyToEntity(entity){ - var part = getPart(entity); - if (part == undefined) { - events.log.error.publish({ text: "CanvasManipualtor - resetColflyToEntityorOfEntities - parts for entityIds not found"}); - return; - } - - part.fit(); - } - - - - function addElement(element){ - var addedElements = document.getElementById("addedElements"); - addedElements.appendChild(element); - } - - function removeElement(element){ - var addedElements = document.getElementById("addedElements"); - addedElements.removeChild(element); - } - - - - //From X3dom coding - //x3dom.DefaultNavigation.prototype.onDoubleClick = function (view, x, y) - - function setCenterOfRotation(entity, setFocus){ - - var centerOfPart = getCenterOfEntity(entity); - - viewpoint.setCenterOfRotation(centerOfPart); - - if(setFocus){ - var mat = viewarea.getViewMatrix().inverse(); - - var from = mat.e3(); - var at = viewarea._pick; - var up = mat.e1(); - - var norm = mat.e0().cross(up).normalize(); - // get distance between look-at point and viewing plane - var dist = norm.dot(viewarea._pick.subtract(from)); - - from = at.addScaled(norm, -dist); - mat = x3dom.fields.SFMatrix4f.lookAt(from, at, up); - - viewarea.animateTo(mat.inverse(), viewpoint); - } - } - - - function getCenterOfEntity(entity){ - var entityPart = getPart(entity); - var volumeOfPart = entityPart.getVolume(); - var centerOfPart = volumeOfPart.center; - - return centerOfPart; - } - - - //Helper - function getPart(entity){ - if (entity.part == undefined){ - var part = multiPart.getParts([entity.id]); - entity.part = part; - } - - return entity.part; - } - - function setColor(parts, color){ - - //Fehler in Methode setDiffuseColor bei nur einem übergebenem Part - //->Heilung durch Dopplung - if(parts.ids.length == 1){ - parts.ids.push(parts.ids[0]); - } - - parts.setDiffuseColor(color); - } - - function setTransparency(parts, value) { - - //Fehler in Methode setTransparency bei nur einem übergebenem Part - //->Heilung durch Dopplung - if(parts.ids.length == 1){ - parts.ids.push(parts.ids[0]); - } - - parts.setTransparency(value); + + function setVisibility(object, visibility) { + object.setAttribute("visible", visibility); } + return { + initialize: initialize, + reset: reset, + colors: colors, + + changeTransparencyOfEntities: changeTransparencyOfEntities, + resetTransparencyOfEntities: resetTransparencyOfEntities, + + changeColorOfEntities: changeColorOfEntities, + resetColorOfEntities: resetColorOfEntities, + + hideEntities: hideEntities, + showEntities: showEntities, + + flyToEntity: flyToEntity, + + addElement: addElement, + removeElement: removeElement, + + + setCenterOfRotation: setCenterOfRotation, + getCenterOfEntity: getCenterOfEntity, + }; - function setVisibility(parts, visibility) { - //Fehler in Methode setVisibility bei nur einem übergebenem Part - //->Heilung durch Dopplung - if(parts.ids.length == 1){ - parts.ids.push(parts.ids[0]); - } - - parts.setVisibility(visibility); - } - - function getElementIds(){ - return multiPart.getIdList(); - } - - - - return { - initialize : initialize, - reset : reset, - colors : colors, - - highlightEntities : highlightEntities, - unhighlightEntities : unhighlightEntities, - - changeTransparencyOfEntities : changeTransparencyOfEntities, - resetTransparencyOfEntities : resetTransparencyOfEntities, - - changeColorOfEntities : changeColorOfEntities, - resetColorOfEntities : resetColorOfEntities, - - hideEntities : hideEntities, - showEntities : showEntities, - - flyToEntity : flyToEntity, - - addElement : addElement, - removeElement : removeElement, - - - setCenterOfRotation : setCenterOfRotation, - getCenterOfEntity : getCenterOfEntity, - - getElementIds : getElementIds, - }; - })(); \ No newline at end of file diff --git a/ui/scripts/Application.js b/ui/scripts/Application.js index 1e5c454a7..e167779b8 100644 --- a/ui/scripts/Application.js +++ b/ui/scripts/Application.js @@ -33,7 +33,6 @@ function initializeApplication(metaDataJson){ //create entity model model.initialize(metaDataJson); - console.debug("Initialize ActionController"); actionController.initialize(); canvasManipulator.initialize(); @@ -384,7 +383,6 @@ var application = (function() { newActiveControllers.forEach(function(controllerObject){ if(controllerObject.activate){ var controllerDiv = activeControllers.get(controllerObject); - console.debug(controllerObject); controllerObject.activate(controllerDiv); } diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js new file mode 100644 index 000000000..d3170174f --- /dev/null +++ b/ui/scripts/CanvasHover/AframeCanvasHoverController.js @@ -0,0 +1,225 @@ +var canvasHoverController = (function() { + + var isInNavigation = false; + + function initialize(setupConfig){ + application.transferConfigParams(setupConfig, controllerConfig); + var cssLink = document.createElement("link"); + cssLink.type = "text/css"; + cssLink.rel = "stylesheet"; + cssLink.href = "scripts/CanvasHover/ho.css"; + document.getElementsByTagName("head")[0].appendChild(cssLink); + } + + //config parameters + var controllerConfig = { + hoverColor: "darkred", + showQualifiedName : false, + showVersion : false, + showIssues : false + }; + + function activate(){ + //createTooltipContainer(); + + events.hovered.on.subscribe(onEntityHover); + events.hovered.off.subscribe(onEntityUnhover); + } + + function reset(){ + var hoveredEntities = events.hovered.getEntities(); + + hoveredEntities.forEach(function(hoveredEntity){ + var unHoverEvent = { + sender: canvasHoverController, + entities: [hoveredEntity] + }; + + events.hovered.off.publish(unHoverEvent); + }); + } + + function createTooltipContainer(){ + + var canvas = document.getElementById("canvas"); + + var tooltipDivElement = document.createElement("DIV"); + tooltipDivElement.id = "tooltip"; + + var namePElement = document.createElement("P"); + namePElement.id = "tooltipName"; + tooltipDivElement.appendChild(namePElement); + + if(controllerConfig.showQualifiedName) { + var qualifiedNamePElement = document.createElement("P"); + qualifiedNamePElement.id = "tooltipQualifiedName"; + tooltipDivElement.appendChild(qualifiedNamePElement); + } + + if(controllerConfig.showVersion) { + var versionPElement = document.createElement("P"); + versionPElement.id = "tooltipVersion"; + tooltipDivElement.appendChild(versionPElement); + } + if(controllerConfig.showIssues) { + var openIssuesPElement = document.createElement("P"); + openIssuesPElement.id = "tooltipOpenIssues"; + tooltipDivElement.appendChild((openIssuesPElement)); + + var closedIssuesPElement = document.createElement("P"); + closedIssuesPElement.id = "tooltipClosedIssues"; + tooltipDivElement.appendChild((closedIssuesPElement)); + + var openSecurityIssuesPElement = document.createElement("P"); + openSecurityIssuesPElement.id = "tooltipOpenSecurityIssues"; + tooltipDivElement.appendChild((openSecurityIssuesPElement)); + + var closedSecurityIssuesPElement = document.createElement("P"); + closedSecurityIssuesPElement.id = "tooltipClosedSecurityIssues"; + tooltipDivElement.appendChild((closedSecurityIssuesPElement)); + } + canvas.appendChild(tooltipDivElement); + } + + function handleOnMousedown(canvasEvent) { + isInNavigation = true; + } + + function handleOnMouseup(canvasEvent) { + isInNavigation = false; + } + + function handleOnMouseEnter(multipartEvent) { + if(isInNavigation){ + return; + } + + var entity = model.getEntityById(multipartEvent.partID); + if(entity === undefined){ + entity = multipartEvent.target.id; + console.log("entity: " + entity); + events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + return; + } + + var applicationEvent = { + sender : canvasHoverController, + entities : [entity], + posX : multipartEvent.layerX, + posY : multipartEvent.layerY + }; + + events.hovered.on.publish(applicationEvent); + } + + function handleOnMouseLeave(multipartEvent) { + + var entity = model.getEntityById(multipartEvent.partID); + if(entity === undefined){ + events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + return; + } + + var applicationEvent = { + sender : canvasHoverController, + entities : [entity] + }; + + events.hovered.off.publish(applicationEvent); + } + + function onEntityHover(applicationEvent) { + console.debug("onEntityHover()"); + var entity = applicationEvent.entities[0]; + + if(entity === undefined){ + events.log.error.publish({ text: "Entity is not defined"}); + } + + if(entity.isTransparent === true) { + return; + } + + if(entity.type === "text"){ + return; + } + + if(entity.marked && entity.selected){ + canvasManipulator.unhighlightEntities([entity]); + } else { + canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); + } + + $("#tooltipName").text(getTooltipName(entity)); + if(controllerConfig.showQualifiedName) { + $("#tooltipQualifiedName").text(entity.qualifiedName); + } + if(controllerConfig.showVersion) { + $("#tooltipVersion").text("Version: " + entity.version); + } + if(controllerConfig.showIssues) { + let openIssuesSelector = $('#tooltipOpenIssues'); + let closedIssuesSelector = $('#tooltipClosedIssues'); + let openSecurityIssuesSelector = $('#tooltipOpenSecurityIssues'); + let closedSecurityIssuesSelector = $('#tooltipClosedSecurityIssues'); + if (entity.type === "Namespace") { + openIssuesSelector.css("display", "none"); + closedIssuesSelector.css("display", "none"); + openSecurityIssuesSelector.css("display", "none"); + closedSecurityIssuesSelector.css("display", "none"); + } else { + openIssuesSelector.text("Open Issues: " + entity.numberOfOpenIssues); + closedIssuesSelector.text("Closed Issues: " + entity.numberOfClosedIssues); + openSecurityIssuesSelector.text("Open Security Issues: " + entity.numberOfOpenSecurityIssues); + closedSecurityIssuesSelector.text("Closed Security Issues: " + entity.numberOfClosedSecurityIssues); + openIssuesSelector.css("display", "block"); + closedIssuesSelector.css("display", "block"); + openSecurityIssuesSelector.css("display", "block"); + closedSecurityIssuesSelector.css("display", "block"); + } + } + + var tooltip = $("#tooltip"); + tooltip.css("top", applicationEvent.posY + 50 + "px"); + tooltip.css("left", applicationEvent.posX + 50 + "px"); + tooltip.css("display", "block"); + } + + function onEntityUnhover(applicationEvent) { + var entity = applicationEvent.entities[0]; + + if(entity.marked && entity.selected){ + canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); + } else { + if(!entity.selected){ + canvasManipulator.unhighlightEntities([entity]); + } + if(entity.type === "Namespace"){ + canvasManipulator.unhighlightEntities([entity]); + } + } + + $("#tooltip").css("display", "none"); + + } + + function getTooltipName(entity) { + if(entity.type === "Method") { + return entity.type + ": " + entity.signature; + } + + if (entity.type === "Namespace") { + return "Package: " + entity.name; + } + + return entity.type + ": " + entity.name; + } + + return { + initialize: initialize, + activate: activate, + reset: reset, + handleOnMouseEnter: handleOnMouseEnter, + handleOnMouseLeave: handleOnMouseLeave + }; +})(); diff --git a/ui/scripts/CanvasManipulator.js b/ui/scripts/CanvasManipulator.js index 5154ef19b..9a82f8041 100644 --- a/ui/scripts/CanvasManipulator.js +++ b/ui/scripts/CanvasManipulator.js @@ -58,10 +58,10 @@ var canvasManipulator = (function() { }); var parts = multiPart.getParts(entitiyIds); - if(parts === null){ - events.log.error.publish({ text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); - return; - } + if(parts === null) { + events.log.error.publish({text: "CanvasManipualtor - unhighlightEntities - parts for entityIds not found"}); + return; + } parts.unhighlight(); } @@ -231,7 +231,6 @@ var canvasManipulator = (function() { var centerOfPart = getCenterOfEntity(entity); viewpoint.setCenterOfRotation(centerOfPart); - if(setFocus){ var mat = viewarea.getViewMatrix().inverse(); @@ -255,7 +254,6 @@ var canvasManipulator = (function() { var entityPart = getPart(entity); var volumeOfPart = entityPart.getVolume(); var centerOfPart = volumeOfPart.center; - return centerOfPart; } @@ -266,7 +264,6 @@ var canvasManipulator = (function() { var part = multiPart.getParts([entity.id]); entity.part = part; } - return entity.part; } @@ -276,8 +273,7 @@ var canvasManipulator = (function() { //->Heilung durch Dopplung if(parts.ids.length == 1){ parts.ids.push(parts.ids[0]); - } - + } parts.setDiffuseColor(color); } @@ -287,8 +283,7 @@ var canvasManipulator = (function() { //->Heilung durch Dopplung if(parts.ids.length == 1){ parts.ids.push(parts.ids[0]); - } - + } parts.setTransparency(value); } @@ -298,8 +293,7 @@ var canvasManipulator = (function() { //->Heilung durch Dopplung if(parts.ids.length == 1){ parts.ids.push(parts.ids[0]); - } - + } parts.setVisibility(visibility); } diff --git a/ui/scripts/CanvasMark/AframeCanvasMarkController.js b/ui/scripts/CanvasMark/AframeCanvasMarkController.js new file mode 100644 index 000000000..9da0efd10 --- /dev/null +++ b/ui/scripts/CanvasMark/AframeCanvasMarkController.js @@ -0,0 +1,214 @@ +var canvasMarkController = (function() { + + + var SELECTION_MODES = { + UP: "UP", + DOWN: "DOWN", + DURATION: "DURATION" + }; + + //config parameters + var controllerConfig = { + setCenterOfRotation : false, + markingColor: "orange", + selectionMouseKey: 1, + selectionMode: "UP", + selectionDurationSeconds: 0.5, + selectionMoveAllowed: false, + showProgressBar: false + }; + + var downActionEventObject; + + function initialize(setupConfig){ + + application.transferConfigParams(setupConfig, controllerConfig); + + } + + function activate(){ + + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].down.subscribe(downAction); + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].up.subscribe(upAction); + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].during.subscribe(duringAction); + actionController.actions.mouse.move.subscribe(mouseMove); + + events.marked.on.subscribe(onEntityMarked); + events.marked.off.subscribe(onEntityUnmarked); + } + + function reset(){ + var markedEntities = events.marked.getEntities(); + + canvasManipulator.resetColorOfEntities(markedEntities); + } + + + + + function downAction(eventObject, timestamp){ + + downActionEventObject = eventObject; + + if(!eventObject.entity){ + return; + } + + if(controllerConfig.selectionMode === "DOWN"){ + handleOnClick(eventObject); + return; + } + + downActionEventObject = eventObject; + + // "progressBar.jqxProgressBar is not a function" + /*if(controllerConfig.selectionMode === "DURATION" && controllerConfig.showProgressBar){ + showProgressBar(eventObject); + }*/ + } + + function upAction(eventObject){ + + if(!downActionEventObject){ + return; + } + + if(controllerConfig.selectionMode === "UP"){ + handleOnClick(downActionEventObject); + return; + } + + /*if(controllerConfig.selectionMode === "DURATION" && controllerConfig.showProgressBar){ + hideProgressBar(); + }*/ + } + + function duringAction(eventObject, timestamp, timeSinceStart){ + + if(!downActionEventObject){ + return; + } + + if(controllerConfig.selectionMode !== "DURATION"){ + return; + } + + if(timeSinceStart > ( 1000 * controllerConfig.selectionDurationSeconds)){ + //hideProgressBar(); + handleOnClick(downActionEventObject); + downActionEventObject = null; + } + } + + function mouseMove(eventObject, timestamp){ + /*if(!downActionEventObject){ + return; + } + + if(!controllerConfig.selectionMoveAllowed){ + hideProgressBar(); + downActionEventObject = null; + }*/ + } + + + function handleOnClick(eventObject) { + if(eventObject.entity != null) { + var applicationEvent = { + sender: canvasMarkController, + entities: [eventObject.entity] + }; + + if (eventObject.entity.marked) { + events.marked.off.publish(applicationEvent); + } else { + events.marked.on.publish(applicationEvent); + } + + //center of rotation + /*if(controllerConfig.setCenterOfRotation){ + canvasManipulator.setCenterOfRotation(eventObject.entity); + }*/ + } + } + + + + + + function onEntityMarked(applicationEvent) { + var entity = applicationEvent.entities[0]; + if(entity == undefined) { + console.debug("no entity"); + return; + } + + if(entity.hovered){ + console.debug("Entity hovered"); + canvasManipulator.unhighlightEntities([entity]); + } + canvasManipulator.changeColorOfEntities([entity], controllerConfig.markingColor); + } + + function onEntityUnmarked(applicationEvent) { + var entity = applicationEvent.entities[0]; + canvasManipulator.resetColorOfEntities([entity]); + } + + + + function showProgressBar(eventObject){ + + var canvas = document.getElementById("canvas"); + + var progressBarDivElement = document.createElement("DIV"); + progressBarDivElement.id = "progressBarDiv"; + + canvas.appendChild(progressBarDivElement); + + var progressBar = $("#progressBarDiv"); + + progressBar.jqxProgressBar({ + width: 250, + height: 30, + value: 100, + animationDuration: controllerConfig.selectionDurationSeconds * 1000, + template: "success" + }); + + + progressBar.css("top", eventObject.layerY + 10 + "px"); + progressBar.css("left", eventObject.layerX + 10 + "px"); + + progressBar.css("z-index", "1"); + progressBar.css("position", "absolute"); + + progressBar.css("width", "250px"); + progressBar.css("height", "30px"); + + progressBar.css("display", "block"); + + } + + function hideProgressBar(){ + + var progressBarDivElement = document.getElementById("progressBarDiv"); + + if(!progressBarDivElement){ + return; + } + + var canvas = document.getElementById("canvas"); + canvas.removeChild(progressBarDivElement); + } + + + return { + initialize : initialize, + reset : reset, + activate : activate, + onEntityMarked : onEntityMarked, + onEntityUnmarked : onEntityUnmarked, + SELECTION_MODES : SELECTION_MODES + }; +})(); \ No newline at end of file diff --git a/ui/scripts/Search/SearchController.js b/ui/scripts/Search/SearchController.js index 846699d52..6ecda9939 100644 --- a/ui/scripts/Search/SearchController.js +++ b/ui/scripts/Search/SearchController.js @@ -68,8 +68,6 @@ var searchController = (function() { } function initializeSearch() { - - console.debug("SearchController.js: initializeSearch() - begin"); suggestions = new Bloodhound({ datumTokenizer: function(entity) { @@ -117,9 +115,6 @@ var searchController = (function() { $(jQsearchInputID).on("typeahead:closed", function(event, suggestion, dataset) { rootDivElement.parentElement.style.overflow = "hidden"; }); - - - console.debug("SearchController.js: initializeSearch() - end"); } function selectEntity(id) { diff --git a/ui/setups/test/blank.js b/ui/setups/test/blank.js index d4d5d8683..a81890f3a 100644 --- a/ui/setups/test/blank.js +++ b/ui/setups/test/blank.js @@ -5,10 +5,15 @@ var setup = { logActionConsole : false, logEventConsole : false }, + { name: "canvasMarkController", + selectionMode: "DURATION", //TODO Constants - UP - DOWN - DURATION + selectionDurationSeconds: 0.5, + selectionMoveAllowed: false, + showProgressBar: true, + }, { - name: "searchController", + name: "searchController" } - ], @@ -24,7 +29,7 @@ var setup = { size: "10%", collapsible: false, controllers: [ - { name: "searchController"}, + { name: "searchController"} ] }, second: { @@ -34,7 +39,8 @@ var setup = { canvas: {}, controllers: [ - { name: "defaultLogger" }, + { name: "canvasMarkController" }, + { name: "defaultLogger" } ], } } From f287bab98321a328dfef0180ec3008b9b27f6b02 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 30 Oct 2018 12:47:18 +0100 Subject: [PATCH 07/71] a-boxes don't get mouselistener-attribute --- ui/scripts/AframeActionController.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index b6b407149..ffaaba2d2 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -225,9 +225,6 @@ var actionController = (function () { }); canvas.setAttribute("mouselistener", ""); - canvas.querySelectorAll("a-box").forEach(function(box) { - box.setAttribute("mouselistener", ""); - }); } From 687c469b9a227f40af7d5d42cbb2f206077042e9 Mon Sep 17 00:00:00 2001 From: David Baum Date: Tue, 30 Oct 2018 17:21:27 +0100 Subject: [PATCH 08/71] improve aframe generation add ids, remove script tag, adopt a-entity and a-scene to ui requirements --- .../org.svis.app.analyzer.metrics/.classpath | 2 + generator/org.svis.generator.tests/.classpath | 2 + .../city/famix/aframe/bricks/model.html | 7162 +++++++++++------ .../city/famix/aframe/floors/model.html | 7162 +++++++++++------ .../city/famix/aframe/original/model.html | 259 +- .../city/famix/aframe/panels/model.html | 7162 +++++++++++------ .../src/org/svis/generator/X3DUtils.xtend | 31 +- .../svis/generator/city/m2t/City2AFrame.xtend | 18 +- .../org/svis/generator/rd/m2t/RD2AFrame.xtend | 28 +- 9 files changed, 14570 insertions(+), 7256 deletions(-) diff --git a/generator/org.svis.app.analyzer.metrics/.classpath b/generator/org.svis.app.analyzer.metrics/.classpath index 567c006e5..09b7d6130 100644 --- a/generator/org.svis.app.analyzer.metrics/.classpath +++ b/generator/org.svis.app.analyzer.metrics/.classpath @@ -16,12 +16,14 @@ + + diff --git a/generator/org.svis.generator.tests/.classpath b/generator/org.svis.generator.tests/.classpath index d79b43ad1..1729fd346 100644 --- a/generator/org.svis.generator.tests/.classpath +++ b/generator/org.svis.generator.tests/.classpath @@ -9,12 +9,14 @@ + + diff --git a/generator/org.svis.generator.tests/testdata/android_phone/output/city/famix/aframe/bricks/model.html b/generator/org.svis.generator.tests/testdata/android_phone/output/city/famix/aframe/bricks/model.html index bad3ee36e..a99bad384 100644 --- a/generator/org.svis.generator.tests/testdata/android_phone/output/city/famix/aframe/bricks/model.html +++ b/generator/org.svis.generator.tests/testdata/android_phone/output/city/famix/aframe/bricks/model.html @@ -3,15 +3,35 @@ Ring - - + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ring - - + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ring - - + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ring - - + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ring - - + - - - - + + + ''' def toAFrameTail() ''' diff --git a/generator/org.svis.generator/src/org/svis/generator/city/m2t/City2AFrame.xtend b/generator/org.svis.generator/src/org/svis/generator/city/m2t/City2AFrame.xtend index 91f07c70d..3511430c6 100644 --- a/generator/org.svis.generator/src/org/svis/generator/city/m2t/City2AFrame.xtend +++ b/generator/org.svis.generator/src/org/svis/generator/city/m2t/City2AFrame.xtend @@ -62,7 +62,8 @@ class City2AFrame { ''' def String toDistrict(Entity district) ''' - «ELSE» - disks,boolean withScale) ''' «FOR disk : disks» «toX3DOMDisk(disk,withScale)» - «IF(disk.diskVersions.size != 0 && !(config.evolutionRepresentation == EvolutionRepresentation::DYNAMIC_EVOLUTION))»«toDiskVersions(disk.diskVersions,heightMultiplier,offset)»«ENDIF» + «IF(disk.diskVersions.size != 0 && !(config.evolutionRepresentation == EvolutionRepresentation::DYNAMIC_EVOLUTION))»«/*toDiskVersions(disk.diskVersions,heightMultiplier,offset)*/»«ENDIF» «ENDFOR» ''' def private toX3DOMDisk(Disk disk, boolean withScale) ''' «IF disk.radius - config.RDRingWidth == 0» - «ELSE» - segments) ''' «FOR segment : segments» «IF segment.innerRadius == 0» - «ELSE» - invocations,List diskSegments) ''' + /*def String toDiskSegmentInvocation(List invocations,List diskSegments) ''' «FOR invocation : invocations» «val segment = diskSegments.findFirst[ds| ds.invocations.contains(invocation)] » diskVersions,int heightMultiplier,int offset) ''' + /*def private toDiskVersions(EList diskVersions,int heightMultiplier,int offset) ''' «FOR diskVersion : diskVersions.sortBy[v| v.level]» «IF (diskVersion.scale > 0) » 0) » @@ -261,5 +263,5 @@ class RD2AFrame { «ENDIF» - ''' + '''*/ } \ No newline at end of file From 574c59bacfed65055501876261575ad0e5ea3207 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Mon, 5 Nov 2018 13:38:20 +0100 Subject: [PATCH 09/71] Select-/FilterController for Aframe -AframeCanvas(-Filter/-Select)Controller working -filter functions can be used via PackageExplorerController -new setup file "aframe.js" will be used for further testing instead of "blank.js" and activates the new Controllers --- ui/aframe.html | 13 +- .../AframeCanvasFilterController.js | 160 ++++++++++++ .../AframeCanvasSelectController.js | 245 ++++++++++++++++++ ui/setups/test/aframe.js | 75 ++++++ ui/setups/test/blank.js | 8 + 5 files changed, 498 insertions(+), 3 deletions(-) create mode 100644 ui/scripts/CanvasFilter/AframeCanvasFilterController.js create mode 100644 ui/scripts/CanvasSelect/AframeCanvasSelectController.js create mode 100644 ui/setups/test/aframe.js diff --git a/ui/aframe.html b/ui/aframe.html index 5f7f21570..c272a73cc 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -48,11 +48,18 @@ - + + + + + + + + - + @@ -79,7 +86,7 @@ - + diff --git a/ui/scripts/CanvasFilter/AframeCanvasFilterController.js b/ui/scripts/CanvasFilter/AframeCanvasFilterController.js new file mode 100644 index 000000000..96175777b --- /dev/null +++ b/ui/scripts/CanvasFilter/AframeCanvasFilterController.js @@ -0,0 +1,160 @@ +var canvasFilterController = (function() { + + let issueFilterId = ""; + let changeFrequency = 0; + let issueFilter = "showAll"; + + function initialize(){ + } + + function activate(){ + events.filtered.on.subscribe(onEntityFilter); + events.tmpFiltered.on.subscribe(onEntityTmpFilter); + events.filtered.off.subscribe(onEntityUnfilter); + events.tmpFiltered.off.subscribe(onEntityTmpUnfilter); + events.versionSelected.on.subscribe(onVersionSelected); + events.versionSelected.off.subscribe(offVersionSelected); + events.config.filterSettings.subscribe(filterSettings); + } + + function applyIssueFilter(entities) { + if(issueFilter === "showAll") { + return entities; + } + if(issueFilter === "showOpen") { + const result = []; + entities.forEach(function(entity){ + let foundOpenIssues = false; + entity.issues.forEach(function(issueId) { + if(issueId !== "") { + const issue = model.getIssuesById(issueId); + if (issue.open) { + foundOpenIssues = true; + } + } + }); + if(foundOpenIssues) { + result.push(entity) + } + }); + return result; + } + if(issueFilter === "showOpenSecurity") { + const result = []; + entities.forEach(function(entity){ + let foundOpenIssues = false; + entity.issues.forEach(function(issueId) { + if(issueId !== "") { + const issue = model.getIssuesById(issueId); + if (issue.open && issue.security) { + foundOpenIssues = true; + } + } + }); + if(foundOpenIssues) { + result.push(entity) + } + }); + return result; + } + } + + function applyChangeFrequencyFilter(entities) { + if (changeFrequency === 0) { + return entities; + } else { + return entities.filter(entity => entity.changeFrequency >= changeFrequency); + } + } + + function applyIssueIdFilter(entities) { + if(issueFilterId === "") { + return entities; + } + return model.getEntitiesByIssue(issueFilterId); + } + + function filterSettings(applicationEvent) { + + const entities = model.getEntitiesByType("Class"); + if (applicationEvent.changeFrequency !== undefined) { + changeFrequency = applicationEvent.changeFrequency + } + if (applicationEvent.issuesFilter !== undefined) { + issueFilter = applicationEvent.issuesFilter + } + if (applicationEvent.issueFilterId !== undefined) { + issueFilterId = applicationEvent.issueFilterId; + } + let changeFrequencyEntities = applyChangeFrequencyFilter(entities); + let issueFilterEntities = applyIssueFilter(entities); + let issueIdEntities = applyIssueIdFilter(entities); + const fadeEntities = []; + const hideEntities = []; + entities.forEach(function(entity){ + if(changeFrequencyEntities.includes(entity) && issueFilterEntities.includes(entity) && issueIdEntities.includes(entity)){ + fadeEntities.push(entity); + } else { + hideEntities.push(entity); + } + }); + + if(hideEntities.length > 0) { + const hideEvent = { + sender: configurationController, + entities: hideEntities + }; + events.filtered.on.publish(hideEvent); + } + if(fadeEntities.length > 0) { + const fadeEvent = { + sender: configurationController, + entities: fadeEntities + }; + events.filtered.off.publish(fadeEvent); + } + + } + + function onEntityFilter(applicationEvent) { + const entities = applicationEvent.entities; + canvasManipulator.hideEntities(entities); + } + + function onEntityUnfilter(applicationEvent) { + const entities = applicationEvent.entities; + canvasManipulator.showEntities(entities); + } + + function onEntityTmpFilter(applicationEvent) { + const entities = applicationEvent.entities; + let stillTmpFiltered = []; + entities.forEach(function(entity){ + if(!entity.filter){ + stillTmpFiltered.push(entity); + } + }); + canvasManipulator.hideEntities(stillTmpFiltered); + + } + + function onEntityTmpUnfilter(applicationEvent) { + const entities = applicationEvent.entities; + canvasManipulator.showEntities(entities); + } + + function onVersionSelected(applicationEvent) { + const entities = model.getEntitiesByVersion(applicationEvent.entities[0]); + canvasManipulator.showEntities(entities); + } + + function offVersionSelected(applicationEvent) { + const entities = model.getEntitiesByVersion(applicationEvent.entities[0]); + canvasManipulator.hideEntities(entities); + } + + return { + initialize: initialize, + activate: activate + }; +})(); diff --git a/ui/scripts/CanvasSelect/AframeCanvasSelectController.js b/ui/scripts/CanvasSelect/AframeCanvasSelectController.js new file mode 100644 index 000000000..ba52b4961 --- /dev/null +++ b/ui/scripts/CanvasSelect/AframeCanvasSelectController.js @@ -0,0 +1,245 @@ +var canvasSelectController = (function() { + + var SELECTION_MODES = { + UP : "UP", + DOWN : "DOWN", + DURATION : "DURATION" + }; + + //config parameters + var controllerConfig = { + setCenterOfRotation : false, + color: "darkred", + selectionMouseKey: 1, + selectionMode: SELECTION_MODES.UP, + selectionDurationSeconds: 0.5, + selectionMoveAllowed: false, + showProgressBar: false, + }; + + var downActionEventObject; + + + + function initialize(setupConfig){ + + application.transferConfigParams(setupConfig, controllerConfig); + + } + + function activate(){ + + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].down.subscribe(downAction); + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].up.subscribe(upAction); + actionController.actions.mouse.key[controllerConfig.selectionMouseKey].during.subscribe(duringAction); + actionController.actions.mouse.move.subscribe(mouseMove); + + events.selected.on.subscribe(onEntitySelected); + events.selected.off.subscribe(onEntityUnselected); + events.componentSelected.on.subscribe(onComponentSelected); + events.antipattern.on.subscribe(onComponentSelected); + } + + function onComponentSelected(applicationEvent){ + console.log("executed") + var selectedEntities = events.selected.getEntities(); + selectedEntities.forEach(function(selectedEntity){ + + var unselectEvent = { + sender: canvasSelectController, + entities: [selectedEntity] + } + + events.selected.off.publish(unselectEvent); + }); + } + + function reset(){ + var selectedEntities = events.selected.getEntities(); + + selectedEntities.forEach(function(selectedEntity){ + var unselectEvent = { + sender: canvasSelectController, + entities: [selectedEntity] + }; + + events.selected.off.publish(unselectEvent); + }); + } + + function downAction(eventObject, timestamp){ + + downActionEventObject = null; + + if(!eventObject.entity){ + return; + } + + if(controllerConfig.selectionMode == "DOWN"){ + handleOnClick(eventObject); + return; + } + + downActionEventObject = eventObject; + + if(controllerConfig.selectionMode == "DURATION" && controllerConfig.showProgressBar){ + showProgressBar(eventObject); + } + } + + function upAction(eventObject){ + + if(!downActionEventObject){ + return; + } + + if(controllerConfig.selectionMode == "UP"){ + handleOnClick(downActionEventObject); + return; + } + + if(controllerConfig.selectionMode == "DURATION" && controllerConfig.showProgressBar){ + //hideProgressBar(); + } + } + + function duringAction(eventObject, timestamp, timeSinceStart){ + + if(!downActionEventObject){ + return; + } + + if(controllerConfig.selectionMode != "DURATION"){ + return; + } + + if(timeSinceStart > ( 1000 * controllerConfig.selectionDurationSeconds)){ + //hideProgressBar(); + handleOnClick(downActionEventObject); + downActionEventObject = null; + return; + } + } + + function mouseMove(eventObject, timestamp){ + if(!downActionEventObject){ + return; + } + + if(!controllerConfig.selectionMoveAllowed){ + //hideProgressBar(); + downActionEventObject = null; + } + } + + function handleOnClick(eventObject) { + + var applicationEvent = { + sender: canvasSelectController, + entities: [eventObject.entity] + }; + + events.selected.on.publish(applicationEvent); + } + + function onEntitySelected(applicationEvent) { + + var entity = applicationEvent.entities[0]; + + var selectedEntities = events.selected.getEntities(); + + //select same entity again -> nothing to do + if(selectedEntities.has(entity)){ + return; + } + + if(entity.type == "text"){ + return; + } + + if(entity.type == "Namespace"){ + return; + } + + //unhighlight old selected entities for single select + if(selectedEntities.size != 0){ + + selectedEntities.forEach(function(selectedEntity){ + + var unselectEvent = { + sender: canvasSelectController, + entities: [selectedEntity] + } + + events.selected.off.publish(unselectEvent); + }); + } + + //higlight new selected entity + canvasManipulator.changeColorOfEntities([entity], controllerConfig.color); + + //center of rotation + if(controllerConfig.setCenterOfRotation){ + canvasManipulator.setCenterOfRotation(entity); + } + } + + function onEntityUnselected(applicationEvent){ + var entity = applicationEvent.entities[0]; + canvasManipulator.resetColorOfEntities([entity]); + } + + function showProgressBar(eventObject){ + + var canvas = document.getElementById("canvas"); + + var progressBarDivElement = document.createElement("DIV"); + progressBarDivElement.id = "progressBarDiv"; + + canvas.appendChild(progressBarDivElement); + + var progressBar = $("#progressBarDiv"); + + progressBar.jqxProgressBar({ + width: 250, + height: 30, + value: 100, + animationDuration: controllerConfig.selectionDurationSeconds * 1000, + template: "danger" + }); + + + progressBar.css("top", eventObject.layerY + 10 + "px"); + progressBar.css("left", eventObject.layerX + 10 + "px"); + + progressBar.css("z-index", "1"); + progressBar.css("position", "absolute"); + + progressBar.css("width", "250px"); + progressBar.css("height", "30px"); + + progressBar.css("display", "block"); + + } + + function hideProgressBar(){ + + var progressBarDivElement = document.getElementById("progressBarDiv"); + + if(!progressBarDivElement){ + return; + } + + var canvas = document.getElementById("canvas"); + canvas.removeChild(progressBarDivElement); + } + + + return { + initialize : initialize, + reset : reset, + activate : activate, + SELECTION_MODES : SELECTION_MODES + }; +})(); + diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js new file mode 100644 index 000000000..13e76e15b --- /dev/null +++ b/ui/setups/test/aframe.js @@ -0,0 +1,75 @@ +var setup = { + + controllers: [ + { name: "defaultLogger", + logActionConsole : false, + logEventConsole : false + }, + { name: "canvasMarkController", + selectionMode: "DURATION", //TODO Constants - UP - DOWN - DURATION + selectionDurationSeconds: 0.5, + selectionMoveAllowed: false, + showProgressBar: true, + }, + { + name: "canvasSelectController" + }, + { + name: "canvasFilterController" + }, + { + name: "packageExplorerController" + }, + { + name: "searchController" + } + ], + + + uis: [ + + + { name: "UI0", + area: { + name: "top", + orientation: "horizontal", + resizable: false, + first: { + size: "10%", + collapsible: false, + controllers: [ + { name: "searchController" } + ] + }, + second: { + area: { + name: "main", + orientation: "vertical", + first: { + size: "20%", + controllers: [ + { name: "packageExplorerController" } + ] + }, + second: { + size: "80%", + collapsible: false, + + canvas: {}, + + controllers: [ + { name: "canvasMarkController" }, + { name: "canvasSelectController"}, + { name: "canvasFilterController"}, + { name: "defaultLogger" } + ] + } + } + + } + } + + } + + ] +}; \ No newline at end of file diff --git a/ui/setups/test/blank.js b/ui/setups/test/blank.js index a81890f3a..f063fe045 100644 --- a/ui/setups/test/blank.js +++ b/ui/setups/test/blank.js @@ -11,6 +11,12 @@ var setup = { selectionMoveAllowed: false, showProgressBar: true, }, + { + name: "canvasSelectController" + }, + { + name: "canvasFilterController" + }, { name: "searchController" } @@ -40,6 +46,8 @@ var setup = { controllers: [ { name: "canvasMarkController" }, + { name: "canvasSelectController"}, + { name: "canvasFilterController"}, { name: "defaultLogger" } ], } From ab7f1ca7419ee560c3a039df199cb23add9a66a3 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Wed, 7 Nov 2018 13:18:42 +0100 Subject: [PATCH 10/71] Removed unused Aframe Controller also: - fixed a bug where multiple hoverEvents were emitted - aframe.js updated - jqxProgressbar added to aframe.html --- ui/aframe.html | 9 +- ui/scripts/AframeActionController.js | 9 +- .../AframeCanvasFilterController.js | 160 ------------ .../AframeCanvasHoverController.js | 225 ---------------- .../CanvasMark/AframeCanvasMarkController.js | 214 --------------- .../AframeCanvasSelectController.js | 245 ------------------ ui/setups/test/aframe.js | 6 +- 7 files changed, 17 insertions(+), 851 deletions(-) delete mode 100644 ui/scripts/CanvasFilter/AframeCanvasFilterController.js delete mode 100644 ui/scripts/CanvasHover/AframeCanvasHoverController.js delete mode 100644 ui/scripts/CanvasMark/AframeCanvasMarkController.js delete mode 100644 ui/scripts/CanvasSelect/AframeCanvasSelectController.js diff --git a/ui/aframe.html b/ui/aframe.html index c272a73cc..ccfbbfc48 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -44,6 +44,7 @@ + @@ -55,11 +56,11 @@ - - + + - - + + diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index ffaaba2d2..f6040766f 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -136,7 +136,9 @@ var actionController = (function () { if (component != null) { hoveredEntity = component; } - hoverAction(actions.mouse, eventObject); + if(eventObject.target.id != canvasId) { + hoverAction(actions.mouse, eventObject); + } if (actions.mouse.bubbles) { return true; @@ -147,7 +149,10 @@ var actionController = (function () { return false; }); this.el.addEventListener("mouseleave", function (eventObject) { - unhoverAction(actions.mouse, eventObject); + if(eventObject.target.id != canvasId) { + unhoverAction(actions.mouse, eventObject); + } + hoveredEntity = canvas; if (actions.mouse.bubbles) { return true; diff --git a/ui/scripts/CanvasFilter/AframeCanvasFilterController.js b/ui/scripts/CanvasFilter/AframeCanvasFilterController.js deleted file mode 100644 index 96175777b..000000000 --- a/ui/scripts/CanvasFilter/AframeCanvasFilterController.js +++ /dev/null @@ -1,160 +0,0 @@ -var canvasFilterController = (function() { - - let issueFilterId = ""; - let changeFrequency = 0; - let issueFilter = "showAll"; - - function initialize(){ - } - - function activate(){ - events.filtered.on.subscribe(onEntityFilter); - events.tmpFiltered.on.subscribe(onEntityTmpFilter); - events.filtered.off.subscribe(onEntityUnfilter); - events.tmpFiltered.off.subscribe(onEntityTmpUnfilter); - events.versionSelected.on.subscribe(onVersionSelected); - events.versionSelected.off.subscribe(offVersionSelected); - events.config.filterSettings.subscribe(filterSettings); - } - - function applyIssueFilter(entities) { - if(issueFilter === "showAll") { - return entities; - } - if(issueFilter === "showOpen") { - const result = []; - entities.forEach(function(entity){ - let foundOpenIssues = false; - entity.issues.forEach(function(issueId) { - if(issueId !== "") { - const issue = model.getIssuesById(issueId); - if (issue.open) { - foundOpenIssues = true; - } - } - }); - if(foundOpenIssues) { - result.push(entity) - } - }); - return result; - } - if(issueFilter === "showOpenSecurity") { - const result = []; - entities.forEach(function(entity){ - let foundOpenIssues = false; - entity.issues.forEach(function(issueId) { - if(issueId !== "") { - const issue = model.getIssuesById(issueId); - if (issue.open && issue.security) { - foundOpenIssues = true; - } - } - }); - if(foundOpenIssues) { - result.push(entity) - } - }); - return result; - } - } - - function applyChangeFrequencyFilter(entities) { - if (changeFrequency === 0) { - return entities; - } else { - return entities.filter(entity => entity.changeFrequency >= changeFrequency); - } - } - - function applyIssueIdFilter(entities) { - if(issueFilterId === "") { - return entities; - } - return model.getEntitiesByIssue(issueFilterId); - } - - function filterSettings(applicationEvent) { - - const entities = model.getEntitiesByType("Class"); - if (applicationEvent.changeFrequency !== undefined) { - changeFrequency = applicationEvent.changeFrequency - } - if (applicationEvent.issuesFilter !== undefined) { - issueFilter = applicationEvent.issuesFilter - } - if (applicationEvent.issueFilterId !== undefined) { - issueFilterId = applicationEvent.issueFilterId; - } - let changeFrequencyEntities = applyChangeFrequencyFilter(entities); - let issueFilterEntities = applyIssueFilter(entities); - let issueIdEntities = applyIssueIdFilter(entities); - const fadeEntities = []; - const hideEntities = []; - entities.forEach(function(entity){ - if(changeFrequencyEntities.includes(entity) && issueFilterEntities.includes(entity) && issueIdEntities.includes(entity)){ - fadeEntities.push(entity); - } else { - hideEntities.push(entity); - } - }); - - if(hideEntities.length > 0) { - const hideEvent = { - sender: configurationController, - entities: hideEntities - }; - events.filtered.on.publish(hideEvent); - } - if(fadeEntities.length > 0) { - const fadeEvent = { - sender: configurationController, - entities: fadeEntities - }; - events.filtered.off.publish(fadeEvent); - } - - } - - function onEntityFilter(applicationEvent) { - const entities = applicationEvent.entities; - canvasManipulator.hideEntities(entities); - } - - function onEntityUnfilter(applicationEvent) { - const entities = applicationEvent.entities; - canvasManipulator.showEntities(entities); - } - - function onEntityTmpFilter(applicationEvent) { - const entities = applicationEvent.entities; - let stillTmpFiltered = []; - entities.forEach(function(entity){ - if(!entity.filter){ - stillTmpFiltered.push(entity); - } - }); - canvasManipulator.hideEntities(stillTmpFiltered); - - } - - function onEntityTmpUnfilter(applicationEvent) { - const entities = applicationEvent.entities; - canvasManipulator.showEntities(entities); - } - - function onVersionSelected(applicationEvent) { - const entities = model.getEntitiesByVersion(applicationEvent.entities[0]); - canvasManipulator.showEntities(entities); - } - - function offVersionSelected(applicationEvent) { - const entities = model.getEntitiesByVersion(applicationEvent.entities[0]); - canvasManipulator.hideEntities(entities); - } - - return { - initialize: initialize, - activate: activate - }; -})(); diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js deleted file mode 100644 index d3170174f..000000000 --- a/ui/scripts/CanvasHover/AframeCanvasHoverController.js +++ /dev/null @@ -1,225 +0,0 @@ -var canvasHoverController = (function() { - - var isInNavigation = false; - - function initialize(setupConfig){ - application.transferConfigParams(setupConfig, controllerConfig); - var cssLink = document.createElement("link"); - cssLink.type = "text/css"; - cssLink.rel = "stylesheet"; - cssLink.href = "scripts/CanvasHover/ho.css"; - document.getElementsByTagName("head")[0].appendChild(cssLink); - } - - //config parameters - var controllerConfig = { - hoverColor: "darkred", - showQualifiedName : false, - showVersion : false, - showIssues : false - }; - - function activate(){ - //createTooltipContainer(); - - events.hovered.on.subscribe(onEntityHover); - events.hovered.off.subscribe(onEntityUnhover); - } - - function reset(){ - var hoveredEntities = events.hovered.getEntities(); - - hoveredEntities.forEach(function(hoveredEntity){ - var unHoverEvent = { - sender: canvasHoverController, - entities: [hoveredEntity] - }; - - events.hovered.off.publish(unHoverEvent); - }); - } - - function createTooltipContainer(){ - - var canvas = document.getElementById("canvas"); - - var tooltipDivElement = document.createElement("DIV"); - tooltipDivElement.id = "tooltip"; - - var namePElement = document.createElement("P"); - namePElement.id = "tooltipName"; - tooltipDivElement.appendChild(namePElement); - - if(controllerConfig.showQualifiedName) { - var qualifiedNamePElement = document.createElement("P"); - qualifiedNamePElement.id = "tooltipQualifiedName"; - tooltipDivElement.appendChild(qualifiedNamePElement); - } - - if(controllerConfig.showVersion) { - var versionPElement = document.createElement("P"); - versionPElement.id = "tooltipVersion"; - tooltipDivElement.appendChild(versionPElement); - } - if(controllerConfig.showIssues) { - var openIssuesPElement = document.createElement("P"); - openIssuesPElement.id = "tooltipOpenIssues"; - tooltipDivElement.appendChild((openIssuesPElement)); - - var closedIssuesPElement = document.createElement("P"); - closedIssuesPElement.id = "tooltipClosedIssues"; - tooltipDivElement.appendChild((closedIssuesPElement)); - - var openSecurityIssuesPElement = document.createElement("P"); - openSecurityIssuesPElement.id = "tooltipOpenSecurityIssues"; - tooltipDivElement.appendChild((openSecurityIssuesPElement)); - - var closedSecurityIssuesPElement = document.createElement("P"); - closedSecurityIssuesPElement.id = "tooltipClosedSecurityIssues"; - tooltipDivElement.appendChild((closedSecurityIssuesPElement)); - } - canvas.appendChild(tooltipDivElement); - } - - function handleOnMousedown(canvasEvent) { - isInNavigation = true; - } - - function handleOnMouseup(canvasEvent) { - isInNavigation = false; - } - - function handleOnMouseEnter(multipartEvent) { - if(isInNavigation){ - return; - } - - var entity = model.getEntityById(multipartEvent.partID); - if(entity === undefined){ - entity = multipartEvent.target.id; - console.log("entity: " + entity); - events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); - return; - } - - var applicationEvent = { - sender : canvasHoverController, - entities : [entity], - posX : multipartEvent.layerX, - posY : multipartEvent.layerY - }; - - events.hovered.on.publish(applicationEvent); - } - - function handleOnMouseLeave(multipartEvent) { - - var entity = model.getEntityById(multipartEvent.partID); - if(entity === undefined){ - events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); - return; - } - - var applicationEvent = { - sender : canvasHoverController, - entities : [entity] - }; - - events.hovered.off.publish(applicationEvent); - } - - function onEntityHover(applicationEvent) { - console.debug("onEntityHover()"); - var entity = applicationEvent.entities[0]; - - if(entity === undefined){ - events.log.error.publish({ text: "Entity is not defined"}); - } - - if(entity.isTransparent === true) { - return; - } - - if(entity.type === "text"){ - return; - } - - if(entity.marked && entity.selected){ - canvasManipulator.unhighlightEntities([entity]); - } else { - canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); - } - - $("#tooltipName").text(getTooltipName(entity)); - if(controllerConfig.showQualifiedName) { - $("#tooltipQualifiedName").text(entity.qualifiedName); - } - if(controllerConfig.showVersion) { - $("#tooltipVersion").text("Version: " + entity.version); - } - if(controllerConfig.showIssues) { - let openIssuesSelector = $('#tooltipOpenIssues'); - let closedIssuesSelector = $('#tooltipClosedIssues'); - let openSecurityIssuesSelector = $('#tooltipOpenSecurityIssues'); - let closedSecurityIssuesSelector = $('#tooltipClosedSecurityIssues'); - if (entity.type === "Namespace") { - openIssuesSelector.css("display", "none"); - closedIssuesSelector.css("display", "none"); - openSecurityIssuesSelector.css("display", "none"); - closedSecurityIssuesSelector.css("display", "none"); - } else { - openIssuesSelector.text("Open Issues: " + entity.numberOfOpenIssues); - closedIssuesSelector.text("Closed Issues: " + entity.numberOfClosedIssues); - openSecurityIssuesSelector.text("Open Security Issues: " + entity.numberOfOpenSecurityIssues); - closedSecurityIssuesSelector.text("Closed Security Issues: " + entity.numberOfClosedSecurityIssues); - openIssuesSelector.css("display", "block"); - closedIssuesSelector.css("display", "block"); - openSecurityIssuesSelector.css("display", "block"); - closedSecurityIssuesSelector.css("display", "block"); - } - } - - var tooltip = $("#tooltip"); - tooltip.css("top", applicationEvent.posY + 50 + "px"); - tooltip.css("left", applicationEvent.posX + 50 + "px"); - tooltip.css("display", "block"); - } - - function onEntityUnhover(applicationEvent) { - var entity = applicationEvent.entities[0]; - - if(entity.marked && entity.selected){ - canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); - } else { - if(!entity.selected){ - canvasManipulator.unhighlightEntities([entity]); - } - if(entity.type === "Namespace"){ - canvasManipulator.unhighlightEntities([entity]); - } - } - - $("#tooltip").css("display", "none"); - - } - - function getTooltipName(entity) { - if(entity.type === "Method") { - return entity.type + ": " + entity.signature; - } - - if (entity.type === "Namespace") { - return "Package: " + entity.name; - } - - return entity.type + ": " + entity.name; - } - - return { - initialize: initialize, - activate: activate, - reset: reset, - handleOnMouseEnter: handleOnMouseEnter, - handleOnMouseLeave: handleOnMouseLeave - }; -})(); diff --git a/ui/scripts/CanvasMark/AframeCanvasMarkController.js b/ui/scripts/CanvasMark/AframeCanvasMarkController.js deleted file mode 100644 index 9da0efd10..000000000 --- a/ui/scripts/CanvasMark/AframeCanvasMarkController.js +++ /dev/null @@ -1,214 +0,0 @@ -var canvasMarkController = (function() { - - - var SELECTION_MODES = { - UP: "UP", - DOWN: "DOWN", - DURATION: "DURATION" - }; - - //config parameters - var controllerConfig = { - setCenterOfRotation : false, - markingColor: "orange", - selectionMouseKey: 1, - selectionMode: "UP", - selectionDurationSeconds: 0.5, - selectionMoveAllowed: false, - showProgressBar: false - }; - - var downActionEventObject; - - function initialize(setupConfig){ - - application.transferConfigParams(setupConfig, controllerConfig); - - } - - function activate(){ - - actionController.actions.mouse.key[controllerConfig.selectionMouseKey].down.subscribe(downAction); - actionController.actions.mouse.key[controllerConfig.selectionMouseKey].up.subscribe(upAction); - actionController.actions.mouse.key[controllerConfig.selectionMouseKey].during.subscribe(duringAction); - actionController.actions.mouse.move.subscribe(mouseMove); - - events.marked.on.subscribe(onEntityMarked); - events.marked.off.subscribe(onEntityUnmarked); - } - - function reset(){ - var markedEntities = events.marked.getEntities(); - - canvasManipulator.resetColorOfEntities(markedEntities); - } - - - - - function downAction(eventObject, timestamp){ - - downActionEventObject = eventObject; - - if(!eventObject.entity){ - return; - } - - if(controllerConfig.selectionMode === "DOWN"){ - handleOnClick(eventObject); - return; - } - - downActionEventObject = eventObject; - - // "progressBar.jqxProgressBar is not a function" - /*if(controllerConfig.selectionMode === "DURATION" && controllerConfig.showProgressBar){ - showProgressBar(eventObject); - }*/ - } - - function upAction(eventObject){ - - if(!downActionEventObject){ - return; - } - - if(controllerConfig.selectionMode === "UP"){ - handleOnClick(downActionEventObject); - return; - } - - /*if(controllerConfig.selectionMode === "DURATION" && controllerConfig.showProgressBar){ - hideProgressBar(); - }*/ - } - - function duringAction(eventObject, timestamp, timeSinceStart){ - - if(!downActionEventObject){ - return; - } - - if(controllerConfig.selectionMode !== "DURATION"){ - return; - } - - if(timeSinceStart > ( 1000 * controllerConfig.selectionDurationSeconds)){ - //hideProgressBar(); - handleOnClick(downActionEventObject); - downActionEventObject = null; - } - } - - function mouseMove(eventObject, timestamp){ - /*if(!downActionEventObject){ - return; - } - - if(!controllerConfig.selectionMoveAllowed){ - hideProgressBar(); - downActionEventObject = null; - }*/ - } - - - function handleOnClick(eventObject) { - if(eventObject.entity != null) { - var applicationEvent = { - sender: canvasMarkController, - entities: [eventObject.entity] - }; - - if (eventObject.entity.marked) { - events.marked.off.publish(applicationEvent); - } else { - events.marked.on.publish(applicationEvent); - } - - //center of rotation - /*if(controllerConfig.setCenterOfRotation){ - canvasManipulator.setCenterOfRotation(eventObject.entity); - }*/ - } - } - - - - - - function onEntityMarked(applicationEvent) { - var entity = applicationEvent.entities[0]; - if(entity == undefined) { - console.debug("no entity"); - return; - } - - if(entity.hovered){ - console.debug("Entity hovered"); - canvasManipulator.unhighlightEntities([entity]); - } - canvasManipulator.changeColorOfEntities([entity], controllerConfig.markingColor); - } - - function onEntityUnmarked(applicationEvent) { - var entity = applicationEvent.entities[0]; - canvasManipulator.resetColorOfEntities([entity]); - } - - - - function showProgressBar(eventObject){ - - var canvas = document.getElementById("canvas"); - - var progressBarDivElement = document.createElement("DIV"); - progressBarDivElement.id = "progressBarDiv"; - - canvas.appendChild(progressBarDivElement); - - var progressBar = $("#progressBarDiv"); - - progressBar.jqxProgressBar({ - width: 250, - height: 30, - value: 100, - animationDuration: controllerConfig.selectionDurationSeconds * 1000, - template: "success" - }); - - - progressBar.css("top", eventObject.layerY + 10 + "px"); - progressBar.css("left", eventObject.layerX + 10 + "px"); - - progressBar.css("z-index", "1"); - progressBar.css("position", "absolute"); - - progressBar.css("width", "250px"); - progressBar.css("height", "30px"); - - progressBar.css("display", "block"); - - } - - function hideProgressBar(){ - - var progressBarDivElement = document.getElementById("progressBarDiv"); - - if(!progressBarDivElement){ - return; - } - - var canvas = document.getElementById("canvas"); - canvas.removeChild(progressBarDivElement); - } - - - return { - initialize : initialize, - reset : reset, - activate : activate, - onEntityMarked : onEntityMarked, - onEntityUnmarked : onEntityUnmarked, - SELECTION_MODES : SELECTION_MODES - }; -})(); \ No newline at end of file diff --git a/ui/scripts/CanvasSelect/AframeCanvasSelectController.js b/ui/scripts/CanvasSelect/AframeCanvasSelectController.js deleted file mode 100644 index ba52b4961..000000000 --- a/ui/scripts/CanvasSelect/AframeCanvasSelectController.js +++ /dev/null @@ -1,245 +0,0 @@ -var canvasSelectController = (function() { - - var SELECTION_MODES = { - UP : "UP", - DOWN : "DOWN", - DURATION : "DURATION" - }; - - //config parameters - var controllerConfig = { - setCenterOfRotation : false, - color: "darkred", - selectionMouseKey: 1, - selectionMode: SELECTION_MODES.UP, - selectionDurationSeconds: 0.5, - selectionMoveAllowed: false, - showProgressBar: false, - }; - - var downActionEventObject; - - - - function initialize(setupConfig){ - - application.transferConfigParams(setupConfig, controllerConfig); - - } - - function activate(){ - - actionController.actions.mouse.key[controllerConfig.selectionMouseKey].down.subscribe(downAction); - actionController.actions.mouse.key[controllerConfig.selectionMouseKey].up.subscribe(upAction); - actionController.actions.mouse.key[controllerConfig.selectionMouseKey].during.subscribe(duringAction); - actionController.actions.mouse.move.subscribe(mouseMove); - - events.selected.on.subscribe(onEntitySelected); - events.selected.off.subscribe(onEntityUnselected); - events.componentSelected.on.subscribe(onComponentSelected); - events.antipattern.on.subscribe(onComponentSelected); - } - - function onComponentSelected(applicationEvent){ - console.log("executed") - var selectedEntities = events.selected.getEntities(); - selectedEntities.forEach(function(selectedEntity){ - - var unselectEvent = { - sender: canvasSelectController, - entities: [selectedEntity] - } - - events.selected.off.publish(unselectEvent); - }); - } - - function reset(){ - var selectedEntities = events.selected.getEntities(); - - selectedEntities.forEach(function(selectedEntity){ - var unselectEvent = { - sender: canvasSelectController, - entities: [selectedEntity] - }; - - events.selected.off.publish(unselectEvent); - }); - } - - function downAction(eventObject, timestamp){ - - downActionEventObject = null; - - if(!eventObject.entity){ - return; - } - - if(controllerConfig.selectionMode == "DOWN"){ - handleOnClick(eventObject); - return; - } - - downActionEventObject = eventObject; - - if(controllerConfig.selectionMode == "DURATION" && controllerConfig.showProgressBar){ - showProgressBar(eventObject); - } - } - - function upAction(eventObject){ - - if(!downActionEventObject){ - return; - } - - if(controllerConfig.selectionMode == "UP"){ - handleOnClick(downActionEventObject); - return; - } - - if(controllerConfig.selectionMode == "DURATION" && controllerConfig.showProgressBar){ - //hideProgressBar(); - } - } - - function duringAction(eventObject, timestamp, timeSinceStart){ - - if(!downActionEventObject){ - return; - } - - if(controllerConfig.selectionMode != "DURATION"){ - return; - } - - if(timeSinceStart > ( 1000 * controllerConfig.selectionDurationSeconds)){ - //hideProgressBar(); - handleOnClick(downActionEventObject); - downActionEventObject = null; - return; - } - } - - function mouseMove(eventObject, timestamp){ - if(!downActionEventObject){ - return; - } - - if(!controllerConfig.selectionMoveAllowed){ - //hideProgressBar(); - downActionEventObject = null; - } - } - - function handleOnClick(eventObject) { - - var applicationEvent = { - sender: canvasSelectController, - entities: [eventObject.entity] - }; - - events.selected.on.publish(applicationEvent); - } - - function onEntitySelected(applicationEvent) { - - var entity = applicationEvent.entities[0]; - - var selectedEntities = events.selected.getEntities(); - - //select same entity again -> nothing to do - if(selectedEntities.has(entity)){ - return; - } - - if(entity.type == "text"){ - return; - } - - if(entity.type == "Namespace"){ - return; - } - - //unhighlight old selected entities for single select - if(selectedEntities.size != 0){ - - selectedEntities.forEach(function(selectedEntity){ - - var unselectEvent = { - sender: canvasSelectController, - entities: [selectedEntity] - } - - events.selected.off.publish(unselectEvent); - }); - } - - //higlight new selected entity - canvasManipulator.changeColorOfEntities([entity], controllerConfig.color); - - //center of rotation - if(controllerConfig.setCenterOfRotation){ - canvasManipulator.setCenterOfRotation(entity); - } - } - - function onEntityUnselected(applicationEvent){ - var entity = applicationEvent.entities[0]; - canvasManipulator.resetColorOfEntities([entity]); - } - - function showProgressBar(eventObject){ - - var canvas = document.getElementById("canvas"); - - var progressBarDivElement = document.createElement("DIV"); - progressBarDivElement.id = "progressBarDiv"; - - canvas.appendChild(progressBarDivElement); - - var progressBar = $("#progressBarDiv"); - - progressBar.jqxProgressBar({ - width: 250, - height: 30, - value: 100, - animationDuration: controllerConfig.selectionDurationSeconds * 1000, - template: "danger" - }); - - - progressBar.css("top", eventObject.layerY + 10 + "px"); - progressBar.css("left", eventObject.layerX + 10 + "px"); - - progressBar.css("z-index", "1"); - progressBar.css("position", "absolute"); - - progressBar.css("width", "250px"); - progressBar.css("height", "30px"); - - progressBar.css("display", "block"); - - } - - function hideProgressBar(){ - - var progressBarDivElement = document.getElementById("progressBarDiv"); - - if(!progressBarDivElement){ - return; - } - - var canvas = document.getElementById("canvas"); - canvas.removeChild(progressBarDivElement); - } - - - return { - initialize : initialize, - reset : reset, - activate : activate, - SELECTION_MODES : SELECTION_MODES - }; -})(); - diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 13e76e15b..984115b71 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -14,6 +14,9 @@ var setup = { { name: "canvasSelectController" }, + { + name: "canvasHoverController" + }, { name: "canvasFilterController" }, @@ -59,8 +62,9 @@ var setup = { controllers: [ { name: "canvasMarkController" }, - { name: "canvasSelectController"}, { name: "canvasFilterController"}, + { name: "canvasSelectController"}, + { name: "canvasHoverController"}, { name: "defaultLogger" } ] } From ee20af5fbe32d40dd27e6848bf3ca05ac46d24ce Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Wed, 7 Nov 2018 15:43:08 +0100 Subject: [PATCH 11/71] AframeCanvasHoverController.js created - added to aframe.html also: (un-)highlightEntity created for aframe --- ui/aframe.html | 2 +- ui/scripts/AframeCanvasManipulator.js | 27 +- .../AframeCanvasHoverController.js | 233 ++++++++++++++++++ 3 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 ui/scripts/CanvasHover/AframeCanvasHoverController.js diff --git a/ui/aframe.html b/ui/aframe.html index ccfbbfc48..a58e12115 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -59,7 +59,7 @@ - + diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index 68d8463e7..c967120ef 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -103,6 +103,28 @@ var canvasManipulator = (function () { }); } + function highlightEntities(entities, color) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - highlightEntities - components for entityIds not found"}); + return; + } + setColor(component, color); + }); + } + + function unhighlightEntities(entities) { + entities.forEach(function (entity) { + let component = document.getElementById(entity.id); + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - unhighlightEntities - components for entityIds not found"}); + return; + } + setColor(component, component.getAttribute("color")); + }); + } + // after clicking an entity fit the camera to show this entity (angle stays the same) // not working function flyToEntity(entity) { @@ -168,7 +190,7 @@ var canvasManipulator = (function () { // working function setColor(object, color) { - object.setAttribute('material', { + object.setAttribute("material", { color: color }); } @@ -198,6 +220,9 @@ var canvasManipulator = (function () { hideEntities: hideEntities, showEntities: showEntities, + highlightEntities: highlightEntities, + unhighlightEntities: unhighlightEntities, + flyToEntity: flyToEntity, addElement: addElement, diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js new file mode 100644 index 000000000..222d77dea --- /dev/null +++ b/ui/scripts/CanvasHover/AframeCanvasHoverController.js @@ -0,0 +1,233 @@ +var canvasHoverController = (function() { + + var isInNavigation = false; + + function initialize(setupConfig){ + application.transferConfigParams(setupConfig, controllerConfig); + var cssLink = document.createElement("link"); + cssLink.type = "text/css"; + cssLink.rel = "stylesheet"; + cssLink.href = "scripts/CanvasHover/ho.css"; + document.getElementsByTagName("head")[0].appendChild(cssLink); + } + + //config parameters + var controllerConfig = { + hoverColor: "darkred", + showQualifiedName : false, + showVersion : false, + showIssues : false + }; + + function activate(){ + + actionController.actions.mouse.hover.subscribe(handleOnMouseEnter); + actionController.actions.mouse.unhover.subscribe(handleOnMouseLeave); + + var canvas = document.getElementById("x3dom-x3dElement-canvas"); + canvas.addEventListener("mousedown", handleOnMousedown, false); + canvas.addEventListener("mouseup", handleOnMouseup, false); + + createTooltipContainer(); + + events.hovered.on.subscribe(onEntityHover); + events.hovered.off.subscribe(onEntityUnhover); + } + + function reset(){ + var hoveredEntities = events.hovered.getEntities(); + + hoveredEntities.forEach(function(hoveredEntity){ + var unHoverEvent = { + sender: canvasHoverController, + entities: [hoveredEntity] + }; + + events.hovered.off.publish(unHoverEvent); + }); + } + + function createTooltipContainer(){ + + var canvas = document.getElementById("canvas"); + + var tooltipDivElement = document.createElement("DIV"); + tooltipDivElement.id = "tooltip"; + + var namePElement = document.createElement("P"); + namePElement.id = "tooltipName"; + tooltipDivElement.appendChild(namePElement); + + if(controllerConfig.showQualifiedName) { + var qualifiedNamePElement = document.createElement("P"); + qualifiedNamePElement.id = "tooltipQualifiedName"; + tooltipDivElement.appendChild(qualifiedNamePElement); + } + + if(controllerConfig.showVersion) { + var versionPElement = document.createElement("P"); + versionPElement.id = "tooltipVersion"; + tooltipDivElement.appendChild(versionPElement); + } + if(controllerConfig.showIssues) { + var openIssuesPElement = document.createElement("P"); + openIssuesPElement.id = "tooltipOpenIssues"; + tooltipDivElement.appendChild((openIssuesPElement)); + + var closedIssuesPElement = document.createElement("P"); + closedIssuesPElement.id = "tooltipClosedIssues"; + tooltipDivElement.appendChild((closedIssuesPElement)); + + var openSecurityIssuesPElement = document.createElement("P"); + openSecurityIssuesPElement.id = "tooltipOpenSecurityIssues"; + tooltipDivElement.appendChild((openSecurityIssuesPElement)); + + var closedSecurityIssuesPElement = document.createElement("P"); + closedSecurityIssuesPElement.id = "tooltipClosedSecurityIssues"; + tooltipDivElement.appendChild((closedSecurityIssuesPElement)); + } + canvas.appendChild(tooltipDivElement); + } + + function handleOnMousedown(canvasEvent) { + isInNavigation = true; + } + + function handleOnMouseup(canvasEvent) { + isInNavigation = false; + } + + function handleOnMouseEnter(eventObject) { + console.debug(eventObject); + if(isInNavigation){ + return; + } + + var entity = model.getEntityById(eventObject.target.id); + if(entity === undefined){ + entity = eventObject.target.id; + events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + return; + } + + var applicationEvent = { + sender : canvasHoverController, + entities : [entity], + /*posX : multipartEvent.layerX, + posY : multipartEvent.layerY*/ + }; + + events.hovered.on.publish(applicationEvent); + } + + function handleOnMouseLeave(eventObject) { + + var entity = model.getEntityById(eventObject.target.id); + if(entity === undefined){ + events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + return; + } + + var applicationEvent = { + sender : canvasHoverController, + entities : [entity] + }; + + events.hovered.off.publish(applicationEvent); + } + + function onEntityHover(applicationEvent) { + console.debug("onEntityHover"); + var entity = applicationEvent.entities[0]; + + if(entity === undefined){ + events.log.error.publish({ text: "Entity is not defined"}); + } + + if(entity.isTransparent === true) { + return; + } + + if(entity.type === "text"){ + return; + } + + if(entity.marked && entity.selected){ + canvasManipulator.unhighlightEntities([entity]); + } else { + canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); + } + + $("#tooltipName").text(getTooltipName(entity)); + if(controllerConfig.showQualifiedName) { + $("#tooltipQualifiedName").text(entity.qualifiedName); + } + if(controllerConfig.showVersion) { + $("#tooltipVersion").text("Version: " + entity.version); + } + if(controllerConfig.showIssues) { + let openIssuesSelector = $('#tooltipOpenIssues'); + let closedIssuesSelector = $('#tooltipClosedIssues'); + let openSecurityIssuesSelector = $('#tooltipOpenSecurityIssues'); + let closedSecurityIssuesSelector = $('#tooltipClosedSecurityIssues'); + if (entity.type === "Namespace") { + openIssuesSelector.css("display", "none"); + closedIssuesSelector.css("display", "none"); + openSecurityIssuesSelector.css("display", "none"); + closedSecurityIssuesSelector.css("display", "none"); + } else { + openIssuesSelector.text("Open Issues: " + entity.numberOfOpenIssues); + closedIssuesSelector.text("Closed Issues: " + entity.numberOfClosedIssues); + openSecurityIssuesSelector.text("Open Security Issues: " + entity.numberOfOpenSecurityIssues); + closedSecurityIssuesSelector.text("Closed Security Issues: " + entity.numberOfClosedSecurityIssues); + openIssuesSelector.css("display", "block"); + closedIssuesSelector.css("display", "block"); + openSecurityIssuesSelector.css("display", "block"); + closedSecurityIssuesSelector.css("display", "block"); + } + } + + var tooltip = $("#tooltip"); + tooltip.css("top", applicationEvent.posY + 50 + "px"); + tooltip.css("left", applicationEvent.posX + 50 + "px"); + tooltip.css("display", "block"); + } + + function onEntityUnhover(applicationEvent) { + var entity = applicationEvent.entities[0]; + + if(entity.marked && entity.selected){ + canvasManipulator.highlightEntities([entity], controllerConfig.hoverColor); + } else { + if(!entity.selected){ + canvasManipulator.unhighlightEntities([entity]); + } + if(entity.type === "Namespace"){ + canvasManipulator.unhighlightEntities([entity]); + } + } + + $("#tooltip").css("display", "none"); + + } + + function getTooltipName(entity) { + if(entity.type === "Method") { + return entity.type + ": " + entity.signature; + } + + if (entity.type === "Namespace") { + return "Package: " + entity.name; + } + + return entity.type + ": " + entity.name; + } + + return { + initialize: initialize, + activate: activate, + reset: reset, + handleOnMouseEnter: handleOnMouseEnter, + handleOnMouseLeave: handleOnMouseLeave + }; +})(); From 25bc678094616627e66d08f3cd5a22f2f305312a Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Thu, 8 Nov 2018 13:13:01 +0100 Subject: [PATCH 12/71] AframeCanvasHoverController working This controller got its own file, because the original specified it's own eventListeners on multiPart and canvas. This version subscribes for actions.hover/unhover instead. --- ui/scripts/CanvasHover/AframeCanvasHoverController.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js index 222d77dea..2bda40614 100644 --- a/ui/scripts/CanvasHover/AframeCanvasHoverController.js +++ b/ui/scripts/CanvasHover/AframeCanvasHoverController.js @@ -23,15 +23,11 @@ var canvasHoverController = (function() { actionController.actions.mouse.hover.subscribe(handleOnMouseEnter); actionController.actions.mouse.unhover.subscribe(handleOnMouseLeave); - - var canvas = document.getElementById("x3dom-x3dElement-canvas"); - canvas.addEventListener("mousedown", handleOnMousedown, false); - canvas.addEventListener("mouseup", handleOnMouseup, false); createTooltipContainer(); events.hovered.on.subscribe(onEntityHover); - events.hovered.off.subscribe(onEntityUnhover); + events.hovered.off.subscribe(onEntityUnhover); } function reset(){ @@ -98,7 +94,6 @@ var canvasHoverController = (function() { } function handleOnMouseEnter(eventObject) { - console.debug(eventObject); if(isInNavigation){ return; } @@ -116,12 +111,10 @@ var canvasHoverController = (function() { /*posX : multipartEvent.layerX, posY : multipartEvent.layerY*/ }; - events.hovered.on.publish(applicationEvent); } function handleOnMouseLeave(eventObject) { - var entity = model.getEntityById(eventObject.target.id); if(entity === undefined){ events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); @@ -137,7 +130,6 @@ var canvasHoverController = (function() { } function onEntityHover(applicationEvent) { - console.debug("onEntityHover"); var entity = applicationEvent.entities[0]; if(entity === undefined){ From 73c97b4456431cfa310e77ad9b3b99505d6ada31 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Thu, 8 Nov 2018 13:52:15 +0100 Subject: [PATCH 13/71] CanvasHoverController working with tooltips AframeActionController.js now adds cursor coordinates as attributes .layerX and .layerY to "mouseenter" and "mouseleave" events. The cursors position gets stored on every "mousemove" event. --- ui/scripts/AframeActionController.js | 9 +++++++++ ui/scripts/CanvasHover/AframeCanvasHoverController.js | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index f6040766f..e79275dfc 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -19,6 +19,9 @@ var actionController = (function () { var hoveredEntity = null; var latestMouseButtonPressed = null; + var cursorX = 0; + var cursorY = 0; + //actions object var actions = { mouse: { @@ -137,6 +140,8 @@ var actionController = (function () { hoveredEntity = component; } if(eventObject.target.id != canvasId) { + eventObject.layerX = cursorX; + eventObject.layerY = cursorY; hoverAction(actions.mouse, eventObject); } @@ -150,6 +155,8 @@ var actionController = (function () { }); this.el.addEventListener("mouseleave", function (eventObject) { if(eventObject.target.id != canvasId) { + eventObject.layerX = cursorX; + eventObject.layerY = cursorY; unhoverAction(actions.mouse, eventObject); } hoveredEntity = canvas; @@ -165,6 +172,8 @@ var actionController = (function () { // interrupts mousedown events somehow this.el.addEventListener("mousemove", function (eventObject) { moveAction(actions.mouse.move, eventObject); + cursorX = eventObject.layerX; + cursorY = eventObject.layerY; if (actions.mouse.move.bubbles) { return true; diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js index 2bda40614..6c3e6b075 100644 --- a/ui/scripts/CanvasHover/AframeCanvasHoverController.js +++ b/ui/scripts/CanvasHover/AframeCanvasHoverController.js @@ -101,15 +101,15 @@ var canvasHoverController = (function() { var entity = model.getEntityById(eventObject.target.id); if(entity === undefined){ entity = eventObject.target.id; - events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + events.log.error.publish({ text: "Entity of partID " + eventObject.target.id + " not in model data."}); return; } var applicationEvent = { sender : canvasHoverController, entities : [entity], - /*posX : multipartEvent.layerX, - posY : multipartEvent.layerY*/ + posX : eventObject.layerX, + posY : eventObject.layerY }; events.hovered.on.publish(applicationEvent); } @@ -117,7 +117,7 @@ var canvasHoverController = (function() { function handleOnMouseLeave(eventObject) { var entity = model.getEntityById(eventObject.target.id); if(entity === undefined){ - events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + events.log.error.publish({ text: "Entity of partID " + eventObject.target.id + " not in model data."}); return; } From dd501ed53a28982a7ee17c0927181154afdffdfa Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Thu, 8 Nov 2018 13:52:15 +0100 Subject: [PATCH 14/71] CanvasHoverController working with tooltips AframeActionController.js now adds cursor coordinates as attributes .layerX and .layerY to "mouseenter" and "mouseleave" events. The cursors position gets stored on every "mousemove" event. --- ui/scripts/AframeActionController.js | 9 +++++++++ ui/scripts/CanvasHover/AframeCanvasHoverController.js | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index f6040766f..e79275dfc 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -19,6 +19,9 @@ var actionController = (function () { var hoveredEntity = null; var latestMouseButtonPressed = null; + var cursorX = 0; + var cursorY = 0; + //actions object var actions = { mouse: { @@ -137,6 +140,8 @@ var actionController = (function () { hoveredEntity = component; } if(eventObject.target.id != canvasId) { + eventObject.layerX = cursorX; + eventObject.layerY = cursorY; hoverAction(actions.mouse, eventObject); } @@ -150,6 +155,8 @@ var actionController = (function () { }); this.el.addEventListener("mouseleave", function (eventObject) { if(eventObject.target.id != canvasId) { + eventObject.layerX = cursorX; + eventObject.layerY = cursorY; unhoverAction(actions.mouse, eventObject); } hoveredEntity = canvas; @@ -165,6 +172,8 @@ var actionController = (function () { // interrupts mousedown events somehow this.el.addEventListener("mousemove", function (eventObject) { moveAction(actions.mouse.move, eventObject); + cursorX = eventObject.layerX; + cursorY = eventObject.layerY; if (actions.mouse.move.bubbles) { return true; diff --git a/ui/scripts/CanvasHover/AframeCanvasHoverController.js b/ui/scripts/CanvasHover/AframeCanvasHoverController.js index 2bda40614..6c3e6b075 100644 --- a/ui/scripts/CanvasHover/AframeCanvasHoverController.js +++ b/ui/scripts/CanvasHover/AframeCanvasHoverController.js @@ -101,15 +101,15 @@ var canvasHoverController = (function() { var entity = model.getEntityById(eventObject.target.id); if(entity === undefined){ entity = eventObject.target.id; - events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + events.log.error.publish({ text: "Entity of partID " + eventObject.target.id + " not in model data."}); return; } var applicationEvent = { sender : canvasHoverController, entities : [entity], - /*posX : multipartEvent.layerX, - posY : multipartEvent.layerY*/ + posX : eventObject.layerX, + posY : eventObject.layerY }; events.hovered.on.publish(applicationEvent); } @@ -117,7 +117,7 @@ var canvasHoverController = (function() { function handleOnMouseLeave(eventObject) { var entity = model.getEntityById(eventObject.target.id); if(entity === undefined){ - events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."}); + events.log.error.publish({ text: "Entity of partID " + eventObject.target.id + " not in model data."}); return; } From e963d296b889cb2556be72187c5a91ba259e004e Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 13 Nov 2018 08:40:04 +0100 Subject: [PATCH 15/71] relation(Highlight/Transparency)Controller working - testing revealed some bugs and deviating behaviors of the AframeCanvasManipulator. These seem to be fixed for now - AframeActionController emitted a second "mouseup" event object with canvas as target which is now filtered out --- ui/scripts/AframeActionController.js | 10 +- ui/scripts/AframeCanvasManipulator.js | 134 +++++++++++++++++--------- ui/setups/test/aframe.js | 8 ++ 3 files changed, 104 insertions(+), 48 deletions(-) diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index e79275dfc..61d9ef872 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -96,10 +96,12 @@ var actionController = (function () { init: function () { this.el.addEventListener("mouseup", function (eventObject) { //general upAction for controllers - eventObject.component = hoveredEntity; - eventObject.which = latestMouseButtonPressed; - upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - upAction(actions.mouse, eventObject); + if(eventObject.target.id != canvasId) { + eventObject.component = hoveredEntity; + eventObject.which = latestMouseButtonPressed; + upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + upAction(actions.mouse, eventObject); + } /*if (getMouseButton(eventObject) !== undefined) { diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index c967120ef..9c2afc4b0 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -2,10 +2,11 @@ var canvasManipulator = (function () { var colors = { darkred: "darkred", + red: "red", black: "black", orange: "orange", darkorange: "darkorange" - } + }; var scene = {}; var threeJSScene = {}; @@ -13,6 +14,8 @@ var canvasManipulator = (function () { var camera; var initialCameraView; + var testEntity; + function initialize() { scene = document.getElementById(canvasId); @@ -27,12 +30,22 @@ var canvasManipulator = (function () { // working - save old transparency in case it is not 0? function changeTransparencyOfEntities(entities, value) { - entities.forEach(function (entity) { + entities.forEach(function (entity2) { + // getting the entity again here, because without it the check if originalTransparency is defined fails sometimes + let entity = model.getEntityById(entity2.id); let component = document.getElementById(entity.id); if (component == undefined) { events.log.error.publish({text: "CanvasManipualtor - changeTransparencyOfEntities - components for entityIds not found"}); return; } + if (entity.originalTransparency === undefined) { + entity.originalTransparency = {}; + entity.currentTransparency = {}; + if(component.getAttribute("material").opacity) { + entity.originalTransparency = 1 - component.getAttribute("material").opacity; + } + } + entity.currentTransparency = value; setTransparency(component, value); }); } @@ -45,7 +58,10 @@ var canvasManipulator = (function () { events.log.error.publish({text: "CanvasManipualtor - resetTransparencyOfEntities - components for entityIds not found"}); return; } - setTransparency(component, 1); + if (!(entity.originalTransparency == undefined)) { + entity.currentTransparency = entity.originalTransparency; + setTransparency(component, entity.originalTransparency); + } }); } @@ -53,21 +69,26 @@ var canvasManipulator = (function () { // working function changeColorOfEntities(entities, color) { entities.forEach(function (entity) { - // in x3dom this function would get entities of the model to change the color of the related object - // for reference in canvasHoverController.js: var entity = model.getEntityById(multipartEvent.partID); - // this entity gets handed over to the ActionController.js as part of an ApplicationEvent - if (!(entity == undefined)) { - var component = document.getElementById(entity.id); - } - if (component == undefined) { - events.log.error.publish({text: "CanvasManipualtor - changeColorOfEntities - components for entityIds not found"}); - return; + // in x3dom this function would get entities of the model to change the color of the related object + // for reference in canvasHoverController.js: var entity = model.getEntityById(multipartEvent.partID); + // this entity gets handed over to the ActionController.js as part of an ApplicationEvent + if (!(entity == undefined)) { + var component = document.getElementById(entity.id); + } + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - changeColorOfEntities - components for entityIds not found"}); + return; + } + if (entity.originalColor == undefined) { + entity.originalColor = component.getAttribute("color"); + } + entity.currentColor = color; + setColor(component, color); } - setColor(component, color); - }); + ); } - // working +// working function resetColorOfEntities(entities) { entities.forEach(function (entity) { let component = document.getElementById(entity.id); @@ -75,11 +96,23 @@ var canvasManipulator = (function () { events.log.error.publish({text: "CanvasManipualtor - resetColorOfEntities - components for entityIds not found"}); return; } - setColor(component, component.getAttribute("color")); + if (entity.originalColor) { + entity.currentColor = entity.originalColor; + setColor(component, entity.originalColor); + } }); } - // working + function setColor(object, color) { + color == colors.darkred ? color = colors.red : color = color; + let colorValues = color.split(" "); + if (colorValues.length == 3) { + color = "#" + parseInt(colorValues[0]).toString(16) + "" + parseInt(colorValues[1]).toString(16) + "" + parseInt(colorValues[2]).toString(16); + } + object.setAttribute("color", color); + } + +// working function hideEntities(entities) { entities.forEach(function (entity) { let component = document.getElementById(entity.id); @@ -91,7 +124,7 @@ var canvasManipulator = (function () { }); } - // working +// working function showEntities(entities) { entities.forEach(function (entity) { let component = document.getElementById(entity.id); @@ -104,13 +137,29 @@ var canvasManipulator = (function () { } function highlightEntities(entities, color) { - entities.forEach(function (entity) { + entities.forEach(function (entity2) { + // getting the entity again here, because without it the check if originalTransparency is defined fails sometimes + let entity = model.getEntityById(entity2.id); let component = document.getElementById(entity.id); if (component == undefined) { events.log.error.publish({text: "CanvasManipualtor - highlightEntities - components for entityIds not found"}); return; } + if (entity.originalColor == undefined) { + entity.originalColor = component.getAttribute("color"); + entity.currentColor = entity.originalColor; + } + if (entity["originalTransparency"] === undefined) { + // in case "material".opacity is undefined originalTransparency gets set to 0 which would be the default value anyways + entity.originalTransparency = {}; + entity.currentTransparency = {}; + if(component.getAttribute("material").opacity) { + entity.originalTransparency = 1 - component.getAttribute("material").opacity; + } else entity.originalTransparency = 0; + entity.currentTransparency = entity.originalTransparency; + } setColor(component, color); + setTransparency(component, 0); }); } @@ -121,12 +170,13 @@ var canvasManipulator = (function () { events.log.error.publish({text: "CanvasManipualtor - unhighlightEntities - components for entityIds not found"}); return; } - setColor(component, component.getAttribute("color")); + setTransparency(component, entity.currentTransparency); + setColor(component, entity.currentColor); }); } - // after clicking an entity fit the camera to show this entity (angle stays the same) - // not working +// after clicking an entity fit the camera to show this entity (angle stays the same) +// not working function flyToEntity(entity) { /*document.querySelector("#camera").object3D.position = {x: 1, y: 2, z: 3}; console.debug(document.querySelector("#camera").object3D.position);*/ @@ -143,8 +193,8 @@ var canvasManipulator = (function () { } - // not working yet - // gets called from Mark- and SelectController if specified in the config +// not working yet +// gets called from Mark- and SelectController if specified in the config function setCenterOfRotation(entity, setFocus) { var centerOfPart = getCenterOfEntity(entity); @@ -177,27 +227,9 @@ var canvasManipulator = (function () { return centerOfPart; } - - //Helper - function getPart(entity) { - if (entity.part == undefined) { - var part = multiPart.getParts([entity.id]); - entity.part = part; - } - - return entity.part; - } - - // working - function setColor(object, color) { - object.setAttribute("material", { - color: color - }); - } - function setTransparency(object, value) { object.setAttribute('material', { - opacity: value + opacity: 1 - value }); } @@ -206,6 +238,17 @@ var canvasManipulator = (function () { object.setAttribute("visible", visibility); } + function getElementIds() { + let sceneArray = Array.from(scene.children); + sceneArray.shift(); // so camera entity needs to be first in model.html + sceneArray.pop(); // last element is of class "a-canvas" + let elementIds = []; + sceneArray.forEach(function (object) { + elementIds.push(object.id); + }); + return elementIds; + } + return { initialize: initialize, reset: reset, @@ -231,6 +274,9 @@ var canvasManipulator = (function () { setCenterOfRotation: setCenterOfRotation, getCenterOfEntity: getCenterOfEntity, + + getElementIds: getElementIds }; -})(); \ No newline at end of file +}) +(); \ No newline at end of file diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 984115b71..1a0d66087 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -23,6 +23,12 @@ var setup = { { name: "packageExplorerController" }, + { + name: "relationHighlightController" + }, + { + name: "relationTransparencyController", + }, { name: "searchController" } @@ -65,6 +71,8 @@ var setup = { { name: "canvasFilterController"}, { name: "canvasSelectController"}, { name: "canvasHoverController"}, + { name: "relationHighlightController"}, + { name: "relationTransparencyController"}, { name: "defaultLogger" } ] } From 8dfcaa9c752f35c1c399e1f4534b5b776fb72313 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 13 Nov 2018 08:40:04 +0100 Subject: [PATCH 16/71] relation(Highlight/Transparency)Controller working - testing revealed some bugs and deviating behaviors of the AframeCanvasManipulator. These seem to be fixed for now - AframeActionController emitted a second "mouseup" event object with canvas as target which is now filtered out --- ui/scripts/AframeActionController.js | 10 +- ui/scripts/AframeCanvasManipulator.js | 134 +++++++++++++++++--------- ui/setups/test/aframe.js | 8 ++ 3 files changed, 104 insertions(+), 48 deletions(-) diff --git a/ui/scripts/AframeActionController.js b/ui/scripts/AframeActionController.js index e79275dfc..61d9ef872 100644 --- a/ui/scripts/AframeActionController.js +++ b/ui/scripts/AframeActionController.js @@ -96,10 +96,12 @@ var actionController = (function () { init: function () { this.el.addEventListener("mouseup", function (eventObject) { //general upAction for controllers - eventObject.component = hoveredEntity; - eventObject.which = latestMouseButtonPressed; - upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); - upAction(actions.mouse, eventObject); + if(eventObject.target.id != canvasId) { + eventObject.component = hoveredEntity; + eventObject.which = latestMouseButtonPressed; + upAction(actions.mouse.key[getMouseButton(eventObject)], eventObject); + upAction(actions.mouse, eventObject); + } /*if (getMouseButton(eventObject) !== undefined) { diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index c967120ef..9c2afc4b0 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -2,10 +2,11 @@ var canvasManipulator = (function () { var colors = { darkred: "darkred", + red: "red", black: "black", orange: "orange", darkorange: "darkorange" - } + }; var scene = {}; var threeJSScene = {}; @@ -13,6 +14,8 @@ var canvasManipulator = (function () { var camera; var initialCameraView; + var testEntity; + function initialize() { scene = document.getElementById(canvasId); @@ -27,12 +30,22 @@ var canvasManipulator = (function () { // working - save old transparency in case it is not 0? function changeTransparencyOfEntities(entities, value) { - entities.forEach(function (entity) { + entities.forEach(function (entity2) { + // getting the entity again here, because without it the check if originalTransparency is defined fails sometimes + let entity = model.getEntityById(entity2.id); let component = document.getElementById(entity.id); if (component == undefined) { events.log.error.publish({text: "CanvasManipualtor - changeTransparencyOfEntities - components for entityIds not found"}); return; } + if (entity.originalTransparency === undefined) { + entity.originalTransparency = {}; + entity.currentTransparency = {}; + if(component.getAttribute("material").opacity) { + entity.originalTransparency = 1 - component.getAttribute("material").opacity; + } + } + entity.currentTransparency = value; setTransparency(component, value); }); } @@ -45,7 +58,10 @@ var canvasManipulator = (function () { events.log.error.publish({text: "CanvasManipualtor - resetTransparencyOfEntities - components for entityIds not found"}); return; } - setTransparency(component, 1); + if (!(entity.originalTransparency == undefined)) { + entity.currentTransparency = entity.originalTransparency; + setTransparency(component, entity.originalTransparency); + } }); } @@ -53,21 +69,26 @@ var canvasManipulator = (function () { // working function changeColorOfEntities(entities, color) { entities.forEach(function (entity) { - // in x3dom this function would get entities of the model to change the color of the related object - // for reference in canvasHoverController.js: var entity = model.getEntityById(multipartEvent.partID); - // this entity gets handed over to the ActionController.js as part of an ApplicationEvent - if (!(entity == undefined)) { - var component = document.getElementById(entity.id); - } - if (component == undefined) { - events.log.error.publish({text: "CanvasManipualtor - changeColorOfEntities - components for entityIds not found"}); - return; + // in x3dom this function would get entities of the model to change the color of the related object + // for reference in canvasHoverController.js: var entity = model.getEntityById(multipartEvent.partID); + // this entity gets handed over to the ActionController.js as part of an ApplicationEvent + if (!(entity == undefined)) { + var component = document.getElementById(entity.id); + } + if (component == undefined) { + events.log.error.publish({text: "CanvasManipualtor - changeColorOfEntities - components for entityIds not found"}); + return; + } + if (entity.originalColor == undefined) { + entity.originalColor = component.getAttribute("color"); + } + entity.currentColor = color; + setColor(component, color); } - setColor(component, color); - }); + ); } - // working +// working function resetColorOfEntities(entities) { entities.forEach(function (entity) { let component = document.getElementById(entity.id); @@ -75,11 +96,23 @@ var canvasManipulator = (function () { events.log.error.publish({text: "CanvasManipualtor - resetColorOfEntities - components for entityIds not found"}); return; } - setColor(component, component.getAttribute("color")); + if (entity.originalColor) { + entity.currentColor = entity.originalColor; + setColor(component, entity.originalColor); + } }); } - // working + function setColor(object, color) { + color == colors.darkred ? color = colors.red : color = color; + let colorValues = color.split(" "); + if (colorValues.length == 3) { + color = "#" + parseInt(colorValues[0]).toString(16) + "" + parseInt(colorValues[1]).toString(16) + "" + parseInt(colorValues[2]).toString(16); + } + object.setAttribute("color", color); + } + +// working function hideEntities(entities) { entities.forEach(function (entity) { let component = document.getElementById(entity.id); @@ -91,7 +124,7 @@ var canvasManipulator = (function () { }); } - // working +// working function showEntities(entities) { entities.forEach(function (entity) { let component = document.getElementById(entity.id); @@ -104,13 +137,29 @@ var canvasManipulator = (function () { } function highlightEntities(entities, color) { - entities.forEach(function (entity) { + entities.forEach(function (entity2) { + // getting the entity again here, because without it the check if originalTransparency is defined fails sometimes + let entity = model.getEntityById(entity2.id); let component = document.getElementById(entity.id); if (component == undefined) { events.log.error.publish({text: "CanvasManipualtor - highlightEntities - components for entityIds not found"}); return; } + if (entity.originalColor == undefined) { + entity.originalColor = component.getAttribute("color"); + entity.currentColor = entity.originalColor; + } + if (entity["originalTransparency"] === undefined) { + // in case "material".opacity is undefined originalTransparency gets set to 0 which would be the default value anyways + entity.originalTransparency = {}; + entity.currentTransparency = {}; + if(component.getAttribute("material").opacity) { + entity.originalTransparency = 1 - component.getAttribute("material").opacity; + } else entity.originalTransparency = 0; + entity.currentTransparency = entity.originalTransparency; + } setColor(component, color); + setTransparency(component, 0); }); } @@ -121,12 +170,13 @@ var canvasManipulator = (function () { events.log.error.publish({text: "CanvasManipualtor - unhighlightEntities - components for entityIds not found"}); return; } - setColor(component, component.getAttribute("color")); + setTransparency(component, entity.currentTransparency); + setColor(component, entity.currentColor); }); } - // after clicking an entity fit the camera to show this entity (angle stays the same) - // not working +// after clicking an entity fit the camera to show this entity (angle stays the same) +// not working function flyToEntity(entity) { /*document.querySelector("#camera").object3D.position = {x: 1, y: 2, z: 3}; console.debug(document.querySelector("#camera").object3D.position);*/ @@ -143,8 +193,8 @@ var canvasManipulator = (function () { } - // not working yet - // gets called from Mark- and SelectController if specified in the config +// not working yet +// gets called from Mark- and SelectController if specified in the config function setCenterOfRotation(entity, setFocus) { var centerOfPart = getCenterOfEntity(entity); @@ -177,27 +227,9 @@ var canvasManipulator = (function () { return centerOfPart; } - - //Helper - function getPart(entity) { - if (entity.part == undefined) { - var part = multiPart.getParts([entity.id]); - entity.part = part; - } - - return entity.part; - } - - // working - function setColor(object, color) { - object.setAttribute("material", { - color: color - }); - } - function setTransparency(object, value) { object.setAttribute('material', { - opacity: value + opacity: 1 - value }); } @@ -206,6 +238,17 @@ var canvasManipulator = (function () { object.setAttribute("visible", visibility); } + function getElementIds() { + let sceneArray = Array.from(scene.children); + sceneArray.shift(); // so camera entity needs to be first in model.html + sceneArray.pop(); // last element is of class "a-canvas" + let elementIds = []; + sceneArray.forEach(function (object) { + elementIds.push(object.id); + }); + return elementIds; + } + return { initialize: initialize, reset: reset, @@ -231,6 +274,9 @@ var canvasManipulator = (function () { setCenterOfRotation: setCenterOfRotation, getCenterOfEntity: getCenterOfEntity, + + getElementIds: getElementIds }; -})(); \ No newline at end of file +}) +(); \ No newline at end of file diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 984115b71..1a0d66087 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -23,6 +23,12 @@ var setup = { { name: "packageExplorerController" }, + { + name: "relationHighlightController" + }, + { + name: "relationTransparencyController", + }, { name: "searchController" } @@ -65,6 +71,8 @@ var setup = { { name: "canvasFilterController"}, { name: "canvasSelectController"}, { name: "canvasHoverController"}, + { name: "relationHighlightController"}, + { name: "relationTransparencyController"}, { name: "defaultLogger" } ] } From c5a54e1f20a0607de0be321788792983d27a8be2 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 13 Nov 2018 12:52:13 +0100 Subject: [PATCH 17/71] index.php canvasId and visMode added --- ui/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/index.php b/ui/index.php index 5c05e7000..249dbfed5 100644 --- a/ui/index.php +++ b/ui/index.php @@ -22,7 +22,10 @@ var multipartX3dUrl = ""; var multipartJsonUrl = ""; - var metaDataJsonUrl = ""; + var metaDataJsonUrl = ""; + + var canvasId = "x3dom-x3dElement-canvas"; + var visMode = "x3dom"; From a4be1239873f62e023386eb40f3be39e10096a8a Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 13 Nov 2018 15:32:33 +0100 Subject: [PATCH 18/71] AframeRelationConnectorController started - created aframe specific script file for controller - first tests on drawing a cylinder and rotating it - centerOfPart function works already --- ui/aframe.html | 2 +- ui/scripts/AframeCanvasManipulator.js | 58 +- .../AframeRelationConnectorController.js | 653 ++++++++++++++++++ 3 files changed, 705 insertions(+), 8 deletions(-) create mode 100644 ui/scripts/RelationConnector/AframeRelationConnectorController.js diff --git a/ui/aframe.html b/ui/aframe.html index a58e12115..17e076aec 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -63,7 +63,7 @@ - + diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index 9c2afc4b0..6e8e8ca7c 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -21,7 +21,7 @@ var canvasManipulator = (function () { scene = document.getElementById(canvasId); threeJSScene = scene.object3D; camera = document.getElementById("camera"); - + } function reset() { @@ -218,13 +218,55 @@ var canvasManipulator = (function () { } } + function createRelation() { + let relationObject = document.createElement("a-cylinder"); + console.debug(relationObject.object3D); - function getCenterOfEntity(entity) { - var entityPart = getPart(entity); - var volumeOfPart = entityPart.getVolume(); - var centerOfPart = volumeOfPart.center; + let sourceCoordinates = getCenterOfEntity(model.getEntityById("ID_26f25e4da4c82dc2370f3bde0201e612dd88c04c")); + let targetCoordinates = getCenterOfEntity(model.getEntityById("ID_527aa1c76ab5cca95e6dbfcea35a5d2d9f5d737f")); + + let deltaX = targetCoordinates["x"] - sourceCoordinates["x"]; + let deltaY = targetCoordinates["y"] - sourceCoordinates["y"]; + let deltaZ = targetCoordinates["z"] - sourceCoordinates["z"]; + + let rotationX = 90*deltaX/Math.sqrt(Math.pow(deltaY, 2)+Math.pow(deltaZ, 2)); + let rotationY = 90*deltaY/Math.sqrt(Math.pow(deltaX, 2)+Math.pow(deltaZ, 2)); + let rotationZ = 90*deltaZ/Math.sqrt(Math.pow(deltaX, 2)+Math.pow(deltaY, 2)); + + console.debug(rotationX); + console.debug(rotationY); + console.debug(rotationZ); + + + let distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2) + Math.pow(deltaZ, 2)); + + relationObject.object3D.rotation.set( + THREE.Math.degToRad(rotationX), + THREE.Math.degToRad(180), + THREE.Math.degToRad(0) + ); - return centerOfPart; + + relationObject.setAttribute("position", { + x: sourceCoordinates["x"]+deltaX/2, + y: sourceCoordinates["y"]+deltaY/2, + z: sourceCoordinates["z"]+deltaZ/2 + }); + relationObject.setAttribute("material", {color:"cyan"}); + relationObject.setAttribute("height", distance); + relationObject.setAttribute("radius", "0.1"); + document.getElementById(canvasId).appendChild(relationObject); + + } + + + function getCenterOfEntity(entity) { + var middle = new THREE.Vector3(); + var object = document.getElementById(entity.id).object3DMap.mesh; + middle.x = object.geometry.boundingSphere.center["x"]; + middle.y = object.geometry.boundingSphere.center["y"]; + middle.z = object.geometry.boundingSphere.center["z"]; + return object.localToWorld(middle); } function setTransparency(object, value) { @@ -275,7 +317,9 @@ var canvasManipulator = (function () { setCenterOfRotation: setCenterOfRotation, getCenterOfEntity: getCenterOfEntity, - getElementIds: getElementIds + getElementIds: getElementIds, + + createRelation : createRelation }; }) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js new file mode 100644 index 000000000..2434920e0 --- /dev/null +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -0,0 +1,653 @@ +var relationConnectorController = function(){ + + var sourceEntity = null; + var relatedEntities = new Array(); + + var connectors = new Array(); + var relations = new Array(); + + var loadedMin = new Map(); + var loadedMax = new Map(); + var loadedPositions = new Map(); + var loadedDistances = new Map(); + + var activated = false; + + + //config parameters + var controllerConfig = { + fixPositionZ : false, + showInnerRelations : false, + elementShape : "", //circle, square + sourceStartAtParentBorder : false, + targetEndAtParentBorder : false, + sourceStartAtBorder: false, + targetEndAtBorder: false, + createEndpoints : false, + } + + + function initialize(setupConfig){ + + application.transferConfigParams(setupConfig, controllerConfig); + + loadPositionData(multipartJsonUrl); + + events.selected.on.subscribe(onRelationsChanged); + } + + function activate(){ + activated = true; + if(relatedEntities.length != 0){ + createRelatedConnections(); + } + } + + function deactivate(){ + reset(); + activated = false; + } + + function reset(){ + removeAllConnectors(); + } + + function loadPositionData(filePath){ + $.getJSON( filePath, function( data ) { + + events.log.info.publish({ text: "connector - loadPositionData"}); + + data.mapping.forEach(function(mapping) { + + var min = parseObjectPosition(mapping.min); + var max = parseObjectPosition(mapping.max); + + var connectorPosition = []; + var connectorDistance = []; + for (var index = 0; index < min.length; ++index) { + connectorPosition[index] = ( Math.abs( max[index] - min[index] ) / 2 ) + min[index]; + connectorDistance[index] = Math.abs( max[index] - min[index] ) / 2; + } + + loadedMin.set(mapping.name, min); + loadedMax.set(mapping.name, max); + loadedPositions.set(mapping.name, connectorPosition); + loadedDistances.set(mapping.name, connectorDistance); + }); + + }); + } + + function removeAllConnectors(){ + + events.log.info.publish({ text: "connector - removeAllConnectors"}); + + if( connectors.length == 0){ + return; + } + + //remove scene elements + connectors.forEach(function(connector){ + canvasManipulator.removeElement(connector); + }); + + connectors = new Array(); + + //remove relation entities + relations.forEach(function(relation){ + model.removeEntity(relation); + }); + + + + //publish removed entities + var applicationEvent = { + sender: relationConnectorController, + entities: relations + }; + events.added.off.publish(applicationEvent); + } + + + + function onRelationsChanged(applicationEvent) { + + events.log.info.publish({ text: "connector - onRelationsChanged"}); + + removeAllConnectors(); + + //get related entites + sourceEntity = applicationEvent.entities[0]; + + events.log.info.publish({ text: "connector - onRelationsChanged - selected Entity - " + sourceEntity.name}); + + relatedEntities = new Array(); + + switch(sourceEntity.type) { + case "Class": + relatedEntities = relatedEntities.concat(sourceEntity.superTypes); + relatedEntities = relatedEntities.concat(sourceEntity.subTypes); + break; + case "ParameterizableClass": + relatedEntities = relatedEntities.concat(sourceEntity.superTypes); + relatedEntities = relatedEntities.concat(sourceEntity.subTypes); + break; + case "Attribute": + relatedEntities = sourceEntity.accessedBy; + break; + case "Method": + relatedEntities = sourceEntity.accesses; + relatedEntities = relatedEntities.concat( sourceEntity.calls ); + relatedEntities = relatedEntities.concat( sourceEntity.calledBy ); + break; + + default: + return; + } + + events.log.info.publish({ text: "connector - onRelationsChanged - related Entites - " + relatedEntities.length}); + + if(relatedEntities.length == 0) { + return; + } + + if(activated){ + createRelatedConnections(); + } + + } + + + function createRelatedConnections(){ + + var relatedEntitesMap = new Map(); + + relatedEntities.forEach(function(relatedEntity){ + if(relatedEntitesMap.has(relatedEntity)){ + events.log.info.publish({ text: "connector - onRelationsChanged - multiple relation"}); + return; + } + + if(controllerConfig.showInnerRelations === false){ + if(isTargetChildOfSourceParent(relatedEntity, sourceEntity)){ + events.log.info.publish({ text: "connector - onRelationsChanged - inner relation"}); + return; + } + } + + //create scene element + var connector = createConnector(sourceEntity, relatedEntity); + + //target or source not rendered -> no connector -> remove relatation + if( connector === undefined){ + return; + } + + events.log.info.publish({ text: "connector - onRelationsChanged - create connector"}); + + connectors.push(connector); + canvasManipulator.addElement(connector); + + //create model entity + var relation = model.createEntity( + "Relation", + sourceEntity.id + "--2--" + relatedEntity.id, + sourceEntity.name + " - " + relatedEntity.name, + sourceEntity.name + " - " + relatedEntity.name, + sourceEntity + ); + + relation.source = sourceEntity; + relation.target = relatedEntity; + + relations.push(relation); + + relatedEntitesMap.set(relatedEntity, relatedEntity); + }); + + + if(relatedEntitesMap.size != 0){ + + var applicationEvent = { + sender: relationConnectorController, + entities: relations + }; + events.added.on.publish(applicationEvent); + } + + } + + + function createConnector(entity, relatedEntity){ + //calculate attributes + var sourcePosition = calculateSourcePosition(entity, relatedEntity); + if( sourcePosition === null ){ + return; + } + + var targetPosition = calculateTargetPosition(entity, relatedEntity); + if( targetPosition === null ){ + return; + } + + var connectorColor = "1 0 0"; + var connectorSize = 0.5; + + //config + if(controllerConfig.fixPositionZ){ + sourcePosition[2] = controllerConfig.fixPositionZ; + targetPosition[2] = controllerConfig.fixPositionZ; + } + + //create element + var transform = document.createElement('Transform'); + + transform.appendChild(createLine(sourcePosition, targetPosition, connectorColor, connectorSize)); + + //config + if(controllerConfig.createEndpoints){ + transform.appendChild(createEndPoint(sourcePosition, targetPosition, "0 0 0", connectorSize * 2)); + } + + return transform; + } + + + + + + + + + function calculateSourcePosition(entity, relatedEntity){ + + var sourcePosition = getObjectPosition(entity.id); + + if(controllerConfig.sourceStartAtParentBorder){ + if(!isTargetChildOfSourceParent(relatedEntity, entity)){ + var targetPosition = getObjectPosition(relatedEntity.id); + if(targetPosition === null){ + return null; + } + sourcePosition = calculatePositionFromParent(sourcePosition, targetPosition, entity.belongsTo); + } + } + + if(controllerConfig.sourceStartAtBorder){ + var targetPosition = getObjectPosition(relatedEntity.id); + if(targetPosition === null){ + return null; + } + sourcePosition = calculateBorderPosition(sourcePosition, targetPosition, entity); + } + + return sourcePosition; + } + + function calculateTargetPosition(entity, relatedEntity){ + + var targetPosition = getObjectPosition(relatedEntity.id); + if(targetPosition === null){ + return null; + } + + if(controllerConfig.targetEndAtParentBorder){ + if(!isTargetChildOfSourceParent(relatedEntity, entity)){ + var sourcePosition = getObjectPosition(entity.id); + targetPosition = calculatePositionFromParent(targetPosition, sourcePosition, relatedEntity.belongsTo); + } + } + + if(controllerConfig.targetEndAtBorder){ + var sourcePosition = getObjectPosition(entity.id); + targetPosition = calculateBorderPosition(targetPosition, sourcePosition, relatedEntity); + } + + return targetPosition; + } + + function isTargetChildOfSourceParent(target, source){ + + var targetParent = target.belongsTo; + var sourceParent = source.belongsTo; + + while(targetParent !== undefined) { + + if(targetParent == sourceParent){ + return true; + } + + targetParent = targetParent.belongsTo; + } + + return false; + } + + function calculateBorderPosition(sourcePosition, targetPosition, entity){ + + if(!loadedMin.has(entity.id) || !loadedMax.has(entity.id)){ + events.log.error.publish({ text: "min max position for " + entity.id + " not loaded!" }); + return; + } + + var min = loadedMin.get(entity.id); + var max = loadedMax.get(entity.id); + + var sourcePosition = sourcePosition.slice(); + var targetPosition = targetPosition.slice(); + + //calculate the 4 corner points + var point00 = min.slice(); + var point01 = min.slice(); + var point10 = max.slice(); + var point11 = max.slice(); + + point01[2] = max[2]; + point10[2] = min[2]; + + //set y value of all points to delta y + var deltaY = min[1] + (( max[1] - min[1]) / 2); + point00[1] = deltaY; + point01[1] = deltaY; + point10[1] = deltaY; + point11[1] = deltaY; + + sourcePosition[1] = deltaY; + targetPosition[1] = deltaY; + + + //calculate distances + + var distances = new Map(); + distances.set(calculateDistance(point00, targetPosition), point00); + distances.set(calculateDistance(point01, targetPosition), point01); + distances.set(calculateDistance(point10, targetPosition), point10); + distances.set(calculateDistance(point11, targetPosition), point11); + + //get the two nearest points + var sortedDistances = Array.from(distances.keys()); + sortedDistances = sortedDistances.sort(function(a,b){return a-b}); + + var nearestPoint1 = distances.get(sortedDistances[0]); + var nearestPoint2 = distances.get(sortedDistances[1]); + + + var valueUsedToCalculate; + var valueToCalculate; + if(nearestPoint1[0] === nearestPoint2[0]){ + valueUsedToCalculate = 0; + valueToCalculate = 2; + } else if(nearestPoint1[2] === nearestPoint2[2]){ + valueUsedToCalculate = 2; + valueToCalculate = 0; + } else { + events.log.error.publish({ text: "border points could not be calcuated" }); + return; + } + + var riseVector = calculateDistanceVector(sourcePosition, targetPosition); + + + if(riseVector[valueUsedToCalculate] == 0){ + var valueSwitch = valueUsedToCalculate; + valueUsedToCalculate = valueToCalculate; + valueToCalculate = valueSwitch; + } + + var riseFactor = ( nearestPoint1[valueUsedToCalculate] - targetPosition[valueUsedToCalculate] ) / riseVector[valueUsedToCalculate]; + + + + var borderPoint = new Array(); + borderPoint[valueUsedToCalculate] = nearestPoint1[valueUsedToCalculate]; + borderPoint[valueToCalculate] = targetPosition[valueToCalculate] + ( riseFactor * riseVector[valueToCalculate] ); + borderPoint[1] = deltaY; + + return borderPoint; + } + + function calculateDistance(point1, point2){ + var distanceVector = calculateDistanceVector(point1, point2); + return Math.sqrt( Math.pow(distanceVector[0], 2) + Math.pow(distanceVector[1], 2) + Math.pow(distanceVector[2], 2) ); + } + + function calculateDistanceVector(point1, point2){ + var distanceVector = new Array(); + distanceVector[0] = point1[0] - point2[0]; + distanceVector[1] = point1[1] - point2[1]; + distanceVector[2] = point1[2] - point2[2]; + + return distanceVector; + } + + + function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ + if(controllerConfig.elementShape == "circle"){ + return calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent); + } + if(controllerConfig.elementShape == "square"){ + return calculateSquarePositionFromParent(sourcePosition, targetPosition, sourceParent); + } + return sourcePosition; + } + + function calculateSquarePositionFromParent(sourcePosition, targetPosition, sourceParent){ + // To implement... + } + + function calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent){ + //calculation derived from http://www.3d-meier.de/tut6/XPresso53.html + + var parentPosition = getObjectPosition(sourceParent.id); + + var parentRadius = loadedDistances.get(sourceParent.id); + var parentX = parentPosition[0]; + var parentY = parentPosition[1]; + + + var targetX = targetPosition[0]; + var targetY = targetPosition[1]; + + var sourceX = sourcePosition[0]; + var sourceY = sourcePosition[1]; + + var deltaX = targetX - sourceX; + var deltaY = targetY - sourceY; + + var a = deltaY / deltaX; + var b = (targetY - parentY) - ( a * (targetX - parentX) ); + + var r = parentRadius[0]; + + + var AA = 1 + Math.pow(a, 2); + var BB = (2 * a * b) + var CC = Math.pow(b, 2) - Math.pow(r, 2); + + var XX = Math.pow(BB, 2) - 4 * AA * CC; + + + var x1 = (-BB + Math.sqrt( XX, 2 )) / ( 2 * AA ); + var x2 = (-BB - Math.sqrt( XX, 2 )) / ( 2 * AA ); + + var y1 = a * x1 + b; + var y2 = a * x2 + b; + + + var newSourcePosition; + if( (targetY > sourceY && targetX < sourceX) || + (targetY < sourceY && targetX < sourceX) ){ + newSourcePosition = [x2+parentX, y2+parentY, sourcePosition[2]]; + } else { + newSourcePosition = [x1+parentX, y1+parentY, sourcePosition[2]]; + } + + return newSourcePosition; + } + + + + function getObjectPosition(objectId){ + + var position = null; + + if( loadedPositions.has(objectId) ){ + position = loadedPositions.get(objectId); + } else { + var myElement = jQuery("#" + objectId)[0]; + if( myElement != undefined ){ + position = parseObjectPosition(myElement.getAttribute("translation")); + } + } + + if( position === null){ + events.log.error.publish({ text: objectId + "has no position data" }); + } + + return position; + } + + function parseObjectPosition(positionString){ + + var position = positionString.split(" "); + + for (var index = 0; index < position.length; ++index) { + position[index] = parseFloat(position[index]); + } + + return position; + } + + + + + function createEndPoint(source, target, color, size){ + //calculate attributes + + //endPointAngle + var lineX = target[0]-source[0]; + var lineY = target[1]-source[1]; + + var endPointAngle = Math.atan( Math.abs(lineY / lineX) ); + + //endPointAmount + var lineAmount = Math.pow( lineX, 2) + Math.pow( lineY, 2); + lineAmount = Math.sqrt(lineAmount,2); + + var endPointAmount = lineAmount - 0.5; + + //endPoint positions + var endPointX = Math.cos(endPointAngle) * endPointAmount; + var endPointY = Math.sin(endPointAngle) * endPointAmount; + + if( lineX <= 0 && lineY >= 0){ + endPointX = endPointX * -1; + } + if( lineX <= 0 && lineY <= 0){ + endPointX = endPointX * -1; + endPointY = endPointY * -1; + } + if( lineX >= 0 && lineY <= 0){ + endPointY = endPointY * -1; + } + + var translation = []; + + translation[0] = source[0] + endPointX; + translation[1] = source[1] + endPointY; + translation[2] = (source[2]+(target[2]-source[2])/2.0); + + var scale = []; + scale[0] = size; + scale[1] = 1; + scale[2] = size; + + var rotation = []; + rotation[0] = (target[2]-source[2]); + rotation[1] = 0; + rotation[2] = (-1.0)*(target[0]-source[0]); + rotation[3] = Math.acos((target[1] - source[1])/(Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) ))); + + //create element + var transform = document.createElement('Transform'); + + transform.setAttribute("translation", translation.toString()); + transform.setAttribute("scale", scale.toString()); + transform.setAttribute("rotation", rotation.toString()); + + var shape = document.createElement('Shape'); + transform.appendChild(shape); + + var appearance = document.createElement('Appearance'); + shape.appendChild(appearance); + var material = document.createElement('Material'); + material.setAttribute("diffuseColor", color); + appearance.appendChild(material); + + + var cylinder = document.createElement('Cylinder'); + cylinder.setAttribute("radius", "0.25"); + cylinder.setAttribute("height", "1"); + shape.appendChild(cylinder); + + return transform; + } + + + + function createLine(source, target, color, size){ + //calculate attributes + + var betrag = (Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) )); + var translation = []; + + translation[0] = source[0]+(target[0]-source[0])/2.0; + translation[1] = source[1]+(target[1]-source[1])/2.0; + translation[2] = source[2]+(target[2]-source[2])/2.0; + + var scale = []; + scale[0] = size; + scale[1] = betrag; + scale[2] = size; + + var rotation = []; + rotation[0] = (target[2]-source[2]); + rotation[1] = 0; + rotation[2] = (-1.0)*(target[0]-source[0]); + rotation[3] = Math.acos((target[1] - source[1])/(Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) ))); + + //create element + var transform = document.createElement('Transform'); + + transform.setAttribute("translation", translation.toString()); + transform.setAttribute("scale", scale.toString()); + transform.setAttribute("rotation", rotation.toString()); + + var shape = document.createElement('Shape'); + transform.appendChild(shape); + + var appearance = document.createElement('Appearance'); + shape.appendChild(appearance); + var material = document.createElement('Material'); + material.setAttribute("diffuseColor", color); + appearance.appendChild(material); + + + var cylinder = document.createElement('Cylinder'); + cylinder.setAttribute("radius", "0.25"); + cylinder.setAttribute("height", "1"); + shape.appendChild(cylinder); + + return transform; + } + + + + return { + initialize : initialize, + reset : reset, + activate : activate, + deactivate : deactivate + }; + +}(); \ No newline at end of file From 804f12a5ec9090dadaa118309292129d12fb5cc2 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Thu, 15 Nov 2018 14:19:34 +0100 Subject: [PATCH 19/71] relationConnectorController first version - controller draws and removes connection - connections are line objects which probably can't be scaled - cylinders can be scaled, but need to be rotated whereas lines are set through start and end points --- ui/scripts/AframeCanvasManipulator.js | 63 +++------------ .../AframeRelationConnectorController.js | 77 +++++++------------ ui/setups/test/aframe.js | 6 +- 3 files changed, 40 insertions(+), 106 deletions(-) diff --git a/ui/scripts/AframeCanvasManipulator.js b/ui/scripts/AframeCanvasManipulator.js index 6e8e8ca7c..61b8e1f4a 100644 --- a/ui/scripts/AframeCanvasManipulator.js +++ b/ui/scripts/AframeCanvasManipulator.js @@ -18,10 +18,10 @@ var canvasManipulator = (function () { function initialize() { - scene = document.getElementById(canvasId); + scene = document.querySelector("a-scene"); threeJSScene = scene.object3D; camera = document.getElementById("camera"); - + } function reset() { @@ -188,8 +188,7 @@ var canvasManipulator = (function () { } function removeElement(element) { - var addedElements = document.getElementById("addedElements"); - addedElements.removeChild(element); + element.parentNode.removeChild(element); } @@ -218,55 +217,13 @@ var canvasManipulator = (function () { } } - function createRelation() { - let relationObject = document.createElement("a-cylinder"); - console.debug(relationObject.object3D); - - let sourceCoordinates = getCenterOfEntity(model.getEntityById("ID_26f25e4da4c82dc2370f3bde0201e612dd88c04c")); - let targetCoordinates = getCenterOfEntity(model.getEntityById("ID_527aa1c76ab5cca95e6dbfcea35a5d2d9f5d737f")); - - let deltaX = targetCoordinates["x"] - sourceCoordinates["x"]; - let deltaY = targetCoordinates["y"] - sourceCoordinates["y"]; - let deltaZ = targetCoordinates["z"] - sourceCoordinates["z"]; - - let rotationX = 90*deltaX/Math.sqrt(Math.pow(deltaY, 2)+Math.pow(deltaZ, 2)); - let rotationY = 90*deltaY/Math.sqrt(Math.pow(deltaX, 2)+Math.pow(deltaZ, 2)); - let rotationZ = 90*deltaZ/Math.sqrt(Math.pow(deltaX, 2)+Math.pow(deltaY, 2)); - - console.debug(rotationX); - console.debug(rotationY); - console.debug(rotationZ); - - - let distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2) + Math.pow(deltaZ, 2)); - - relationObject.object3D.rotation.set( - THREE.Math.degToRad(rotationX), - THREE.Math.degToRad(180), - THREE.Math.degToRad(0) - ); - - - relationObject.setAttribute("position", { - x: sourceCoordinates["x"]+deltaX/2, - y: sourceCoordinates["y"]+deltaY/2, - z: sourceCoordinates["z"]+deltaZ/2 - }); - relationObject.setAttribute("material", {color:"cyan"}); - relationObject.setAttribute("height", distance); - relationObject.setAttribute("radius", "0.1"); - document.getElementById(canvasId).appendChild(relationObject); - - } - - function getCenterOfEntity(entity) { - var middle = new THREE.Vector3(); + var center = new THREE.Vector3(); var object = document.getElementById(entity.id).object3DMap.mesh; - middle.x = object.geometry.boundingSphere.center["x"]; - middle.y = object.geometry.boundingSphere.center["y"]; - middle.z = object.geometry.boundingSphere.center["z"]; - return object.localToWorld(middle); + center.x = object.geometry.boundingSphere.center["x"]; + center.y = object.geometry.boundingSphere.center["y"]; + center.z = object.geometry.boundingSphere.center["z"]; + return object.localToWorld(center); } function setTransparency(object, value) { @@ -317,9 +274,7 @@ var canvasManipulator = (function () { setCenterOfRotation: setCenterOfRotation, getCenterOfEntity: getCenterOfEntity, - getElementIds: getElementIds, - - createRelation : createRelation + getElementIds: getElementIds }; }) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index 2434920e0..d6e2f8a8e 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -17,7 +17,7 @@ var relationConnectorController = function(){ //config parameters var controllerConfig = { fixPositionZ : false, - showInnerRelations : false, + showInnerRelations : true, elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, @@ -29,9 +29,7 @@ var relationConnectorController = function(){ function initialize(setupConfig){ - application.transferConfigParams(setupConfig, controllerConfig); - - loadPositionData(multipartJsonUrl); + application.transferConfigParams(setupConfig, controllerConfig); events.selected.on.subscribe(onRelationsChanged); } @@ -52,32 +50,6 @@ var relationConnectorController = function(){ removeAllConnectors(); } - function loadPositionData(filePath){ - $.getJSON( filePath, function( data ) { - - events.log.info.publish({ text: "connector - loadPositionData"}); - - data.mapping.forEach(function(mapping) { - - var min = parseObjectPosition(mapping.min); - var max = parseObjectPosition(mapping.max); - - var connectorPosition = []; - var connectorDistance = []; - for (var index = 0; index < min.length; ++index) { - connectorPosition[index] = ( Math.abs( max[index] - min[index] ) / 2 ) + min[index]; - connectorDistance[index] = Math.abs( max[index] - min[index] ) / 2; - } - - loadedMin.set(mapping.name, min); - loadedMax.set(mapping.name, max); - loadedPositions.set(mapping.name, connectorPosition); - loadedDistances.set(mapping.name, connectorDistance); - }); - - }); - } - function removeAllConnectors(){ events.log.info.publish({ text: "connector - removeAllConnectors"}); @@ -116,8 +88,8 @@ var relationConnectorController = function(){ removeAllConnectors(); - //get related entites - sourceEntity = applicationEvent.entities[0]; + //get related entities + sourceEntity = applicationEvent.entities[0]; events.log.info.publish({ text: "connector - onRelationsChanged - selected Entity - " + sourceEntity.name}); @@ -145,7 +117,7 @@ var relationConnectorController = function(){ return; } - events.log.info.publish({ text: "connector - onRelationsChanged - related Entites - " + relatedEntities.length}); + events.log.info.publish({ text: "connector - onRelationsChanged - related Entities - " + relatedEntities.length}); if(relatedEntities.length == 0) { return; @@ -159,11 +131,10 @@ var relationConnectorController = function(){ function createRelatedConnections(){ + var relatedEntitiesMap = new Map(); - var relatedEntitesMap = new Map(); - relatedEntities.forEach(function(relatedEntity){ - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ events.log.info.publish({ text: "connector - onRelationsChanged - multiple relation"}); return; } @@ -176,7 +147,7 @@ var relationConnectorController = function(){ } //create scene element - var connector = createConnector(sourceEntity, relatedEntity); + let connector = createConnector(sourceEntity, relatedEntity); //target or source not rendered -> no connector -> remove relatation if( connector === undefined){ @@ -186,7 +157,6 @@ var relationConnectorController = function(){ events.log.info.publish({ text: "connector - onRelationsChanged - create connector"}); connectors.push(connector); - canvasManipulator.addElement(connector); //create model entity var relation = model.createEntity( @@ -202,11 +172,11 @@ var relationConnectorController = function(){ relations.push(relation); - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - if(relatedEntitesMap.size != 0){ + if(relatedEntitiesMap.size != 0){ var applicationEvent = { sender: relationConnectorController, @@ -220,36 +190,41 @@ var relationConnectorController = function(){ function createConnector(entity, relatedEntity){ //calculate attributes - var sourcePosition = calculateSourcePosition(entity, relatedEntity); + var sourcePosition = canvasManipulator.getCenterOfEntity(entity); if( sourcePosition === null ){ return; } - var targetPosition = calculateTargetPosition(entity, relatedEntity); + var targetPosition = canvasManipulator.getCenterOfEntity(relatedEntity); if( targetPosition === null ){ return; } var connectorColor = "1 0 0"; var connectorSize = 0.5; - + //config if(controllerConfig.fixPositionZ){ - sourcePosition[2] = controllerConfig.fixPositionZ; - targetPosition[2] = controllerConfig.fixPositionZ; + sourcePosition[z] = controllerConfig.fixPositionZ; + targetPosition[z] = controllerConfig.fixPositionZ; } - + //create element - var transform = document.createElement('Transform'); + var connector = document.createElement("a-entity"); + connector.setAttribute("line", { + start: sourcePosition, + end: targetPosition, + color: "red" + }); - transform.appendChild(createLine(sourcePosition, targetPosition, connectorColor, connectorSize)); + document.querySelector("a-scene").appendChild(connector); - //config + /*//config if(controllerConfig.createEndpoints){ transform.appendChild(createEndPoint(sourcePosition, targetPosition, "0 0 0", connectorSize * 2)); - } + }*/ - return transform; + return connector; } diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 1a0d66087..447808cf5 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -27,7 +27,10 @@ var setup = { name: "relationHighlightController" }, { - name: "relationTransparencyController", + name: "relationTransparencyController" + }, + { + name: "relationConnectorController" }, { name: "searchController" @@ -73,6 +76,7 @@ var setup = { { name: "canvasHoverController"}, { name: "relationHighlightController"}, { name: "relationTransparencyController"}, + { name: "relationConnectorController"}, { name: "defaultLogger" } ] } From bd003239d23e84b9fd88d65fa0db1a0b3f550aa0 Mon Sep 17 00:00:00 2001 From: David Baum Date: Fri, 16 Nov 2018 16:33:22 +0100 Subject: [PATCH 20/71] release of generator2 --- generator2/.gitignore | 25 + generator2/README.md | 23 + generator2/org.getaviz.generator/.classpath | 26 + generator2/org.getaviz.generator/.gitignore | 1 + generator2/org.getaviz.generator/.project | 39 + generator2/org.getaviz.generator/pom.xml | 270 +++++++ .../org.getaviz.generator/settings.properties | 174 ++++ .../src/log4j.properties | 20 + .../src/org/getaviz/generator/Generator.java | 48 ++ .../src/org/getaviz/generator/Helper.xtend | 44 + .../generator/OutputFormatHelper.xtend | 90 +++ .../generator/SettingsConfiguration.java | 761 ++++++++++++++++++ .../org/getaviz/generator/city/CityUtils.java | 247 ++++++ .../generator/city/m2m/BrickLayout.java | 111 +++ .../city/m2m/BuildingSegmentComparator.java | 227 ++++++ .../generator/city/m2m/City2City.xtend | 574 +++++++++++++ .../generator/city/m2m/CityKDTree.java | 36 + .../generator/city/m2m/CityKDTreeNode.java | 76 ++ .../generator/city/m2m/CityLayout.java | 445 ++++++++++ .../getaviz/generator/city/m2m/RGBColor.java | 75 ++ .../generator/city/m2m/Rectangle.xtend | 134 +++ .../generator/city/m2t/City2AFrame.xtend | 217 +++++ .../getaviz/generator/city/m2t/City2X3D.xtend | 218 +++++ .../getaviz/generator/city/s2m/JQA2City.xtend | 141 ++++ .../generator/jqa/EndNodeEvaluator.xtend | 23 + .../org/getaviz/generator/jqa/JQA2JSON.xtend | 316 ++++++++ .../generator/jqa/JQAEnhancement.xtend | 130 +++ .../getaviz/generator/jqa/JQAEvaluator.xtend | 81 ++ .../org/getaviz/generator/rd/RDUtils.xtend | 51 ++ .../getaviz/generator/rd/m2m/Calculator.java | 177 ++++ .../org/getaviz/generator/rd/m2m/Circle.xtend | 26 + .../generator/rd/m2m/CircleJPanel.java | 97 +++ .../rd/m2m/CircleWithInnerCircles.xtend | 70 ++ .../org/getaviz/generator/rd/m2m/RD2RD.xtend | 381 +++++++++ .../getaviz/generator/rd/m2m/RDLayout.java | 123 +++ .../getaviz/generator/rd/m2m/RGBColor.java | 68 ++ .../org/getaviz/generator/rd/m2m/Util.java | 117 +++ .../getaviz/generator/rd/m2t/RD2AFrame.xtend | 132 +++ .../org/getaviz/generator/rd/m2t/RD2X3D.xtend | 120 +++ .../org/getaviz/generator/rd/s2m/JQA2RD.xtend | 198 +++++ .../generator/tests/RDModificationTest.java | 21 + .../org.getaviz.lib.database/.classpath | 27 + .../org.getaviz.lib.database/.gitignore | 1 + generator2/org.getaviz.lib.database/.project | 29 + generator2/org.getaviz.lib.database/pom.xml | 68 ++ .../org/getaviz/lib/database/Database.xtend | 101 +++ .../src/org/getaviz/lib/database/Labels.java | 9 + .../src/org/getaviz/lib/database/Rels.java | 7 + generator2/org.getaviz.parent/.classpath | 14 + generator2/org.getaviz.parent/.project | 11 + .../org.getaviz.parent/Generator.launch | 16 + generator2/org.getaviz.parent/pom.xml | 31 + 52 files changed, 6467 insertions(+) create mode 100644 generator2/.gitignore create mode 100644 generator2/README.md create mode 100644 generator2/org.getaviz.generator/.classpath create mode 100644 generator2/org.getaviz.generator/.gitignore create mode 100644 generator2/org.getaviz.generator/.project create mode 100644 generator2/org.getaviz.generator/pom.xml create mode 100644 generator2/org.getaviz.generator/settings.properties create mode 100644 generator2/org.getaviz.generator/src/log4j.properties create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/Helper.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/OutputFormatHelper.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTree.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTreeNode.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/RGBColor.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/Rectangle.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Calculator.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Circle.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleJPanel.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RDLayout.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RGBColor.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Util.java create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend create mode 100644 generator2/org.getaviz.generator/tests/org/getaviz/generator/tests/RDModificationTest.java create mode 100644 generator2/org.getaviz.lib.database/.classpath create mode 100644 generator2/org.getaviz.lib.database/.gitignore create mode 100644 generator2/org.getaviz.lib.database/.project create mode 100644 generator2/org.getaviz.lib.database/pom.xml create mode 100644 generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend create mode 100644 generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java create mode 100644 generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java create mode 100644 generator2/org.getaviz.parent/.classpath create mode 100644 generator2/org.getaviz.parent/.project create mode 100644 generator2/org.getaviz.parent/Generator.launch create mode 100644 generator2/org.getaviz.parent/pom.xml diff --git a/generator2/.gitignore b/generator2/.gitignore new file mode 100644 index 000000000..a7624f145 --- /dev/null +++ b/generator2/.gitignore @@ -0,0 +1,25 @@ +.metadata/ +*/bin +*/model/* +*/xtend-gen/* +*/test-xtend-gen/* +*/src-gen/* +*.xml_gen +*/target/* +**/generated-sources/* +*/.settings/* +*/output/* +.directory +/databases +/databases.old +dbms +/bin/ +store_lock +**.log +neostore.transaction.db.** +*.xtextbin +*.xtendbin +test-xtend-gen/ + +# Ignore default models +/.recommenders/ diff --git a/generator2/README.md b/generator2/README.md new file mode 100644 index 000000000..58a5abe9e --- /dev/null +++ b/generator2/README.md @@ -0,0 +1,23 @@ +# README # + +## What is this repository for? + +The generator takes a database created by jQAssistant as input and generates a software visualization that can be explored using the ui component. + +## How do I build and run the generator? +* [Maven](../wiki/Maven) is used as build management system. It is used to build the generator, to run testcases and to start the generator + +## Contribution Guidelines + +* Don't commit generated files like in *tmp*, *xtend-gen* and *src-gen* +* Commit only working and tested code +* Write tests and change existing tests if necessary + +## Further Documentation + +* [Overview](../wiki/Generator%20Overview) +* [Generation Process](../wiki/Generation%20Process) +* [Maven](../wiki/Maven) +* [Testing Process](../wiki/Testing%20Process%20Generator) +* [Xtend Coding Guidelines](../wiki/Xtend%20Coding%20Guidelines) + diff --git a/generator2/org.getaviz.generator/.classpath b/generator2/org.getaviz.generator/.classpath new file mode 100644 index 000000000..505bc9da1 --- /dev/null +++ b/generator2/org.getaviz.generator/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/generator2/org.getaviz.generator/.gitignore b/generator2/org.getaviz.generator/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/generator2/org.getaviz.generator/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/generator2/org.getaviz.generator/.project b/generator2/org.getaviz.generator/.project new file mode 100644 index 000000000..c1d83efe3 --- /dev/null +++ b/generator2/org.getaviz.generator/.project @@ -0,0 +1,39 @@ + + + org.getaviz.generator + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/org.eclipse.xtext.ui.shared.xtextBuilder.launch + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/generator2/org.getaviz.generator/pom.xml b/generator2/org.getaviz.generator/pom.xml new file mode 100644 index 000000000..526e9781b --- /dev/null +++ b/generator2/org.getaviz.generator/pom.xml @@ -0,0 +1,270 @@ + + 4.0.0 + + ../org.getaviz.parent/pom.xml + org.getaviz + org.getaviz.parent + 1.0.0-SNAPSHOT + + org.getaviz.generator + Getaviz Generator + + + ${project.artifactId}-site + ${project.baseUri} + + + + + + org.getaviz.lib.database + org.getaviz.lib.database + 1.0.0-SNAPSHOT + + + + + + + commons-logging + commons-logging + 1.2 + + + + org.apache.commons + commons-text + 1.6 + + + + org.apache.commons + commons-lang3 + 3.8.1 + + + + commons-codec + commons-codec + 1.11 + + + + org.apache.commons + commons-configuration2 + 2.4 + + + + + + org.eclipse.xtend + org.eclipse.xtend.lib + ${xtend.version} + + + com.google.guava + guava + 19.0-rc3 + + + + org.neo4j + neo4j-graphdb-api + ${neo4j.version} + + + + org.neo4j + neo4j-resource + ${neo4j.version} + + + + commons-beanutils + commons-beanutils + 1.9.3 + + + com.vividsolutions + jts + 1.13 + + + + org.junit.jupiter + junit-jupiter-api + 5.3.1 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.3.1 + test + + + org.junit.vintage + junit-vintage-engine + 5.3.1 + test + + + org.junit.platform + junit-platform-launcher + 1.1.0 + test + + + org.junit.platform + junit-platform-runner + 1.1.0 + test + + + + org.neo4j.test + neo4j-harness + 3.4.9 + test + + + + + + src + + + org.eclipse.xtend + xtend-maven-plugin + + + maven-compiler-plugin + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.junit.platform + junit-platform-surefire-provider + 1.1.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.3.1 + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + ${basedir}/xtend-gen/:${basedir}/src/ + false + true + false + false + + + + org.codehaus.mojo + exec-maven-plugin + 1.4.0 + + + deploy + + java + + + + + java + true + true + + + -Xmx8g + -classpath + + org.getaviz.generator.Generator + -p + runtimeProject=${project.basedir} + + + + + + + + + maven-project-info-reports-plugin + 2.9 + + + + org.eclipse.xtend + xtend-maven-plugin + ${xtend.version} + + + + + + + + + + + compile + testCompile + + + + + ${basedir}/xtend-gen + ${basedir}/test-xtend-gen + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + true + + + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.4 + + false + false + + + + + diff --git a/generator2/org.getaviz.generator/settings.properties b/generator2/org.getaviz.generator/settings.properties new file mode 100644 index 000000000..efc3307fe --- /dev/null +++ b/generator2/org.getaviz.generator/settings.properties @@ -0,0 +1,174 @@ +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# OUTPUT # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +# Output format of the generated visualization +# Possible values are x3d(default), aframe +# output.format = x3d + +# Visualization metaphor of the generated visualization +# Possible value ard rd(default), city +# metaphor = rd + +# Directory to which the visualization will be generated, relative to the directory of this project +# output.path = ./output/ + +# If true, the x3d files is converted to multipart automatically, if InstantPlayer is installed locally +# convert_to_multipart = false + +# Directory of the used jQAssistant database, relative to the directory of this project +# database_name = ../databases/graph.db + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# CITY VISUALIZATION # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +# Possible values are original (default), panels, bricks, floor +# city.building_type = original + +# The active mode to structure +# The active mode to structure and color the methods and attributes. +# Possible values are +# types (default): The class elements are sorted and colored associated to type/functionality of the method. +# visibility: The class elements are sorted and colored corresponding to there visibility modifiers. +# city.scheme = types + +# Switch to control the elements of the classes to show. +# Possible values are methods_and_attributes (default), methods_only, attributes_only +# city.class_elements_mode = methods_and_attributes + +# Possible values are methods_first (default), unsorted, attributes_first +# city.class_elements_sort_mode_coarse = methods_first + +# The active mode, how to sort the methods or attributes separately among each other +# This means a method is only compared to another method and an attribute is only +# compared to another attribute in this comparison, according their values. +# If it is set to scheme, a secondary sorting is performed to place methods +# with high numbers of statements to the bottom. +# Possible values are scheme (default), unsorted, alphabetically, nos +# city.class_elements_sort_mode_fine = scheme + +# If set true, the order of the sorting, defined in class_elements_sort_mode_fide is reversed. +# If class_elements_sort_mode_fide is set to scheme, a secondary sorting is performed to place +# methods with high numbers of statements to the bottom. This behavior isn't influenced by this switch. +# city.class_elements_sort_mode_fine_direction_reversed = false + +# Switch to show or hide building base in panels or bricks mode. +# If set to false, only districts and buildingSegments are visible. +# city.show_building_base = true + +# Switch for showing attributes as cylinders instead of boxes. +# This setting has only an affect in panels-mode. +# city.show_attributes_as_cylinders = true + +# The active mode for the layout of the bricks/methods. +# This setting has only an affect in brick-mode. +# Possible values are progressive (default), straight, balanced +# city.brick.layout = progressive +# city.brick.size = 1.0 +# city.brick.horizontal_margin = 0.5 +# city.brick.horizontal_gap = 0.2 +# city.brick.vertical_margin = 0.2 +# city.brick.vertical_gap = 0.2 + +# The active mode for the area between panels/methods. +# Possible values are +# separator (default): Between the panels separators are placed with a fix height and color. +# none: No space between the panels and they are placed on top of each other. +# gap: The panels have a free space between them and don't touch each other. +# city.panel.separator_mode = separator + +# Multiplier for height of a panel, declared in panel.height_unit. The elements of this array +# are threshold values for the number of statements inside the method and are multiplied with the +# index+1, so the product will be the actual height of the panel. +# The values are inclusive. +# Comment property out to use default value (is 3, 6, 12, 24, 48, 96, 144, 192, 240) +# city.panel.height_treshold_nos = 3, 6, 12, 24, 48, 96, 144, 192, 240 + +## Measurements Panels + +# Height is multiplied by panel.height_treshold_nos +# city.panel.height_unit = 0.5 + +# city.panel.horizontal_margin = 0.5 +# city.panel.vertical_margin = 0.25 +# city.panel.vertical_gap = 0.125 +# city.panel.separator_height = 0.125 + +# Possible values are none (default) and nos +# city.original_building_metric = none + +# city.width_min = 1 +# city.height_min = 1 +# city.building.horizontal_margin = 3.0 +# city.building.horizontal_margin = 20.0 +# city.building.horizontal_gap = 3.0 +# city.building.horizontal_gap = 20.0 +# city.building.vertical_margin = 1.0 + +# city.package.color_start = #969696 +# city.package.color_end = #f0f0f0 +# city.class.color_start = #131615 +# city.class.color_end = #00ff00 +# city.class.color = #353559 + +# Dynamic City colors +# city.dynamic.class.color_start = #fa965c +# city.dynamic.class.color_end = #feb280 +# city.dynamic.method.color = #735eb9 +# city.dynamic.package.color_start = #23862c +# city.dynamic.package.color_end = #7bcd8d + +# city.color.blue = #99FFCC +# city.color.aqua = #99CCFF +# city.color.light_green = #CCFF99 +# city.color.dark_green = #99FF99 +# city.color.yellow = #ffff99 +# city.color.orange = #FFCC99 +# city.color.red = #FF9999 +# city.color.pink = #FF99FF +# city.color.violet = #9999FF +# city.color.light_grey = #CCCCCC +# city.color.dark_grey = #999999 +# city.color.white = #FFFFFF +# city.color.black = #000000 + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# RECURSIVE DISK VISUALIZATION # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +# rd.data_factor = 4.0 +# rd.method_factor = 1.0 +# rd.height = 1.0 +# rd.height_boost = 8 +# rd.height_multiplicator = 50.0 +# rd.ring_width = 2.0 + +# Sets the ring width of the method disks +# Only relevant if disk of type FAMIX.Method exist +# rd.ring_width_md = 0 + +# Equal to ring_width_md but for attribute disks +# rd.ring_with_ad = 0 +# rd.min_area = 10.0 +# rd.namespace_transparency = 0 +# rd.class_transparency = 0 +# rd.method_transparency = 0 +# rd.data_transparency = 0 +# rd.color.class = #353559 +# rd.color.data = #fffc19 +# rd.color.method = #1485cc +# rd.color.namespace = #969696 + +# If true the Methods will be visualized as Disks instead of DiskSegments. +# rd.method_disks = false + +# If true Attributes will be visualized as disks. +# rd.data_disks = false diff --git a/generator2/org.getaviz.generator/src/log4j.properties b/generator2/org.getaviz.generator/src/log4j.properties new file mode 100644 index 000000000..90e20d4cd --- /dev/null +++ b/generator2/org.getaviz.generator/src/log4j.properties @@ -0,0 +1,20 @@ +# Root logger option +log4j.rootLogger=DEBUG, file, stdout +log4j.logger.org.apache.commons.beanutils.converters=ERROR + +# Redirect log messages to console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c{1} - %m%n +log4j.appender.stdout.Threshold=INFO + +# Direct log messages to a log file +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.Append=false +log4j.appender.file.File=./output/debug.log +#log4j.appender.file.MaxFileSize=50MB +#log4j.appender.file.MaxBackupIndex=10 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +log4j.appender.file.Threshold=DEBUG diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java new file mode 100644 index 000000000..58b2b7f58 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java @@ -0,0 +1,48 @@ +package org.getaviz.generator; + +import org.getaviz.generator.city.m2m.City2City; +import org.getaviz.generator.city.m2t.City2AFrame; +import org.getaviz.generator.city.m2t.City2X3D; +import org.getaviz.generator.jqa.JQA2JSON; +import org.getaviz.generator.jqa.JQAEnhancement; +import org.getaviz.generator.rd.m2m.RD2RD; +import org.getaviz.generator.rd.m2t.RD2AFrame; +import org.getaviz.generator.rd.m2t.RD2X3D; +import org.getaviz.generator.city.s2m.JQA2City; +import org.getaviz.generator.rd.s2m.JQA2RD; + +public class Generator { + + public static void main(String[] args) { + SettingsConfiguration config = SettingsConfiguration.getInstance(); + new JQAEnhancement(); + switch (config.getMetaphor()) { + case CITY: { + new JQA2City(); + new JQA2JSON(); + new City2City(); + switch(config.getOutputFormat()) { + case X3D: new City2X3D(); + case AFrame: new City2AFrame(); + } + break; + } + case RD: { + new JQA2RD(); + new JQA2JSON(); + new RD2RD(); + switch(config.getOutputFormat()) { + case X3D: { + new RD2X3D(); + break; + } + case AFrame: { + new RD2AFrame(); + break; + } + } + break; + } + } + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/Helper.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/Helper.xtend new file mode 100644 index 000000000..850c81112 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/Helper.xtend @@ -0,0 +1,44 @@ +package org.getaviz.generator + +//import org.apache.commons.logging.LogFactory +import org.apache.commons.lang3.StringUtils +import org.getaviz.generator.city.m2m.RGBColor + +class Helper { +// val log = LogFactory::getLog(class) +// val typesMap = newHashMap('String' -> 128.0, 'byte' -> 8.0, 'short' -> 16.0, 'int' -> 32.0, +// 'long' -> 64.0, 'float' -> 32.0, 'double' -> 64.0, 'boolean' -> 4.0, 'char' -> 16.0) + + def getGradient(double value) { + val red = 255 * value + val green = 255 * (1 - value) + val color = new RGBColor(red, green, 0) + return color + } + /** + * Creates hash as (hopefully) unique ID for every FAMIXElement + * + * @param fqn full qualified name of FAMIXElement + * @return sha1 hash + * + */ + + def removeBrackets(String[] array) { + return removeBrackets(array.toString) + } + + def removeBrackets(String string) { + return StringUtils::remove(StringUtils::remove(string, "["), "]") + } + + def removeApostrophes(String string) { + return StringUtils::remove(StringUtils::remove(string,"'"),"") + } + + def checkNull(String string) { + if(string === null) { + return "" + } + return string + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/OutputFormatHelper.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/OutputFormatHelper.xtend new file mode 100644 index 000000000..bee7997aa --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/OutputFormatHelper.xtend @@ -0,0 +1,90 @@ +package org.getaviz.generator + +import org.getaviz.generator.SettingsConfiguration.BuildingType +import org.getaviz.generator.city.m2m.CityLayout + +class OutputFormatHelper { + val config = SettingsConfiguration.getInstance(); + + def String X3DHead() ''' + + + + + + + + + + ''' + + def String settingsInfo() ''' + + ''' + + def String viewports() ''' + «var rootEntity = CityLayout::rootRectangle» + «var width = rootEntity.width» + «var length = rootEntity.length» + + + + + + + ''' + + def String X3DTail() ''' + + + + ''' + + def String AFrameHead() ''' + + + + + Ring + + + + + + + ''' + + def String AFrameTail() ''' + + + + ''' +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java new file mode 100644 index 000000000..b3807aaa8 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java @@ -0,0 +1,761 @@ +package org.getaviz.generator; + +import java.io.File; +import java.awt.Color; + +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.builder.fluent.Configurations; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.getaviz.generator.SettingsConfiguration.Bricks.Layout; +import org.getaviz.generator.SettingsConfiguration.Original.BuildingMetric; +import org.getaviz.generator.SettingsConfiguration.Panels.SeparatorModes; + +public class SettingsConfiguration { + private static PropertiesConfiguration config; + private static SettingsConfiguration instance = null; + + private SettingsConfiguration() { + } + + public static SettingsConfiguration getInstance() { + if (instance == null) { + instance = new SettingsConfiguration(); + loadConfig("./settings.properties"); + } + return instance; + } + + public static SettingsConfiguration getInstance(String path) { + if (instance == null) { + instance = new SettingsConfiguration(); + } + loadConfig(path); + return instance; + } + + private static void loadConfig(String path) { + File file = new File(path); + try { + Configurations configs = new Configurations(); + config = configs.properties(file); + } catch (ConfigurationException cex) { + System.out.println(cex); + } + } + + public void loadDefault() { + loadConfig("./settings.properties"); + } + + public Metaphor getMetaphor() { + String metaphor = config.getString("metaphor", "rdr"); + switch (metaphor) { + case "city": + return Metaphor.CITY; + default: + return Metaphor.RD; + } + } + + public String getOutputPath() { + return config.getString("output.path", "./output/"); + } + + public String getRepositoryName() { + return config.getString("history.repository_name", ""); + } + + public String getRepositoryOwner() { + return config.getString("history.repository_owner", ""); + } + + public String getDatabaseName() { + return config.getString("database_name", "../databases/graph.db"); + } + + public OutputFormat getOutputFormat() { + switch (config.getString("output.format", "x3d")) { + case "aframe": + return OutputFormat.AFrame; + default: + return OutputFormat.X3D; + } + } + + public String getBuildingTypeAsString() { + return config.getString("city.building_type", "original"); + } + + public BuildingType getBuildingType() { + String value = config.getString("city.building_type", "original"); + switch (value) { + case "panels": + return BuildingType.CITY_PANELS; + case "bricks": + return BuildingType.CITY_BRICKS; + case "floor": + return BuildingType.CITY_FLOOR; + default: + return BuildingType.CITY_ORIGINAL; + } + } + + public Schemes getScheme() { + String value = config.getString("city.scheme", "types"); + switch (value) { + case "visibility": + return Schemes.VISIBILITY; + default: + return Schemes.TYPES; + } + } + + public ClassElementsModes getClassElementsMode() { + String value = config.getString("city.class_elements_mode", "methods_and_attributes"); + switch (value) { + case "methods_only": + return ClassElementsModes.METHODS_ONLY; + case "attributes_only": + return ClassElementsModes.ATTRIBUTES_ONLY; + default: + return ClassElementsModes.METHODS_AND_ATTRIBUTES; + } + } + + public ClassElementsSortModesCoarse getClassElementsSortModeCoarse() { + String value = config.getString("city.class_elements_sort_mode_coarse", "methods_first"); + switch (value) { + case "unsorted": + return ClassElementsSortModesCoarse.UNSORTED; + case "attributes_first": + return ClassElementsSortModesCoarse.ATTRIBUTES_FIRST; + default: + return ClassElementsSortModesCoarse.METHODS_FIRST; + } + } + + public ClassElementsSortModesFine getClassElementsSortModeFine() { + String value = config.getString("city.elements_sort_mode_fine", "scheme"); + switch (value) { + case "unsorted": + return ClassElementsSortModesFine.UNSORTED; + case "alphabetically": + return ClassElementsSortModesFine.ALPHABETICALLY; + case "nos": + return ClassElementsSortModesFine.NOS; + default: + return ClassElementsSortModesFine.SCHEME; + } + } + + public boolean isClassElementsSortModeFineDirectionReversed() { + return config.getBoolean("city.class_elements_sort_mode_fine_direction_reversed", false); + } + + public boolean isShowBuildingBase() { + return config.getBoolean("city.building_base", true); + } + + public Layout getBrickLayout() { + String brickLayout = config.getString("city.brick.layout", "progressive"); + switch (brickLayout) { + case "straight": + return Layout.STRAIGHT; + case "balanced": + return Layout.BALANCED; + default: + return Layout.PROGRESSIVE; + } + } + + public double getBrickSize() { + return config.getDouble("city.brick.size", 1.0); + } + + public double getBrickHorizontalMargin() { + return config.getDouble("city.brick.horizontal_margin", 0.5); + } + + public double getBrickHorizontalGap() { + return config.getDouble("city.brick.horizontal_gap", 0.2); + } + + public double getBrickVerticalMargin() { + return config.getDouble("city.brick.vertical_margin", 0.2); + } + + public double getBrickVerticalGap() { + return config.getDouble("city.brick.vertical_gap", 0.2); + } + + public boolean isShowAttributesAsCylinders() { + return config.getBoolean("city.show_attributes_as_cylinders", true); + } + + public SeparatorModes getPanelSeparatorMode() { + String value = config.getString("city.panel_separator_mode", "separator"); + switch (value) { + case "none": + return SeparatorModes.NONE; + case "gap": + return SeparatorModes.GAP; + default: + return SeparatorModes.SEPARATOR; + } + } + + public int[] getPanelHeightTresholdNos() { + int[] defaultValue = { 3, 6, 12, 24, 48, 96, 144, 192, 240 }; + String[] result = config.getStringArray("city.panel.height_treshold_nos"); + if (result.length == 0) { + return defaultValue; + } else { + int[] value = new int[result.length]; + for (int i = 0; i < result.length; i++) { + try { + value[i] = Integer.parseInt(result[i]); + System.out.print(value[i] + " "); + } catch(NumberFormatException e) { + return defaultValue; + } + + } + return value; + } + } + + public double getPanelHeightUnit() { + return config.getDouble("city.panel.height_unit", 0.5); + } + + public double getPanelHorizontalMargin() { + return config.getDouble("city.panel.horizontal_margin", 0.5); + } + + public double getPanelVerticalMargin() { + return config.getDouble("city.panel.vertical_margin", 0.25); + } + + public double getPanelVerticalGap() { + return config.getDouble("city.panel.vertical_gap", 0.125); + } + + public double getPanelSeparatorHeight() { + return config.getDouble("city.panel.separator_height", 0.125); + } + + public BuildingMetric getOriginalBuildingMetric() { + String value = config.getString("city.original_building_metric", "none"); + switch (value) { + case "nos": + return BuildingMetric.NOS; + default: + return BuildingMetric.NONE; + } + } + + public double getWidthMin() { + return config.getDouble("city.width_min", 1.0); + } + + public double getHeightMin() { + return config.getDouble("city.height_min", 1.0); + } + + public double getBuildingHorizontalMargin() { + return config.getDouble("city.building.horizontal_margin", 3.0); + } + + public double getBuildingHorizontalGap() { + return config.getDouble("city.building.horizontal_gap", 3.0); + } + + public double getBuildingVerticalMargin() { + return config.getDouble("city.building.vertical_margin", 1.0); + } + + public String getPackageColorHex() { + return config.getString("city.package.color_start", "#969696"); + } + + public Color getPackageColorStart() { + return getColor(config.getString("city.package.color_start", "#969696")); + } + + public Color getPackageColorEnd() { + return getColor(config.getString("city.package.color_end", "#f0f0f0")); + } + + public String getClassColorHex() { + return config.getString("city.class.color", "#353559"); + } + + public Color getClassColorStart() { + return getColor(config.getString("city.class.color_start", "#131615")); + } + + public Color getClassColorEnd() { + return getColor(config.getString("city.class.color_end", "#00ff00")); + } + + public Color getClassColor() { + return getColor(config.getString("city.class.color", "#353559")); + } + + public Color getDynamicClassColorStart() { + return getColor(config.getString("city.dynamic.class.color_start", "#fa965c")); + } + + public Color getDynamicClassColorEnd() { + return getColor(config.getString("city.dynamic.class.color_end", "#feb280")); + } + + public Color getDynamicMethodColor() { + return getColor(config.getString("city.dynamic.method.color", "#735eb9")); + } + + public Color getDynamicPackageColorStart() { + return getColor(config.getString("city.dynamic.package.color_start", "#23862c")); + } + + public Color getDynamicPackageColorEnd() { + return getColor(config.getString("city.dynamic.package.color_end", "#7bcd8d")); + } + + public Color getCityColor(String name) { + return getColor(getCityColorHex(name)); + } + + public String getCityColorHex(String name) { + String color = name.toLowerCase(); + String defaultColor = ""; + switch (name) { + case "aqua": + defaultColor = "#99CCFF"; break; + case "blue": + defaultColor = "#99FFCC"; break; + case "light_green": + defaultColor = "#CCFF99"; break; + case "dark_green": + defaultColor = "#99FF99"; break; + case "yellow": + defaultColor = "#FFFF99"; break; + case "orange": + defaultColor = "#FFCC99"; break; + case "red": + defaultColor = "#FF9999"; break; + case "pink": + defaultColor = "#FF99FF"; break; + case "violet": + defaultColor = "#9999FF"; break; + case "light_grey": + defaultColor = "#CCCCCC"; break; + case "dark_grey": + defaultColor = "#999999"; break; + case "white": + defaultColor = "#FFFFFF"; break; + case "black": + defaultColor = "#000000"; break; + } + return config.getString("city.color." + color, defaultColor); + } + + public String getCityColorAsPercentage(String name) { + return getColorFormatted(getCityColor(name)); + } + + public double getRDDataFactor() { + return config.getDouble("rd.data_factor", 4.0); + } + + public double getRDMethodFactor() { + return config.getDouble("rd.method_factor", 1.0); + } + + public double getRDHeight() { + return config.getDouble("rd.height", 1.0); + } + + public int getRDHeightBoost() { + return config.getInt("rd.height_boost", 8); + } + + public float getRDHeightMultiplicator() { + return (float)config.getDouble("rd.height_multiplicator", 50.0); + } + + public double getRDRingWidth() { + return config.getDouble("rd.ring_width", 2.0); + } + + public double getRDRingWidthMD() { + return config.getDouble("rd.ring_width_md", 0); + } + + public double getRDRingWidthAD() { + return config.getDouble("rd.ring_width_ad", 0); + } + + public double getRDMinArea() { + return config.getDouble("rd.min_area", 10.0); + } + + public double getRDNamespaceTransparency() { + return config.getDouble("rd.namespace_transparency", 0); + } + + public double getRDClassTransparency() { + return config.getDouble("rd.class_transparency", 0); + } + + public double getRDMethodTransparency() { + return config.getDouble("rd.method_transparency", 0); + } + + public double getRDDataTransparency() { + return config.getDouble("rd.data_transparency", 0); + } + + public Color getRDClassColor() { + return getColor(getRDClassColorHex()); + } + + public String getRDClassColorHex() { + return config.getString("rd.color.class", "#353559"); + } + + public String getRDClassColorAsPercentage() { + return getColorFormatted(getRDClassColor()); + } + + public Color getRDDataColor() { + return getColor(getRDDataColorHex()); + } + + public String getRDDataColorHex() { + return config.getString("rd.color.data", "#fffc19"); + } + + public String getRDDataColorAsPercentage() { + return getColorFormatted(getRDDataColor()); + } + + public Color getRDMethodColor() { + return getColor(getRDMethodColorHex()); + } + + public String getRDMethodColorHex() { + return config.getString("rd.color.method", "#1485cc"); + } + + public String getRDMethodColorAsPercentage() { + return getColorFormatted(getRDMethodColor()); + } + + public Color getRDNamespaceColor() { + return getColor(getRDNamespaceColorHex()); + } + + public String getRDNamespaceColorHex() { + return config.getString("rd.color.namespace", "#969696"); + } + + public String getRDNamespaceColorAsPercentage() { + return getColorFormatted(getRDNamespaceColor()); + } + + public boolean isMethodDisks() { + return config.getBoolean("rd.method_disks", false); + } + + public boolean isDataDisks() { + return config.getBoolean("rd.data_disks", false); + } + + public boolean isMethodTypeMode() { + return config.getBoolean("rd.method_type_mode", false); + } + + private String getColorFormatted(Color color) { + double r = color.getRed() / 255.0; + double g = color.getGreen() / 255.0; + double b = color.getBlue() / 255.0; + return r + " " + g + " " + b; + } + + private Color getColor(String hex) { + return Color.decode(hex); + } + + public static enum OutputFormat { + X3D, AFrame; + } + + /** + * Sets in which way the Historic Evolution + * of the analyzed Software should be represented, + * it can either be in a static or dynamic way + */ + + public static enum BuildingType{ + CITY_ORIGINAL, CITY_PANELS, CITY_BRICKS, CITY_FLOOR; + } + + /** + * Defines how the methods and attributes are sorted and colored in the city + * model. + * + * @see CitySettings#SET_SCHEME SET_SCHEME + */ + public static enum Schemes { + /** + * The class elements are sorted and colored corresponding to there + * visibility modifiers. + * + * @see SortPriorities_Visibility + */ + VISIBILITY, + + /** + * The class elements are sorted and colored associated to + * type/functionality of the method. + * + * @see Methods.SortPriorities_Types + * @see Attributes.SortPriorities_Types + */ + TYPES; + }; + + /** + * Defines which elements of a class are to show. + * + * @see CitySettings#SET_CLASS_ELEMENTS_MODE SET_CLASS_ELEMENTS_MODE + */ + public static enum ClassElementsModes { + METHODS_ONLY, ATTRIBUTES_ONLY, METHODS_AND_ATTRIBUTES; + } + + /** + * Defines which how the elements of a class are sorted. + * + * @see CitySettings#SET_CLASS_ELEMENTS_SORT_MODE_COARSE + * SET_CLASS_ELEMENTS_SORT_MODE_COARSE + */ + public static enum ClassElementsSortModesCoarse { + UNSORTED, ATTRIBUTES_FIRST, METHODS_FIRST; + } + + /** + * A list of types of a method with the associated priority value.
+ * Highest priority/smallest number is placed on the bottom, lowest on top. + * + * @see #SET_CLASS_ELEMENTS_SORT_MODE_FINE SET_CLASS_ELEMENTS_SORT_MODE_FINE + * @see SortPriorities_Visibility + * @see Methods.SortPriorities_Types + * @see Attributes.SortPriorities_Types + */ + public static enum ClassElementsSortModesFine { + /** Class elements won't be sorted. */ + UNSORTED, + + /** Methods will be sorted according to the name. */ + ALPHABETICALLY, + + /** + * Methods will be sorted according to the active + * {@link CitySettings#SET_CLASS_ELEMENTS_SORT_MODE_FINE + * SET_CLASS_ELEMENTS_SORT_MODE_FINE}. + */ + SCHEME, + + /** Methods will be sorted according to there number of statements. */ + NOS; + } + + /** + * A list of visibility modifiers of a method with the associated priority + * value.
+ * Highest priority/smallest number is placed on the bottom, lowest on top. + * + * @see #SET_CLASS_ELEMENTS_SORT_MODE_FINE SET_CLASS_ELEMENTS_SORT_MODE_FINE + * @see ClassElementsSortModesFine + * + */ + public static enum SortPriorities_Visibility {; + public static int PRIVATE = 1; + public static int PROTECTED = 2; + public static int PACKAGE = 3; + public static int PUBLIC = 4; + } + + public static enum Methods {; + + /** + * A list of types of a method with the associated priority value.
+ * Highest priority/smallest number is placed on the bottom, lowest on + * top. + * + * @see CitySettings#SET_CLASS_ELEMENTS_SORT_MODE_FINE + * SET_CLASS_ELEMENTS_SORT_MODE_FINE + * @see ClassElementsSortModesFine + * @see SortPriorities_Visibility + */ + public static enum SortPriorities_Types {; + + /** + * Method is a constructor. + */ + public static int CONSTRUCTOR = 1; + + /** + * The name of the method begins with "get". + */ + public static int GETTER = 2; + + /** + * The name of the method begins with "set". + */ + public static int SETTER = 3; + + /** + * Method has a {@code static} modifier. + */ + public static int STATIC = 4; + + /** + * Method has an {@code abstract} modifier. + */ + public static int ABSTRACT = 5; + + /** + * Every other type that isn't specified by the other constants in + * this field. + */ + public static int LEFTOVER = 6; + } + + } + + public static enum Attributes {; + + /** + * A list of types of a method with the associated priority value.
+ * Highest priority/smallest number is placed on the bottom, lowest on + * top. + * + * @see CitySettings#SET_CLASS_ELEMENTS_SORT_MODE_FINE + * SET_CLASS_ELEMENTS_SORT_MODE_FINE + * @see ClassElementsSortModesFine + */ + public static enum SortPriorities_Types {; + + /** Type is a primitive like {@code boolean}, {@code int}. */ + public static int PRIMITVE = 1; + + /** Type is a (Non-wrapper) class, collection, etc. */ + public static int COMPLEX = 2; + + } + + } + + public static enum Bricks {; + + /** + * Defines the layout for the BuildingSegments of the city model, which + * represents the methods and/or attributes of a class. + * + * @see CitySettings#SET_BRICK_LAYOUT SET_BRICK_LAYOUT + */ + public static enum Layout { + + /** + * One-dimensional bricks layout, where the segments simply are + * placed on top of the other. + */ + STRAIGHT, + + /** + * Three-dimensional brick layout, where the base area is computed + * depending on the {@link CitySettings#SET_CLASS_ELEMENTS_MODE + * SET_CLASS_ELEMENTS_MODE}.
+ * If only methods are shown, the base area is computed by the + * number of attributes and vice versa.
+ * In case of methods and attributes are shown, the base area is + * computed by the sum of the numbers of attributes and methods + * inside the class. + *

+ * When {@link CitySettings#SET_CLASS_ELEMENTS_MODE + * SET_CLASS_ELEMENTS_MODE} is set to + * {@code METHODS_AND_ATTRIBUTES}, the {@code BALANCED} layout and + * {@link Layout#PROGRESSIVE PROGRESSIVE} layout are identical. + */ + BALANCED, + + /** + * Three-dimensional brick layout, where the base area is computed + * depending on the {@link CitySettings#SET_CLASS_ELEMENTS_MODE + * SET_CLASS_ELEMENTS_MODE}.
+ * If only methods are shown, the base area is computed by the + * number of methods and vice versa. So the aspect lies on only one + * type of element of a class and is visualized. + *

+ * When {@link CitySettings#SET_CLASS_ELEMENTS_MODE + * SET_CLASS_ELEMENTS_MODE} is set to + * {@code METHODS_AND_ATTRIBUTES}, the {@link Layout#BALANCED + * PROGRESSIVE} layout and {@code PROGRESSIVE} layout are identical. + */ + PROGRESSIVE; + + } + } + + public enum Panels { + ; + + /** + * Defines the the space between the panels.
+ * The panels can either touch each other without a gap, leave a gap + * between them, or fill the space with a separator of a defined color. + * + * @see CitySettings#SET_PANEL_SEPARATOR_MODE SET_PANEL_SEPARATOR_MODE + */ + public static enum SeparatorModes { + + /** + * No space between the panels and they are placed on top of each + * other. + */ + NONE, + + /** + * The panels have a free space between them and don't touch each + * other. + * + * @see Panels#PANEL_VERTICAL_GAP PANEL_VERTICAL_GAP + */ + GAP, + + /** + * Between the panels separators are placed with a fix height and + * color. + * + * @see Panels#SEPARATOR_HEIGHT SEPARATOR_HEIGHT + */ + SEPARATOR; + + } + } + + public static enum Original { + ; + public static enum BuildingMetric { + NONE, + NOS; + } + } + + public static enum Metaphor { + RD, CITY + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java new file mode 100644 index 000000000..eb9d03b51 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java @@ -0,0 +1,247 @@ +package org.getaviz.generator.city; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.neo4j.graphdb.Direction; +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.Relationship; +import org.getaviz.generator.SettingsConfiguration; +import org.getaviz.generator.SettingsConfiguration.OutputFormat; +import org.getaviz.generator.city.m2m.BuildingSegmentComparator; +import org.getaviz.generator.city.m2m.RGBColor; +import org.getaviz.lib.database.Labels; +import org.getaviz.lib.database.Rels; + +public class CityUtils { + + private static SettingsConfiguration config = SettingsConfiguration.getInstance(); + public static String getFamixClassString(final String className) { + String s = className.substring(0, 5) + "." + className.substring(5, className.length()); + if (className.endsWith("Impl")) + s = s.substring(0, s.length() - 4); + return s; + } + + /** + * Creates the color gradient for the packages depending on your hierarchy + * level. + * + * @param start + * RGBColor + * @param end + * RGBColor + * @param maxLevel + * int + * @return color range + */ + public static RGBColor[] createPackageColorGradient(final RGBColor start, final RGBColor end, final int maxLevel) { + int steps = maxLevel - 1; + if (maxLevel == 1) { + steps++; + } + double r_step = (end.r() - start.r()) / steps; + double g_step = (end.g() - start.g()) / steps; + double b_step = (end.b() - start.b()) / steps; + + RGBColor[] colorRange = new RGBColor[maxLevel]; + double newR, newG, newB; + for (int i = 0; i < maxLevel; ++i) { + newR = start.r() + i * r_step; + newG = start.g() + i * g_step; + newB = start.b() + i * b_step; + + colorRange[i] = new RGBColor(newR, newG, newB); + } + + return colorRange; + } + + public static void setBuildingSegmentColor(final Node segment) { + String color = ""; + Node entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + String visibility = ""; + if(entity.hasProperty("visibility")) { + visibility = (String)(entity.getProperty("visibility")); + } + if (config.getOutputFormat() == OutputFormat.AFrame) { + switch (config.getScheme()) { + case VISIBILITY: + if (visibility.equals("public")) { + color = config.getCityColorHex("dark_green"); + } else if (visibility.equals("protected")) { + color = config.getCityColorHex("yellow"); + } else if (visibility.equals("private")) { + color = config.getCityColorHex("red"); + } else { + // Package visibility or default + color = config.getCityColorHex("blue"); + } + segment.setProperty("color", color); + break; + case TYPES: + if(entity.hasLabel(Labels.Field)) { + setAttributeColor(segment); + } else if(entity.hasLabel(Labels.Method)) { + setMethodColor(segment); + } else { + segment.setProperty("color", config.getCityColorHex("blue")); + } + default: + segment.setProperty("color", config.getCityColorHex("blue")); + } + } else { + switch (config.getScheme()) { + case VISIBILITY: + if (visibility.equals("public")) { + color = config.getCityColorAsPercentage("dark_green"); + } else if (visibility.equals("protected")) { + color = config.getCityColorAsPercentage("yellow"); + } else if (visibility.equals("private")) { + color = config.getCityColorAsPercentage("red"); + } else { + // Package visibility or default + color = config.getCityColorAsPercentage("blue"); + } + segment.setProperty("color", color); + break; + case TYPES: + if(entity.hasLabel(Labels.Field)) { + setAttributeColor(segment); + } else if(entity.hasLabel(Labels.Method)) { + setMethodColor(segment); + } else { + segment.setProperty("color", config.getCityColorAsPercentage("blue")); + } + break; + default: + segment.setProperty("color", config.getCityColorAsPercentage("blue")); + } + } + } + + private static void setAttributeColor(final Node segment) { + String color = ""; + Node entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + boolean isPrimitive = false; + if(entity.hasRelationship(Rels.OF_TYPE)) { + Node declaredType = entity.getSingleRelationship(Rels.OF_TYPE, Direction.OUTGOING).getEndNode(); + if (declaredType.hasLabel(Labels.Primitive)) { + isPrimitive = true; + } + } + if (config.getOutputFormat() == OutputFormat.AFrame) { + if (isPrimitive) { + color = config.getCityColorHex("pink"); + } else { // complex type + color = config.getCityColorHex("aqua"); + } + } else { + if (isPrimitive) { + color = config.getCityColorAsPercentage("pink"); + } else { // complex type + color = config.getCityColorAsPercentage("aqua"); + } + } + segment.setProperty("color", color); + } + + private static void setMethodColor(final Node segment) { + Node entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + String color = ""; + boolean isStatic = false; + if(entity.hasProperty("static")) { + isStatic = (Boolean)entity.getProperty("static"); + } + boolean isAbstract = false; + if(entity.hasProperty("abstract")) { + isAbstract = (Boolean)entity.getProperty("abstract"); + } + if (config.getOutputFormat() == OutputFormat.AFrame) { + // if (bs.getMethodKind().equals("constructor")) { + if (entity.hasLabel(Labels.Constructor)) { + color = config.getCityColorHex("red"); + } else if (entity.hasLabel(Labels.Getter)) { + color = config.getCityColorHex("light_green"); + } else if (entity.hasLabel(Labels.Setter)) { + color = config.getCityColorHex("dark_green"); + } else if (isStatic) { + color = config.getCityColorHex("yellow"); + } else if (isAbstract) { + color = config.getCityColorHex("orange"); + } else { + // Default + color = config.getCityColorHex("violet"); + } + } else { + // if (bs.getMethodKind().equals("constructor")) { + if (entity.hasLabel(Labels.Constructor)) { + color = config.getCityColorAsPercentage("red"); + } else if (entity.hasLabel(Labels.Getter)) { + color = config.getCityColorAsPercentage("light_green"); + } else if (entity.hasLabel(Labels.Setter)) { + color = config.getCityColorAsPercentage("dark_green"); + } else if (isStatic) { + color = config.getCityColorAsPercentage("yellow"); + } else if (isAbstract) { + color = config.getCityColorAsPercentage("orange"); + } else { + // Default + color = config.getCityColorAsPercentage("violet"); + } + } + segment.setProperty("color", color); + } + + /** + * Sorting the {@link BuildingSegment}s with help of + * {@link BuildingSegmentComparator} based on sorting settings in + * {@link CitySettings}. + * + * @param bsList + * BuildingSegments which are to be sorted. + * + */ + + public static void sortBuildingSegments(final List buildingSegments) { + final List sortedList = new ArrayList(buildingSegments.size()); + for (Node segment : buildingSegments) + sortedList.add(new BuildingSegmentComparator(segment)); + Collections.sort(sortedList); + buildingSegments.clear(); + for (BuildingSegmentComparator bsc : sortedList) + buildingSegments.add(bsc.getSegment()); + } + + public static List getChildren(Node parent) { + ArrayList children = new ArrayList(); + Iterable childrenRels = parent.getRelationships(Rels.CONTAINS, Direction.OUTGOING); + for (Relationship relationship : childrenRels) { + children.add(relationship.getEndNode()); + } + return children; + } + + public static List getMethods(Node building) { + ArrayList methods = new ArrayList(); + for (Node child : getChildren(building)) { + Node entity = child.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + if (entity.hasLabel(Labels.Method)) { + methods.add(child); + } + } + return methods; + } + + public static List getData(Node building) { + ArrayList data = new ArrayList(); + for (Node child : getChildren(building)) { + Node entity = child.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + if (entity.hasLabel(Labels.Field)) { + data.add(child); + } + } + return data; + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java new file mode 100644 index 000000000..6e2877a79 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java @@ -0,0 +1,111 @@ +package org.getaviz.generator.city.m2m; + +import java.util.List; + +import org.neo4j.graphdb.Direction; +import org.neo4j.graphdb.GraphDatabaseService; +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.Result; +import org.getaviz.generator.SettingsConfiguration; +import org.getaviz.generator.city.CityUtils; +import org.getaviz.lib.database.Database; +import org.getaviz.lib.database.Labels; +import org.getaviz.lib.database.Rels; + +public class BrickLayout { + private static SettingsConfiguration config = SettingsConfiguration.getInstance(); + private static GraphDatabaseService graph = Database.getInstance(); + + public static void brickLayout(Node model) { + Result buildings = graph.execute("MATCH (n:City:Model)-[:CONTAINS*]->(m:Building) WHERE ID(n) = " + model.getId() + " RETURN m"); + while(buildings.hasNext()) { + Node building = (Node)buildings.next().get("m"); + separateBuilding(building); + } + } + + // Builds up the bricks for a specific given building/class + private static void separateBuilding(Node building) { + // Don't build up bricks, if this building isn't visualized or isn't positioned + // (e.g. is an inner classes) + if (building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).getEndNode() == null) { + return; + } + + // variables for brick algorithm + int sideCapacity, layerCapacity, brickIndexWithinSide, brickIndexWithinLayer, sideIndex, // side index - + // north,east,... + bsPosIndex_X, bsPosIndex_Y, bsPosIndex_Z; + double b_lowerLeftX, b_upperY, b_lowerLeftZ; + sideCapacity = (Integer) building.getProperty("sideCapacity"); + List classElements = null; + switch (config.getClassElementsMode()) { + case ATTRIBUTES_ONLY: + classElements = CityUtils.getData(building); + CityUtils.sortBuildingSegments(CityUtils.getData(building)); + break; + case METHODS_ONLY: + classElements = CityUtils.getMethods(building); + CityUtils.sortBuildingSegments(CityUtils.getMethods(building)); + break; + default: + classElements = CityUtils.getChildren(building); + break; + } + CityUtils.sortBuildingSegments(classElements); + // coordinates of edges of building + Node position = building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).getEndNode(); + b_lowerLeftX = (Double)position.getProperty("x") - (Double)building.getProperty("width") / 2; + b_lowerLeftZ = (Double)position.getProperty("z") - (Double)building.getProperty("length") / 2; + b_upperY = (Double)position.getProperty("y") + (Double)building.getProperty("height") / 2; + // System.out.println(""); + // set positions for all methods in current class + for (int i = 0; i < classElements.size(); ++i) { + if (sideCapacity <= 1) { + layerCapacity = 1; + brickIndexWithinSide = 0; + sideIndex = 0; + } else { + layerCapacity = (sideCapacity - 1) * 4; + brickIndexWithinLayer = i % layerCapacity; + brickIndexWithinSide = brickIndexWithinLayer % (sideCapacity - 1); + sideIndex = brickIndexWithinLayer / (sideCapacity - 1); + } + // System.out.println(bs.getType() + " " + bs.getValue() + " " + + // bs.getModifiers() + " " + bs.getNumberOfStatements()); + // calculating position for brick + switch (sideIndex) { + case 0: + bsPosIndex_X = brickIndexWithinSide; + bsPosIndex_Z = 0; + break; + case 1: + bsPosIndex_X = sideCapacity - 1; + bsPosIndex_Z = brickIndexWithinSide; + break; + case 2: + bsPosIndex_X = sideCapacity - brickIndexWithinSide - 1; + bsPosIndex_Z = sideCapacity - 1; + break; + default: + bsPosIndex_X = 0; + bsPosIndex_Z = sideCapacity - brickIndexWithinSide - 1; + break; + } + bsPosIndex_Y = i / layerCapacity; + + // setting position for brick + Node pos = graph.createNode(Labels.Position, Labels.City, Labels.Dummy); + classElements.get(i).createRelationshipTo(pos, Rels.HAS); + pos.setProperty("x", b_lowerLeftX + config.getBrickHorizontalMargin() + + (config.getBrickHorizontalGap() + config.getBrickSize()) * bsPosIndex_X + + config.getBrickSize() * 0.5); + pos.setProperty("y", b_upperY + config.getBrickVerticalMargin() + + (config.getBrickVerticalGap() + config.getBrickSize()) * bsPosIndex_Y + + config.getBrickSize() * 0.5); + pos.setProperty("z", b_lowerLeftZ + config.getBrickHorizontalMargin() + + (config.getBrickHorizontalGap() + config.getBrickSize()) * bsPosIndex_Z + + config.getBrickSize() * 0.5); + } + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java new file mode 100644 index 000000000..b30eade2a --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java @@ -0,0 +1,227 @@ +package org.getaviz.generator.city.m2m; + +import org.neo4j.graphdb.Direction; +import org.neo4j.graphdb.Node; +import org.getaviz.generator.SettingsConfiguration; +import org.getaviz.generator.SettingsConfiguration.Attributes; +import org.getaviz.generator.SettingsConfiguration.Methods; +import org.getaviz.generator.SettingsConfiguration.SortPriorities_Visibility; +import org.getaviz.lib.database.Labels; +import org.getaviz.lib.database.Rels; + +public class BuildingSegmentComparator implements Comparable { + private Node segment; + private Node relatedEntity; + // Temporary attribute to use db and famix in same transformation + private int coarseValue; // compares class elements (methods <-> attributes) + private int fineValue; // compared after coarseValue + private int finerValue; // compared after finevalue, if it was equal + private SettingsConfiguration config = SettingsConfiguration.getInstance(); + + public BuildingSegmentComparator(final Node segment) { + this.segment = segment; + this.relatedEntity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + setCoarseValue(); + switch (config.getClassElementsSortModeFine()) { + case ALPHABETICALLY: // names compared directly in compareTo-method + break; + case SCHEME: + switch (config.getScheme()) { + case VISIBILITY: + fineValue = getCompValue_Visibility(relatedEntity); + break; + case TYPES: + fineValue = getCompValue_Type(relatedEntity); + break; + } + break; + case NOS: // numberOfStatements compared directly in compareTo-method + finerValue = getCompValue_Type(relatedEntity); // If NOS are equal, sort for types + break; + case UNSORTED: + break; + default: + break; + } + } + + static int getCompValue_Visibility(final String modifier) { + if (modifier.indexOf("private") >= 0) { + return SortPriorities_Visibility.PRIVATE; + } else if (modifier.indexOf("protected") >= 0) { + return SortPriorities_Visibility.PROTECTED; + } else if (modifier.indexOf("public") >= 0) { + return SortPriorities_Visibility.PUBLIC; + } else { + return SortPriorities_Visibility.PACKAGE; + } + + } + + static int getCompValue_Visibility(final Node relatedEntity) { + String visbility = (String) relatedEntity.getProperty("visibility"); + if (visbility.equals("private")) { + return SortPriorities_Visibility.PRIVATE; + } else if (visbility.equals("protected")) { + return SortPriorities_Visibility.PROTECTED; + } else if (visbility.equals("public")) { + return SortPriorities_Visibility.PUBLIC; + } else { + return SortPriorities_Visibility.PACKAGE; + } + } + + static int getCompValue_Type(final Node relatedEntity) { + if (relatedEntity.hasLabel(Labels.Field)) { + boolean isPrimitive = false; + if (relatedEntity.hasRelationship(Rels.OF_TYPE)) { + Node declaredType = relatedEntity.getSingleRelationship(Rels.OF_TYPE, Direction.OUTGOING).getEndNode(); + if (declaredType.hasLabel(Labels.Primitive)) { + isPrimitive = true; + } + } + if (isPrimitive) { + return Attributes.SortPriorities_Types.PRIMITVE; + } else { + return Attributes.SortPriorities_Types.COMPLEX; + } + } else { + boolean isStatic = false; + if (relatedEntity.hasProperty("static")) { + isStatic = (Boolean) relatedEntity.getProperty("static"); + } + boolean isAbstract = false; + if (relatedEntity.hasProperty("abstract")) { + isAbstract = (Boolean) relatedEntity.getProperty("abstract"); + } + if (relatedEntity.hasLabel(Labels.Constructor)) { + return Methods.SortPriorities_Types.CONSTRUCTOR; + } else if (relatedEntity.hasLabel(Labels.Getter)) { + return Methods.SortPriorities_Types.GETTER; + } else if (relatedEntity.hasLabel(Labels.Setter)) { + return Methods.SortPriorities_Types.SETTER; + } else if (isStatic) { + return Methods.SortPriorities_Types.STATIC; + } else if (isAbstract) { + return Methods.SortPriorities_Types.ABSTRACT; + } else { + return Methods.SortPriorities_Types.LEFTOVER; + } + } + } + + @Override + public int compareTo(final BuildingSegmentComparator comp) { + int result; + // Coarse sorting after attributes and methods if elements aren't the same type + // of class element + if (coarseValue < comp.coarseValue) + result = -1; + else if (coarseValue > comp.coarseValue) + result = 1; + else + result = 0; + + if (result != 0) + return result; + + // Sorting after fine sort mode between equal class elements types (e.g. method + // compared to method) + switch (config.getClassElementsSortModeFine()) { + case UNSORTED: + return 0; + case ALPHABETICALLY: + String name = (String) relatedEntity.getProperty("name"); + result = name.compareTo((String) comp.relatedEntity.getProperty("name")); + break; + case SCHEME: + if (fineValue < comp.fineValue) + result = -1; + else if (fineValue > comp.fineValue) + result = 1; + else + return compareNOS(comp); // Largest methods are always at the bottom in SCHEME-mode + break; + case NOS: + result = compareNOS(comp); + if (result == 0) + if (finerValue < comp.finerValue) + result = -1; + else if (finerValue > comp.finerValue) + result = 1; + else + return 0; + break; + default: + return 0; + } + + // Reverse order if setting has been made + if (config.isClassElementsSortModeFineDirectionReversed()) + return result * -1; + else + return result; + } + + /** Compares the number of statements inside the given methods. */ + private int compareNOS(final BuildingSegmentComparator comp) { + long numberOfStatements = 0; + long numberOfStatementsComp = 0; + if (relatedEntity.hasProperty("effectiveLineCount")) { + numberOfStatements = (int) relatedEntity.getProperty("effectiveLineCount"); + } + if (comp.relatedEntity.hasProperty("effectiveLineCount")) { + numberOfStatementsComp = (int) comp.relatedEntity.getProperty("effectiveLineCount"); + } + if (numberOfStatements < numberOfStatementsComp) + return 1; + else if (numberOfStatements > numberOfStatementsComp) + return -1; + else + return 0; + } + + public Node getSegment() { + return segment; + } + + /** + * Called once by constructor. Sets the coarse sort value.
+ * Made an additional method for that to make it better readable. + */ + private void setCoarseValue() { + switch (config.getClassElementsSortModeCoarse()) { + case ATTRIBUTES_FIRST: + if (relatedEntity.hasLabel(Labels.Field)) { + coarseValue = -1; + } else if (relatedEntity.hasLabel(Labels.Method)) { + coarseValue = 1; + } else { + coarseValue = 0; + } + + case METHODS_FIRST: + if (relatedEntity.hasLabel(Labels.Field)) { + coarseValue = 1; + } else if (relatedEntity.hasLabel(Labels.Method)) { + coarseValue = -1; + } else { + coarseValue = 0; + } + + break; + case UNSORTED: + coarseValue = 0; + break; + default: + if (relatedEntity.hasLabel(Labels.Field)) { + coarseValue = 1; + } else if (relatedEntity.hasLabel(Labels.Method)) { + coarseValue = -1; + } else { + coarseValue = 0; + } + + } + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend new file mode 100644 index 000000000..5ac2fbba0 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend @@ -0,0 +1,574 @@ +package org.getaviz.generator.city.m2m + +import org.neo4j.graphdb.GraphDatabaseService +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Database +import org.getaviz.lib.database.Labels +import org.getaviz.generator.SettingsConfiguration.BuildingType +import org.neo4j.graphdb.Node +import org.getaviz.generator.city.CityUtils +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.getaviz.generator.SettingsConfiguration.ClassElementsModes +import org.neo4j.graphdb.Path +import org.getaviz.generator.SettingsConfiguration.Original.BuildingMetric +import org.getaviz.generator.SettingsConfiguration.OutputFormat +import java.util.HashMap +import java.util.List +import java.util.ArrayList +import org.getaviz.generator.SettingsConfiguration.Panels.SeparatorModes +import org.apache.commons.logging.LogFactory + +class City2City { + var GraphDatabaseService graph + val config = SettingsConfiguration.instance + val log = LogFactory::getLog(class) + var RGBColor[] PCKG_colors + var RGBColor[] NOS_colors + var properties = new HashMap + var Node model + + new () { + log.info("CityModification started") + graph = Database::getInstance(config.databaseName) + var tx = graph.beginTx + try { + model = graph.findNode(Labels.Model, "building_type", config.buildingTypeAsString) + if (config.buildingType == BuildingType::CITY_BRICKS || + config.buildingType == BuildingType::CITY_PANELS) { + val buildingSegments = graph.execute( + "MATCH (n:Model:City)-[:CONTAINS*]->(m:BuildingSegment) RETURN m").map[return get("m") as Node] + buildingSegments.forEach[setBuildingSegmentAttributes] + } + + val result = graph.execute( + "MATCH p=(n:District)-[:CONTAINS*]->(m:District) WHERE NOT (m)-[:CONTAINS]->(:District) RETURN length(p) AS length ORDER BY length(p) DESC LIMIT 1") + val packageMaxLevel = (result.head.get("length") as Long).intValue + 1 + PCKG_colors = createColorGradiant(new RGBColor(config.packageColorStart), + new RGBColor(config.packageColorEnd), packageMaxLevel) + + if (config.originalBuildingMetric == BuildingMetric::NOS) { + val result2 = graph.execute("MATCH (n:Building) RETURN max(n.numberOfStatements) AS nos") + val NOS_max = result2.head.get("nos") as Integer + NOS_colors = createColorGradiant(new RGBColor(config.classColorStart), + new RGBColor(config.classColorEnd), NOS_max + 1) + } + + val districtPaths = graph.execute("MATCH p=(n:Model:City)-[:CONTAINS*]->(m:District) RETURN p").map[return get("p") as Path] + val buildingNodes = graph.execute("MATCH (n:Model:City)-[:CONTAINS*]->(m:Building) RETURN m").map[return get("m") as Node] + districtPaths.forEach[setDistrictAttributes] + buildingNodes.forEach[setBuildingAttributes] + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + val districtPaths = graph.execute("MATCH (n:Model:City)-[:CONTAINS*]->(m:District) RETURN m").map[return get("m") as Node] + val buildingNodes = graph.execute("MATCH (n:Model:City)-[:CONTAINS*]->(m:Building) RETURN m").map[return get("m") as Node] + districtPaths.forEach[ + var width = 0.0 + var length = 0.0 + if(hasProperty("width")) { + width = getProperty("width") as Double + } + if(hasProperty("length")) { + length = getProperty("length") as Double + } + val double[] array = #[width, length] + properties.put(id, array) + ] + buildingNodes.forEach[ + var width = 0.0 + var length = 0.0 + if(hasProperty("width")) { + width = getProperty("width") as Double + } + if(hasProperty("length")) { + length = getProperty("length") as Double + } + val double[] array = #[width, length] + properties.put(id, array)] + tx.success + } finally { + tx.close + } + CityLayout::cityLayout(model, properties) + tx = graph.beginTx + try { + val buildingNodes = graph.execute("MATCH (n:Model:City)-[:CONTAINS*]->(m:Building) RETURN m").map[return get("m") as Node] + switch (config.buildingType) { + case CITY_BRICKS: + BrickLayout.brickLayout(model) // Layout for buildingSegments + case CITY_PANELS: + buildingNodes.forEach[setBuildingSegmentPositions] + case CITY_FLOOR: { + buildingNodes.forEach[calculateSegments] + } + default: { + } // CityDebugUtils.infoEntities(cityRoot.document.entities, 0, true, true) + } + tx.success + } finally { + tx.close + } + log.info("CityModification finished") + } + + def private void setDistrictAttributes(Path districtPath) { + var color = "" + val district = districtPath.endNode + district.setProperty("height", config.heightMin) + if (config.outputFormat == OutputFormat::AFrame) { + color = config.packageColorHex + } else { + color = PCKG_colors.get(districtPath.length - 1).asPercentage + } + district.setProperty("color", color) + } + + def private setBuildingAttributes(Node building) { + val entity = building.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val subElements = entity.getRelationships(Rels.DECLARES, Direction.OUTGOING).map[return endNode as Node] + val methodCounter = subElements.filter [hasLabel(Labels.Method)].size + val dataCounter = subElements.filter[!entity.hasLabel(Labels.Enum) && hasLabel(Labels.Field)].size + switch (config.buildingType) { + case CITY_ORIGINAL: setBuildingAttributesOriginal(building, methodCounter, dataCounter) + case CITY_PANELS: setBuildingAttributesPanels(building, methodCounter, dataCounter) + case CITY_BRICKS: setBuildingAttributesBricks(building, methodCounter, dataCounter) + case CITY_FLOOR: setBuildingAttributesFloors(building, methodCounter, dataCounter) + } + } + + def private setBuildingAttributesOriginal(Node building, int methodCounter, int dataCounter) { + var width = 0.0 + var length = 0.0 + var height = 0.0 + var color = "" + if (dataCounter == 0) { + width = config.widthMin + length = config.widthMin + } else { + width = dataCounter + length = dataCounter + } + if (methodCounter == 0) { + height = config.heightMin + } else { + height = methodCounter + } + if (config.originalBuildingMetric == BuildingMetric::NOS) { + color = NOS_colors.get(building.getProperty("numberOfStatements") as Integer).asPercentage + } else if (config.outputFormat == OutputFormat::AFrame) { + color = config.classColorHex + } else { + color = new RGBColor(config.classColor).asPercentage + } + building.setProperty("width", width) + building.setProperty("length", length) + building.setProperty("height", height) + building.setProperty("color", color) + } + + def private setBuildingAttributesPanels(Node building, int methodCounter, int dataCounter) { + var height = 0.0 + var width = 0.0 + var length = 0.0 + var color = "" + if (config.showBuildingBase) { + height = config.heightMin + } else { + height = 0 + } + var int areaUnit = 1 + if (config.classElementsMode == ClassElementsModes::ATTRIBUTES_ONLY) { + areaUnit = methodCounter + } else { + areaUnit = dataCounter + } + if (areaUnit <= 1) { + width = config.widthMin + config.panelHorizontalMargin * 2 + length = config.widthMin + config.panelHorizontalMargin * 2 + } else { + width = config.widthMin * areaUnit + config.panelHorizontalMargin * 2 + length = config.widthMin * areaUnit + config.panelHorizontalMargin * 2 + } + if (config.outputFormat == OutputFormat::AFrame) { + color = config.classColorHex + } else { + color = new RGBColor(config.classColor).asPercentage + } + building.setProperty("height", height) + building.setProperty("width", width) + building.setProperty("length", length) + building.setProperty("color", color) + } + + def setBuildingAttributesBricks(Node building, int methodCounter, int dataCounter) { + var height = 0.0 + var width = 0.0 + var length = 0.0 + var sideCapacity = 0 + var color = "" + if (config.showBuildingBase) { + height = config.heightMin + } else { + height = 0 + } + if (config.outputFormat == OutputFormat::AFrame) { + color = config.classColorHex + } else { + color = new RGBColor(config.classColor).asPercentage; + } + // Setting width, height & sideCapacity + switch (config.brickLayout) { + case STRAIGHT: { + sideCapacity = 1; + } + case BALANCED: { + switch (config.classElementsMode) { + case ATTRIBUTES_ONLY: sideCapacity = calculateSideCapacity(methodCounter) + case METHODS_AND_ATTRIBUTES: sideCapacity = calculateSideCapacity(dataCounter + methodCounter) + default: sideCapacity = calculateSideCapacity(dataCounter) + } + } + case PROGRESSIVE: { + switch (config.classElementsMode) { + case METHODS_ONLY: sideCapacity = calculateSideCapacity(methodCounter) + case METHODS_AND_ATTRIBUTES: sideCapacity = calculateSideCapacity(dataCounter + methodCounter) + default: sideCapacity = calculateSideCapacity(dataCounter) + } + } + default: { + sideCapacity = 1; + } + } + width = config.brickSize * sideCapacity + config.brickHorizontalMargin * 2 + + config.brickHorizontalGap * (sideCapacity - 1) + length = config.brickSize * sideCapacity + config.brickHorizontalMargin * 2 + + config.brickHorizontalGap * (sideCapacity - 1) + building.setProperty("height", height) + building.setProperty("width", width) + building.setProperty("length", length) + building.setProperty("sideCapacity", sideCapacity) + building.setProperty("color", color) + } + + def void setBuildingAttributesFloors(Node building, int methodCounter, int dataCounter) { + var width = 0.0 + var length = 0.0 + var height = 0.0 + var color = "" + if (dataCounter < 2) { // pko 2016 + width = 2 // TODO in settings datei aufnehmen + length = 2 + } else { + width = Math.ceil(dataCounter / 4.0) + 1 // pko 2016 + length = Math.ceil(dataCounter / 4.0) + 1 // pko 2016 + } + if (methodCounter == 0) { + height = config.heightMin + } else { + height = methodCounter + } + if (config.outputFormat == OutputFormat::AFrame) { + color = config.classColorHex + } else { + color = 53 / 255.0 + " " + 53 / 255.0 + " " + 89 / 255.0 // pko 2016 + } + building.setProperty("width", width) + building.setProperty("length", length) + building.setProperty("height", height) + building.setProperty("color", color) + } + + def private void setBuildingSegmentAttributes(Node segment) { + switch (config.buildingType) { + case CITY_PANELS: + setBuildingSegmentAttributesPanels(segment) + case CITY_BRICKS: + setBuildingSegmentAttributesBricks(segment) + default: { + } + } + } + + def private setBuildingSegmentAttributesPanels(Node segment) { + val relatedEntity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val parent = segment.getSingleRelationship(Rels.CONTAINS, Direction.INCOMING).startNode + val childs = parent.getRelationships(Direction.OUTGOING, Rels.CONTAINS).map[return endNode] + childs.filter [ + val entity = getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + entity.hasLabel(Labels.Field) && + !entity.getSingleRelationship(Rels.DECLARES, Direction.INCOMING).startNode.hasLabel(Labels.Enum) + ].size + + var int areaUnit = 1 + if (config.classElementsMode == ClassElementsModes::ATTRIBUTES_ONLY) { + areaUnit = childs.filter [ + val entity = getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + entity.hasLabel(Labels.Method) + ].size + } else { + areaUnit = childs.filter [ + val entity = getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + entity.hasLabel(Labels.Field) && + !entity.getSingleRelationship(Rels.DECLARES, Direction.INCOMING).startNode.hasLabel(Labels.Enum) + ].size + } + var width = 0.0 + var length = 0.0 + if (areaUnit <= 1) { + width = config.widthMin + length = config.widthMin + } else { + width = config.widthMin * areaUnit + length = config.widthMin * areaUnit + } + var index = 0 + var effectiveLineCount = 0 + if(relatedEntity.hasProperty("effectiveLineCount")) { + effectiveLineCount = (relatedEntity.getProperty("effectiveLineCount") as Long).intValue + } + while (index < config.panelHeightTresholdNos.size && + effectiveLineCount >= config.panelHeightTresholdNos.get(index)) { + index = index + 1 + } + segment.setProperty("width", width) + segment.setProperty("length", length) + segment.setProperty("height", config.panelHeightUnit * (index + 1)) + CityUtils.setBuildingSegmentColor(segment); + } + + def private setBuildingSegmentAttributesBricks(Node segment) { + segment.setProperty("width", config.brickSize) + segment.setProperty("height", config.brickSize) + segment.setProperty("length", config.brickSize) + CityUtils.setBuildingSegmentColor(segment); + } + + def private void setBuildingSegmentPositions(Node building) { + // Sorting elements + var List classElements = new ArrayList + switch (config.classElementsMode) { + case ATTRIBUTES_ONLY: + classElements += CityUtils.getData(building) + case METHODS_AND_ATTRIBUTES: { + classElements += CityUtils.getData(building) + classElements += CityUtils.getMethods(building) + } + default: + classElements += CityUtils.getMethods(building) + } + CityUtils.sortBuildingSegments(classElements) + + // upper bound of the panel below the actual panel inside the loop + val position = building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + var lowerBsPosY = position.getProperty("y") as Double + building.getProperty("height") as Double / 2 + config.panelVerticalMargin + + // Correcting the initial gap on top of building depending on SeparatorMode + if (config.panelSeparatorMode == SeparatorModes::GAP || config.panelSeparatorMode == SeparatorModes::SEPARATOR) + lowerBsPosY = lowerBsPosY - config.panelVerticalGap + // System.out.println("") + // Looping through methods of building + for (var i = 0; i < classElements.size(); i++) { + val segment = classElements.get(i) + val height = segment.getProperty("height") as Double + val width = segment.getProperty("width") as Double + // System.out.println(bs.getType() + " " + bs.getValue() + " " + bs.getModifiers() + " " + bs.getNumberOfStatements()); +// val bsPos = cityFactory.createPosition + val pos = graph.createNode(Labels.City, Labels.Position) + val x = position.getProperty("x") as Double + var double y + val z = position.getProperty("z") as Double + pos.setProperty("x", x) + pos.setProperty("z", z) + switch (config.panelSeparatorMode) { + case NONE: { // place segments on top of each other + y = lowerBsPosY + height / 2 + lowerBsPosY = y + height / 2 + } + case GAP: { // Leave a free space between segments + y = lowerBsPosY + config.panelVerticalGap + height / 2 + lowerBsPosY = y + height / 2 + } + case SEPARATOR: { // Placing additional separators + y = lowerBsPosY + height / 2 + + // Placing a separator on top of the current method if it is not last method + if (i < classElements.size() - 1) { + val sepPos = graph.createNode(Labels.City, Labels.Position) + val sepY = y + height / 2 + config.panelSeparatorHeight / 2 + sepPos.setProperty("x", x) + sepPos.setProperty("y", sepY) + sepPos.setProperty("z", z) + + // Deciding which shape the separator has to have + val nextElementType = classElements.get(i + 1).getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val segmentType = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val panelSeparator = graph.createNode(Labels.City, Labels.PanelSeparator) + panelSeparator.createRelationshipTo(sepPos, Rels.HAS) + segment.createRelationshipTo(panelSeparator, Rels.HAS) + if ((segmentType.hasLabel(Labels.Method) && nextElementType.hasLabel(Labels.Method)) || + !config.showAttributesAsCylinders) { + panelSeparator.addLabel(Labels.Box) + panelSeparator.setProperty("width", width) + panelSeparator.setProperty("length", segment.getProperty("length")) + } else { + panelSeparator.addLabel(Labels.Cylinder) + panelSeparator.setProperty("radius", width / 2) + } + + lowerBsPosY = x + config.panelSeparatorHeight / 2 + } + } + } + pos.setProperty("y", y); + segment.createRelationshipTo(pos, Rels.HAS) + } + } + + def calculateSegments(Node building) { + building.calculateFloors + building.calculateChimneys + } + + def void calculateFloors(Node building) { + val position = building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val bHeight = building.getProperty("height") as Double + val bWidth = building.getProperty("width") as Double + val bLength = building.getProperty("length") as Double + val bPosX = position.getProperty("x") as Double + val bPosY = position.getProperty("y") as Double + val bPosZ = position.getProperty("z") as Double + val floors = building.getRelationships(Rels.CONTAINS, Direction.OUTGOING).map[return endNode].filter[(hasLabel(Labels.Floor))] + val floorNumber = floors.length + var floorCounter = 0 + for (floor : floors) { + floorCounter++ + floor.setProperty("height", bHeight / ( floorNumber + 2 ) * 0.80) + floor.setProperty("width", bWidth * 1.1) + floor.setProperty("length", bLength * 1.1) + var color = 20 / 255.0 + " " + 133 / 255.0 + " " + 204 / 255.0 + if (config.outputFormat == OutputFormat::AFrame) { + color = "#1485CC" + } + floor.setProperty("color", color) + val floorPosition = graph.createNode(Labels.City, Labels.Position) + floorPosition.setProperty("x", bPosX) + floorPosition.setProperty("y", (bPosY - ( bHeight / 2) ) + bHeight / ( floorNumber + 2 ) * floorCounter) + floorPosition.setProperty("z", bPosZ) + floor.createRelationshipTo(floorPosition, Rels.HAS) + } + } + + def void calculateChimneys(Node building) { + val position = building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val bHeight = building.getProperty("height") as Double + val bWidth = building.getProperty("width") as Double + val bPosX = position.getProperty("x") as Double + val bPosY = position.getProperty("y") as Double + val bPosZ = position.getProperty("z") as Double + val chimneys = building.getRelationships(Rels.CONTAINS, Direction.OUTGOING).map[return endNode].filter[(hasLabel(Labels.Chimney))] + + // val chimneyNumber = chimneys.length + var courner1 = newArrayList() + var courner2 = newArrayList() + var courner3 = newArrayList() + var courner4 = newArrayList() + + var chimneyCounter = 0 + for (chimney : chimneys) { + chimney.setProperty("height", 1.0) + chimney.setProperty("width", 0.5) + chimney.setProperty("length", 0.5) + var color = 255 / 255.0 + " " + 252 / 255.0 + " " + 25 / 255.0 + if (config.outputFormat == OutputFormat::AFrame) { + color = "#FFFC19" + } + chimney.setProperty("color", color) + val chimneyPosition = graph.createNode(Labels.City, Labels.Position) + chimney.createRelationshipTo(chimneyPosition, Rels.HAS) + + if (chimneyCounter % 4 == 0) { + courner1.add(chimneyPosition) + } + if (chimneyCounter % 4 == 1) { + courner2.add(chimneyPosition) + } + if (chimneyCounter % 4 == 2) { + courner3.add(chimneyPosition) + } + if (chimneyCounter % 4 == 3) { + courner4.add(chimneyPosition) + } + chimneyCounter++ + } + chimneyCounter = 0 + for (chimneyPosition : courner1) { + chimneyPosition.setProperty("x", (bPosX - ( bWidth / 2) ) + 0.5 + (1 * chimneyCounter)) + chimneyPosition.setProperty("y", (bPosY + ( bHeight / 2) ) + 0.5) + chimneyPosition.setProperty("z", (bPosZ - ( bWidth / 2) ) + 0.5) + chimneyCounter++ + } + chimneyCounter = 0 + for (chimneyPosition : courner2) { + chimneyPosition.setProperty("x", (bPosX + ( bWidth / 2) ) - 0.5) + chimneyPosition.setProperty("y", (bPosY + ( bHeight / 2) ) + 0.5) + chimneyPosition.setProperty("z", (bPosZ - ( bWidth / 2) ) + 0.5 + (1 * chimneyCounter)) + chimneyCounter++ + } + chimneyCounter = 0 + for (chimneyPosition : courner3) { + chimneyPosition.setProperty("x", (bPosX + ( bWidth / 2) ) - 0.5 - (1 * chimneyCounter)) + chimneyPosition.setProperty("y", (bPosY + ( bHeight / 2) ) + 0.5) + chimneyPosition.setProperty("z", (bPosZ + ( bWidth / 2) ) - 0.5) + chimneyCounter++ + } + chimneyCounter = 0 + for (chimneyPosition : courner4) { + chimneyPosition.setProperty("x", (bPosX - ( bWidth / 2) ) + 0.5) + chimneyPosition.setProperty("y", (bPosY + ( bHeight / 2) ) + 0.5) + chimneyPosition.setProperty("z", (bPosZ + ( bWidth / 2) ) - 0.5 - (1 * chimneyCounter)) + chimneyCounter++ + } + } + + def private RGBColor[] createColorGradiant(RGBColor start, RGBColor end, int maxLevel) { + var steps = maxLevel - 1 + if (maxLevel == 1) { + steps++ + } + val r_step = (end.r - start.r) / steps + val g_step = (end.g - start.g) / steps + val b_step = (end.b - start.b) / steps + + val colorRange = newArrayOfSize(maxLevel) + for (i : 0 ..< maxLevel) { + val newR = start.r + i * r_step + val newG = start.g + i * g_step + val newB = start.b + i * b_step + colorRange.set(i, new RGBColor(newR, newG, newB)) + } + return colorRange + } + + // Calculates side capacity for progressive/balanced bricks layout + def private int calculateSideCapacity(double value) { + var sc = 0 // side capacity + var lc = 0 // layer capacity + var nolMin = 0 // number of layers + var bcMin = 0 // building capacity min + var bcMax = 0 // building capacity max + do { + sc++ + lc = sc * 4 + nolMin = sc * 2 + bcMin = lc * nolMin + bcMax = bcMin - 1 + } while (bcMax < value) + + return sc; + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTree.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTree.java new file mode 100644 index 000000000..d06074c25 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTree.java @@ -0,0 +1,36 @@ +package org.getaviz.generator.city.m2m; + +import java.util.ArrayList; +import java.util.List; +import org.getaviz.generator.city.m2m.Rectangle; + +public class CityKDTree{ + public CityKDTree() { + super(); + this.root = new CityKDTreeNode(); + } + + public CityKDTree(CityKDTreeNode root) { + super(); + this.root = root; + } + + public CityKDTree(Rectangle rectangle) { + super(); + this.root = new CityKDTreeNode(rectangle); + } + + private CityKDTreeNode root; + + public List getFittingNodes(Rectangle r){ + List fittingNodes = new ArrayList(); + this.root.isEmptyLeaf(r, fittingNodes); + return fittingNodes; + } + public CityKDTreeNode getRoot() { + return root; + } + public void setRoot(CityKDTreeNode root) { + this.root = root; + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTreeNode.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTreeNode.java new file mode 100644 index 000000000..505af45e8 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityKDTreeNode.java @@ -0,0 +1,76 @@ +package org.getaviz.generator.city.m2m; + +import java.util.List; +import org.getaviz.generator.city.m2m.Rectangle; +/** + * This class is specifically designed for a KD-Tree used in SVIS-Generato, + * following the example of Richard Wettel's CodeCity-Visualization Tool + * + * @see + */ +public class CityKDTreeNode { + public CityKDTreeNode() { + super(); + this.leftChild = null; + this.rightChild = null; + this.rectangle = new Rectangle(); + this.occupied = false; + } + + public CityKDTreeNode(Rectangle rectangle) { + super(); + this.leftChild = null; + this.rightChild = null; + this.rectangle = rectangle; + this.occupied = false; + } + + public CityKDTreeNode(CityKDTreeNode leftChild, CityKDTreeNode rightChild, Rectangle rectangle) { + super(); + this.leftChild = leftChild; + this.rightChild = rightChild; + this.rectangle = rectangle; + this.occupied = false; + } + + private CityKDTreeNode leftChild; + private CityKDTreeNode rightChild; + private Rectangle rectangle; + private boolean occupied; + + public void isEmptyLeaf(Rectangle r, List list){ + if(this.rectangle.getWidth() >= r.getWidth() && this.rectangle.getLength() >= r.getLength() && this.occupied == false){ + list.add(this); + } + if(this.leftChild != null){ + this.leftChild.isEmptyLeaf(r, list); + } + if(this.rightChild != null){ + this.rightChild.isEmptyLeaf(r, list); + } + } + public CityKDTreeNode getLeftChild() { + return leftChild; + } + public void setLeftChild(CityKDTreeNode leftChild) { + this.leftChild = leftChild; + } + public CityKDTreeNode getRightChild() { + return rightChild; + } + public void setRightChild(CityKDTreeNode rightChild) { + this.rightChild = rightChild; + } + public Rectangle getRectangle() { + return rectangle; + } + public void setRectangle(Rectangle rectangle) { + this.rectangle = rectangle; + } + public boolean isOccupied() { + return occupied; + } + public void setOccupied(boolean occupied) { + this.occupied = occupied; + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java new file mode 100644 index 000000000..38d17a7e7 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java @@ -0,0 +1,445 @@ +package org.getaviz.generator.city.m2m; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.neo4j.graphdb.Direction; +import org.neo4j.graphdb.GraphDatabaseService; +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.Relationship; +import org.neo4j.graphdb.Transaction; +import org.getaviz.generator.SettingsConfiguration; +import org.getaviz.generator.city.m2m.Rectangle; +import org.getaviz.lib.database.Database; +import org.getaviz.lib.database.Labels; +import org.getaviz.lib.database.Rels; + +public class CityLayout { + private static boolean DEBUG = false; + private static boolean DEBUG_Part2 = false; + private static String info = "[INFOstream] "; + public static Rectangle rootRectangle; + private static SettingsConfiguration config = SettingsConfiguration.getInstance(); + private static GraphDatabaseService graph = Database.getInstance(); + private static Transaction tx; + //This is to hold actual values of width (index 0) and length (index 1) of database object before transaction can save them + private static Map properties; + + public static void cityLayout(Node model, Map testMap) { + properties = testMap; + tx = graph.beginTx(); + try { + arrangeChildrenRoot(model); + tx.success(); + } finally { + tx.close(); + } + + tx = graph.beginTx(); + try { + adjustPositions(getChildren(model), 0, 0, 0); + tx.success(); + } finally { + tx.close(); + } + } + + /* functions for Document */ + + private static void arrangeChildrenRoot(Node model) { + // get maxArea (worst case) for root of KDTree + Rectangle docRectangle = calculateMaxAreaRoot(model); + CityKDTree ptree = new CityKDTree(docRectangle); + Rectangle covrec = new Rectangle(); + List elements = sortChildrenAsRectangles(getChildren(model)); + + // algorithm + for (Rectangle el : elements) { + List pnodes = ptree.getFittingNodes(el); + Map preservers = new LinkedHashMap(); // LinkedHashMap + // necessary, so + // elements are + // ordered by + // inserting-order + Map expanders = new LinkedHashMap(); + CityKDTreeNode targetNode = new CityKDTreeNode(); + CityKDTreeNode fitNode = new CityKDTreeNode(); + + // check all empty leaves: either they extend COVREC (->expanders) or it doesn't + // change (->preservers) + for (CityKDTreeNode pnode : pnodes) { + sortEmptyLeaf(pnode, el, covrec, preservers, expanders); + } + + // choose best-fitting pnode + if (preservers.isEmpty() != true) { + targetNode = bestFitIsPreserver(preservers.entrySet()); + } else { + targetNode = bestFitIsExpander(expanders.entrySet()); + } + + // modify targetNode if necessary + if (targetNode.getRectangle().getWidth() == el.getWidth() + && targetNode.getRectangle().getLength() == el.getLength()) { // this if could probably be skipped, + // trimmingNode() always returns + // fittingNode + fitNode = targetNode; + } else { + fitNode = trimmingNode(targetNode, el); + } + + // set fitNode as occupied + fitNode.setOccupied(true); + + // give Entity it's Position + setNewPositionFromNode(el, fitNode); + + // if fitNode expands covrec, update covrec + if (fitNode.getRectangle().getBottomRightX() > covrec.getBottomRightX() + || fitNode.getRectangle().getBottomRightY() > covrec.getBottomRightY()) { + updateCovrec(fitNode, covrec); + } + } + + rootRectangle = covrec; // used to adjust viewpoint in x3d + } + + private static Rectangle calculateMaxAreaRoot(Node model) { + double sum_width = 0; + double sum_length = 0; + for (Node child : getChildren(model)) { + Node entity = child.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); +// Map properties = null; + if (entity.hasLabel(Labels.Package)) { + arrangeChildren(child); + } + sum_width += properties.get(child.getId())[0] + config.getBuildingHorizontalGap(); + sum_length += properties.get(child.getId())[1] + config.getBuildingHorizontalGap(); + } + return new Rectangle(0, 0, sum_width, sum_length, 1); + } + + /* functions for Entity */ + + private static void arrangeChildren(Node entity) { + // get maxArea (worst case) for root of KDTree + Rectangle entityRec = calculateMaxArea(entity); + CityKDTree ptree = new CityKDTree(entityRec); + Rectangle covrec = new Rectangle(); + List elements = sortChildrenAsRectangles(getChildren(entity)); + + // start algorithm + for (Rectangle el : elements) { + List pnodes = ptree.getFittingNodes(el); + Map preservers = new LinkedHashMap(); // LinkedHashMap + // necessary, so + // elements are + // ordered by + // inserting-order + Map expanders = new LinkedHashMap(); + CityKDTreeNode targetNode = new CityKDTreeNode(); + CityKDTreeNode fitNode = new CityKDTreeNode(); + + // check all empty leaves: either they extend COVREC (->expanders) or it doesn't + // change (->preservers) + for (CityKDTreeNode pnode : pnodes) { + sortEmptyLeaf(pnode, el, covrec, preservers, expanders); + } + + // choose best-fitting pnode + if (preservers.isEmpty() != true) { + targetNode = bestFitIsPreserver(preservers.entrySet()); + } else { + targetNode = bestFitIsExpander(expanders.entrySet()); + } + + // modify targetNode if necessary + if (targetNode.getRectangle().getWidth() == el.getWidth() + && targetNode.getRectangle().getLength() == el.getLength()) { // this if could be skipped, + // trimmingNode() always returns + // fittingNode + fitNode = targetNode; + } else { + fitNode = trimmingNode(targetNode, el); + } + + // set fitNode as occupied + fitNode.setOccupied(true); + + // give Entity it's Position + setNewPositionFromNode(el, fitNode); + + // if fitNode expands covrec, update covrec + if (fitNode.getRectangle().getBottomRightX() > covrec.getBottomRightX() + || fitNode.getRectangle().getBottomRightY() > covrec.getBottomRightY()) { + updateCovrec(fitNode, covrec); + } + } + double width = covrec.getBottomRightX() + + (config.getBuildingHorizontalMargin() - config.getBuildingHorizontalGap() / 2) * 2; + double length = covrec.getBottomRightY() + + (config.getBuildingHorizontalMargin() - config.getBuildingHorizontalGap() / 2) * 2; + double[] array = {width,length}; + properties.put(entity.getId(), array); + } + + private static Rectangle calculateMaxArea(Node entity) { + double sum_width = 0; + double sum_length = 0; + for (Node child : getChildren(entity)) { + Node element = child.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + if (element.hasLabel(Labels.Package)) { + arrangeChildren(child); + } + sum_width += properties.get(child.getId())[0] + config.getBuildingHorizontalGap(); + sum_length += properties.get(child.getId())[1] + config.getBuildingHorizontalGap(); + } + return new Rectangle(0, 0, sum_width, sum_length, 1); + } + + /* functions for algorithm */ + private static List sortChildrenAsRectangles(List children) { + List elements = new ArrayList(); + // copy all child-elements into a List (for easier sort) with links + // to former entities + for (Node child : children) { + double width = properties.get(child.getId())[0]; + double length = properties.get(child.getId())[1]; + + Rectangle rectangle = new Rectangle(0, 0, width + config.getBuildingHorizontalGap(), + length + config.getBuildingHorizontalGap(), 1); + rectangle.setNodeLink(child); + elements.add(rectangle); + } + // sort elements by size in descending order + Collections.sort(elements); + Collections.reverse(elements); + return elements; + } + + private static void sortEmptyLeaf(CityKDTreeNode pnode, Rectangle el, Rectangle covrec, + Map preservers, Map expanders) { + // either element fits in current bounds (->preservers) or it doesn't + // (->expanders) + double nodeUpperLeftX = pnode.getRectangle().getUpperLeftX(); + double nodeUpperLeftY = pnode.getRectangle().getUpperLeftY(); + double nodeNewBottomRightX = nodeUpperLeftX + el.getWidth(); // expected BottomRightCorner, if el was insert + // into pnode + double nodeNewBottomRightY = nodeUpperLeftY + el.getLength(); // this new corner-point is compared with covrec + + if (nodeNewBottomRightX <= covrec.getBottomRightX() && nodeNewBottomRightY <= covrec.getBottomRightY()) { + double waste = pnode.getRectangle().getArea() - el.getArea(); + preservers.put(pnode, waste); + if (DEBUG_Part2) { + System.out.println("\t\t" + info + "Node is preserver. waste=" + waste); + } + } else { + double ratio = ((nodeNewBottomRightX > covrec.getBottomRightX() ? nodeNewBottomRightX + : covrec.getBottomRightX()) + / (nodeNewBottomRightY > covrec.getBottomRightY() ? nodeNewBottomRightY + : covrec.getBottomRightY())); + expanders.put(pnode, ratio); + if (DEBUG_Part2) { + System.out.println( + "\t\t" + info + "Node is expander. ratio=" + ratio + " distance=" + Math.abs(ratio - 1)); + } + } + } + + private static CityKDTreeNode bestFitIsPreserver(Set> entrySet) { + // determines which entry in Set has the lowest value of all + double lowestValue = -1; + CityKDTreeNode targetNode = new CityKDTreeNode(); + for (Map.Entry entry : entrySet) { + if (entry.getValue() < lowestValue || lowestValue == -1) { + lowestValue = entry.getValue(); + targetNode = entry.getKey(); + } + } + if (DEBUG_Part2) { + System.out.println("\t\t" + info + "chosen Node is preserver: " + lowestValue); + System.out.println("\t\t" + info + "Node Rec[(" + targetNode.getRectangle().getUpperLeftX() + "|" + + targetNode.getRectangle().getUpperLeftY() + "), (" + targetNode.getRectangle().getBottomRightX() + + "|" + targetNode.getRectangle().getBottomRightY() + ")]"); + } + return targetNode; + } + + private static CityKDTreeNode bestFitIsExpander(Set> entrySet) { + double closestTo = 1; + double lowestDistance = -1; + CityKDTreeNode targetNode = new CityKDTreeNode(); + for (Map.Entry entry : entrySet) { + double distance = Math.abs(entry.getValue() - closestTo); + if (distance < lowestDistance || lowestDistance == -1) { + lowestDistance = distance; + targetNode = entry.getKey(); + } + } + if (DEBUG_Part2) { + System.out.println("\t\t" + info + "chosen Node is expander: " + lowestDistance); + System.out.println("\t\t" + info + "Node Rec[(" + targetNode.getRectangle().getUpperLeftX() + "|" + + targetNode.getRectangle().getUpperLeftY() + "), (" + targetNode.getRectangle().getBottomRightX() + + "|" + targetNode.getRectangle().getBottomRightY() + ")]"); + } + return targetNode; + } + + private static CityKDTreeNode trimmingNode(CityKDTreeNode node, Rectangle r) { + if (DEBUG) { + System.out.println("\t\t" + info + "trimmingNode()-arrival."); + } + double nodeUpperLeftX = node.getRectangle().getUpperLeftX(); + double nodeUpperLeftY = node.getRectangle().getUpperLeftY(); + double nodeBottomRightX = node.getRectangle().getBottomRightX(); + double nodeBottomRightY = node.getRectangle().getBottomRightY(); + + // first split: horizontal cut, if necessary + // Round to 3 digits to prevent infinity loop, because e.g. 12.34000000007 is + // declared equal to 12.34 + if (Math.round(node.getRectangle().getLength() * 1000d) != Math.round(r.getLength() * 1000d)) { + // new child-nodes + node.setLeftChild(new CityKDTreeNode( + new Rectangle(nodeUpperLeftX, nodeUpperLeftY, nodeBottomRightX, (nodeUpperLeftY + r.getLength())))); + node.setRightChild(new CityKDTreeNode(new Rectangle(nodeUpperLeftX, (nodeUpperLeftY + r.getLength()), + nodeBottomRightX, nodeBottomRightY))); + // set node as occupied (only leaves can contain elements) + node.setOccupied(true); + + if (DEBUG_Part2) { + System.out.println("\t\t\t" + info + "horizontal"); + System.out.println("\t\t\t" + info + "targetNode Rec[(" + nodeUpperLeftX + "|" + nodeUpperLeftY + "), (" + + nodeBottomRightX + "|" + nodeBottomRightY + ")]"); + System.out.println( + "\t\t\t" + info + "LeftChild Rec[(" + node.getLeftChild().getRectangle().getUpperLeftX() + "|" + + node.getLeftChild().getRectangle().getUpperLeftY() + "), (" + + node.getLeftChild().getRectangle().getBottomRightX() + "|" + + node.getLeftChild().getRectangle().getBottomRightY() + ")]"); + System.out.println( + "\t\t\t" + info + "RightChild Rec[(" + node.getRightChild().getRectangle().getUpperLeftX() + "|" + + node.getRightChild().getRectangle().getUpperLeftY() + "), (" + + node.getRightChild().getRectangle().getBottomRightX() + "|" + + node.getRightChild().getRectangle().getBottomRightY() + ")]"); + } + + return trimmingNode(node.getLeftChild(), r); + // second split: vertical cut, if necessary + // Round to 3 digits, because e.g. 12.34000000007 is declared equal to 12.34 + } else if (Math.round(node.getRectangle().getWidth() * 1000d) != Math.round(r.getWidth() * 1000d)) { + // new child-nodes + node.setLeftChild(new CityKDTreeNode( + new Rectangle(nodeUpperLeftX, nodeUpperLeftY, (nodeUpperLeftX + r.getWidth()), nodeBottomRightY))); + node.setRightChild(new CityKDTreeNode(new Rectangle((nodeUpperLeftX + r.getWidth()), nodeUpperLeftY, + nodeBottomRightX, nodeBottomRightY))); + // set node as occupied (only leaves can contain elements) + node.setOccupied(true); + + if (DEBUG_Part2) { + System.out.println("\t\t\t" + info + "vertical"); + System.out.println("\t\t\t" + info + "targetNode Rec[(" + nodeUpperLeftX + "|" + nodeUpperLeftY + "), (" + + nodeBottomRightX + "|" + nodeBottomRightY + ")]"); + System.out.println( + "\t\t\t" + info + "LeftChild Rec[(" + node.getLeftChild().getRectangle().getUpperLeftX() + "|" + + node.getLeftChild().getRectangle().getUpperLeftY() + "), (" + + node.getLeftChild().getRectangle().getBottomRightX() + "|" + + node.getLeftChild().getRectangle().getBottomRightY() + ")]"); + System.out + .println("\t\t\t" + info + "LeftChild center(" + node.getLeftChild().getRectangle().getCenterX() + + "|" + node.getLeftChild().getRectangle().getCenterY() + ")"); + System.out.println( + "\t\t\t" + info + "RightChild Rec[(" + node.getRightChild().getRectangle().getUpperLeftX() + "|" + + node.getRightChild().getRectangle().getUpperLeftY() + "), (" + + node.getRightChild().getRectangle().getBottomRightX() + "|" + + node.getRightChild().getRectangle().getBottomRightY() + ")]"); + } + if (DEBUG) { + System.out.println("\t\t" + info + "trimmingNode()-exit."); + } + return node.getLeftChild(); + } else { + if (DEBUG) { + System.out.println("\t\t" + info + "trimmingNode()-exit."); + } + return node; + } + } + private static void setNewPositionFromNode(Rectangle el, CityKDTreeNode fitNode) { + Node node = el.getNodeLink(); + // mapping 2D rectangle on 3D building + double x = fitNode.getRectangle().getCenterX() - config.getBuildingHorizontalGap() / 2; + double y = ((Double) (node.getProperty("height")) / 2); + double z = fitNode.getRectangle().getCenterY() - config.getBuildingHorizontalGap() / 2; + Node position = graph.createNode(Labels.Position, Labels.City); + position.setProperty("name", "position"); + position.setProperty("x", x); + position.setProperty("y", y); + position.setProperty("z", z); + node.createRelationshipTo(position, Rels.HAS); + } + + private static void updateCovrec(CityKDTreeNode fitNode, Rectangle covrec) { + double newX = (fitNode.getRectangle().getBottomRightX() > covrec.getBottomRightX() + ? fitNode.getRectangle().getBottomRightX() + : covrec.getBottomRightX()); + double newY = (fitNode.getRectangle().getBottomRightY() > covrec.getBottomRightY() + ? fitNode.getRectangle().getBottomRightY() + : covrec.getBottomRightY()); + covrec.changeRectangle(0, 0, newX, newY); + if (DEBUG) { + System.out.println( + "\t\t" + info + "CovRec [checkVALUES]: [(" + covrec.getUpperLeftX() + "|" + covrec.getUpperLeftY() + + "), (" + covrec.getBottomRightX() + "|" + covrec.getBottomRightY() + ")]"); + } + } + + private static void adjustPositions(List children, double parentX, double parentY, + double parentZ) { + for (Node child : children) { + Node entity = child.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).getEndNode(); + Node position = null; + Iterable tmp = child.getRelationships(Rels.HAS, Direction.OUTGOING); + for (Relationship element : tmp) { + Node node = element.getEndNode(); + if (node.hasLabel(Labels.Position)) { + position = node; + } + } + double centerX = (Double) (position.getProperty("x")); + double centerZ = (Double) (position.getProperty("z")); + double centerY = (Double) (position.getProperty("y")); + double setX = centerX + parentX + config.getBuildingHorizontalMargin(); + double setZ = centerZ + parentZ + config.getBuildingHorizontalMargin(); + double setY = centerY + parentY + config.getBuildingVerticalMargin(); + double width = properties.get(child.getId())[0]; + double length = properties.get(child.getId())[1]; + child.setProperty("width", width); + child.setProperty("length", length); + position.setProperty("x", setX); + position.setProperty("y", setY); + position.setProperty("z", setZ); + double height = (Double) (child.getProperty("height")); + if (entity.hasLabel(Labels.Package)) { + double newUpperLeftX = setX - width / 2; + double newUpperLeftZ = setZ - length / 2; + double newUpperLeftY = setY - height / 2; + adjustPositions(getChildren(child), newUpperLeftX, newUpperLeftY, newUpperLeftZ); + } + } + } + + private static List getChildren(Node entity) { + List children = new ArrayList(); + for(Relationship relationship : entity.getRelationships(Rels.CONTAINS, Direction.OUTGOING)) { + Node child = relationship.getEndNode(); + if(child.hasLabel(Labels.District) || child.hasLabel(Labels.Building)) { + children.add(child); + } + } + return children; + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/RGBColor.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/RGBColor.java new file mode 100644 index 000000000..3ad525753 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/RGBColor.java @@ -0,0 +1,75 @@ +package org.getaviz.generator.city.m2m; + +import java.awt.Color; + +public class RGBColor { + private final double lowerBound =0; + private final double upperBound =255; + + public RGBColor() { + super(); + this.r =0; + this.g =0; + this.b =0; + } + + public RGBColor(double r, double g, double b) { + super(); + this.r = checkRanges(r); + this.g = checkRanges(g); + this.b = checkRanges(b); + } + + public RGBColor(Color color) { + super(); + this.r = color.getRed(); + this.g = color.getGreen(); + this.b = color.getBlue(); + } + + private double r; + private double g; + private double b; + + private double checkRanges(double value){ + if(value>upperBound){ + return upperBound; + }else if(value { + @Accessors(PUBLIC_GETTER) var double width + @Accessors(PUBLIC_GETTER) var double length + var double area + @Accessors(PUBLIC_GETTER, PUBLIC_SETTER) var Node nodeLink + var double upperLeftX + var double upperLeftY + var double bottomRightX + var double bottomRightY + var double centerX + var double centerY + + + new() { + super() + changeRectangle(0, 0, 0, 0) + } + + new(double x1, double y1, double x2, double y2) { + super(); + changeRectangle(x1, y1, x2, y2); + } + + /** + * Constructs a new Rectangle + * + * @param pX x coordinate + * @param pY y coordinate + * @param width width of the new Rectangle + * @param length length of the new Rectangle + * @param pointPosition determines how P(x|y) is interpreted: + * 0: P(x|y) is CenterPoint + * 1: P(x|y) is UpperLeft + * 2: P(x|y) is UpperRight + * 3: P(x|y) is BottomRight + * 4: P(x|y) is BottomLeft + */ + new(double pX, double pY, double width, double length, int pointPosition) { + super(); + changeRectangle(pX, pY, width, length, pointPosition); + } + + /** + * Uses two corner points to change values of the rectangle + * @param x1 corner1 of Rectangle + * @param y1 corner1 of Rectangle + * @param x2 corner2 of Rectangle + * @param y2 corner2 of Rectangle + */ + def void changeRectangle(double x1, double y1, double x2, double y2){ + setCornerPoints(x1, y1, x2, y2) + update() + } + /** + *

changeRectangle(double, double, double, double, int)

+ * @param x coordinate + * @param y coordinate + * @param width width of rectangle + * @param length length of rectangle + * @param pointPosition determines how P(x|y) is identified: + * 0: P(x|y) is CenterPoint + * 1: P(x|y) is UpperLeft + * 2: P(x|y) is UpperRight + * 3: P(x|y) is BottomRight + * 4: P(x|y) is BottomLeft + */ + def void changeRectangle(double x, double y, double width, double length, int pointPosition){ + //method forces width & length to equal/be greater than zero: using absolute value + val w = Math.abs(width) + val h = Math.abs(length) + + switch pointPosition{ + case 0: setCornerPoints((x- w/2), (y- h/2), (x+ w/2), (y+ h/2)) // identifies P(x|y) as CenterPoint + case 1: setCornerPoints(x, y, (x+w), (y+h)) // identifies P(x|y) as UpperLeft + case 2: setCornerPoints((x-w), y, x, (y+h)) // identifies P(x|y) as UpperRight + case 3: setCornerPoints((x-w), (y-h), x, y) // identifies P(x|y) as BottomRight + case 4: setCornerPoints(x, (y-h), (x+w), y) //FOUR identifies P(x|y) as BottomLeft + default:setCornerPoints(x, y, (x+w), (y+h)) //UNDEF identifies P(x|y) as UpperLeft + } + update() + } + + def private void setCornerPoints(double x1, double y1, double x2, double y2){ + //upperLeftCorner of a rectangle always has the leftmost X-coordinate and the smallest Y-coordinate as it's values + //bottomRightCorner always uses the rightmost X-coordinate and the highest Y-coordinate as it's values + val double[] xValues = #[x1, x2] + val double[] yValues = #[y1, y2] + Arrays.sort(xValues); + Arrays.sort(yValues); + + upperLeftX = xValues.get(0); + upperLeftY = yValues.get(0); + bottomRightX = xValues.get(1); + bottomRightY = yValues.get(1); + } + + def private update() { + width = bottomRightX - upperLeftX + length = bottomRightY - upperLeftY + area = width * length + centerX = upperLeftX + width/2 + centerY = upperLeftY + length/2 + } + + override compareTo(Rectangle second) { + val firstComparison = Double.compare(this.area, second.area); + if(firstComparison == 0){ + val secondComparison = Double.compare(this.width, second.width); + if(secondComparison == 0){ + return 0; + } else { + return secondComparison; + } + }else{ + return firstComparison; + } + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend new file mode 100644 index 000000000..964304674 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend @@ -0,0 +1,217 @@ +package org.getaviz.generator.city.m2t + +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Database +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Labels +import org.getaviz.generator.SettingsConfiguration.BuildingType +import org.neo4j.graphdb.Transaction +import org.apache.commons.logging.LogFactory +import java.io.IOException +import java.io.FileWriter +import org.getaviz.generator.OutputFormatHelper + +class City2AFrame { + val config = SettingsConfiguration.instance + val graph = Database::instance + var Transaction tx + val log = LogFactory::getLog(class) + extension OutputFormatHelper helper = new OutputFormatHelper + + new() { + log.info("City2AFrame has started") + var FileWriter fw = null + var fileName = "model.html" + + try { + fw = new FileWriter(config.outputPath + fileName) + fw.write(AFrameHead() + toAFrameModel() + AFrameTail()) + } catch (IOException e) { + log.error("Could not create file"); + } finally { + if (fw !== null) + try { + fw.close; + } catch (IOException e) { + e.printStackTrace; + } + } + log.info("City2AFrame has finished") + } + + def private String toAFrameModel() { + val districts = new StringBuilder + val buildings = new StringBuilder + val segments = new StringBuilder + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:District) WHERE n.building_type = \'" + config.buildingTypeAsString + "\' RETURN m").map[return get("m") as Node] + result.forEach[districts.append(toDistrict)] + tx.success + } finally { + tx.close + } + + if(config.buildingType == BuildingType.CITY_ORIGINAL || config.showBuildingBase) { + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:Building) WHERE n.building_type = \'" + config.buildingTypeAsString + "\' RETURN m").map[return get("m") as Node] + result.forEach[buildings.append(toBuilding)] + tx.success + } finally { + tx.close + } + } + + if(!(config.buildingType == BuildingType.CITY_ORIGINAL)) { + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:BuildingSegment) WHERE n.building_type = \'" + config.buildingTypeAsString + "\' RETURN m").map[return get("m") as Node] + result.forEach[ + if(hasLabel(Labels.Floor)) { + segments.append(toFloor) + } else if(hasLabel(Labels.Chimney)) { + segments.append(toChimney) + } + else { + segments.append(toBuildingSegment) + } + ] + tx.success + } finally { + tx.close + } + } + return districts.toString + buildings + segments + } + + def private String toDistrict(Node district) { + val position = district.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val result = ''' + + + ''' + return result + } + + def private String toBuilding(Node building) { + val position = building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val result = ''' + + + ''' + return result + } + + def private String toBuildingSegment(Node segment) { + val entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val has = segment.getRelationships(Rels.HAS, Direction.OUTGOING).map[return endNode] + val position = has.filter[hasLabel(Labels.Position)].head + val separators = has.filter[hasLabel(Labels.PanelSeparator)] + val width = segment.getProperty("width") as Double + val height = segment.getProperty("height") + val length = segment.getProperty("length") + val result = ''' + «IF config.buildingType == BuildingType.CITY_PANELS + && entity.hasLabel(Labels.Field) + && config.showAttributesAsCylinders» + + + «ELSE» + + + «ENDIF» + «FOR separator : separators» + «val pos = separator.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode» + «IF separator.hasLabel(Labels.Cylinder)» + + + «ELSE» + + + «ENDIF» + «ENDFOR» + ''' + return result + } + + def private toFloor(Node floor) { + val has = floor.getRelationships(Rels.HAS, Direction.OUTGOING).map[return endNode] + val position = has.filter[hasLabel(Labels.Position)].head + val result = ''' + + + ''' + return result + } + + def private toChimney(Node chimney) { + val has = chimney.getRelationships(Rels.HAS, Direction.OUTGOING).map[return endNode] + val position = has.filter[hasLabel(Labels.Position)].head + val result = ''' + + + ''' + return result + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend new file mode 100644 index 000000000..e05309ace --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend @@ -0,0 +1,218 @@ +package org.getaviz.generator.city.m2t + +import org.getaviz.generator.SettingsConfiguration +import org.neo4j.graphdb.Transaction +import org.getaviz.lib.database.Database +import org.getaviz.generator.SettingsConfiguration.BuildingType +import org.neo4j.graphdb.Node +import org.neo4j.graphdb.Direction +import org.getaviz.lib.database.Rels +import org.getaviz.lib.database.Labels +import org.apache.commons.logging.LogFactory +import java.io.FileWriter +import org.getaviz.generator.OutputFormatHelper +import java.io.IOException + +class City2X3D { + val config = SettingsConfiguration.instance + val graph = Database::instance + var Transaction tx + val log = LogFactory::getLog(class) + extension OutputFormatHelper helper = new OutputFormatHelper + + new () { + log.info("CityOutput started") + var FileWriter fw = null + var head = X3DHead() + var body = viewports() + toX3DModel() + var tail = X3DTail() + var fileName = "model.x3d" + try { + fw = new FileWriter(config.outputPath + fileName) + switch (config.buildingType) { + case BuildingType::CITY_ORIGINAL: fw.write(head + body + tail) + case BuildingType::CITY_PANELS, + case BuildingType::CITY_FLOOR, + case BuildingType::CITY_BRICKS: + fw.write(head + settingsInfo + body + tail) + } + } catch (IOException e) { + log.error("Could not create file"); + } finally { + if (fw !== null) + try { + fw.close; + } catch (IOException e) { + e.printStackTrace; + } + } + log.info("CityOutput finished") + } + + def private String toX3DModel() { + val districts = new StringBuilder + val buildings = new StringBuilder + val segments = new StringBuilder + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:District) WHERE n.building_type = \'" + config.buildingTypeAsString + "\' RETURN m").map[return get("m") as Node] + result.forEach[districts.append(toDistrict)] + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:Building) WHERE n.building_type = \'" + config.buildingTypeAsString + "\' RETURN m").map[return get("m") as Node] + result.forEach[ + val entity = getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + if(entity.hasLabel(Labels.Class) || entity.hasLabel(Labels.Interface)) { + buildings.append(toBuilding(entity)) + } + ] + tx.success + } finally { + tx.close + } + + if(!(config.buildingType == BuildingType.CITY_ORIGINAL)) { + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:BuildingSegment) WHERE n.building_type = \'" + config.buildingTypeAsString + "\' RETURN m").map[return get("m") as Node] + result.forEach[ + if(hasLabel(Labels.Floor)) { + segments.append(toFloor) + } else if(hasLabel(Labels.Chimney)) { + segments.append(toChimney) + } + else { + segments.append(toBuildingSegment) + } + ] + tx.success + } finally { + tx.close + } + } + return districts.toString + buildings + segments + } + + def private toDistrict(Node district) { + val entity = district.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val position = district.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val result = ''' + + + + + + + + + + + ''' + return result + } + + def private toBuilding(Node building, Node entity) { + val position = building.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val result = ''' + + + + + + + + + + + ''' + return result + } + + def private String toBuildingSegment(Node segment) { + val entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val has = segment.getRelationships(Rels.HAS, Direction.OUTGOING).map[return endNode] + val position = has.filter[hasLabel(Labels.Position)].head + val separators = has.filter[hasLabel(Labels.PanelSeparator)] + val x = position.getProperty("x") + val y = position.getProperty("y") + val z = position.getProperty("z") + val width = segment.getProperty("width") as Double + val height = segment.getProperty("height") + val length = segment.getProperty("length") + val result = ''' + + + + «IF config.buildingType == BuildingType.CITY_PANELS + && segment.hasLabel(Labels.Field) + && config.showAttributesAsCylinders» + + «ELSE» + + «ENDIF» + + + + + + «FOR separator : separators» + «val pos = separator.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode» + + + «IF separator.hasLabel(Labels.Cylinder)» + + «ELSE» + + «ENDIF» + + + + + + «ENDFOR» + + ''' + return result + } + + def private toFloor(Node floor) { + val entity = floor.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val position = floor.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val result = ''' + + + + + + + + + + + ''' + return result + } + + def private toChimney(Node chimney) { + val entity = chimney.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val position = chimney.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val result = ''' + + + + + + + + + + + ''' + return result + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend new file mode 100644 index 000000000..ef9600405 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend @@ -0,0 +1,141 @@ +package org.getaviz.generator.city.s2m + +import org.neo4j.graphdb.GraphDatabaseService +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Database +import org.getaviz.lib.database.Labels +import java.util.GregorianCalendar +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.getaviz.generator.SettingsConfiguration.BuildingType +import org.getaviz.generator.SettingsConfiguration.ClassElementsModes +//import org.neo4j.graphdb.traversal.Evaluators +//import org.getaviz.generator.jqa.EndNodeEvaluator +import org.getaviz.generator.SettingsConfiguration.Original.BuildingMetric +import org.apache.commons.logging.LogFactory + +class JQA2City { + val config = SettingsConfiguration.instance + val log = LogFactory::getLog(class) + var GraphDatabaseService graph + + new () { + log.info("JQA2City started") + graph = Database::getInstance(config.databaseName) + var tx = graph.beginTx + try { + val result = graph.execute("MATCH (n:Package) WHERE NOT (n)<-[:CONTAINS]-(:Package)RETURN n") + val root = graph.createNode(Labels.Model, Labels.City) + root.setProperty("date", new GregorianCalendar().time.toString) + root.setProperty("building_type", config.buildingTypeAsString) + val rootNamespaces = result.map[return get("n") as Node] + rootNamespaces.forEach [ + root.createRelationshipTo(namespaceToDistrict, Rels.CONTAINS) + ] + tx.success + } finally { + tx.close + } + log.info("JQA2City finished") + } + + def private Node namespaceToDistrict(Node namespace) { + val district = graph.createNode(Labels.City, Labels.District) + district.createRelationshipTo(namespace, Rels.VISUALIZES) + val subElements = namespace.getRelationships(Rels.CONTAINS, Direction.OUTGOING).map[return endNode] + val structures = subElements.filter[(hasLabel(Labels.Class) || hasLabel(Labels.Interface)) && !hasLabel(Labels.Inner) && hasProperty("hash")] + val subPackages = subElements.filter[hasLabel(Labels.Package)] + structures.forEach[district.createRelationshipTo(structureToBuilding(district), Rels.CONTAINS)] + subPackages.forEach[district.createRelationshipTo(namespaceToDistrict, Rels.CONTAINS)] + return district + } + +// def private Node structureToDistrict(Node structure) { +// val district = graph.createNode(Labels.City, Labels.District) +// district.createRelationshipTo(structure, Rels.VISUALIZES) +// val subElements = structure.getRelationships(Rels.DECLARES, Direction.OUTGOING).map[return endNode as Node] +// val methods = subElements.filter [hasLabel(Labels.Method) && hasProperty("hash")] +// if (config.classElementsMode === ClassElementsModes::METHODS_AND_ATTRIBUTES || +// config.classElementsMode === ClassElementsModes::METHODS_ONLY) { +// methods.forEach[district.createRelationshipTo(methodToBuilding, Rels.CONTAINS)] +// } +// return district +// } + + def private Node structureToBuilding(Node structure, Node district) { + val building = graph.createNode(Labels.City, Labels.Building) + building.createRelationshipTo(structure, Rels.VISUALIZES) + + val subElements = structure.getRelationships(Rels.DECLARES, Direction.OUTGOING).map[return endNode as Node] +// val methods = getEndNodes(Rels.DECLARES, Labels.Method, structure) + val methods = subElements.filter[hasProperty("hash") && hasLabel(Labels.Method)] + val attributes = subElements.filter[hasProperty("hash") && hasLabel(Labels.Field)] + if (config.buildingType == BuildingType::CITY_FLOOR && methods !== null) { + methods.forEach[building.createRelationshipTo(methodToFloor, Rels.CONTAINS)] + attributes.forEach[building.createRelationshipTo(attributeToChimney, Rels.CONTAINS)] + } else { + if (config.originalBuildingMetric == BuildingMetric::NOS) { + val numberOfStatements = methods.fold(0)[sum, method | + var effectiveLineCount = 0 + if(method.hasProperty("effectiveLineCount")) { + effectiveLineCount = method.getProperty("effectiveLineCount") as Integer + } + sum + effectiveLineCount + ] + building.setProperty("numberOfStatements", numberOfStatements) + } + + if ((config.classElementsMode === ClassElementsModes::METHODS_AND_ATTRIBUTES || + config.classElementsMode === ClassElementsModes::METHODS_ONLY)) { + methods.forEach[building.createRelationshipTo(methodToBuildingSegment, Rels.CONTAINS)] + } + + if (config.classElementsMode === ClassElementsModes::METHODS_AND_ATTRIBUTES || + config.classElementsMode === ClassElementsModes::ATTRIBUTES_ONLY) { + attributes.forEach[building.createRelationshipTo(attributeToBuildingSegment, Rels.CONTAINS)] + } + } + val subStructures = subElements.filter[hasLabel(Labels.Inner) && hasProperty("hash")] + subStructures.forEach[district.createRelationshipTo(structureToBuilding(district), Rels.CONTAINS)] + return building + } + +// def private Node methodToBuilding(Node method) { +// val building = graph.createNode(Labels.City, Labels.Building) +// building.createRelationshipTo(method, Rels.VISUALIZES) +// return building +// } + + def private Node methodToBuildingSegment(Node method) { + val segment = graph.createNode(Labels.City, Labels.BuildingSegment) + segment.createRelationshipTo(method, Rels.VISUALIZES) + return segment + } + + def private Node methodToFloor(Node method) { + val floor = graph.createNode(Labels.City, Labels.BuildingSegment, Labels.Floor) + floor.createRelationshipTo(method, Rels.VISUALIZES) + return floor + } + + def private Node attributeToBuildingSegment(Node attribute) { + val segment = graph.createNode(Labels.City, Labels.BuildingSegment) + segment.createRelationshipTo(attribute, Rels.VISUALIZES) + return segment + } + + def private Node attributeToChimney(Node attribute) { + val chimney = graph.createNode(Labels.City, Labels.BuildingSegment, Labels.Chimney) + chimney.createRelationshipTo(attribute, Rels.VISUALIZES) + return chimney + } + + /*def private getEndNodes(Rels relationship, Labels label, Node startNode) { + val endNodes = graph.traversalDescription().relationships(relationship, Direction.OUTGOING) + .evaluator(Evaluators.toDepth(1)).evaluator(Evaluators.fromDepth(1)) + .evaluator(new EndNodeEvaluator(label)) + .traverse(startNode).nodes + return endNodes + } */ +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend new file mode 100644 index 000000000..18673786e --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend @@ -0,0 +1,23 @@ +package org.getaviz.generator.jqa + +import org.neo4j.graphdb.Path +import org.neo4j.graphdb.traversal.Evaluation +import org.neo4j.graphdb.traversal.Evaluator +import org.getaviz.lib.database.Labels + +class EndNodeEvaluator implements Evaluator { + var Labels label + + new (Labels label) { + this.label = label + } + + override evaluate(Path path) { + if (path.endNode.hasLabel(label) && path.endNode.hasProperty("hash")) { + return Evaluation.INCLUDE_AND_CONTINUE + } + else { + return Evaluation.EXCLUDE_AND_CONTINUE + } + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend new file mode 100644 index 000000000..a49810f3e --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend @@ -0,0 +1,316 @@ +package org.getaviz.generator.jqa + +import java.io.Writer +import java.io.FileWriter +import org.getaviz.lib.database.Database +import org.neo4j.graphdb.Node +import java.io.IOException +import java.util.List +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.apache.commons.lang3.StringUtils +import static org.apache.commons.text.StringEscapeUtils.escapeHtml4 +import org.getaviz.lib.database.Labels +import org.getaviz.generator.SettingsConfiguration +import org.apache.commons.logging.LogFactory + +class JQA2JSON { + val graph = Database::instance + val config = SettingsConfiguration.instance + val log = LogFactory::getLog(class) + + new () { + log.info("JQA2JSON has started.") + val elements = newArrayList + graph.execute("MATCH (n)<-[:VISUALIZES]-() RETURN n").forEach[elements.add(get("n") as Node)] + val tx = graph.beginTx + var Writer fw = null + try { + val path = config.outputPath + "metaData.json" + fw = new FileWriter(path) + fw.write(elements.toJSON) + tx.success + } catch (IOException e) { + System.err.println(e); + } finally { + if (fw !== null) + try { + fw.close; + } catch (IOException e) { + e.printStackTrace; + } + tx.close + } + log.info("JQA2JSON has finished.") + } + + private def String toJSON (List list) ''' + «FOR el : list BEFORE "[{" SEPARATOR "\n},{" AFTER "}]"» + «IF el.hasLabel(Labels.Package)» + «toMetaDataNamespace(el)» + «ENDIF» + «IF el.hasLabel(Labels.Class) || el.hasLabel(Labels.Interface)» + «toMetaDataClass(el)» + «ENDIF» + «IF el.hasLabel(Labels.Type) && el.hasLabel(Labels.Annotation)» + «toMetaDataAnnotation(el)» + «ENDIF» + «IF el.hasLabel(Labels.Type) && el.hasLabel(Labels.Enum)» + «toMetaDataEnum(el)» + «ENDIF» + «IF el.hasLabel(Labels.Method)» + «toMetaDataMethod(el)» + «ENDIF» + «IF el.hasLabel(Labels.Field) && !el.hasLabel(Labels.Enum)» + «toMetaDataAttribute(el)» + «ENDIF» + «IF el.hasLabel(Labels.Field) && el.hasLabel(Labels.Enum)» + «toMetaDataEnumValue(el)» + «ENDIF» + «ENDFOR» + ''' + + private def toMetaDataNamespace(Node namespace) { + val parent = namespace.getRelationships(Rels.CONTAINS, Direction.INCOMING).filter[startNode.hasLabel(Labels.Package)].head + var belongsTo = "root" + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash") as String + } + val result = ''' + "id": "«namespace.getProperty("hash")»", + "qualifiedName": "«namespace.getProperty("fqn")»", + "name": "«namespace.getProperty("name")»", + "type": "FAMIX.Namespace", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private toMetaDataClass(Node c) { + var belongsTo = "" + var parent = c.getRelationships(Rels.DECLARES, Direction.INCOMING).filter[startNode.hasLabel(Labels.Type)].head + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash", "XXX") as String + } else { + parent = c.getRelationships(Rels.CONTAINS, Direction.INCOMING).filter[startNode.hasLabel(Labels.Package)].head + belongsTo = parent.startNode.getProperty("hash", "YYY") as String + } + val result = ''' + "id": "«c.getProperty("hash")»", + "qualifiedName": "«c.getProperty("fqn")»", + "name": "«c.getProperty("name")»", + "type": "FAMIX.Class", + "modifiers": "«c.modifiers»", + "subClassOf": "«c.superClasses»", + "superClassOf": "«c.subClasses»", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private toMetaDataAttribute(Node attribute) { + var belongsTo = "" + var declaredType = "" + val parent = attribute.getRelationships(Direction.INCOMING, Rels.CONTAINS, Rels.DECLARES).head + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash") as String + } + val type = attribute.getSingleRelationship(Rels.OF_TYPE, Direction.OUTGOING) + if(type !== null) { + declaredType = type.startNode.getProperty("name") as String + } + val result = ''' + "id": "«attribute.getProperty("hash")»", + "qualifiedName": "«attribute.getProperty("fqn")»", + "name": "«attribute.getProperty("name")»", + "type": "FAMIX.Attribute", + "modifiers": "«attribute.getModifiers»", + "declaredType": "«declaredType»", + "accessedBy": "«attribute.getAccessedBy»", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private toMetaDataMethod(Node method) { + var belongsTo = "" + val parent = method.getSingleRelationship(Rels.DECLARES, Direction.INCOMING) + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash") as String + } + var signature = method.getProperty("signature") as String + if(signature.contains(".")) { + val lBraceIndex = signature.indexOf("(") + signature = signature.substring(0,lBraceIndex + 1) + method.getParameters + ")" + } + val result = ''' + "id": "«method.getProperty("hash")»", + "qualifiedName": "«escapeHtml4(method.getProperty("fqn") as String)»", + "name": "«method.getProperty("name")»", + "type": "FAMIX.Method", + "modifiers": "«method.modifiers»", + "signature": "«signature»", + "calls": "«method.getCalls»", + "calledBy": "«method.getCalledBy»", + "accesses": "«method.getAccesses»", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private toMetaDataEnum(Node e) { + var belongsTo = "" + val parent = e.getSingleRelationship(Rels.DECLARES, Direction.INCOMING) + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash") as String + } + val result = ''' + "id": "«e.getProperty("hash")»", + "qualifiedName": "«e.getProperty("fqn")»", + "name": "«e.getProperty("name")»", + "type": "FAMIX.Enum", + "modifiers": "«e.modifiers»", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private toMetaDataEnumValue(Node ev) { + var belongsTo = "" + val parent = ev.getSingleRelationship(Rels.DECLARES, Direction.INCOMING) + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash") as String + } + val result = ''' + "id": "«ev.getProperty("hash")»", + "qualifiedName": "«ev.getProperty("fqn")»", + "name": "«ev.getProperty("name")»", + "type": "FAMIX.EnumValue", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private toMetaDataAnnotation(Node annotation) { + var belongsTo = "" + val parent = annotation.getRelationships(Direction.INCOMING, Rels.CONTAINS, Rels.DECLARES).head + if(parent !== null) { + belongsTo = parent.startNode.getProperty("hash") as String + } + val result = ''' + "id": "«annotation.getProperty("hash")»", + "qualifiedName": "«annotation.getProperty("fqn")»", + "name": "«annotation.getProperty("name")»", + "type": "FAMIX.AnnotationType", + "modifiers": "«annotation.modifiers»", + "subClassOf": "", + "superClassOf": "", + "belongsTo": "«belongsTo»" + ''' + return result + } + + def private getSuperClasses(Node element) { + val superClasses = element.getRelationships(Rels.EXTENDS, Direction.OUTGOING) + val tmp = newArrayList + superClasses.forEach[ + if(endNode.hasProperty("hash")) { + tmp += endNode.getProperty("hash") as String + } + ] + return tmp.removeBrackets + } + + def private getSubClasses(Node element) { + val subClasses = element.getRelationships(Rels.EXTENDS, Direction.INCOMING) + val tmp = newArrayList + subClasses.forEach[ + if(startNode.hasProperty("hash")) { + tmp += startNode.getProperty("hash") as String + } + ] + return tmp.removeBrackets + } + + def private getAccessedBy(Node element) { + val accesses = element.getRelationships(Direction.INCOMING, Rels.WRITES, Rels.READS) + val tmp = newArrayList + accesses.forEach[ + if(startNode.hasProperty("hash")) { + tmp += startNode.getProperty("hash") as String + } + ] + return tmp.removeBrackets + } + + def private getAccesses(Node element) { + val accesses = element.getRelationships(Direction.OUTGOING, Rels.WRITES, Rels.READS) + val tmp = newArrayList + accesses.forEach[ + if(endNode.hasProperty("hash")) { + tmp += endNode.getProperty("hash") as String + } + ] + return tmp.removeBrackets + } + + def private getCalls(Node element) { + val calls = element.getRelationships(Direction.OUTGOING, Rels.INVOKES) + val tmp = newArrayList + calls.forEach[ + if(endNode.hasProperty("hash")) { + tmp += endNode.getProperty("hash") as String + } + ] + return tmp.removeBrackets + } + + def private getCalledBy(Node element) { + val calls = element.getRelationships(Direction.INCOMING, Rels.INVOKES) + val tmp = newArrayList + calls.forEach[ + if(startNode.hasProperty("hash")) { + tmp += startNode.getProperty("hash") as String + } + ] + return tmp.removeBrackets + } + + def private getModifiers(Node element) { + val tmp = newArrayList + if (element.hasProperty("visibility")) { + tmp += element.getProperty("visibility") as String + } + if (element.hasProperty("final")) { + if (element.getProperty("final") === true) { + tmp += "final" + } + } + if (element.hasProperty("abstract")) { + if (element.getProperty("abstract") === true) { + tmp += "abstract" + } + } + if (element.hasProperty("static")) { + tmp += "static" + } + return tmp.removeBrackets + } + + def private getParameters(Node method) { + val parameterList = newArrayList + val list = method.getRelationships(Rels.HAS, Direction.OUTGOING).map[endNode]; + list.filter[hasLabel(Labels.Parameter)].sortBy[p|p.getProperty("index") as Integer].forEach[p| + parameterList += p.getSingleRelationship(Rels.OF_TYPE, Direction.OUTGOING).endNode.getProperty("name") as String + ] + return parameterList.removeBrackets + } + + def removeBrackets(String[] array) { + return removeBrackets(array.toString) + } + + def removeBrackets(String string) { + return StringUtils::remove(StringUtils::remove(string, "["), "]") + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend new file mode 100644 index 000000000..11f977fdf --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend @@ -0,0 +1,130 @@ +package org.getaviz.generator.jqa + +import org.getaviz.generator.SettingsConfiguration +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Labels +import org.apache.commons.codec.digest.DigestUtils +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.neo4j.graphdb.traversal.Uniqueness +import org.getaviz.lib.database.Database +import org.apache.commons.logging.LogFactory + +class JQAEnhancement { + val log = LogFactory::getLog(class) + val config = SettingsConfiguration.instance + val graph = Database::getInstance(config.databaseName) + val evaluator = new JQAEvaluator + + new() { + log.info("JQAEnhancement has started.") + var tx = graph.beginTx + try { + labelGetter() + labelSetter() + labelPrimitives() + labelInnerTypes() + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + labelAnonymousInnerTypes() + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + addHashes() + tx.success + } finally { + tx.close + } + log.info("JQAEnhancement finished") + } + + private def addHashes() { + val roots = graph.execute("MATCH (n:Package) WHERE NOT (n)<-[:CONTAINS]-(:Package) RETURN n").map [ + return get("n") as Node + ] + + roots.forEach [ package | + graph.traversalDescription.depthFirst.relationships(Rels.CONTAINS, Direction.OUTGOING).relationships( + Rels.DECLARES, Direction.OUTGOING).uniqueness(Uniqueness.NONE).evaluator(evaluator).traverse(package). + nodes.forEach [ + // log.debug(id) + var fqn = getProperty("fqn", "") as String + if (fqn.empty) { + val container = getSingleRelationship(Rels.DECLARES, Direction.INCOMING).startNode + val containerFqn = container.getProperty("fqn") as String + var name = getProperty("name", "") as String + var signature = getProperty("signature") as String + val index = signature.indexOf(" ") + 1 + if (hasLabel(Labels.Method)) { + val indexOfBracket = signature.indexOf("(") + if (name.empty) { + name = signature.substring(index, indexOfBracket) + setProperty("name", name) + } + fqn = containerFqn + "." + signature.substring(index) + } else { + if (name.empty) { + name = signature.substring(index) + setProperty("name", name) + } + fqn = containerFqn + "." + name + } + setProperty("fqn", fqn) + } + // fqn = fqn.replace("$", ".") + var hash = getProperty("hash", "") as String + if (hash.empty) { + setProperty("hash", createHash(fqn)) + } + ] + ] + } + + private def createHash(String fqn) { + return "ID_" + DigestUtils.sha1Hex(fqn + config.repositoryName + config.repositoryOwner) + } + + private def labelPrimitives() { + graph.execute("MATCH (p:Type) WHERE p.name =~ \"[a-z]+\" RETURN p").forEach [ + val primitive = get("p") as Node + primitive.addLabel(Labels.Primitive) + ] + } + + private def labelGetter() { + graph.execute("MATCH (o:Type)-[:DECLARES]->(method:Method)-[getter:READS]->(attribute:Field)<-[:DECLARES]-(q:Type) + WHERE method.name =~ \"get[A-Z]+[A-Za-z]*\" + AND toLower(method.name) contains(attribute.name) AND ID(o) = ID(q) + RETURN method").forEach [ + val getter = get("method") as Node + getter.addLabel(Labels.Getter) + ] + } + + private def labelSetter() { + graph.execute("MATCH (o:Type)-[:DECLARES]->(method:Method)-[setter:WRITES]->(attribute:Field)<-[:DECLARES]-(q:Type) + WHERE method.name =~ \"set[A-Z]+[A-Za-z]*\" + AND toLower(method.name) contains(attribute.name) AND ID(o) = ID(q) + RETURN method").forEach [ + val setter = get("method") as Node + setter.addLabel(Labels.Getter) + ] + } + + private def labelInnerTypes() { + graph.execute("MATCH (:Type)-[:DECLARES]->(innerType:Type) SET innerType:Inner") + } + + private def labelAnonymousInnerTypes() { + graph.execute("MATCH (innerType:Inner:Type) WHERE innerType.name =~ \".*\\\\$[0-9]*\" SET innerType:Anonymous") + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend new file mode 100644 index 000000000..bc3f2391b --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend @@ -0,0 +1,81 @@ +package org.getaviz.generator.jqa + +import org.neo4j.graphdb.traversal.Evaluator +import org.neo4j.graphdb.Path +import org.getaviz.lib.database.Labels +import org.neo4j.graphdb.traversal.Evaluation +//import org.getaviz.lib.database.Database +//import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction + +class JQAEvaluator implements Evaluator { + // val config = SettingsConfiguration.instance + // val graph = Database::getInstance(config.databaseName) + override evaluate(Path path) { + val node = path.endNode + + if (node.hasLabel(Labels.Package)) { + return Evaluation.INCLUDE_AND_CONTINUE + } + + if (node.hasLabel(Labels.Anonymous)) { + return Evaluation.EXCLUDE_AND_PRUNE + } + + if (node.hasLabel(Labels.Type) && + ((node.hasLabel(Labels.Class) || node.hasLabel(Labels.Interface) || node.hasLabel(Labels.Enum) || + node.hasLabel(Labels.Annotation)))) { + val pre = path.nodes.get(path.length - 1) + if ((pre.hasLabel(Labels.Package) && node.hasLabel(Labels.Inner)) || pre.hasLabel(Labels.Method)) { + return Evaluation.EXCLUDE_AND_PRUNE + } else { + return Evaluation.INCLUDE_AND_CONTINUE + } + } + + var name = node.getProperty("name", "") as String + if (node.hasLabel(Labels.Field) && !name.contains("$")) { + return Evaluation.INCLUDE_AND_CONTINUE + } + + if (node.hasLabel(Labels.Method) && !name.contains("$")) { + if (node.hasLabel(Labels.Constructor)) { + return Evaluation.INCLUDE_AND_CONTINUE + } else { + var found = false + var signature = node.getProperty("signature") as String + val c = node.getSingleRelationship(Rels.DECLARES, Direction.INCOMING).startNode + val ps = c.getRelationships(Rels.EXTENDS, Direction.OUTGOING) + for (p : ps) { + if (p.endNode.hasLabel(Labels.Type)) { + val m2s = p.endNode.getRelationships(Rels.DECLARES, Direction.OUTGOING) + for (m2 : m2s) { + if (m2.endNode.hasLabel(Labels.Method)) { + if (signature == m2.endNode.getProperty("signature") as String) { + found = true + } + + } + } + } + } + if (found) { + return Evaluation.EXCLUDE_AND_CONTINUE + } else { + return Evaluation.INCLUDE_AND_CONTINUE + } + +// val result = graph.execute( +// "MATCH (m1:Method)<-[:DECLARES]-(c:Type)-[:EXTENDS]->(p:Type)-[:DECLARES]->(m2) WHERE ID(m1) = " + +// node.id + " AND m1.signature = m2.signature RETURN m1") +// if (result === null) { +// return Evaluation.INCLUDE_AND_CONTINUE +// } else { +// return Evaluation.EXCLUDE_AND_CONTINUE +// } + } + } + return Evaluation.EXCLUDE_AND_PRUNE + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend new file mode 100644 index 000000000..cd98fcd73 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend @@ -0,0 +1,51 @@ +package org.getaviz.generator.rd + +import org.neo4j.graphdb.Node +import org.neo4j.graphdb.Direction +import org.getaviz.lib.database.Rels +import org.getaviz.lib.database.Labels +import org.neo4j.graphdb.GraphDatabaseService +import org.neo4j.graphdb.Path + +class RDUtils { + + def static getMethods(Node disk) { + val methods = disk.getRelationships(Direction.OUTGOING, Rels.CONTAINS).filter [ + endNode.hasLabel(Labels.DiskSegment) + ].map[return endNode].filter [ + getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode.hasLabel(Labels.Method) + ] + return methods + } + + def static getSubDisks(Node disk) { + val subDisks = disk.getRelationships(Direction.OUTGOING, Rels.CONTAINS).filter [ + endNode.hasLabel(Labels.Disk) + ].map[return endNode] + return subDisks + } + + def static getData(Node disk) { + val data = disk.getRelationships(Direction.OUTGOING, Rels.CONTAINS).filter [ + endNode.hasLabel(Labels.DiskSegment) + ].map[return endNode].filter [ + getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode.hasLabel(Labels.Field) + ] + return data + } + + def static sum(Iterable segments) { + var sum = 0.0 + for (segment : segments) { + sum += segment.getProperty("size") as Double + } + return sum + } + + def static getLevel(GraphDatabaseService graph, Node disk) { + val result = graph.execute( + "MATCH p=(n:RD:Model)-[:CONTAINS*]->(m:RD:Disk) WHERE ID(m) = " + disk.id + " RETURN p LIMIT 1") + val path = result.head.get("p") as Path + return path.length + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Calculator.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Calculator.java new file mode 100644 index 000000000..853e4dd9c --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Calculator.java @@ -0,0 +1,177 @@ +package org.getaviz.generator.rd.m2m; + +import java.awt.geom.Point2D; +import java.util.Collections; +import java.util.List; + +import org.getaviz.generator.rd.m2m.Circle; +import org.getaviz.generator.rd.m2m.CircleWithInnerCircles; + +public class Calculator { + + public static final int SILENT = 0; + public static final int DEBUG = 1; + + private static int VERBOSE_MODE = SILENT; + + public static void setVerboseMode(int mode) { + switch (mode) { + case SILENT: + VERBOSE_MODE = SILENT; + break; + case DEBUG: + VERBOSE_MODE = DEBUG; + break; + default: + VERBOSE_MODE = SILENT; + break; + } + } + + public static void printCircle(Circle c, int number) { + if (VERBOSE_MODE != DEBUG) + return; + System.out.println("Circle numer " + number); + System.out.println("----------------------"); + System.out.println("Radius: " + c.getRadius()); + System.out.println("Centre: " + c.getCentre().x + "|" + c.getCentre().y); + System.out.println(""); + } + + public static List calculate(final List circleList) { + + if (circleList == null || circleList.size() == 0) { + // TODO throw exception + return null; + } + + Collections.sort(circleList); + // TODO order the circles + int m = 0; + + // angle is the angle between m and n + double angle = 0; + // List circleList = new ArrayList(); + + // Instantiate the first circle + Circle first = circleList.get(0); + first.setCentre(new Point2D.Double(0, 0)); + + printCircle(first, 0); + + if (circleList.size() < 2) { + return circleList; + } + + // Instantiate the second circle + Circle second = circleList.get(1); + + second.setCentre(Util.calculateCentre(first, second, angle)); + + printCircle(second, 1); + + // start from the third circle, because the first and the second are fix + + for (int n = 2; n < circleList.size(); n++) { + + // new circle + Circle n_circle = circleList.get(n); + + // previous circle + Circle n_minus1_circle = circleList.get(n - 1); + + // m circle + Circle m_circle = circleList.get(m); + + // 1. calculate triangleangle. this is the angle in the triangle + // (m,n,n-1) + // so angle + triangle_angle will be the angle of the new circle + // at this point angle ist the angle between m and n-1 + double triangle_angle = 0; + double a = n_circle.getRadius() + n_minus1_circle.getRadius(); + double b = m_circle.getRadius() + n_circle.getRadius(); + double c = m_circle.getRadius() + n_minus1_circle.getRadius(); + + triangle_angle = Math.toDegrees(Math.acos((a * a - b * b - c * c) / (-2 * b * c))); + // 2. calc centre of new circle (n) + n_circle.setCentre(Util.calculateCentre(circleList.get(m), n_circle, angle + triangle_angle)); + // 3. check intersect of new circle (n) with circle m+1 + if (!Util.intersect(circleList.get(m + 1), n_circle)) { + + // 3.1 if no intersect + angle += triangle_angle; + angle = Util.correctAngle(angle); + // angle is now the angle between m and n + } else { + // 3.2 if n intersects with m+1 + // angle2 is the same angle as 'angle', but between m+1 and n-1 + + // if the circles are not ordered, intersect must be checked for + // all circles that are are at the same side in the range of m + // to n-1 + Circle m_plus1_cirle = circleList.get(m + 1); + double angle2 = 0; + a = n_circle.getRadius() + n_minus1_circle.getRadius(); + b = Util.distance(circleList.get(m + 1), circleList.get(n - 1)); + c = m_plus1_cirle.getRadius() + n_circle.getRadius(); + + // alpha is the angle in the trangle (m,n-1,n) + // alpha + angle2 is the total angle between m+1 and n + double alpha = Math.toDegrees(Math.acos((a * a - b * b - c * c) / (-2 * b * c))); + + if (Util.isLeftOf(circleList.get(n - 1), circleList.get(m + 1))) { + if (Util.isAboveOf(circleList.get(n - 1), circleList.get(m + 1))) { + // upper left + angle2 = Util.correctAngle(360 - Util.angleBetweenPoints_XasKatethe(circleList.get(m + 1), + circleList.get(n - 1))); + } else if (Util.isBelowOf(circleList.get(n - 1), circleList.get(m + 1))) { + // bottom left + angle2 = Util.correctAngle(180 + Util.angleBetweenPoints_XasKatethe(circleList.get(m + 1), + circleList.get(n - 1))); + } else { + // total left + angle2 = 270; + + } + } else if (Util.isRightOf(circleList.get(n - 1), circleList.get(m + 1))) { + if (Util.isAboveOf(circleList.get(n - 1), circleList.get(m + 1))) { + // upper right + angle2 = Util.correctAngle(Util.angleBetweenPoints_XasKatethe(circleList.get(m + 1), + circleList.get(n - 1))); + + } else if (Util.isBelowOf(circleList.get(n - 1), circleList.get(m + 1))) { + // bottom right + angle2 = Util.correctAngle(90 + Util.angleBetweenPoints_YasKatethe(circleList.get(m + 1), + circleList.get(n - 1))); + } else { + // total right + angle2 = 90; + } + } else { + if (Util.isAboveOf(circleList.get(n - 1), circleList.get(m + 1))) { + // total above + angle2 = 0; + } else { + // total below + angle2 = 180; + } + } + + // angle will be the angle between m+1 and the new circle n + angle = Util.correctAngle(angle2 + alpha); + + // calculate the centre of the new circle + n_circle.setCentre(Util.calculateCentre(circleList.get(m + 1), n_circle, angle)); + + // increase m + m += 1; + + // angle is now the angle between m and n + } + + printCircle(n_circle, n); + } + // return the result + return circleList; + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Circle.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Circle.xtend new file mode 100644 index 000000000..85fa9af7b --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/Circle.xtend @@ -0,0 +1,26 @@ +package org.getaviz.generator.rd.m2m; + +import java.awt.geom.Point2D.Double; +import org.eclipse.xtend.lib.annotations.Accessors + + abstract class Circle implements Comparable { + + @Accessors double radius = 0 + @Accessors Double centre = new Double(0,0) + // TODO extended circle! + @Accessors double minArea = 0 + @Accessors double netArea + @Accessors double grossArea + @Accessors String serial = "" + @Accessors double ringWidth + + override int compareTo(Circle circle) { + if (netArea < circle.netArea) { + return 1 + } else if (netArea > circle.netArea) { + return -1 + } else { + return 0 + } + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleJPanel.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleJPanel.java new file mode 100644 index 000000000..a36d67712 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleJPanel.java @@ -0,0 +1,97 @@ +package org.getaviz.generator.rd.m2m; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.util.List; +import javax.swing.JPanel; + +import org.getaviz.generator.rd.m2m.Circle; + +public class CircleJPanel extends JPanel { + + private static final long serialVersionUID = -5387744622629823215L; + private List circleList; + public int SHIFT_Y = 500; + public int SHIFT_X = 300; + private final int SCALE = 1; + + private double x_min = 0; + private double x_max = 0; + private double y_min = 0; + private double y_max = 0; + private double r_max = 0; + + public CircleJPanel(List circleList) { + this.circleList = circleList; + + setBackground(Color.white); + + // get the most left circle + // get the most right circle + for (Circle circle : circleList) { + if (circle.getCentre().x - circle.getRadius() < x_min) { + x_min = circle.getCentre().x - circle.getRadius(); + } + + if (circle.getCentre().y - circle.getRadius() < y_min) { + y_min = circle.getCentre().y - circle.getRadius(); + } + + if (circle.getCentre().x + circle.getRadius() > x_max) { + x_max = circle.getCentre().x + circle.getRadius(); + } + if (circle.getCentre().y + circle.getRadius() > y_max) { + y_max = circle.getCentre().y + circle.getRadius(); + } + + if (circle.getRadius() > r_max) { + r_max = circle.getRadius(); + } + } + SHIFT_X = (int) (x_max - x_min); + SHIFT_Y = (int) (y_max - y_min); + setPreferredSize(new Dimension((int) (x_max - x_min) * SCALE + 10, (int) (y_min - y_max) * SCALE + 10)); + + } + + public void paintComponent(Graphics g) { + super.paintComponent(g); + + // Try drawing some example circles. + // int i = 0; + for (Circle circle : circleList) { + drawCircle(g, ((int) (SCALE * circle.getCentre().x) + (int) (SCALE * Math.abs(x_min))), SHIFT_Y + - ((int) (SCALE * circle.getCentre().y) + (int) (SCALE * Math.abs(y_min))), + (int) (SCALE * circle.getRadius())); // center + // (30,30) + // r=20 + // g.drawString(Integer.toString(i)+" "+Double.toString(circle.getRadius()), + // SHIFT_X + (int) (SCALE * circle.getCentre().x) + // + (int) (SCALE * Math.abs(x_min)), SHIFT_Y - ((int) (SCALE * + // circle + // .getCentre().y) + (int) (SCALE * Math.abs(y_min)))); + // i++; + } + + } + + public void drawCircle(Graphics cg, int xCenter, int yCenter, int r) { + + // int colorComponent = (int) (((float) r / (float) (r_max + 5)) * + // 255.0f); + // outer circle + cg.drawOval(xCenter - r, yCenter - r, 2 * r, 2 * r); + // cg.setColor(new Color(10, colorComponent, 255 - colorComponent, + // colorComponent)); + // cg.fillOval(xCenter - r, yCenter - r, 2 * r, 2 * r); + + // // inner circle + cg.setColor(Color.BLACK); + cg.drawOval(xCenter - (int) (0.75 * r), yCenter - (int) (0.75 * r), (int) (1.5 * r), (int) (1.5 * r)); + // // component dividers + cg.drawLine(xCenter - (int) (0.535 * r), yCenter - (int) (0.535 * r), xCenter, yCenter + (int) (0.06 * r)); + cg.drawLine(xCenter + (int) (0.535 * r), yCenter - (int) (0.535 * r), xCenter, yCenter + (int) (0.06 * r)); + cg.drawLine(xCenter, yCenter + (int) (0.75 * r), xCenter, yCenter + (int) (0.06 * r)); + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend new file mode 100644 index 000000000..108e72c11 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend @@ -0,0 +1,70 @@ +package org.getaviz.generator.rd.m2m; + +import java.util.ArrayList +import org.eclipse.xtend.lib.annotations.Accessors +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.getaviz.lib.database.Labels +import org.getaviz.generator.rd.RDUtils +import org.getaviz.lib.database.Database +import org.apache.commons.logging.LogFactory + +class CircleWithInnerCircles extends Circle { + @Accessors int level + @Accessors val innerCircles = new ArrayList + val log = LogFactory::getLog(class) + var Node diskNode + val graph = Database::instance + + new(Node disk, Boolean nesting) { + diskNode = disk + val data = RDUtils.getData(disk) + val methods = RDUtils.getMethods(disk) + if (nesting == true) { + minArea = RDUtils.sum(methods) + RDUtils.sum(data) + } else { + minArea = disk.getProperty("netArea") as Double + level = RDUtils.getLevel(graph, disk) + } + ringWidth = disk.getProperty("ringWidth") as Double + serial = disk.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode.id.toString + netArea = disk.getProperty("netArea") as Double + log.debug("set netArea to " + netArea + "for disk " + diskNode.id) + radius = disk.getProperty("radius", 0.0) as Double + + if (disk.hasProperty("grossArea")) { + grossArea = disk.getProperty("grossArea") as Double + } else { + grossArea = 0.0 + } + val subDisks = RDUtils.getSubDisks(disk) + subDisks.forEach [ + innerCircles.add(new CircleWithInnerCircles(it, true)) + ] + } + + /** + * write calculated positions into extended disk + * + */ + def void updateDiskNode() { + diskNode.setProperty("radius", radius) + diskNode.setProperty("netArea", netArea) + diskNode.setProperty("grossArea", grossArea) + log.debug("set netArea to " + netArea + "for disk " + diskNode.id) + val position = diskNode.getSingleRelationship(Rels.HAS, Direction.OUTGOING) + val newPosition = graph.createNode(Labels.Position, Labels.RD) + var oldZPosition = 0.0 + if (position !== null) { + oldZPosition = position.endNode.getProperty("z") as Double + } else { + diskNode.createRelationshipTo(newPosition, Rels.HAS) + } + newPosition.setProperty("x", centre.x) + newPosition.setProperty("y", centre.y) + newPosition.setProperty("z", oldZPosition) + + innerCircles.forEach[updateDiskNode] + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend new file mode 100644 index 000000000..5313b34e0 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend @@ -0,0 +1,381 @@ +package org.getaviz.generator.rd.m2m + +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Database +import org.neo4j.graphdb.Node +import org.neo4j.graphdb.Direction +import org.getaviz.lib.database.Rels +import org.getaviz.lib.database.Labels +import org.getaviz.generator.SettingsConfiguration.OutputFormat +import org.getaviz.generator.rd.RDUtils +import java.util.ArrayList +import com.vividsolutions.jts.geom.Geometry +import com.vividsolutions.jts.util.GeometricShapeFactory +import com.vividsolutions.jts.geom.GeometryFactory +import com.vividsolutions.jts.algorithm.MinimumBoundingCircle +import com.vividsolutions.jts.geom.CoordinateList +import com.vividsolutions.jts.geom.Coordinate +import org.getaviz.generator.Helper +import org.apache.commons.logging.LogFactory + +class RD2RD { + val config = SettingsConfiguration.instance + val graph = Database::getInstance(config.databaseName) + val log = LogFactory::getLog(class) + extension Helper util = new Helper + + // TODO set colors via RGBColor class for all entities + // color scheme + RGBColor NS_colorStart = new RGBColor(150, 150, 150); + RGBColor NS_colorEnd = new RGBColor(240, 240, 240); // from CodeCity + RGBColor[] NS_colors + + new() { + log.info("RDModifikation started") + var tx = graph.beginTx + try { + var result = graph.execute( + "MATCH p=(n:Package)-[:CONTAINS*]->(m:Package) WHERE NOT (m)-[:CONTAINS]->(:Package) RETURN max(length(p)) AS length") + val namespaceMaxLevel = (result.head.get("length") as Long).intValue + 1 + // Returns the longest Path from root to deepest sub package + result = graph.execute( + "MATCH p=(n:RD:Model)-[:CONTAINS*]->(m:RD:Disk) WHERE NOT (m)-[:CONTAINS]->(:RD:Disk) RETURN max(length(p)) AS length") + val diskMaxLevel = (result.head.get("length") as Long).intValue + NS_colors = createColorGradiant(NS_colorStart, NS_colorEnd, namespaceMaxLevel) + getDisks.forEach [ + if (getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode.hasLabel(Labels.Package)) { + setNamespaceColor + } + setProperty("maxLevel", diskMaxLevel) + ] + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + getRootDisks.calculateNetArea + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + getDisks.forEach[calculateRadius] + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + getRootDisks.calculateLayout + tx.success + } finally { + tx.close + } + + tx = graph.beginTx + try { + getDisks.forEach[postLayout] + tx.success + } finally { + tx.close + } + tx = graph.beginTx + try { + getDisks.forEach[postLayout2] + tx.success + } finally { + tx.close + } + log.info("RDModifikation finished") + } + + def private setNamespaceColor(Node namespaceDisk) { + var String color + val result = graph.execute("MATCH p=(n:RD:Model)-[:CONTAINS*]->(m:RD:Disk) where ID(m) = " + namespaceDisk.id + + " RETURN max(length(p)) AS length") + val level = (result.head.get("length") as Long).intValue + if (config.outputFormat == OutputFormat::AFrame) { + color = config.RDNamespaceColorHex + } else { + // namespace.color = NS_colors.get(namespace.getLevel() - 1).asPercentage + color = NS_colors.get(level - 1).asPercentage + } + namespaceDisk.setProperty("color", color) + } + + def private void calculateNetArea(Iterable disks) { + disks.forEach[disk| + RDUtils::getSubDisks(disk).calculateNetArea + disk.calculateNetArea + ] + } + + def private calculateNetArea(Node disk) { + var netArea = 0.0 + var methodSum = 0.0 + var dataSum = 0.0 + for(field : RDUtils::getData(disk)) { + val size = field.getProperty("size") as Double * config.RDDataFactor + field.setProperty("size", size) + dataSum += size + } + for(method : RDUtils::getMethods(disk)){ + val size = method.getProperty("size") as Double * config.RDMethodFactor + method.setProperty("size", size) + methodSum += size + } + netArea = dataSum + methodSum + disk.setProperty("netArea", netArea) + } + + def private calculateRadius(Node disk) { + val netArea = disk.getProperty("netArea") as Double + val ringWidth = disk.getProperty("ringWidth") as Double + var radius = Math::sqrt(netArea / Math::PI) + ringWidth + disk.setProperty("radius", radius) + } + + def private calculateLayout(Iterable disks) { + val nestedCircles = new ArrayList + disks.forEach[disk|nestedCircles += new CircleWithInnerCircles(disk, false)] + RDLayout::nestedLayout(nestedCircles) + nestedCircles.forEach[updateDiskNode] + } + + def private postLayout(Node disk) { + val data = RDUtils.getData(disk) + val methods = RDUtils.getMethods(disk) + disk.fractions(data, methods) + data.fractions + methods.fractions + } + + def private postLayout2(Node disk) { + RDUtils::getSubDisks(disk).forEach[calculateRings] + disk.calculateRings + } + + def private fractions(Node disk, Iterable data, Iterable methods) { + val netArea = disk.getProperty("netArea") as Double + var currentMethodArea = RDUtils.sum(methods) / netArea + var currentDataArea = RDUtils.sum(data) / netArea + disk.setProperty("methodArea", currentMethodArea) + disk.setProperty("dataArea", currentDataArea) + } + + def private fractions(Iterable segments) { + val sum = RDUtils.sum(segments) + segments.forEach [ + setProperty("size", getProperty("size") as Double / sum) + ] + } + + def private calculateRings(Node disk) { + val ringWidth = disk.getProperty("ringWidth") as Double + val height = disk.getProperty("height") as Double + val radius = disk.getProperty("radius") as Double + var methodArea = disk.getProperty("methodArea") as Double + var dataArea = disk.getProperty("dataArea") as Double + val netArea = disk.getProperty("netArea") as Double + if (ringWidth == 0) { + calculateCrossSection(disk, ringWidth, 0) + } else { + calculateCrossSection(disk, ringWidth, height) + } + calculateSpines(disk, radius - (0.5 * ringWidth)) + if (RDUtils::getSubDisks(disk).nullOrEmpty) { + val r_data = Math::sqrt(dataArea * netArea / Math::PI) + val r_methods = radius - ringWidth + val b_methods = r_methods - r_data + val diskMethods = RDUtils.getMethods(disk) + val diskData = RDUtils.getData(disk) + if (!diskMethods.nullOrEmpty) { + diskMethods.calculateCrossSection(b_methods, height) + calculateSpines(diskMethods, r_methods - 0.5 * b_methods) + if (config.outputFormat == OutputFormat::AFrame) { + diskMethods.forEach [ + setProperty("outerRadius", r_methods) + setProperty("innerRadius", r_data) + ] + } + } + if (!diskData.nullOrEmpty) { + diskData.calculateCrossSection(r_data, height) + calculateSpines(diskData, 0.5 * r_data) + if (config.outputFormat == OutputFormat::AFrame) { + diskData.forEach [ + setProperty("outerRadius", r_data) + setProperty("innerRadius", 0.0) + ] + } + } + } else { + val outerRadius = disk.calculateOuterRadius + val r_data = Math::sqrt((dataArea * netArea / Math::PI) + (outerRadius * outerRadius)) + val b_data = r_data - outerRadius + val r_methods = Math::sqrt((methodArea * netArea / Math::PI) + (r_data * r_data)) + val b_methods = r_methods - r_data + val diskMethods = RDUtils.getMethods(disk) + if (!diskMethods.nullOrEmpty) { + diskMethods.calculateCrossSection(b_methods, height) + calculateSpines(diskMethods, r_methods - 0.5 * b_methods) + if (config.outputFormat == OutputFormat::AFrame) { + diskMethods.forEach [ + setProperty("outerRadius", r_methods) + setProperty("innerRadius", r_data) + ] + } + } + val diskData = RDUtils.getData(disk) + if (!diskData.nullOrEmpty) { + diskData.calculateCrossSection(b_data, height) + calculateSpines(diskData, r_data - 0.5 * b_data) + if (config.outputFormat == OutputFormat::AFrame) { + diskData.forEach [ + setProperty("outerRadius", r_data) + setProperty("innerRadius", r_data - b_data) + ] + } + } + } + } + + def private calculateOuterRadius(Node disk) { + val coordinates = new CoordinateList() + RDUtils::getSubDisks(disk).forEach [ + val position = getSingleRelationship(Rels.HAS, Direction.OUTGOING) + var x = 0.0 + var y = 0.0 + if (position !== null) { + x = position.endNode.getProperty("x") as Double + y = position.endNode.getProperty("y") as Double + } + coordinates.add(createCircle(x, y, getProperty("radius") as Double).coordinates, false) + ] + val geoFactory = new GeometryFactory() + val innerCircleMultiPoint = geoFactory.createMultiPoint(coordinates.toCoordinateArray) + val mbc = new MinimumBoundingCircle(innerCircleMultiPoint) + + return mbc.radius + } + + def private Geometry createCircle(double x, double y, double radius) { + val shapeFactory = new GeometricShapeFactory + shapeFactory.numPoints = 64 + shapeFactory.centre = new Coordinate(x, y) + shapeFactory.size = radius * 2 + return shapeFactory.createCircle + } + + def private calculateCrossSection(Iterable segments, double width, double height) { + val crossSection = (-(width / 2 ) + " " + (height)) + ", " + ((width / 2) + " " + (height)) + ", " + + ((width / 2 ) + " " + 0) + ", " + (-(width / 2) + " " + 0) + ", " + (-(width / 2) + " " + (height)) + segments.forEach[setProperty("crossSection", crossSection)] + } + + def private calculateCrossSection(Node disk, double width, double height) { + val crossSection = (-(width / 2 ) + " " + (height)) + ", " + ((width / 2) + " " + (height)) + ", " + + ((width / 2 ) + " " + 0) + ", " + (-(width / 2) + " " + 0) + ", " + (-(width / 2) + " " + (height)) + + disk.setProperty("crossSection", crossSection) + } + + def private calculateSpines(Iterable segments, double factor) { + if (config.outputFormat == OutputFormat::X3D) { + var spinePointCount = 0 + if (segments.length < 50) { + spinePointCount = 400 + } else { + spinePointCount = 1000 + } + val completeSpine = newArrayOfSize(spinePointCount) + val stepX = 2 * Math::PI / spinePointCount; + + for (i : 0 ..< spinePointCount) { + completeSpine.set(i, factor * Math::cos(i * stepX) + " " + factor * Math::sin(i * stepX) + " " + 0.0) + } + completeSpine.set(spinePointCount - 1, completeSpine.get(0)) + // calculate spines according to fractions + var start = 0 + var end = 0 + + for (segment : segments) { + val size = segment.getProperty("size") as Double + // val entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + start = end; + end = start + Math::floor(spinePointCount * size).intValue + if (end > (completeSpine.length - 1)) { + end = completeSpine.length - 1 + } + if (segment == segments.last) { + end = completeSpine.length - 1 + } + val partSpine = newArrayOfSize(end - start); + for (j : 0 ..< end - start) { + partSpine.set(j, completeSpine.get(start + j)) + } + segment.setProperty("spine", partSpine.removeBrackets) + } + } + if (config.outputFormat == OutputFormat::AFrame) { + if (!segments.empty) { + var length = segments.length + var sizeSum = 0.0 + var position = 0.0 + for (segment : segments) { + val size = segment.getProperty("size") as Double + sizeSum += size + } + sizeSum += sizeSum / 360 * length + for (segment : segments) { + val angle = (segment.getProperty("size") as Double / sizeSum) * 360 + segment.setProperty("angle", angle) + segment.setProperty("anglePosition", position) + position += angle + 1 + } + } + } + } + + def private calculateSpines(Node disk, double factor) { + val spinePointCount = 50 + val completeSpine = newArrayOfSize(spinePointCount) + val stepX = 2 * Math::PI / spinePointCount; + for (i : 0 ..< spinePointCount) { + completeSpine.set(i, factor * Math::cos(i * stepX) + " " + factor * Math::sin(i * stepX) + " " + 0.0) + } + completeSpine.set(spinePointCount - 1, completeSpine.get(0)) + disk.setProperty("spine", completeSpine.removeBrackets) + } + + def private RGBColor[] createColorGradiant(RGBColor start, RGBColor end, int maxLevel) { + var steps = maxLevel + val r_step = (end.r - start.r) / steps + val g_step = (end.g - start.g) / steps + val b_step = (end.b - start.b) / steps + + val colorRange = newArrayOfSize(maxLevel) + for (i : 0 ..< maxLevel) { + val newR = start.r + i * r_step + val newG = start.g + i * g_step + val newB = start.b + i * b_step + + colorRange.set(i, new RGBColor(newR, newG, newB)) + } + return colorRange + } + + def private getDisks() { + return graph.execute("MATCH (n:Model:RD)-[:CONTAINS*]->(m:Disk) RETURN m").map[return get("m") as Node] + } + + def private getRootDisks() { + val rootDisks = graph.execute("MATCH (n:Model:RD)-[:CONTAINS]->(m:Disk) RETURN m").map[return get("m") as Node].toList + return rootDisks + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RDLayout.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RDLayout.java new file mode 100644 index 000000000..a758b8960 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RDLayout.java @@ -0,0 +1,123 @@ +package org.getaviz.generator.rd.m2m; + +import java.awt.geom.Point2D; +import java.util.List; +import com.vividsolutions.jts.algorithm.MinimumBoundingCircle; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateList; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.MultiPoint; +import com.vividsolutions.jts.util.GeometricShapeFactory; +import java.util.ArrayList; + +public class RDLayout { + + public static void nestedLayout(ArrayList circleList) { + layout(circleList); + transformPositions(circleList); + } + + private static void layout(List circleList) { + for (CircleWithInnerCircles circle : circleList) { + if (((CircleWithInnerCircles) circle).getInnerCircles().size() > 0) { + List innerCircles = ((CircleWithInnerCircles) circle).getInnerCircles(); + layout(innerCircles); + calculateRadiusForOuterCircles(circle,innerCircles); + } + } + updateArea(circleList); + Calculator.calculate(circleList); + } + + private static void transformPositions(List circleList) { + for (Circle circle : circleList) { + if (((CircleWithInnerCircles) circle).getInnerCircles() != null) { + transformPositionOfInnerCircles(circle,((CircleWithInnerCircles) circle).getInnerCircles()); + transformPositions(((CircleWithInnerCircles) circle).getInnerCircles()); + } + } + } + + private static void updateArea(List circleList) { + for (CircleWithInnerCircles circle : circleList) { + circle.setGrossArea(circle.getRadius() * circle.getRadius() * Math.PI); + if (((CircleWithInnerCircles) circle).getInnerCircles().size() < 1) { + circle.setNetArea(circle.getGrossArea()); + } else { + List innerCircles = ((CircleWithInnerCircles) circle).getInnerCircles(); + circle.setNetArea(circle.getNetArea() + (2 * circle.getRadius() - circle.getRingWidth()) * circle.getRingWidth() * Math.PI); + + for (CircleWithInnerCircles c : innerCircles) { + circle.setNetArea(circle.getNetArea() + c.getNetArea()); + } + + } + } + } + private static void transformPositionOfInnerCircles(Circle outerCircle, + List innerCircles) { + final double x_outer = outerCircle.getCentre().x; + final double y_outer = outerCircle.getCentre().y; + + for (Circle circle : innerCircles) { + circle.getCentre().x += x_outer; + circle.getCentre().y += y_outer; + } + } + + // TODO optimize + private static void calculateRadiusForOuterCircles(CircleWithInnerCircles outerCircle, List innerCircles) { + + CoordinateList coordinates = new CoordinateList(); + for (CircleWithInnerCircles circle : innerCircles) { + coordinates.add(createCircle(circle.getCentre().x, circle.getCentre().y, circle.getRadius()).getCoordinates(), false); + } + + GeometryFactory geoFactory = new GeometryFactory(); + MultiPoint innerCirclemultipoint = geoFactory.createMultiPoint(coordinates.toCoordinateArray()); + MinimumBoundingCircle mbc = new MinimumBoundingCircle(innerCirclemultipoint); + +// outerCircle.setCentre(centre); +// outerCircle.setRadius(RING_WIDTH + radius + calculateB(calculateD(outerCircle.getMinArea(), radius), radius)); +// normalizePositionOfInnerCircles(outerCircle, innerCircles); + final double radius = mbc.getRadius(); + final Point2D.Double centre = new Point2D.Double(mbc.getCentre().x, mbc.getCentre().y); + + outerCircle.setCentre(centre); + if (((CircleWithInnerCircles)outerCircle).getLevel()==1){ + outerCircle.setRadius(outerCircle.getRingWidth() + radius); + }else{ + outerCircle.setRadius(outerCircle.getRingWidth() + radius + calculateB(calculateD(outerCircle.getMinArea(), radius), radius)); + } + normalizePositionOfInnerCircles(outerCircle, innerCircles); + } + + private static double calculateD(double area, double radius) { + return Math.sqrt((2 * radius) * (2 * radius) + (area / Math.PI) * 4); + } + + private static double calculateB(double D, double radius) { + return (D - (2 * radius)) / 2; + } + + private static Geometry createCircle(double x, double y, final double RADIUS) { + GeometricShapeFactory shapeFactory = new GeometricShapeFactory(); + shapeFactory.setNumPoints(64); + shapeFactory.setCentre(new Coordinate(x, y)); + shapeFactory.setSize(RADIUS * 2); + return shapeFactory.createCircle(); + } + + private static void normalizePositionOfInnerCircles(Circle outerCircle, + List innerCircles) { + final double x_outer = outerCircle.getCentre().x; + final double y_outer = outerCircle.getCentre().y; + + for (Circle circle : innerCircles) { + circle.getCentre().x -= x_outer; + circle.getCentre().y -= y_outer; + } + outerCircle.setCentre(new Point2D.Double(0, 0)); + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RGBColor.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RGBColor.java new file mode 100644 index 000000000..d2c775246 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RGBColor.java @@ -0,0 +1,68 @@ +package org.getaviz.generator.rd.m2m; + +//import java.awt.Color; + +public class RGBColor { + private final double lowerBound =0; + private final double upperBound =255; + + public RGBColor() { + super(); + this.r =0; + this.g =0; + this.b =0; + } + + public RGBColor(double r, double g, double b) { + super(); + this.r = checkRanges(r); + this.g = checkRanges(g); + this.b = checkRanges(b); + } + + private double r; + private double g; + private double b; + + private double checkRanges(double value){ + if(value>upperBound){ + return upperBound; + }else if(value 90) { + result -= 90; + } + return result; + } + + public static double distance(Circle firstPoint, Circle secondPoint) { + double a = Math.abs(firstPoint.getCentre().y - secondPoint.getCentre().y); + double b = Math.abs(firstPoint.getCentre().x - secondPoint.getCentre().x); + + return Math.sqrt(a * a + b * b); + } + + public static double angleBetweenPoints_XasKatethe(Circle firstPoint, Circle secondPoint) { + double a = Math.abs(firstPoint.getCentre().y - secondPoint.getCentre().y); + double b = Math.abs(firstPoint.getCentre().x - secondPoint.getCentre().x); + double c = Math.sqrt(a * a + b * b); + return Math.abs(Math.toDegrees(Math.asin(b / c))); + + } + + public static double angleBetweenPoints_YasKatethe(Circle firstPoint, Circle secondPoint) { + double a = Math.abs(firstPoint.getCentre().y - secondPoint.getCentre().y); + double b = Math.abs(firstPoint.getCentre().x - secondPoint.getCentre().x); + double c = Math.sqrt(a * a + b * b); + return Math.abs(Math.toDegrees(Math.asin(a / c))); + + } + + public static boolean intersect(Circle firstPoint, Circle secondPoint) { + //TODO remove + //System.out.println(((SnailCircle)secondPoint).getSerial()); + double a = Math.abs(firstPoint.getCentre().y - secondPoint.getCentre().y); + double b = Math.abs(firstPoint.getCentre().x - secondPoint.getCentre().x); + // there must be a little tolerance! + return (Math.sqrt(a * a + b * b) <= firstPoint.getRadius() + secondPoint.getRadius() - 0.001) ? true : false; + } + + public static boolean isLeftOf(Circle firstPoint, Circle secondPoint) { + return firstPoint.getCentre().x < secondPoint.getCentre().x ? true : false; + } + + public static boolean isRightOf(Circle firstPoint, Circle secondPoint) { + return firstPoint.getCentre().x > secondPoint.getCentre().x ? true : false; + } + + public static boolean isAboveOf(Circle firstPoint, Circle secondPoint) { + return firstPoint.getCentre().y > secondPoint.getCentre().y ? true : false; + } + + public static boolean isBelowOf(Circle firstPoint, Circle secondPoint) { + return firstPoint.getCentre().y < secondPoint.getCentre().y ? true : false; + } + + public static Point2D.Double calculateCentre(Circle m, Circle n, double angle) { + angle = Util.correctAngle(angle); + if (angle == 0 || angle == 360) { + return new Point2D.Double(m.getCentre().x, m.getCentre().y + n.getRadius() + m.getRadius()); + } else if (0 < angle && angle < 90) { + double c = n.getRadius() + m.getRadius(); + double b = c * Math.cos(Math.toRadians(angle)); + double a = c * Math.sin(Math.toRadians(angle)); + + return new Point2D.Double(m.getCentre().x + a, m.getCentre().y + b); + } else if (angle == 90) { + return new Point2D.Double(m.getCentre().x + n.getRadius() + m.getRadius(), m.getCentre().y); + } else if (90 < angle && angle < 180) { + double c = n.getRadius() + m.getRadius(); + double b = c * Math.cos(Math.toRadians(angle - 90)); + double a = c * Math.sin(Math.toRadians(angle - 90)); + + return new Point2D.Double(m.getCentre().x + b, m.getCentre().y - a); + } else if (angle == 180) { + return new Point2D.Double(m.getCentre().x, m.getCentre().y - n.getRadius() - m.getRadius()); + } else if (180 < angle && angle < 270) { + double c = n.getRadius() + m.getRadius(); + double b = c * Math.cos(Math.toRadians(angle - 180)); + double a = c * Math.sin(Math.toRadians(angle - 180)); + + return new Point2D.Double(m.getCentre().x - a, m.getCentre().y - b); + } else if (angle == 270) { + return new Point2D.Double(m.getCentre().x - n.getRadius() - m.getRadius(), m.getCentre().y); + } else if (270 < angle && angle < 360) { + double c = n.getRadius() + m.getRadius(); + double b = c * Math.cos(Math.toRadians(angle - 270)); + double a = c * Math.sin(Math.toRadians(angle - 270)); + return new Point2D.Double(m.getCentre().x - b, m.getCentre().y + a); + } + return null; + } + + public static double calculateAngle(Circle m, Circle n, Circle n_minus_1, double alpha_m_n_minus_1) { + + double rm = m.getRadius(); + double rn = n.getRadius(); + double rn_minus_1 = n_minus_1.getRadius(); + + return alpha_m_n_minus_1 + + Math.toDegrees(Math.acos((rm * rm + rm * rn_minus_1 + rm * rn - rn_minus_1 * rn) + / (rm * rm + rm * rn_minus_1 + rm * rn + rn_minus_1 * rn))); + } + +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend new file mode 100644 index 000000000..20f6827d5 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend @@ -0,0 +1,132 @@ +package org.getaviz.generator.rd.m2t + +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Database +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.getaviz.lib.database.Labels +import org.apache.commons.logging.LogFactory +import org.getaviz.generator.OutputFormatHelper +import java.io.FileWriter +import java.io.IOException + +class RD2AFrame { + val config = SettingsConfiguration.instance + var graph = Database::getInstance(config.databaseName) + val log = LogFactory::getLog(class) + extension OutputFormatHelper helper = new OutputFormatHelper + + new() { + log.info("RD2AFrame has started") + var FileWriter fw = null + var fileName = "model.html" + try { + fw = new FileWriter(config.outputPath + fileName) + fw.write(AFrameHead() + toX3DOMRD() + AFrameTail()) + } catch (IOException e) { + log.error("Could not create file"); + } finally { + if (fw !== null) + try { + fw.close; + } catch (IOException e) { + e.printStackTrace; + } + } + log.info("RD2AFrame has finished") + } + + def private toX3DOMRD() { + val elements = new StringBuilder + val tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Model)-[:CONTAINS*]->(m:Disk) RETURN m").map[return get("m") as Node] + result.forEach[elements.append(toDisk)] + tx.success + } finally { + tx.close + } + return elements.toString + } + + def private toDisk(Node disk) { + val radius = disk.getProperty("radius") as Double + val hash = disk.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode.getProperty("hash") + val position = disk.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val segments = disk.getRelationships(Rels.CONTAINS, Direction.OUTGOING).map[return endNode].filter [ + hasLabel(Labels.DiskSegment) + ] + val result = ''' + «IF radius - config.RDRingWidth == 0» + +««« segments="20"> + «segments.toSegment» + + «ELSE» + + ««« segments-theta="20" +««« segments-phi="1"> + «segments.toSegment» + + «ENDIF» + ''' + return result + } + + def private toSegment(Iterable segments) { + val result = ''' + «FOR segment : segments» + «val hash = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode.getProperty("hash")» + «IF segment.getProperty("innerRadius") as Double == 0» + +««« segments="«(segment.getProperty("angle") as Double/20).intValue+1»"> + + «ELSE» + + + «ENDIF» + «ENDFOR» + ''' + return result + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend new file mode 100644 index 000000000..45c71503a --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend @@ -0,0 +1,120 @@ +package org.getaviz.generator.rd.m2t + +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Database +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.getaviz.generator.OutputFormatHelper +import java.io.FileWriter +import java.io.IOException +import org.apache.commons.logging.LogFactory + +class RD2X3D { + val config = SettingsConfiguration.instance + val graph = Database::getInstance(config.databaseName) + val log = LogFactory::getLog(class) + extension OutputFormatHelper helper = new OutputFormatHelper + + new() { + log.info("RD2X3D has started") + var FileWriter fw = null + var fileName = "model.x3d" + try { + fw = new FileWriter(config.outputPath + fileName) + fw.write(X3DHead() + toRD + X3DTail()) + } catch (IOException e) { + log.error("Could not create file " + fileName); + } finally { + if (fw !== null) + try { + fw.close; + } catch (IOException e) { + e.printStackTrace; + } + } + log.info("RD2X3D has finished") + } + + def private String toRD() { + val disks = new StringBuilder + val segments = new StringBuilder + var tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:Disk) RETURN n").map[return get("n") as Node] + result.forEach[disks.append(toDisk)] + tx.success + } finally { + tx.close + } + tx = graph.beginTx + try { + var result = graph.execute("MATCH (n:DiskSegment) RETURN n").map[return get("n") as Node] + result.forEach[segments.append(toSegment)] + tx.success + } finally { + tx.close + } + return disks.toString + segments.toString + } + + def private String toDisk(Node disk) { + val position = disk.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode as Node + val entity = disk.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val result = ''' + + + + + + + + + + + ''' + return result + } + + def private String toSegment(Node segment) { + val parent = segment.getSingleRelationship(Rels.CONTAINS, Direction.INCOMING).startNode + val position = parent.getSingleRelationship(Rels.HAS, Direction.OUTGOING).endNode + val entity = segment.getSingleRelationship(Rels.VISUALIZES, Direction.OUTGOING).endNode + val result = ''' + + + + + + + + + + + ''' + return result + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend new file mode 100644 index 000000000..6f475d51a --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend @@ -0,0 +1,198 @@ +package org.getaviz.generator.rd.s2m + +import org.getaviz.lib.database.Database +import org.getaviz.generator.SettingsConfiguration +import org.getaviz.lib.database.Labels +import java.util.GregorianCalendar +import org.neo4j.graphdb.Node +import org.getaviz.lib.database.Rels +import org.neo4j.graphdb.Direction +import org.getaviz.generator.SettingsConfiguration.OutputFormat +import org.apache.commons.logging.LogFactory + +class JQA2RD { + val config = SettingsConfiguration.getInstance + var graph = Database::getInstance(config.databaseName) + val log = LogFactory::getLog(class) + + new () { + log.info("JQA2RD started") + var tx = graph.beginTx + try { + val result = graph.execute("MATCH (n:Package) WHERE NOT (n)<-[:CONTAINS]-(:Package) RETURN n") + val root = graph.createNode(Labels.Model, Labels.RD) + root.setProperty("date", new GregorianCalendar().time.toString) + val configuration = graph.createNode(Labels.RD, Labels.Configuration) + configuration.setProperty("method_type_mode", config.methodTypeMode) + configuration.setProperty("method_disks", config.methodDisks) + configuration.setProperty("data_disks", config.dataDisks) + root.createRelationshipTo(configuration, Rels.USED) + val rootNamespaces = result.map[return get("n") as Node] + rootNamespaces.forEach [ + root.createRelationshipTo(namespaceToDisk, Rels.CONTAINS) + ] + tx.success + } finally { + tx.close + } + log.info("JQA2RD finished") + } + + def private Node namespaceToDisk(Node namespace) { + val disk = graph.createNode(Labels.RD, Labels.Disk) + disk.createRelationshipTo(namespace, Rels.VISUALIZES) + disk.setProperty("ringWidth", config.RDRingWidth) + disk.setProperty("height", config.RDHeight) + disk.setProperty("transparency", config.RDNamespaceTransparency) + val subElements = namespace.getRelationships(Rels.CONTAINS, Direction.OUTGOING).map[return endNode] + val structures = subElements.filter[hasProperty("hash") && !hasLabel(Labels.Inner) && (hasLabel(Labels.Annotation) || hasLabel(Labels.Class) || hasLabel(Labels.Interface) || hasLabel(Labels.Enum))] + val subPackages = subElements.filter[hasProperty("hash") && hasLabel(Labels.Package)] + structures.forEach[disk.createRelationshipTo(structureToDisk, Rels.CONTAINS)] + subPackages.forEach[disk.createRelationshipTo(namespaceToDisk, Rels.CONTAINS)] + return disk + } + + def private Node structureToDisk(Node structure) { + val disk = graph.createNode(Labels.RD, Labels.Disk) + disk.createRelationshipTo(structure, Rels.VISUALIZES) + disk.setProperty("ringWidth", config.RDRingWidth) + disk.setProperty("height", config.RDHeight) + disk.setProperty("transparency", config.RDClassTransparency) + if (config.outputFormat == OutputFormat::AFrame) { + disk.setProperty("color", config.RDClassColorHex) + } else { + disk.setProperty("color", config.RDClassColorAsPercentage) + } + val subElements = structure.getRelationships(Rels.DECLARES, Direction.OUTGOING).map[return endNode as Node] + val methods = subElements.filter [hasProperty("hash") && hasLabel(Labels.Method)] + val attributes = subElements.filter[hasProperty("hash") && !structure.hasLabel(Labels.Enum) && hasLabel(Labels.Field)] + val enumValues = subElements.filter[hasProperty("hash") && structure.hasLabel(Labels.Enum) && hasLabel(Labels.Field)] + + if (config.methodTypeMode) { + methods.forEach [ + if (hasLabel(Labels.Constructor)) { + disk.createRelationshipTo(methodToDiskSegment, Rels.CONTAINS) + } else { + disk.createRelationshipTo(methodToDisk, Rels.CONTAINS) + } + ] + attributes.forEach[disk.createRelationshipTo(attributeToDisk, Rels.CONTAINS)] + enumValues.forEach[disk.createRelationshipTo(enumValueToDisk, Rels.CONTAINS)] + } else { + if (config.dataDisks) { + attributes.forEach[disk.createRelationshipTo(attributeToDisk, Rels.CONTAINS)] + enumValues.forEach[disk.createRelationshipTo(enumValueToDisk, Rels.CONTAINS)] + } else { + attributes.forEach[disk.createRelationshipTo(attributeToDiskSegment, Rels.CONTAINS)] + enumValues.forEach[disk.createRelationshipTo(enumValueToDiskSegment, Rels.CONTAINS)] + } + if (config.methodDisks) { + methods.forEach[disk.createRelationshipTo(methodToDisk, Rels.CONTAINS)] + } else { + methods.forEach[disk.createRelationshipTo(methodToDiskSegment, Rels.CONTAINS)] + } + } + val subStructures = subElements.filter[hasProperty("hash") && (hasLabel(Labels.Class) || hasLabel(Labels.Interface) || hasLabel(Labels.Enum) || hasLabel(Labels.Annotation))] + subStructures.forEach [disk.createRelationshipTo(structureToDisk, Rels.CONTAINS)] + return disk + } + + def private methodToDisk(Node method) { + val disk = graph.createNode(Labels.RD, Labels.Disk) + disk.createRelationshipTo(method, Rels.VISUALIZES) + disk.setProperty("ringWidth", config.RDRingWidth) + disk.setProperty("height", config.RDHeight) + disk.setProperty("transparency", config.RDMethodTransparency) + var color = 153 / 255.0 + " " + 0 / 255.0 + " " + 0 / 255.0 + if (config.outputFormat == OutputFormat::AFrame) { + color = config.RDMethodColorHex + } + disk.setProperty("color", color) + return disk + } + + def private methodToDiskSegment(Node method) { + val diskSegment = graph.createNode(Labels.RD, Labels.DiskSegment) + diskSegment.createRelationshipTo(method, Rels.VISUALIZES) + var frequency = 0.0 + var luminance = 0.0 + var height = config.RDHeight + if (config.outputFormat == OutputFormat::AFrame) { + diskSegment.setProperty("color", config.RDMethodColorHex) + } else { + diskSegment.setProperty("color", config.RDMethodColorAsPercentage) + } + diskSegment.setProperty("transparency", config.RDMethodTransparency) + diskSegment.setProperty("frequency", frequency) + diskSegment.setProperty("luminance", luminance) + diskSegment.setProperty("height", height) + var numberOfStatements = 0 + if (method.hasProperty("effectiveLineCount")) { + numberOfStatements = method.getProperty("effectiveLineCount") as Integer + } + if (numberOfStatements <= config.RDMinArea) { + diskSegment.setProperty("size", config.RDMinArea) + } else { + diskSegment.setProperty("size", numberOfStatements.doubleValue) + } + return diskSegment + } + + def private attributeToDisk(Node attribute) { + val disk = graph.createNode(Labels.RD, Labels.Disk) + disk.createRelationshipTo(attribute, Rels.VISUALIZES) + disk.setProperty("ringWidth", config.RDRingWidthAD) + disk.setProperty("height", config.RDHeight) + disk.setProperty("transparency", config.RDDataTransparency) + var color = 153 / 255.0 + " " + 0 / 255.0 + " " + 0 / 255.0 + if (config.outputFormat == OutputFormat::AFrame) { + color = config.RDDataColorHex + } + disk.setProperty("color", color) + // TODO: getter und setter als disk segment + return disk + } + + def private attributeToDiskSegment(Node attribute) { + val diskSegment = graph.createNode(Labels.RD, Labels.DiskSegment) + diskSegment.createRelationshipTo(attribute, Rels.VISUALIZES) + diskSegment.setProperty("size", 1.0) + diskSegment.setProperty("height", config.RDHeight) + var color = config.RDDataColorAsPercentage + if (config.outputFormat == OutputFormat::AFrame) { + color = config.RDDataColorHex + } + diskSegment.setProperty("color", color) + diskSegment.setProperty("transparency", config.RDDataTransparency) + return diskSegment + } + + def private enumValueToDisk(Node enumValue) { + val disk = graph.createNode(Labels.RD, Labels.Disk) + disk.createRelationshipTo(enumValue, Rels.VISUALIZES) + disk.setProperty("ringWidth", config.RDRingWidthAD) + disk.setProperty("height", config.RDHeight) + disk.setProperty("transparency", config.RDDataTransparency) + var color = 153 / 255.0 + " " + 0 / 255.0 + " " + 0 / 255.0 + if (config.outputFormat == OutputFormat::AFrame) { + color = config.RDDataColorHex + } + disk.setProperty("color", color) + return disk + } + + def private enumValueToDiskSegment(Node enumValue) { + val diskSegment = graph.createNode(Labels.RD, Labels.DiskSegment) + diskSegment.createRelationshipTo(enumValue, Rels.VISUALIZES) + diskSegment.setProperty("size", 1.0) + diskSegment.setProperty("height", config.RDHeight) + var color = config.RDDataColorAsPercentage + if (config.outputFormat == OutputFormat::AFrame) { + color = config.RDDataColorHex + } + diskSegment.setProperty("color", color) + diskSegment.setProperty("transparency", config.RDDataTransparency) + return diskSegment + } + +} diff --git a/generator2/org.getaviz.generator/tests/org/getaviz/generator/tests/RDModificationTest.java b/generator2/org.getaviz.generator/tests/org/getaviz/generator/tests/RDModificationTest.java new file mode 100644 index 000000000..c3e08a44b --- /dev/null +++ b/generator2/org.getaviz.generator/tests/org/getaviz/generator/tests/RDModificationTest.java @@ -0,0 +1,21 @@ +package org.getaviz.generator.tests; + +//import static org.junit.jupiter.api.Assertions.assertTrue; +//import org.junit.jupiter.api.BeforeEach; +//import org.junit.jupiter.api.Disabled; +//import org.junit.jupiter.api.DisplayName; +//import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +//import org.junit.jupiter.api.TestInfo; +//import org.neo4j.graphdb.GraphDatabaseService; +//import org.neo4j.graphdb.Node; +//import org.neo4j.test.TestGraphDatabaseFactory; + + +public class RDModificationTest { + @Test + void justAnExample() { + //GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); + //Node node1 = graph.createNode(); + } +} diff --git a/generator2/org.getaviz.lib.database/.classpath b/generator2/org.getaviz.lib.database/.classpath new file mode 100644 index 000000000..cb998e4d1 --- /dev/null +++ b/generator2/org.getaviz.lib.database/.classpath @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/generator2/org.getaviz.lib.database/.gitignore b/generator2/org.getaviz.lib.database/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/generator2/org.getaviz.lib.database/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/generator2/org.getaviz.lib.database/.project b/generator2/org.getaviz.lib.database/.project new file mode 100644 index 000000000..4687e16ef --- /dev/null +++ b/generator2/org.getaviz.lib.database/.project @@ -0,0 +1,29 @@ + + + org.getaviz.lib.database + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/generator2/org.getaviz.lib.database/pom.xml b/generator2/org.getaviz.lib.database/pom.xml new file mode 100644 index 000000000..23cb4534b --- /dev/null +++ b/generator2/org.getaviz.lib.database/pom.xml @@ -0,0 +1,68 @@ + + 4.0.0 + + ../org.getaviz.parent/pom.xml + org.getaviz + org.getaviz.parent + 1.0.0-SNAPSHOT + + org.getaviz.lib.database + org.getaviz.lib.database + Getaviz Database Connector + + + + org.neo4j + neo4j + 3.4.9 + + + + org.neo4j + neo4j-graphdb-api + ${neo4j.version} + + + + org.eclipse.xtend + org.eclipse.xtend.lib + ${xtend.version} + + + + src + + + org.eclipse.xtend + xtend-maven-plugin + + + maven-compiler-plugin + + + default-testCompile + none + + + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-clean-plugin + ${clean.version} + + + + ${basedir}/output + + + + + + + diff --git a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend b/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend new file mode 100644 index 000000000..687aeabba --- /dev/null +++ b/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend @@ -0,0 +1,101 @@ +package org.getaviz.lib.database + +import org.neo4j.graphdb.GraphDatabaseService +import java.io.File +import org.neo4j.graphdb.factory.GraphDatabaseFactory +import java.util.List +import org.eclipse.xtend.lib.annotations.Accessors + +class Database { + static GraphDatabaseService graph + var static GraphDatabaseService testGraph + @Accessors(PUBLIC_GETTER) static String path + @Accessors(PUBLIC_GETTER) static List databases= { + val dir = new File("../databases/") + dir.mkdir + dir.listFiles.filter(file | file.directory).toList + } + + def static getInstance() { + return graph + } + + def static getInstance(String owner, String name){ + val newPath = "../databases/" + owner + "_" + name + ".db" + return getInstance(newPath) + } + + def static getInstance(File newFile) { + return getInstance(newFile.toString) + } + + def static getInstance(String newPath) { + if (graph === null || path != newPath) { + if (graph !== null) { + graph.shutdown + } + path = newPath + graph = initializeDatabase(path) + } + return graph + } + + def static getName() { + return path.substring(13) + } + + def static getTestInstance() { + if (testGraph === null) { + testGraph = initializeDatabase("testdata/databases/softvis.db") + } + return testGraph + } + + + /** + * Initializes the database. + * If a database already exists, the existing database is used. + * Otherwise a new embedded database is created and the schema constraints are applied. + * Constraints: Define IDs as unique + * + * @param path Path of the database + * @return graph database instance + */ + + def private static initializeDatabase(String path) { + val neofile = new File(path) + val graph = new GraphDatabaseFactory().newEmbeddedDatabase(neofile) + graph.registerShutdownHook +// val tx = graph.beginTx +// try { +// if (graph.schema.constraints.size < 3) { +// graph.schema.constraintFor(DBLabel::FAMIXELEMENT).assertPropertyIsUnique("fid").create +// graph.schema.constraintFor(DBLabel::FAMIX).assertPropertyIsUnique("snapshotID").create +// graph.schema.constraintFor(DBLabel::SYSTEM).assertPropertyIsUnique("systemID").create +// } +// tx.success +// } finally { +// tx.close +// } + + return graph + } + + /** + * Registers a shutdown hook for the Neo4j instance so that it shuts down nicely when the VM exits + * (even if you "Ctrl-C" the running application). + * http://neo4j.com/docs/java-reference/current/#tutorials-java-embedded-setup-startstop + * + * @param graphDb neo4j database + */ + + def private static registerShutdownHook(GraphDatabaseService graphDb ) { + Runtime.runtime.addShutdownHook( new Thread() { + override void run() { + if (graphDb !== null) { + graphDb.shutdown + } + } + } ) + } +} \ No newline at end of file diff --git a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java b/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java new file mode 100644 index 000000000..2700513e3 --- /dev/null +++ b/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java @@ -0,0 +1,9 @@ +package org.getaviz.lib.database; + +import org.neo4j.graphdb.Label; + +public enum Labels implements Label { + Anonymous, Inner, Dummy, Primitive, Parameterized, Package, Member, Type, Method, Constructor, Getter, Setter, Parameter, Field, Class, Interface, Enum, Annotation, + Model, RD, Disk, DiskSegment, City, District, Building, BuildingSegment, Floor, Chimney, Configuration, Position, PanelSeparator, + Cylinder, Box, TRANSFORMED +} \ No newline at end of file diff --git a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java b/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java new file mode 100644 index 000000000..4a602a17e --- /dev/null +++ b/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java @@ -0,0 +1,7 @@ +package org.getaviz.lib.database; + +import org.neo4j.graphdb.RelationshipType; + +public enum Rels implements RelationshipType { + CONTAINS, DECLARES, EXTENDS, INVOKES, WRITES, READS, HAS, USED, VISUALIZES, OF_TYPE, RETURNS +} diff --git a/generator2/org.getaviz.parent/.classpath b/generator2/org.getaviz.parent/.classpath new file mode 100644 index 000000000..248406be3 --- /dev/null +++ b/generator2/org.getaviz.parent/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/generator2/org.getaviz.parent/.project b/generator2/org.getaviz.parent/.project new file mode 100644 index 000000000..e2e9d9cd3 --- /dev/null +++ b/generator2/org.getaviz.parent/.project @@ -0,0 +1,11 @@ + + + org.getaviz.parent + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/generator2/org.getaviz.parent/Generator.launch b/generator2/org.getaviz.parent/Generator.launch new file mode 100644 index 000000000..5059ef870 --- /dev/null +++ b/generator2/org.getaviz.parent/Generator.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/generator2/org.getaviz.parent/pom.xml b/generator2/org.getaviz.parent/pom.xml new file mode 100644 index 000000000..234ab4e4a --- /dev/null +++ b/generator2/org.getaviz.parent/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + org.getaviz + org.getaviz.parent + 1.0.0-SNAPSHOT + Getaviz Generator + https://github.com/getaviz/Getaviz + pom + + ../org.getaviz.lib.database + ../org.getaviz.generator + + + 2.15.0 + 3.0.0 + 2.19.1 + 3.4.9 + 5.3.1 + false + UTF-8 + + + + log4j + log4j + 1.2.17 + + + From 785aa0f52064471e921a1d1fb28510e0494718dd Mon Sep 17 00:00:00 2001 From: David Baum Date: Fri, 16 Nov 2018 18:43:33 +0100 Subject: [PATCH 21/71] small bug fixes --- generator2/org.getaviz.generator/.project | 10 ---------- .../src/org/getaviz/generator/city/m2m/City2City.xtend | 4 ++-- .../src/org/getaviz/generator/jqa/JQA2JSON.xtend | 10 +++++++--- .../src/org/getaviz/generator/jqa/JQAEnhancement.xtend | 5 +---- .../src/org/getaviz/generator/jqa/JQAEvaluator.xtend | 9 --------- .../src/org/getaviz/generator/rd/m2m/RD2RD.xtend | 4 ++-- 6 files changed, 12 insertions(+), 30 deletions(-) diff --git a/generator2/org.getaviz.generator/.project b/generator2/org.getaviz.generator/.project index c1d83efe3..002d4c05b 100644 --- a/generator2/org.getaviz.generator/.project +++ b/generator2/org.getaviz.generator/.project @@ -10,16 +10,6 @@ - - org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, - - - LaunchConfigHandle - <project>/.externalToolBuilders/org.eclipse.xtext.ui.shared.xtextBuilder.launch - - - org.eclipse.jdt.core.javabuilder diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend index 5ac2fbba0..6177e67c9 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend @@ -29,7 +29,7 @@ class City2City { var Node model new () { - log.info("CityModification started") + log.info("City2City started") graph = Database::getInstance(config.databaseName) var tx = graph.beginTx try { @@ -113,7 +113,7 @@ class City2City { } finally { tx.close } - log.info("CityModification finished") + log.info("City2City finished") } def private void setDistrictAttributes(Path districtPath) { diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend index a49810f3e..7e96304cf 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend @@ -193,7 +193,7 @@ class JQA2JSON { def private toMetaDataAnnotation(Node annotation) { var belongsTo = "" - val parent = annotation.getRelationships(Direction.INCOMING, Rels.CONTAINS, Rels.DECLARES).head + val parent = annotation.getRelationships(Direction.INCOMING, Rels.CONTAINS, Rels.DECLARES).filter[hasProperty("Package")].head if(parent !== null) { belongsTo = parent.startNode.getProperty("hash") as String } @@ -300,8 +300,12 @@ class JQA2JSON { def private getParameters(Node method) { val parameterList = newArrayList val list = method.getRelationships(Rels.HAS, Direction.OUTGOING).map[endNode]; - list.filter[hasLabel(Labels.Parameter)].sortBy[p|p.getProperty("index") as Integer].forEach[p| - parameterList += p.getSingleRelationship(Rels.OF_TYPE, Direction.OUTGOING).endNode.getProperty("name") as String + list.filter[hasLabel(Labels.Parameter)].sortBy[p|p.getProperty("index", 0) as Integer].forEach[p| + try { + parameterList += p.getSingleRelationship(Rels.OF_TYPE, Direction.OUTGOING).endNode.getProperty("name") as String + } catch (NullPointerException e) { + + } ] return parameterList.removeBrackets } diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend index 11f977fdf..0a1118e8b 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend @@ -56,7 +56,6 @@ class JQAEnhancement { graph.traversalDescription.depthFirst.relationships(Rels.CONTAINS, Direction.OUTGOING).relationships( Rels.DECLARES, Direction.OUTGOING).uniqueness(Uniqueness.NONE).evaluator(evaluator).traverse(package). nodes.forEach [ - // log.debug(id) var fqn = getProperty("fqn", "") as String if (fqn.empty) { val container = getSingleRelationship(Rels.DECLARES, Direction.INCOMING).startNode @@ -80,9 +79,7 @@ class JQAEnhancement { } setProperty("fqn", fqn) } - // fqn = fqn.replace("$", ".") - var hash = getProperty("hash", "") as String - if (hash.empty) { + if (!hasProperty("hash")) { setProperty("hash", createHash(fqn)) } ] diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend index bc3f2391b..32f530281 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend @@ -65,15 +65,6 @@ class JQAEvaluator implements Evaluator { } else { return Evaluation.INCLUDE_AND_CONTINUE } - -// val result = graph.execute( -// "MATCH (m1:Method)<-[:DECLARES]-(c:Type)-[:EXTENDS]->(p:Type)-[:DECLARES]->(m2) WHERE ID(m1) = " + -// node.id + " AND m1.signature = m2.signature RETURN m1") -// if (result === null) { -// return Evaluation.INCLUDE_AND_CONTINUE -// } else { -// return Evaluation.EXCLUDE_AND_CONTINUE -// } } } return Evaluation.EXCLUDE_AND_PRUNE diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend index 5313b34e0..29a18cd3b 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend @@ -31,7 +31,7 @@ class RD2RD { RGBColor[] NS_colors new() { - log.info("RDModifikation started") + log.info("RD2RD started") var tx = graph.beginTx try { var result = graph.execute( @@ -91,7 +91,7 @@ class RD2RD { } finally { tx.close } - log.info("RDModifikation finished") + log.info("RD2RD finished") } def private setNamespaceColor(Node namespaceDisk) { From 2c589f145224b3baa35b6e5bd2761348f972cc98 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 18 Dec 2018 11:57:44 +0100 Subject: [PATCH 22/71] AframeRelationConnectorController works - most functions work - calculateBorderPosition-function can be universally used to determine the intersection point of a line through two points and an specific object - no testing of sourceStart/targetEndAtParentBorder due to missing relations in the current model. Should work though with aforementioned function - no work on circle/square shapes because they don't work correctly in x3dom version - added a missing semicolon to the original relationConnectorController --- .../AframeRelationConnectorController.js | 415 ++++-------------- .../RelationConnectorController.js | 2 +- ui/setups/test/aframe.js | 10 +- 3 files changed, 93 insertions(+), 334 deletions(-) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index d6e2f8a8e..624b4a24a 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -17,13 +17,13 @@ var relationConnectorController = function(){ //config parameters var controllerConfig = { fixPositionZ : false, - showInnerRelations : true, + showInnerRelations : false, elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, - createEndpoints : false, + createEndpoints : true, } @@ -147,16 +147,18 @@ var relationConnectorController = function(){ } //create scene element - let connector = createConnector(sourceEntity, relatedEntity); + let connectorElements = createConnector(sourceEntity, relatedEntity); //target or source not rendered -> no connector -> remove relatation - if( connector === undefined){ + if( connectorElements === undefined){ return; } events.log.info.publish({ text: "connector - onRelationsChanged - create connector"}); - - connectors.push(connector); + + connectorElements.forEach(function(element) { + connectors.push(element); + }); //create model entity var relation = model.createEntity( @@ -199,86 +201,82 @@ var relationConnectorController = function(){ if( targetPosition === null ){ return; } + if( controllerConfig.sourceStartAtBorder ) { + sourcePosition = calculateBorderPosition(targetPosition, sourcePosition, entity); + } + if( controllerConfig.targetEndAtBorder ) { + targetPosition = calculateBorderPosition(sourcePosition, targetPosition, relatedEntity); + } - var connectorColor = "1 0 0"; - var connectorSize = 0.5; + var connectorColor = {r:1, g:1, b:0}; + var connectorSize = 0.05; //config - if(controllerConfig.fixPositionZ){ - sourcePosition[z] = controllerConfig.fixPositionZ; - targetPosition[z] = controllerConfig.fixPositionZ; - } + if(controllerConfig.fixPositionZ) { + sourcePosition[z] = controllerConfig.fixPositionZ; + targetPosition[z] = controllerConfig.fixPositionZ; + } + + + let deltaX = targetPosition.x - sourcePosition.x; + let deltaY = targetPosition.y - sourcePosition.y; + let deltaZ = targetPosition.z - sourcePosition.z; + + let distance = sourcePosition.distanceTo(targetPosition); + let direction = new THREE.Vector3(deltaX, deltaY, deltaZ).normalize(); //create element - var connector = document.createElement("a-entity"); - connector.setAttribute("line", { - start: sourcePosition, - end: targetPosition, - color: "red" - }); - - document.querySelector("a-scene").appendChild(connector); - - /*//config - if(controllerConfig.createEndpoints){ - transform.appendChild(createEndPoint(sourcePosition, targetPosition, "0 0 0", connectorSize * 2)); - }*/ - - return connector; - } + var connector = document.createElement("a-cylinder"); + connector.addEventListener("loaded", function() { + let threeMesh = this.object3DMap.mesh; - - - - - - - - function calculateSourcePosition(entity, relatedEntity){ - - var sourcePosition = getObjectPosition(entity.id); - - if(controllerConfig.sourceStartAtParentBorder){ - if(!isTargetChildOfSourceParent(relatedEntity, entity)){ - var targetPosition = getObjectPosition(relatedEntity.id); - if(targetPosition === null){ - return null; - } - sourcePosition = calculatePositionFromParent(sourcePosition, targetPosition, entity.belongsTo); - } - } + threeMesh.scale.set(connectorSize, distance, connectorSize); + threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.position.set(sourcePosition.x+deltaX/2, + sourcePosition.y+deltaY/2, + sourcePosition.z+deltaZ/2); - if(controllerConfig.sourceStartAtBorder){ - var targetPosition = getObjectPosition(relatedEntity.id); - if(targetPosition === null){ - return null; - } - sourcePosition = calculateBorderPosition(sourcePosition, targetPosition, entity); - } - - return sourcePosition; - } - - function calculateTargetPosition(entity, relatedEntity){ - - var targetPosition = getObjectPosition(relatedEntity.id); - if(targetPosition === null){ - return null; - } - - if(controllerConfig.targetEndAtParentBorder){ - if(!isTargetChildOfSourceParent(relatedEntity, entity)){ - var sourcePosition = getObjectPosition(entity.id); - targetPosition = calculatePositionFromParent(targetPosition, sourcePosition, relatedEntity.belongsTo); - } - } - if(controllerConfig.targetEndAtBorder){ - var sourcePosition = getObjectPosition(entity.id); - targetPosition = calculateBorderPosition(targetPosition, sourcePosition, relatedEntity); - } - - return targetPosition; + var quaternion = threeMesh.quaternion; + quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); + }); + + + + let scene = document.querySelector("a-scene"); + scene.appendChild(connector); + var connectorElements = []; + connectorElements.push(connector); + if(controllerConfig.createEndpoints) { + var size = connectorSize*1.5; + var length = size * 6; + var sourceEndPoint = document.createElement("a-cylinder"); + sourceEndPoint.addEventListener("loaded", function() { + let threeMesh = this.object3DMap.mesh; + threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.scale.set(size, length, size); + threeMesh.position.set(sourcePosition.x, sourcePosition.y, sourcePosition.z); + var quaternion = threeMesh.quaternion; + quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); + }); + var targetEndPoint = document.createElement("a-cylinder"); + targetEndPoint.addEventListener("loaded", function() { + let threeMesh = this.object3DMap.mesh; + threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.material.needsUpdate = true; + console.debug(threeMesh.material); + threeMesh.scale.set(size, length, size); + threeMesh.position.set(targetPosition.x, targetPosition.y, targetPosition.z); + var quaternion = threeMesh.quaternion; + quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction.normalize()); + }); + scene.appendChild(sourceEndPoint); + scene.appendChild(targetEndPoint); + connectorElements.push(sourceEndPoint); + connectorElements.push(targetEndPoint); + + } + return connectorElements; } function isTargetChildOfSourceParent(target, source){ @@ -299,104 +297,14 @@ var relationConnectorController = function(){ } function calculateBorderPosition(sourcePosition, targetPosition, entity){ - - if(!loadedMin.has(entity.id) || !loadedMax.has(entity.id)){ - events.log.error.publish({ text: "min max position for " + entity.id + " not loaded!" }); - return; - } - - var min = loadedMin.get(entity.id); - var max = loadedMax.get(entity.id); - - var sourcePosition = sourcePosition.slice(); - var targetPosition = targetPosition.slice(); - - //calculate the 4 corner points - var point00 = min.slice(); - var point01 = min.slice(); - var point10 = max.slice(); - var point11 = max.slice(); - - point01[2] = max[2]; - point10[2] = min[2]; - - //set y value of all points to delta y - var deltaY = min[1] + (( max[1] - min[1]) / 2); - point00[1] = deltaY; - point01[1] = deltaY; - point10[1] = deltaY; - point11[1] = deltaY; - - sourcePosition[1] = deltaY; - targetPosition[1] = deltaY; - - - //calculate distances - - var distances = new Map(); - distances.set(calculateDistance(point00, targetPosition), point00); - distances.set(calculateDistance(point01, targetPosition), point01); - distances.set(calculateDistance(point10, targetPosition), point10); - distances.set(calculateDistance(point11, targetPosition), point11); - - //get the two nearest points - var sortedDistances = Array.from(distances.keys()); - sortedDistances = sortedDistances.sort(function(a,b){return a-b}); - - var nearestPoint1 = distances.get(sortedDistances[0]); - var nearestPoint2 = distances.get(sortedDistances[1]); - - - var valueUsedToCalculate; - var valueToCalculate; - if(nearestPoint1[0] === nearestPoint2[0]){ - valueUsedToCalculate = 0; - valueToCalculate = 2; - } else if(nearestPoint1[2] === nearestPoint2[2]){ - valueUsedToCalculate = 2; - valueToCalculate = 0; - } else { - events.log.error.publish({ text: "border points could not be calcuated" }); - return; - } - - var riseVector = calculateDistanceVector(sourcePosition, targetPosition); - - - if(riseVector[valueUsedToCalculate] == 0){ - var valueSwitch = valueUsedToCalculate; - valueUsedToCalculate = valueToCalculate; - valueToCalculate = valueSwitch; - } - - var riseFactor = ( nearestPoint1[valueUsedToCalculate] - targetPosition[valueUsedToCalculate] ) / riseVector[valueUsedToCalculate]; - - - - var borderPoint = new Array(); - borderPoint[valueUsedToCalculate] = nearestPoint1[valueUsedToCalculate]; - borderPoint[valueToCalculate] = targetPosition[valueToCalculate] + ( riseFactor * riseVector[valueToCalculate] ); - borderPoint[1] = deltaY; - - return borderPoint; - } - - function calculateDistance(point1, point2){ - var distanceVector = calculateDistanceVector(point1, point2); - return Math.sqrt( Math.pow(distanceVector[0], 2) + Math.pow(distanceVector[1], 2) + Math.pow(distanceVector[2], 2) ); - } - - function calculateDistanceVector(point1, point2){ - var distanceVector = new Array(); - distanceVector[0] = point1[0] - point2[0]; - distanceVector[1] = point1[1] - point2[1]; - distanceVector[2] = point1[2] - point2[2]; - - return distanceVector; + let object = document.getElementById(entity.id); + let raycaster = new THREE.Raycaster(); + raycaster.set(sourcePosition, targetPosition.subVectors(targetPosition, sourcePosition).normalize()); + let intersection = raycaster.intersectObject(object.object3DMap.mesh); + return intersection[0].point; } - - function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ + /*function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ if(controllerConfig.elementShape == "circle"){ return calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent); } @@ -458,164 +366,7 @@ var relationConnectorController = function(){ } return newSourcePosition; - } - - - - function getObjectPosition(objectId){ - - var position = null; - - if( loadedPositions.has(objectId) ){ - position = loadedPositions.get(objectId); - } else { - var myElement = jQuery("#" + objectId)[0]; - if( myElement != undefined ){ - position = parseObjectPosition(myElement.getAttribute("translation")); - } - } - - if( position === null){ - events.log.error.publish({ text: objectId + "has no position data" }); - } - - return position; - } - - function parseObjectPosition(positionString){ - - var position = positionString.split(" "); - - for (var index = 0; index < position.length; ++index) { - position[index] = parseFloat(position[index]); - } - - return position; - } - - - - - function createEndPoint(source, target, color, size){ - //calculate attributes - - //endPointAngle - var lineX = target[0]-source[0]; - var lineY = target[1]-source[1]; - - var endPointAngle = Math.atan( Math.abs(lineY / lineX) ); - - //endPointAmount - var lineAmount = Math.pow( lineX, 2) + Math.pow( lineY, 2); - lineAmount = Math.sqrt(lineAmount,2); - - var endPointAmount = lineAmount - 0.5; - - //endPoint positions - var endPointX = Math.cos(endPointAngle) * endPointAmount; - var endPointY = Math.sin(endPointAngle) * endPointAmount; - - if( lineX <= 0 && lineY >= 0){ - endPointX = endPointX * -1; - } - if( lineX <= 0 && lineY <= 0){ - endPointX = endPointX * -1; - endPointY = endPointY * -1; - } - if( lineX >= 0 && lineY <= 0){ - endPointY = endPointY * -1; - } - - var translation = []; - - translation[0] = source[0] + endPointX; - translation[1] = source[1] + endPointY; - translation[2] = (source[2]+(target[2]-source[2])/2.0); - - var scale = []; - scale[0] = size; - scale[1] = 1; - scale[2] = size; - - var rotation = []; - rotation[0] = (target[2]-source[2]); - rotation[1] = 0; - rotation[2] = (-1.0)*(target[0]-source[0]); - rotation[3] = Math.acos((target[1] - source[1])/(Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) ))); - - //create element - var transform = document.createElement('Transform'); - - transform.setAttribute("translation", translation.toString()); - transform.setAttribute("scale", scale.toString()); - transform.setAttribute("rotation", rotation.toString()); - - var shape = document.createElement('Shape'); - transform.appendChild(shape); - - var appearance = document.createElement('Appearance'); - shape.appendChild(appearance); - var material = document.createElement('Material'); - material.setAttribute("diffuseColor", color); - appearance.appendChild(material); - - - var cylinder = document.createElement('Cylinder'); - cylinder.setAttribute("radius", "0.25"); - cylinder.setAttribute("height", "1"); - shape.appendChild(cylinder); - - return transform; - } - - - - function createLine(source, target, color, size){ - //calculate attributes - - var betrag = (Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) )); - var translation = []; - - translation[0] = source[0]+(target[0]-source[0])/2.0; - translation[1] = source[1]+(target[1]-source[1])/2.0; - translation[2] = source[2]+(target[2]-source[2])/2.0; - - var scale = []; - scale[0] = size; - scale[1] = betrag; - scale[2] = size; - - var rotation = []; - rotation[0] = (target[2]-source[2]); - rotation[1] = 0; - rotation[2] = (-1.0)*(target[0]-source[0]); - rotation[3] = Math.acos((target[1] - source[1])/(Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) ))); - - //create element - var transform = document.createElement('Transform'); - - transform.setAttribute("translation", translation.toString()); - transform.setAttribute("scale", scale.toString()); - transform.setAttribute("rotation", rotation.toString()); - - var shape = document.createElement('Shape'); - transform.appendChild(shape); - - var appearance = document.createElement('Appearance'); - shape.appendChild(appearance); - var material = document.createElement('Material'); - material.setAttribute("diffuseColor", color); - appearance.appendChild(material); - - - var cylinder = document.createElement('Cylinder'); - cylinder.setAttribute("radius", "0.25"); - cylinder.setAttribute("height", "1"); - shape.appendChild(cylinder); - - return transform; - } - + }*/ return { diff --git a/ui/scripts/RelationConnector/RelationConnectorController.js b/ui/scripts/RelationConnector/RelationConnectorController.js index ca38faa53..2e6079f4a 100644 --- a/ui/scripts/RelationConnector/RelationConnectorController.js +++ b/ui/scripts/RelationConnector/RelationConnectorController.js @@ -461,7 +461,7 @@ var relationConnectorController = function(){ var AA = 1 + Math.pow(a, 2); - var BB = (2 * a * b) + var BB = (2 * a * b); var CC = Math.pow(b, 2) - Math.pow(r, 2); var XX = Math.pow(BB, 2) - 4 * AA * CC; diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 447808cf5..7e0ef25e1 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -30,7 +30,15 @@ var setup = { name: "relationTransparencyController" }, { - name: "relationConnectorController" + name: "relationConnectorController", + fixPositionZ : false, + showInnerRelations : true, + elementShape : "", //circle, square + sourceStartAtParentBorder : false, + targetEndAtParentBorder : false, + sourceStartAtBorder: true, + targetEndAtBorder: true, + createEndpoints : true, }, { name: "searchController" From 2dd70a131018d786abf54c399da9d7126d4c5f71 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 18 Dec 2018 11:57:44 +0100 Subject: [PATCH 23/71] AframeRelationConnectorController works - most functions work - setting color of connector works a-scenes defaultLights enabled - calculateBorderPosition-function can be universally used to determine the intersection point of a line through two points and an specific object - no testing of sourceStart/targetEndAtParentBorder due to missing relations in the current model. Should work though with aforementioned function - no work on circle/square shapes because they don't work correctly in x3dom version - added a missing semicolon to the original relationConnectorController --- .../AframeRelationConnectorController.js | 415 ++++-------------- .../RelationConnectorController.js | 2 +- ui/setups/test/aframe.js | 10 +- 3 files changed, 93 insertions(+), 334 deletions(-) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index d6e2f8a8e..624b4a24a 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -17,13 +17,13 @@ var relationConnectorController = function(){ //config parameters var controllerConfig = { fixPositionZ : false, - showInnerRelations : true, + showInnerRelations : false, elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, - createEndpoints : false, + createEndpoints : true, } @@ -147,16 +147,18 @@ var relationConnectorController = function(){ } //create scene element - let connector = createConnector(sourceEntity, relatedEntity); + let connectorElements = createConnector(sourceEntity, relatedEntity); //target or source not rendered -> no connector -> remove relatation - if( connector === undefined){ + if( connectorElements === undefined){ return; } events.log.info.publish({ text: "connector - onRelationsChanged - create connector"}); - - connectors.push(connector); + + connectorElements.forEach(function(element) { + connectors.push(element); + }); //create model entity var relation = model.createEntity( @@ -199,86 +201,82 @@ var relationConnectorController = function(){ if( targetPosition === null ){ return; } + if( controllerConfig.sourceStartAtBorder ) { + sourcePosition = calculateBorderPosition(targetPosition, sourcePosition, entity); + } + if( controllerConfig.targetEndAtBorder ) { + targetPosition = calculateBorderPosition(sourcePosition, targetPosition, relatedEntity); + } - var connectorColor = "1 0 0"; - var connectorSize = 0.5; + var connectorColor = {r:1, g:1, b:0}; + var connectorSize = 0.05; //config - if(controllerConfig.fixPositionZ){ - sourcePosition[z] = controllerConfig.fixPositionZ; - targetPosition[z] = controllerConfig.fixPositionZ; - } + if(controllerConfig.fixPositionZ) { + sourcePosition[z] = controllerConfig.fixPositionZ; + targetPosition[z] = controllerConfig.fixPositionZ; + } + + + let deltaX = targetPosition.x - sourcePosition.x; + let deltaY = targetPosition.y - sourcePosition.y; + let deltaZ = targetPosition.z - sourcePosition.z; + + let distance = sourcePosition.distanceTo(targetPosition); + let direction = new THREE.Vector3(deltaX, deltaY, deltaZ).normalize(); //create element - var connector = document.createElement("a-entity"); - connector.setAttribute("line", { - start: sourcePosition, - end: targetPosition, - color: "red" - }); - - document.querySelector("a-scene").appendChild(connector); - - /*//config - if(controllerConfig.createEndpoints){ - transform.appendChild(createEndPoint(sourcePosition, targetPosition, "0 0 0", connectorSize * 2)); - }*/ - - return connector; - } + var connector = document.createElement("a-cylinder"); + connector.addEventListener("loaded", function() { + let threeMesh = this.object3DMap.mesh; - - - - - - - - function calculateSourcePosition(entity, relatedEntity){ - - var sourcePosition = getObjectPosition(entity.id); - - if(controllerConfig.sourceStartAtParentBorder){ - if(!isTargetChildOfSourceParent(relatedEntity, entity)){ - var targetPosition = getObjectPosition(relatedEntity.id); - if(targetPosition === null){ - return null; - } - sourcePosition = calculatePositionFromParent(sourcePosition, targetPosition, entity.belongsTo); - } - } + threeMesh.scale.set(connectorSize, distance, connectorSize); + threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.position.set(sourcePosition.x+deltaX/2, + sourcePosition.y+deltaY/2, + sourcePosition.z+deltaZ/2); - if(controllerConfig.sourceStartAtBorder){ - var targetPosition = getObjectPosition(relatedEntity.id); - if(targetPosition === null){ - return null; - } - sourcePosition = calculateBorderPosition(sourcePosition, targetPosition, entity); - } - - return sourcePosition; - } - - function calculateTargetPosition(entity, relatedEntity){ - - var targetPosition = getObjectPosition(relatedEntity.id); - if(targetPosition === null){ - return null; - } - - if(controllerConfig.targetEndAtParentBorder){ - if(!isTargetChildOfSourceParent(relatedEntity, entity)){ - var sourcePosition = getObjectPosition(entity.id); - targetPosition = calculatePositionFromParent(targetPosition, sourcePosition, relatedEntity.belongsTo); - } - } - if(controllerConfig.targetEndAtBorder){ - var sourcePosition = getObjectPosition(entity.id); - targetPosition = calculateBorderPosition(targetPosition, sourcePosition, relatedEntity); - } - - return targetPosition; + var quaternion = threeMesh.quaternion; + quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); + }); + + + + let scene = document.querySelector("a-scene"); + scene.appendChild(connector); + var connectorElements = []; + connectorElements.push(connector); + if(controllerConfig.createEndpoints) { + var size = connectorSize*1.5; + var length = size * 6; + var sourceEndPoint = document.createElement("a-cylinder"); + sourceEndPoint.addEventListener("loaded", function() { + let threeMesh = this.object3DMap.mesh; + threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.scale.set(size, length, size); + threeMesh.position.set(sourcePosition.x, sourcePosition.y, sourcePosition.z); + var quaternion = threeMesh.quaternion; + quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); + }); + var targetEndPoint = document.createElement("a-cylinder"); + targetEndPoint.addEventListener("loaded", function() { + let threeMesh = this.object3DMap.mesh; + threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.material.needsUpdate = true; + console.debug(threeMesh.material); + threeMesh.scale.set(size, length, size); + threeMesh.position.set(targetPosition.x, targetPosition.y, targetPosition.z); + var quaternion = threeMesh.quaternion; + quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction.normalize()); + }); + scene.appendChild(sourceEndPoint); + scene.appendChild(targetEndPoint); + connectorElements.push(sourceEndPoint); + connectorElements.push(targetEndPoint); + + } + return connectorElements; } function isTargetChildOfSourceParent(target, source){ @@ -299,104 +297,14 @@ var relationConnectorController = function(){ } function calculateBorderPosition(sourcePosition, targetPosition, entity){ - - if(!loadedMin.has(entity.id) || !loadedMax.has(entity.id)){ - events.log.error.publish({ text: "min max position for " + entity.id + " not loaded!" }); - return; - } - - var min = loadedMin.get(entity.id); - var max = loadedMax.get(entity.id); - - var sourcePosition = sourcePosition.slice(); - var targetPosition = targetPosition.slice(); - - //calculate the 4 corner points - var point00 = min.slice(); - var point01 = min.slice(); - var point10 = max.slice(); - var point11 = max.slice(); - - point01[2] = max[2]; - point10[2] = min[2]; - - //set y value of all points to delta y - var deltaY = min[1] + (( max[1] - min[1]) / 2); - point00[1] = deltaY; - point01[1] = deltaY; - point10[1] = deltaY; - point11[1] = deltaY; - - sourcePosition[1] = deltaY; - targetPosition[1] = deltaY; - - - //calculate distances - - var distances = new Map(); - distances.set(calculateDistance(point00, targetPosition), point00); - distances.set(calculateDistance(point01, targetPosition), point01); - distances.set(calculateDistance(point10, targetPosition), point10); - distances.set(calculateDistance(point11, targetPosition), point11); - - //get the two nearest points - var sortedDistances = Array.from(distances.keys()); - sortedDistances = sortedDistances.sort(function(a,b){return a-b}); - - var nearestPoint1 = distances.get(sortedDistances[0]); - var nearestPoint2 = distances.get(sortedDistances[1]); - - - var valueUsedToCalculate; - var valueToCalculate; - if(nearestPoint1[0] === nearestPoint2[0]){ - valueUsedToCalculate = 0; - valueToCalculate = 2; - } else if(nearestPoint1[2] === nearestPoint2[2]){ - valueUsedToCalculate = 2; - valueToCalculate = 0; - } else { - events.log.error.publish({ text: "border points could not be calcuated" }); - return; - } - - var riseVector = calculateDistanceVector(sourcePosition, targetPosition); - - - if(riseVector[valueUsedToCalculate] == 0){ - var valueSwitch = valueUsedToCalculate; - valueUsedToCalculate = valueToCalculate; - valueToCalculate = valueSwitch; - } - - var riseFactor = ( nearestPoint1[valueUsedToCalculate] - targetPosition[valueUsedToCalculate] ) / riseVector[valueUsedToCalculate]; - - - - var borderPoint = new Array(); - borderPoint[valueUsedToCalculate] = nearestPoint1[valueUsedToCalculate]; - borderPoint[valueToCalculate] = targetPosition[valueToCalculate] + ( riseFactor * riseVector[valueToCalculate] ); - borderPoint[1] = deltaY; - - return borderPoint; - } - - function calculateDistance(point1, point2){ - var distanceVector = calculateDistanceVector(point1, point2); - return Math.sqrt( Math.pow(distanceVector[0], 2) + Math.pow(distanceVector[1], 2) + Math.pow(distanceVector[2], 2) ); - } - - function calculateDistanceVector(point1, point2){ - var distanceVector = new Array(); - distanceVector[0] = point1[0] - point2[0]; - distanceVector[1] = point1[1] - point2[1]; - distanceVector[2] = point1[2] - point2[2]; - - return distanceVector; + let object = document.getElementById(entity.id); + let raycaster = new THREE.Raycaster(); + raycaster.set(sourcePosition, targetPosition.subVectors(targetPosition, sourcePosition).normalize()); + let intersection = raycaster.intersectObject(object.object3DMap.mesh); + return intersection[0].point; } - - function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ + /*function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ if(controllerConfig.elementShape == "circle"){ return calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent); } @@ -458,164 +366,7 @@ var relationConnectorController = function(){ } return newSourcePosition; - } - - - - function getObjectPosition(objectId){ - - var position = null; - - if( loadedPositions.has(objectId) ){ - position = loadedPositions.get(objectId); - } else { - var myElement = jQuery("#" + objectId)[0]; - if( myElement != undefined ){ - position = parseObjectPosition(myElement.getAttribute("translation")); - } - } - - if( position === null){ - events.log.error.publish({ text: objectId + "has no position data" }); - } - - return position; - } - - function parseObjectPosition(positionString){ - - var position = positionString.split(" "); - - for (var index = 0; index < position.length; ++index) { - position[index] = parseFloat(position[index]); - } - - return position; - } - - - - - function createEndPoint(source, target, color, size){ - //calculate attributes - - //endPointAngle - var lineX = target[0]-source[0]; - var lineY = target[1]-source[1]; - - var endPointAngle = Math.atan( Math.abs(lineY / lineX) ); - - //endPointAmount - var lineAmount = Math.pow( lineX, 2) + Math.pow( lineY, 2); - lineAmount = Math.sqrt(lineAmount,2); - - var endPointAmount = lineAmount - 0.5; - - //endPoint positions - var endPointX = Math.cos(endPointAngle) * endPointAmount; - var endPointY = Math.sin(endPointAngle) * endPointAmount; - - if( lineX <= 0 && lineY >= 0){ - endPointX = endPointX * -1; - } - if( lineX <= 0 && lineY <= 0){ - endPointX = endPointX * -1; - endPointY = endPointY * -1; - } - if( lineX >= 0 && lineY <= 0){ - endPointY = endPointY * -1; - } - - var translation = []; - - translation[0] = source[0] + endPointX; - translation[1] = source[1] + endPointY; - translation[2] = (source[2]+(target[2]-source[2])/2.0); - - var scale = []; - scale[0] = size; - scale[1] = 1; - scale[2] = size; - - var rotation = []; - rotation[0] = (target[2]-source[2]); - rotation[1] = 0; - rotation[2] = (-1.0)*(target[0]-source[0]); - rotation[3] = Math.acos((target[1] - source[1])/(Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) ))); - - //create element - var transform = document.createElement('Transform'); - - transform.setAttribute("translation", translation.toString()); - transform.setAttribute("scale", scale.toString()); - transform.setAttribute("rotation", rotation.toString()); - - var shape = document.createElement('Shape'); - transform.appendChild(shape); - - var appearance = document.createElement('Appearance'); - shape.appendChild(appearance); - var material = document.createElement('Material'); - material.setAttribute("diffuseColor", color); - appearance.appendChild(material); - - - var cylinder = document.createElement('Cylinder'); - cylinder.setAttribute("radius", "0.25"); - cylinder.setAttribute("height", "1"); - shape.appendChild(cylinder); - - return transform; - } - - - - function createLine(source, target, color, size){ - //calculate attributes - - var betrag = (Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) )); - var translation = []; - - translation[0] = source[0]+(target[0]-source[0])/2.0; - translation[1] = source[1]+(target[1]-source[1])/2.0; - translation[2] = source[2]+(target[2]-source[2])/2.0; - - var scale = []; - scale[0] = size; - scale[1] = betrag; - scale[2] = size; - - var rotation = []; - rotation[0] = (target[2]-source[2]); - rotation[1] = 0; - rotation[2] = (-1.0)*(target[0]-source[0]); - rotation[3] = Math.acos((target[1] - source[1])/(Math.sqrt( Math.pow(target[0] - source[0], 2) + Math.pow(target[1] - source[1], 2) + Math.pow(target[2] - source[2], 2) ))); - - //create element - var transform = document.createElement('Transform'); - - transform.setAttribute("translation", translation.toString()); - transform.setAttribute("scale", scale.toString()); - transform.setAttribute("rotation", rotation.toString()); - - var shape = document.createElement('Shape'); - transform.appendChild(shape); - - var appearance = document.createElement('Appearance'); - shape.appendChild(appearance); - var material = document.createElement('Material'); - material.setAttribute("diffuseColor", color); - appearance.appendChild(material); - - - var cylinder = document.createElement('Cylinder'); - cylinder.setAttribute("radius", "0.25"); - cylinder.setAttribute("height", "1"); - shape.appendChild(cylinder); - - return transform; - } - + }*/ return { diff --git a/ui/scripts/RelationConnector/RelationConnectorController.js b/ui/scripts/RelationConnector/RelationConnectorController.js index ca38faa53..2e6079f4a 100644 --- a/ui/scripts/RelationConnector/RelationConnectorController.js +++ b/ui/scripts/RelationConnector/RelationConnectorController.js @@ -461,7 +461,7 @@ var relationConnectorController = function(){ var AA = 1 + Math.pow(a, 2); - var BB = (2 * a * b) + var BB = (2 * a * b); var CC = Math.pow(b, 2) - Math.pow(r, 2); var XX = Math.pow(BB, 2) - 4 * AA * CC; diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 447808cf5..7e0ef25e1 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -30,7 +30,15 @@ var setup = { name: "relationTransparencyController" }, { - name: "relationConnectorController" + name: "relationConnectorController", + fixPositionZ : false, + showInnerRelations : true, + elementShape : "", //circle, square + sourceStartAtParentBorder : false, + targetEndAtParentBorder : false, + sourceStartAtBorder: true, + targetEndAtBorder: true, + createEndpoints : true, }, { name: "searchController" From 51a6eed415ae9f5b46493e0fa8e579b19bf35f40 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 18 Dec 2018 12:09:06 +0100 Subject: [PATCH 24/71] /relationConnectorController: Auto stash before revert of "Merge remote-tracking branch 'origin/feature/relationConnectorController' into feature/relationConnectorController" --- .../RelationConnector/AframeRelationConnectorController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index 624b4a24a..9bdc44487 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -23,7 +23,7 @@ var relationConnectorController = function(){ targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, - createEndpoints : true, + createEndpoints : false, } From 604702d6c3140b7545a3b575d480ebeb222388e6 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 18 Dec 2018 12:10:53 +0100 Subject: [PATCH 25/71] Revert "Merge remote-tracking branch 'origin/feature/relationConnectorController' into feature/relationConnectorController" This reverts commit e37a5579cbaab44350c4fe26f3593ffe45ac9c79. From 32be132b335d45f218fae59ac76477ca84923bbc Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 18 Dec 2018 12:10:53 +0100 Subject: [PATCH 26/71] Revert "Merge remote-tracking branch 'origin/feature/relationConnectorController' into feature/relationConnectorController" This reverts commit e37a5579cbaab44350c4fe26f3593ffe45ac9c79. --- .../AframeRelationConnectorController.js | 197 ++++++++---------- .../RelationConnectorController.js | 18 +- .../RelationHighlightController.js | 34 +-- .../RelationTransparencyController.js | 9 +- ui/setups/test/aframe.js | 14 +- 5 files changed, 127 insertions(+), 145 deletions(-) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index 9bdc44487..736a84d98 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -5,25 +5,22 @@ var relationConnectorController = function(){ var connectors = new Array(); var relations = new Array(); - - var loadedMin = new Map(); - var loadedMax = new Map(); - var loadedPositions = new Map(); - var loadedDistances = new Map(); var activated = false; //config parameters var controllerConfig = { + fixPositionY : false, fixPositionZ : false, showInnerRelations : false, - elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, createEndpoints : false, + connectorColor : {r: 1, g: 0, b: 0}, + endpointColor : {r: 0, g: 0, b: 0} } @@ -201,21 +198,55 @@ var relationConnectorController = function(){ if( targetPosition === null ){ return; } + + if(controllerConfig.sourceStartAtParentBorder){ + let sourceParent = entity.belongsTo; + let targetParent = relatedEntity.belongsTo; + if(sourceParent != targetParent){ + if(controllerConfig.targetEndAtParentBorder) { + targetPosition = canvasManipulator.getCenterOfEntity(targetParent); + } + let intersection = calculateBorderPosition(targetPosition, canvasManipulator.getCenterOfEntity(sourceParent), sourceParent); + if(intersection != undefined) { + sourcePosition = intersection; + } else console.debug("raycasting found no intersection with parent objects surface"); + } + } + + if(controllerConfig.targetEndAtParentBorder){ + let targetParent = relatedEntity.belongsTo; + if(targetParent != entity.belongsTo) { + let intersection = calculateBorderPosition(sourcePosition, canvasManipulator.getCenterOfEntity(targetParent), targetParent); + if(intersection != undefined) { + targetPostion = intersection; + } else console.debug("raycasting found no intersection with parent objects surface"); + } + } + if( controllerConfig.sourceStartAtBorder ) { - sourcePosition = calculateBorderPosition(targetPosition, sourcePosition, entity); + if(controllerConfig.targetEndAtBorder) { + targetPosition = canvasManipulator.getCenterOfEntity(relatedEntity); + } + // getCenterOfEntity again in-case it got overwritten for sourceStartAtParentBorder + sourcePosition = calculateBorderPosition(targetPosition, canvasManipulator.getCenterOfEntity(entity), entity); } if( controllerConfig.targetEndAtBorder ) { - targetPosition = calculateBorderPosition(sourcePosition, targetPosition, relatedEntity); + // getCenterOfEntity again in-case it got overwritten for targetEndAtParentBorder + targetPosition = calculateBorderPosition(sourcePosition, canvasManipulator.getCenterOfEntity(relatedEntity), relatedEntity); } - - var connectorColor = {r:1, g:1, b:0}; + var connectorSize = 0.05; - //config - if(controllerConfig.fixPositionZ) { - sourcePosition[z] = controllerConfig.fixPositionZ; - targetPosition[z] = controllerConfig.fixPositionZ; - } + // This function made no sense and doesn't seem to work on x3dom either + /*if(controllerConfig.fixPositionZ) { + sourcePosition.z = controllerConfig.fixPositionZ; + targetPosition.z = controllerConfig.fixPositionZ; + }*/ + // suggestion for city model: draw horizontal cylinders on the lower positions level + if(controllerConfig.fixPositionY) { + sourcePosition.y = Math.min(sourcePosition.y, targetPosition.y); + targetPosition.y = sourcePosition.y; + } let deltaX = targetPosition.x - sourcePosition.x; @@ -225,13 +256,13 @@ var relationConnectorController = function(){ let distance = sourcePosition.distanceTo(targetPosition); let direction = new THREE.Vector3(deltaX, deltaY, deltaZ).normalize(); - //create element + //create connector var connector = document.createElement("a-cylinder"); connector.addEventListener("loaded", function() { let threeMesh = this.object3DMap.mesh; threeMesh.scale.set(connectorSize, distance, connectorSize); - threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.material.color.setRGB(controllerConfig.connectorColor.r, controllerConfig.connectorColor.g, controllerConfig.connectorColor.b); threeMesh.position.set(sourcePosition.x+deltaX/2, sourcePosition.y+deltaY/2, sourcePosition.z+deltaZ/2); @@ -240,6 +271,8 @@ var relationConnectorController = function(){ var quaternion = threeMesh.quaternion; quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); }); + connector.setAttribute("flat-shading", true); + connector.setAttribute("shader", "flat"); @@ -247,127 +280,67 @@ var relationConnectorController = function(){ scene.appendChild(connector); var connectorElements = []; connectorElements.push(connector); + + // create Endpoints if(controllerConfig.createEndpoints) { var size = connectorSize*1.5; var length = size * 6; - var sourceEndPoint = document.createElement("a-cylinder"); - sourceEndPoint.addEventListener("loaded", function() { + var sourceEndpoint = document.createElement("a-cylinder"); + sourceEndpoint.addEventListener("loaded", function() { let threeMesh = this.object3DMap.mesh; - threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.material.color.setRGB(controllerConfig.endpointColor); threeMesh.scale.set(size, length, size); threeMesh.position.set(sourcePosition.x, sourcePosition.y, sourcePosition.z); var quaternion = threeMesh.quaternion; quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); }); - var targetEndPoint = document.createElement("a-cylinder"); - targetEndPoint.addEventListener("loaded", function() { + sourceEndpoint.setAttribute("flat-shading", true); + sourceEndpoint.setAttribute("shader", "flat"); + + var targetEndpoint = document.createElement("a-cylinder"); + targetEndpoint.addEventListener("loaded", function() { let threeMesh = this.object3DMap.mesh; - threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); - threeMesh.material.needsUpdate = true; - console.debug(threeMesh.material); + threeMesh.material.color.setRGB(controllerConfig.endpointColor); threeMesh.scale.set(size, length, size); threeMesh.position.set(targetPosition.x, targetPosition.y, targetPosition.z); var quaternion = threeMesh.quaternion; quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction.normalize()); }); - scene.appendChild(sourceEndPoint); - scene.appendChild(targetEndPoint); - connectorElements.push(sourceEndPoint); - connectorElements.push(targetEndPoint); + targetEndpoint.setAttribute("shader", "flat"); + + scene.appendChild(sourceEndpoint); + scene.appendChild(targetEndpoint); + connectorElements.push(sourceEndpoint); + connectorElements.push(targetEndpoint); } return connectorElements; } - - function isTargetChildOfSourceParent(target, source){ - - var targetParent = target.belongsTo; - var sourceParent = source.belongsTo; - - while(targetParent !== undefined) { - - if(targetParent == sourceParent){ - return true; - } - - targetParent = targetParent.belongsTo; - } - - return false; - } - function calculateBorderPosition(sourcePosition, targetPosition, entity){ + function isTargetChildOfSourceParent(target, source){ + + var targetParent = target.belongsTo; + var sourceParent = source.belongsTo; + + while(targetParent !== undefined) { + + if(targetParent == sourceParent){ + return true; + } + + targetParent = targetParent.belongsTo; + } + + return false; + } + + function calculateBorderPosition(sourceOfRay, targetOfRay, entity){ let object = document.getElementById(entity.id); let raycaster = new THREE.Raycaster(); raycaster.set(sourcePosition, targetPosition.subVectors(targetPosition, sourcePosition).normalize()); let intersection = raycaster.intersectObject(object.object3DMap.mesh); return intersection[0].point; } - - /*function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ - if(controllerConfig.elementShape == "circle"){ - return calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent); - } - if(controllerConfig.elementShape == "square"){ - return calculateSquarePositionFromParent(sourcePosition, targetPosition, sourceParent); - } - return sourcePosition; - } - - function calculateSquarePositionFromParent(sourcePosition, targetPosition, sourceParent){ - // To implement... - } - - function calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent){ - //calculation derived from http://www.3d-meier.de/tut6/XPresso53.html - - var parentPosition = getObjectPosition(sourceParent.id); - - var parentRadius = loadedDistances.get(sourceParent.id); - var parentX = parentPosition[0]; - var parentY = parentPosition[1]; - - - var targetX = targetPosition[0]; - var targetY = targetPosition[1]; - - var sourceX = sourcePosition[0]; - var sourceY = sourcePosition[1]; - - var deltaX = targetX - sourceX; - var deltaY = targetY - sourceY; - - var a = deltaY / deltaX; - var b = (targetY - parentY) - ( a * (targetX - parentX) ); - - var r = parentRadius[0]; - - - var AA = 1 + Math.pow(a, 2); - var BB = (2 * a * b) - var CC = Math.pow(b, 2) - Math.pow(r, 2); - - var XX = Math.pow(BB, 2) - 4 * AA * CC; - - - var x1 = (-BB + Math.sqrt( XX, 2 )) / ( 2 * AA ); - var x2 = (-BB - Math.sqrt( XX, 2 )) / ( 2 * AA ); - - var y1 = a * x1 + b; - var y2 = a * x2 + b; - - - var newSourcePosition; - if( (targetY > sourceY && targetX < sourceX) || - (targetY < sourceY && targetX < sourceX) ){ - newSourcePosition = [x2+parentX, y2+parentY, sourcePosition[2]]; - } else { - newSourcePosition = [x1+parentX, y1+parentY, sourcePosition[2]]; - } - - return newSourcePosition; - }*/ - return { initialize : initialize, diff --git a/ui/scripts/RelationConnector/RelationConnectorController.js b/ui/scripts/RelationConnector/RelationConnectorController.js index 2e6079f4a..f23ea12f2 100644 --- a/ui/scripts/RelationConnector/RelationConnectorController.js +++ b/ui/scripts/RelationConnector/RelationConnectorController.js @@ -23,8 +23,8 @@ var relationConnectorController = function(){ targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, - createEndpoints : false, - } + createEndpoints : false + }; function initialize(setupConfig){ @@ -116,7 +116,7 @@ var relationConnectorController = function(){ removeAllConnectors(); - //get related entites + //get related entities sourceEntity = applicationEvent.entities[0]; events.log.info.publish({ text: "connector - onRelationsChanged - selected Entity - " + sourceEntity.name}); @@ -145,7 +145,7 @@ var relationConnectorController = function(){ return; } - events.log.info.publish({ text: "connector - onRelationsChanged - related Entites - " + relatedEntities.length}); + events.log.info.publish({ text: "connector - onRelationsChanged - related Entities - " + relatedEntities.length}); if(relatedEntities.length == 0) { return; @@ -160,10 +160,10 @@ var relationConnectorController = function(){ function createRelatedConnections(){ - var relatedEntitesMap = new Map(); + var relatedEntitiesMap = new Map(); relatedEntities.forEach(function(relatedEntity){ - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ events.log.info.publish({ text: "connector - onRelationsChanged - multiple relation"}); return; } @@ -202,11 +202,11 @@ var relationConnectorController = function(){ relations.push(relation); - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - if(relatedEntitesMap.size != 0){ + if(relatedEntitiesMap.size != 0){ var applicationEvent = { sender: relationConnectorController, @@ -238,7 +238,7 @@ var relationConnectorController = function(){ sourcePosition[2] = controllerConfig.fixPositionZ; targetPosition[2] = controllerConfig.fixPositionZ; } - + //create element var transform = document.createElement('Transform'); diff --git a/ui/scripts/RelationHighlight/RelationHighlightController.js b/ui/scripts/RelationHighlight/RelationHighlightController.js index a495ddfa3..6b6d37f02 100644 --- a/ui/scripts/RelationHighlight/RelationHighlightController.js +++ b/ui/scripts/RelationHighlight/RelationHighlightController.js @@ -2,9 +2,16 @@ var relationHighlightController = function(){ var relatedEntities = new Array(); var activated = false; + + var controllerConfig = { + color : "black", + unfadeOnHighlight : true + }; - function initialize(config){ - events.selected.on.subscribe(onRelationsChanged); + function initialize(setupConfig){ + application.transferConfigParams(setupConfig, controllerConfig); + + events.selected.on.subscribe(onRelationsChanged); } function activate(){ @@ -30,7 +37,7 @@ var relationHighlightController = function(){ return; } - var relatedEntitesMap = new Map(); + var relatedEntitiesMap = new Map(); //highlight related entities relatedEntities.forEach(function(relatedEntity){ @@ -38,14 +45,14 @@ var relationHighlightController = function(){ return; } - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ return; } - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - canvasManipulator.resetColorOfEntities(Array.from(relatedEntitesMap.keys())); + canvasManipulator.resetColorOfEntities(Array.from(relatedEntitiesMap.keys())); } @@ -54,7 +61,7 @@ var relationHighlightController = function(){ resetColor(); - //get related entites + //get related entities var entity = applicationEvent.entities[0]; relatedEntities = new Array(); @@ -93,7 +100,7 @@ var relationHighlightController = function(){ } function highlightRelatedEntities(){ - var relatedEntitesMap = new Map(); + var relatedEntitiesMap = new Map(); //highlight related entities relatedEntities.forEach(function(relatedEntity){ @@ -101,14 +108,17 @@ var relationHighlightController = function(){ return; } - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ return; } - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - - canvasManipulator.changeColorOfEntities(Array.from(relatedEntitesMap.keys()), "0 0 0"); + + if(controllerConfig.unfadeOnHighlight) { + canvasManipulator.resetTransparencyOfEntities(Array.from(relatedEntitiesMap.keys())); + } + canvasManipulator.changeColorOfEntities(Array.from(relatedEntitiesMap.keys()), controllerConfig.color); } diff --git a/ui/scripts/RelationTransparency/RelationTransparencyController.js b/ui/scripts/RelationTransparency/RelationTransparencyController.js index 7b53afa76..564a39277 100644 --- a/ui/scripts/RelationTransparency/RelationTransparencyController.js +++ b/ui/scripts/RelationTransparency/RelationTransparencyController.js @@ -1,7 +1,4 @@ var relationTransparencyController = (function() { - - - var noFadeValue = 0; var relatedEntities = new Array(); var parents = new Array(); @@ -14,8 +11,8 @@ var relationTransparencyController = (function() { fullFadeValue : 0.85, halfFadeValue : 0.55, noFadeValue : 0, - startFaded: false, - } + startFaded: false + }; @@ -82,7 +79,7 @@ var relationTransparencyController = (function() { } - //get new related entites + //get new related entities var entity = applicationEvent.entities[0]; relatedEntities = new Array(); diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 7e0ef25e1..20d2110a7 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -24,21 +24,23 @@ var setup = { name: "packageExplorerController" }, { - name: "relationHighlightController" + name: "relationTransparencyController", + fullFadeValue: 0.15, + halfFadeValue: 0.45 }, { - name: "relationTransparencyController" + name: "relationHighlightController", + unfadeOnHighlight: false }, { name: "relationConnectorController", - fixPositionZ : false, + fixPositionY : false, showInnerRelations : true, - elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, sourceStartAtBorder: true, targetEndAtBorder: true, - createEndpoints : true, + createEndpoints : true }, { name: "searchController" @@ -68,7 +70,7 @@ var setup = { first: { size: "20%", controllers: [ - { name: "packageExplorerController" } + { name: "packageExplorerController" }, ] }, second: { From 6626bdc2865fbdc917f061e815b1cd10f9d9c839 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Tue, 18 Dec 2018 12:10:53 +0100 Subject: [PATCH 27/71] AframeRelation(Highl./Transp./Con.)Controller working AframeRelationConnectorController: -implemented a function to determine intersections of cylinders with any object (objects of any shape and also its parents) by raycasting function calculateBorderPosition(THREE.Vector3 sourceOfRay, THREE.Vector3 targetOfRay, model.entity entity) : returns THREE.Vector3 if intersection was found struggles with current aframe RD Bank Model since it consists of 2D shapes where no intersection can be found -fixPositionZ made no sense; renamed it to fixPositionY setting the y coordinates of source and target to the lower one of both -added colors for connector and endPoints to the controllerConfig -objects created in this controller are not contained in the model which may cause errors in other controllers (e.g. hoverController) -the config parameter elementShape was removed due to the original RelationConnectorController only implementing the function for circle (assuming circle and square refer to the (related)Entities shape RelationConnectorController: -corrected some typos RelationHighlightController: -added a controllerConfig -corrected some typos -changed color(0, 0, 0) to "black" which is aframe compatible RelationTransparencyController: -corrected some typos -removed unused variable noFadeValue --- .../AframeRelationConnectorController.js | 197 ++++++++---------- .../RelationConnectorController.js | 18 +- .../RelationHighlightController.js | 34 +-- .../RelationTransparencyController.js | 9 +- ui/setups/test/aframe.js | 14 +- 5 files changed, 127 insertions(+), 145 deletions(-) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index 9bdc44487..736a84d98 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -5,25 +5,22 @@ var relationConnectorController = function(){ var connectors = new Array(); var relations = new Array(); - - var loadedMin = new Map(); - var loadedMax = new Map(); - var loadedPositions = new Map(); - var loadedDistances = new Map(); var activated = false; //config parameters var controllerConfig = { + fixPositionY : false, fixPositionZ : false, showInnerRelations : false, - elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, createEndpoints : false, + connectorColor : {r: 1, g: 0, b: 0}, + endpointColor : {r: 0, g: 0, b: 0} } @@ -201,21 +198,55 @@ var relationConnectorController = function(){ if( targetPosition === null ){ return; } + + if(controllerConfig.sourceStartAtParentBorder){ + let sourceParent = entity.belongsTo; + let targetParent = relatedEntity.belongsTo; + if(sourceParent != targetParent){ + if(controllerConfig.targetEndAtParentBorder) { + targetPosition = canvasManipulator.getCenterOfEntity(targetParent); + } + let intersection = calculateBorderPosition(targetPosition, canvasManipulator.getCenterOfEntity(sourceParent), sourceParent); + if(intersection != undefined) { + sourcePosition = intersection; + } else console.debug("raycasting found no intersection with parent objects surface"); + } + } + + if(controllerConfig.targetEndAtParentBorder){ + let targetParent = relatedEntity.belongsTo; + if(targetParent != entity.belongsTo) { + let intersection = calculateBorderPosition(sourcePosition, canvasManipulator.getCenterOfEntity(targetParent), targetParent); + if(intersection != undefined) { + targetPostion = intersection; + } else console.debug("raycasting found no intersection with parent objects surface"); + } + } + if( controllerConfig.sourceStartAtBorder ) { - sourcePosition = calculateBorderPosition(targetPosition, sourcePosition, entity); + if(controllerConfig.targetEndAtBorder) { + targetPosition = canvasManipulator.getCenterOfEntity(relatedEntity); + } + // getCenterOfEntity again in-case it got overwritten for sourceStartAtParentBorder + sourcePosition = calculateBorderPosition(targetPosition, canvasManipulator.getCenterOfEntity(entity), entity); } if( controllerConfig.targetEndAtBorder ) { - targetPosition = calculateBorderPosition(sourcePosition, targetPosition, relatedEntity); + // getCenterOfEntity again in-case it got overwritten for targetEndAtParentBorder + targetPosition = calculateBorderPosition(sourcePosition, canvasManipulator.getCenterOfEntity(relatedEntity), relatedEntity); } - - var connectorColor = {r:1, g:1, b:0}; + var connectorSize = 0.05; - //config - if(controllerConfig.fixPositionZ) { - sourcePosition[z] = controllerConfig.fixPositionZ; - targetPosition[z] = controllerConfig.fixPositionZ; - } + // This function made no sense and doesn't seem to work on x3dom either + /*if(controllerConfig.fixPositionZ) { + sourcePosition.z = controllerConfig.fixPositionZ; + targetPosition.z = controllerConfig.fixPositionZ; + }*/ + // suggestion for city model: draw horizontal cylinders on the lower positions level + if(controllerConfig.fixPositionY) { + sourcePosition.y = Math.min(sourcePosition.y, targetPosition.y); + targetPosition.y = sourcePosition.y; + } let deltaX = targetPosition.x - sourcePosition.x; @@ -225,13 +256,13 @@ var relationConnectorController = function(){ let distance = sourcePosition.distanceTo(targetPosition); let direction = new THREE.Vector3(deltaX, deltaY, deltaZ).normalize(); - //create element + //create connector var connector = document.createElement("a-cylinder"); connector.addEventListener("loaded", function() { let threeMesh = this.object3DMap.mesh; threeMesh.scale.set(connectorSize, distance, connectorSize); - threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.material.color.setRGB(controllerConfig.connectorColor.r, controllerConfig.connectorColor.g, controllerConfig.connectorColor.b); threeMesh.position.set(sourcePosition.x+deltaX/2, sourcePosition.y+deltaY/2, sourcePosition.z+deltaZ/2); @@ -240,6 +271,8 @@ var relationConnectorController = function(){ var quaternion = threeMesh.quaternion; quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); }); + connector.setAttribute("flat-shading", true); + connector.setAttribute("shader", "flat"); @@ -247,127 +280,67 @@ var relationConnectorController = function(){ scene.appendChild(connector); var connectorElements = []; connectorElements.push(connector); + + // create Endpoints if(controllerConfig.createEndpoints) { var size = connectorSize*1.5; var length = size * 6; - var sourceEndPoint = document.createElement("a-cylinder"); - sourceEndPoint.addEventListener("loaded", function() { + var sourceEndpoint = document.createElement("a-cylinder"); + sourceEndpoint.addEventListener("loaded", function() { let threeMesh = this.object3DMap.mesh; - threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); + threeMesh.material.color.setRGB(controllerConfig.endpointColor); threeMesh.scale.set(size, length, size); threeMesh.position.set(sourcePosition.x, sourcePosition.y, sourcePosition.z); var quaternion = threeMesh.quaternion; quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction); }); - var targetEndPoint = document.createElement("a-cylinder"); - targetEndPoint.addEventListener("loaded", function() { + sourceEndpoint.setAttribute("flat-shading", true); + sourceEndpoint.setAttribute("shader", "flat"); + + var targetEndpoint = document.createElement("a-cylinder"); + targetEndpoint.addEventListener("loaded", function() { let threeMesh = this.object3DMap.mesh; - threeMesh.material.color.setRGB(connectorColor.r, connectorColor.g, connectorColor.b); - threeMesh.material.needsUpdate = true; - console.debug(threeMesh.material); + threeMesh.material.color.setRGB(controllerConfig.endpointColor); threeMesh.scale.set(size, length, size); threeMesh.position.set(targetPosition.x, targetPosition.y, targetPosition.z); var quaternion = threeMesh.quaternion; quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), direction.normalize()); }); - scene.appendChild(sourceEndPoint); - scene.appendChild(targetEndPoint); - connectorElements.push(sourceEndPoint); - connectorElements.push(targetEndPoint); + targetEndpoint.setAttribute("shader", "flat"); + + scene.appendChild(sourceEndpoint); + scene.appendChild(targetEndpoint); + connectorElements.push(sourceEndpoint); + connectorElements.push(targetEndpoint); } return connectorElements; } - - function isTargetChildOfSourceParent(target, source){ - - var targetParent = target.belongsTo; - var sourceParent = source.belongsTo; - - while(targetParent !== undefined) { - - if(targetParent == sourceParent){ - return true; - } - - targetParent = targetParent.belongsTo; - } - - return false; - } - function calculateBorderPosition(sourcePosition, targetPosition, entity){ + function isTargetChildOfSourceParent(target, source){ + + var targetParent = target.belongsTo; + var sourceParent = source.belongsTo; + + while(targetParent !== undefined) { + + if(targetParent == sourceParent){ + return true; + } + + targetParent = targetParent.belongsTo; + } + + return false; + } + + function calculateBorderPosition(sourceOfRay, targetOfRay, entity){ let object = document.getElementById(entity.id); let raycaster = new THREE.Raycaster(); raycaster.set(sourcePosition, targetPosition.subVectors(targetPosition, sourcePosition).normalize()); let intersection = raycaster.intersectObject(object.object3DMap.mesh); return intersection[0].point; } - - /*function calculatePositionFromParent(sourcePosition, targetPosition, sourceParent){ - if(controllerConfig.elementShape == "circle"){ - return calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent); - } - if(controllerConfig.elementShape == "square"){ - return calculateSquarePositionFromParent(sourcePosition, targetPosition, sourceParent); - } - return sourcePosition; - } - - function calculateSquarePositionFromParent(sourcePosition, targetPosition, sourceParent){ - // To implement... - } - - function calculateCirclePositionFromParent(sourcePosition, targetPosition, sourceParent){ - //calculation derived from http://www.3d-meier.de/tut6/XPresso53.html - - var parentPosition = getObjectPosition(sourceParent.id); - - var parentRadius = loadedDistances.get(sourceParent.id); - var parentX = parentPosition[0]; - var parentY = parentPosition[1]; - - - var targetX = targetPosition[0]; - var targetY = targetPosition[1]; - - var sourceX = sourcePosition[0]; - var sourceY = sourcePosition[1]; - - var deltaX = targetX - sourceX; - var deltaY = targetY - sourceY; - - var a = deltaY / deltaX; - var b = (targetY - parentY) - ( a * (targetX - parentX) ); - - var r = parentRadius[0]; - - - var AA = 1 + Math.pow(a, 2); - var BB = (2 * a * b) - var CC = Math.pow(b, 2) - Math.pow(r, 2); - - var XX = Math.pow(BB, 2) - 4 * AA * CC; - - - var x1 = (-BB + Math.sqrt( XX, 2 )) / ( 2 * AA ); - var x2 = (-BB - Math.sqrt( XX, 2 )) / ( 2 * AA ); - - var y1 = a * x1 + b; - var y2 = a * x2 + b; - - - var newSourcePosition; - if( (targetY > sourceY && targetX < sourceX) || - (targetY < sourceY && targetX < sourceX) ){ - newSourcePosition = [x2+parentX, y2+parentY, sourcePosition[2]]; - } else { - newSourcePosition = [x1+parentX, y1+parentY, sourcePosition[2]]; - } - - return newSourcePosition; - }*/ - return { initialize : initialize, diff --git a/ui/scripts/RelationConnector/RelationConnectorController.js b/ui/scripts/RelationConnector/RelationConnectorController.js index 2e6079f4a..f23ea12f2 100644 --- a/ui/scripts/RelationConnector/RelationConnectorController.js +++ b/ui/scripts/RelationConnector/RelationConnectorController.js @@ -23,8 +23,8 @@ var relationConnectorController = function(){ targetEndAtParentBorder : false, sourceStartAtBorder: false, targetEndAtBorder: false, - createEndpoints : false, - } + createEndpoints : false + }; function initialize(setupConfig){ @@ -116,7 +116,7 @@ var relationConnectorController = function(){ removeAllConnectors(); - //get related entites + //get related entities sourceEntity = applicationEvent.entities[0]; events.log.info.publish({ text: "connector - onRelationsChanged - selected Entity - " + sourceEntity.name}); @@ -145,7 +145,7 @@ var relationConnectorController = function(){ return; } - events.log.info.publish({ text: "connector - onRelationsChanged - related Entites - " + relatedEntities.length}); + events.log.info.publish({ text: "connector - onRelationsChanged - related Entities - " + relatedEntities.length}); if(relatedEntities.length == 0) { return; @@ -160,10 +160,10 @@ var relationConnectorController = function(){ function createRelatedConnections(){ - var relatedEntitesMap = new Map(); + var relatedEntitiesMap = new Map(); relatedEntities.forEach(function(relatedEntity){ - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ events.log.info.publish({ text: "connector - onRelationsChanged - multiple relation"}); return; } @@ -202,11 +202,11 @@ var relationConnectorController = function(){ relations.push(relation); - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - if(relatedEntitesMap.size != 0){ + if(relatedEntitiesMap.size != 0){ var applicationEvent = { sender: relationConnectorController, @@ -238,7 +238,7 @@ var relationConnectorController = function(){ sourcePosition[2] = controllerConfig.fixPositionZ; targetPosition[2] = controllerConfig.fixPositionZ; } - + //create element var transform = document.createElement('Transform'); diff --git a/ui/scripts/RelationHighlight/RelationHighlightController.js b/ui/scripts/RelationHighlight/RelationHighlightController.js index a495ddfa3..6b6d37f02 100644 --- a/ui/scripts/RelationHighlight/RelationHighlightController.js +++ b/ui/scripts/RelationHighlight/RelationHighlightController.js @@ -2,9 +2,16 @@ var relationHighlightController = function(){ var relatedEntities = new Array(); var activated = false; + + var controllerConfig = { + color : "black", + unfadeOnHighlight : true + }; - function initialize(config){ - events.selected.on.subscribe(onRelationsChanged); + function initialize(setupConfig){ + application.transferConfigParams(setupConfig, controllerConfig); + + events.selected.on.subscribe(onRelationsChanged); } function activate(){ @@ -30,7 +37,7 @@ var relationHighlightController = function(){ return; } - var relatedEntitesMap = new Map(); + var relatedEntitiesMap = new Map(); //highlight related entities relatedEntities.forEach(function(relatedEntity){ @@ -38,14 +45,14 @@ var relationHighlightController = function(){ return; } - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ return; } - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - canvasManipulator.resetColorOfEntities(Array.from(relatedEntitesMap.keys())); + canvasManipulator.resetColorOfEntities(Array.from(relatedEntitiesMap.keys())); } @@ -54,7 +61,7 @@ var relationHighlightController = function(){ resetColor(); - //get related entites + //get related entities var entity = applicationEvent.entities[0]; relatedEntities = new Array(); @@ -93,7 +100,7 @@ var relationHighlightController = function(){ } function highlightRelatedEntities(){ - var relatedEntitesMap = new Map(); + var relatedEntitiesMap = new Map(); //highlight related entities relatedEntities.forEach(function(relatedEntity){ @@ -101,14 +108,17 @@ var relationHighlightController = function(){ return; } - if(relatedEntitesMap.has(relatedEntity)){ + if(relatedEntitiesMap.has(relatedEntity)){ return; } - relatedEntitesMap.set(relatedEntity, relatedEntity); + relatedEntitiesMap.set(relatedEntity, relatedEntity); }); - - canvasManipulator.changeColorOfEntities(Array.from(relatedEntitesMap.keys()), "0 0 0"); + + if(controllerConfig.unfadeOnHighlight) { + canvasManipulator.resetTransparencyOfEntities(Array.from(relatedEntitiesMap.keys())); + } + canvasManipulator.changeColorOfEntities(Array.from(relatedEntitiesMap.keys()), controllerConfig.color); } diff --git a/ui/scripts/RelationTransparency/RelationTransparencyController.js b/ui/scripts/RelationTransparency/RelationTransparencyController.js index 7b53afa76..564a39277 100644 --- a/ui/scripts/RelationTransparency/RelationTransparencyController.js +++ b/ui/scripts/RelationTransparency/RelationTransparencyController.js @@ -1,7 +1,4 @@ var relationTransparencyController = (function() { - - - var noFadeValue = 0; var relatedEntities = new Array(); var parents = new Array(); @@ -14,8 +11,8 @@ var relationTransparencyController = (function() { fullFadeValue : 0.85, halfFadeValue : 0.55, noFadeValue : 0, - startFaded: false, - } + startFaded: false + }; @@ -82,7 +79,7 @@ var relationTransparencyController = (function() { } - //get new related entites + //get new related entities var entity = applicationEvent.entities[0]; relatedEntities = new Array(); diff --git a/ui/setups/test/aframe.js b/ui/setups/test/aframe.js index 7e0ef25e1..20d2110a7 100644 --- a/ui/setups/test/aframe.js +++ b/ui/setups/test/aframe.js @@ -24,21 +24,23 @@ var setup = { name: "packageExplorerController" }, { - name: "relationHighlightController" + name: "relationTransparencyController", + fullFadeValue: 0.15, + halfFadeValue: 0.45 }, { - name: "relationTransparencyController" + name: "relationHighlightController", + unfadeOnHighlight: false }, { name: "relationConnectorController", - fixPositionZ : false, + fixPositionY : false, showInnerRelations : true, - elementShape : "", //circle, square sourceStartAtParentBorder : false, targetEndAtParentBorder : false, sourceStartAtBorder: true, targetEndAtBorder: true, - createEndpoints : true, + createEndpoints : true }, { name: "searchController" @@ -68,7 +70,7 @@ var setup = { first: { size: "20%", controllers: [ - { name: "packageExplorerController" } + { name: "packageExplorerController" }, ] }, second: { From 9b9bc3a1ab0345645d8955eed2473fbdc3e1e2c8 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Thu, 20 Dec 2018 17:34:06 +0100 Subject: [PATCH 28/71] renamed variables in function body --- .../RelationConnector/AframeRelationConnectorController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/scripts/RelationConnector/AframeRelationConnectorController.js b/ui/scripts/RelationConnector/AframeRelationConnectorController.js index 736a84d98..5cdd85c9e 100644 --- a/ui/scripts/RelationConnector/AframeRelationConnectorController.js +++ b/ui/scripts/RelationConnector/AframeRelationConnectorController.js @@ -337,7 +337,7 @@ var relationConnectorController = function(){ function calculateBorderPosition(sourceOfRay, targetOfRay, entity){ let object = document.getElementById(entity.id); let raycaster = new THREE.Raycaster(); - raycaster.set(sourcePosition, targetPosition.subVectors(targetPosition, sourcePosition).normalize()); + raycaster.set(sourceOfRay, targetOfRay.subVectors(targetOfRay, sourceOfRay).normalize()); let intersection = raycaster.intersectObject(object.object3DMap.mesh); return intersection[0].point; } From 93e0a9c9e1421a0b493792f0128f55ebe7e04ea1 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 21 Dec 2018 14:24:29 +0100 Subject: [PATCH 29/71] models added --- ui/.gitignore | 1 - ui/aframe.html | 2 +- ui/data/aframe/RDbank/metaData.json | 712 +++++++++++++++ ui/data/aframe/RDbank/model.html | 927 ++++++++++++++++++++ ui/data/aframe/cityBankAframe/metaData.json | 712 +++++++++++++++ ui/data/aframe/cityBankAframe/model.html | 146 +++ 6 files changed, 2498 insertions(+), 2 deletions(-) create mode 100644 ui/data/aframe/RDbank/metaData.json create mode 100644 ui/data/aframe/RDbank/model.html create mode 100644 ui/data/aframe/cityBankAframe/metaData.json create mode 100644 ui/data/aframe/cityBankAframe/model.html diff --git a/ui/.gitignore b/ui/.gitignore index b8d6b1a73..c3fa68e75 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -1,3 +1,2 @@ .directory .idea/ -data/** diff --git a/ui/aframe.html b/ui/aframe.html index 17e076aec..e1f952753 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -5,7 +5,7 @@ TODO in application auslagern --> From 52dcbe7941c8fb1d4a1ccaecfe688b1b7a81d6d4 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 21 Dec 2018 14:52:52 +0100 Subject: [PATCH 35/71] fixed the bug-fix --- ui/aframe.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/aframe.html b/ui/aframe.html index 1b63bcba2..8a36b00ec 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -94,7 +94,7 @@
From a38ca72c7e8c3e175108170178c96a9290b62088 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 21 Dec 2018 15:23:09 +0100 Subject: [PATCH 36/71] final .gitignore correction --- ui/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/.gitignore b/ui/.gitignore index a4602628a..4e948c646 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -1,3 +1,3 @@ .directory .idea/ -.data/.. +.data/** From 8ca528ddceea1a52dc6f62f68d72ab10e337acef Mon Sep 17 00:00:00 2001 From: David Baum Date: Thu, 3 Jan 2019 14:09:58 +0100 Subject: [PATCH 37/71] set url root --- evaluationserver/config.ru | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/evaluationserver/config.ru b/evaluationserver/config.ru index 5bc2a619e..2b551a4f2 100644 --- a/evaluationserver/config.ru +++ b/evaluationserver/config.ru @@ -1,4 +1,11 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) -run Rails.application +require ::File.expand_path('../config/environment', __FILE__) + +if ENV['RAILS_RELATIVE_URL_ROOT'] + map ENV['RAILS_RELATIVE_URL_ROOT'] do + run Rails.application + end +else + run Rails.application +end From 6d46599ae459837b94e588f3ede0b80ccc7ea9c4 Mon Sep 17 00:00:00 2001 From: David Baum Date: Thu, 3 Jan 2019 14:24:47 +0100 Subject: [PATCH 38/71] update gem --- evaluationserver/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/evaluationserver/Dockerfile b/evaluationserver/Dockerfile index 301a0eb46..2ba2dd5e9 100644 --- a/evaluationserver/Dockerfile +++ b/evaluationserver/Dockerfile @@ -6,6 +6,7 @@ RUN apt-get update \ RUN mkdir -p /usr/src/app WORkDIR /usr/src/app/ COPY . . +RUN gem update --system RUN gem install bundler && bundle install --jobs 20 --retry 5 # might be better? RUN gem install bundler LABEL maintainer="david.baum@uni-leipzig.de" \ From 379eb01f33172b29a4f8369d7e214b1f75f3b8e7 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 20:35:59 +0100 Subject: [PATCH 39/71] fix xtend problem for generator2 --- generator2/org.getaviz.generator/pom.xml | 470 +++++++++----------- generator2/org.getaviz.lib.database/pom.xml | 115 ++--- generator2/org.getaviz.parent/pom.xml | 101 +++-- 3 files changed, 325 insertions(+), 361 deletions(-) diff --git a/generator2/org.getaviz.generator/pom.xml b/generator2/org.getaviz.generator/pom.xml index 526e9781b..c071633b6 100644 --- a/generator2/org.getaviz.generator/pom.xml +++ b/generator2/org.getaviz.generator/pom.xml @@ -1,270 +1,208 @@ - 4.0.0 - - ../org.getaviz.parent/pom.xml - org.getaviz - org.getaviz.parent - 1.0.0-SNAPSHOT - - org.getaviz.generator - Getaviz Generator - - - ${project.artifactId}-site - ${project.baseUri} - - - - - - org.getaviz.lib.database - org.getaviz.lib.database - 1.0.0-SNAPSHOT - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + ../org.getaviz.parent/pom.xml + org.getaviz + org.getaviz.parent + 1.0.0-SNAPSHOT + + org.getaviz.generator + Getaviz Generator + + + ${project.artifactId}-site + ${project.baseUri} + + + + + + org.getaviz.lib.database + org.getaviz.lib.database + 1.0.0-SNAPSHOT + + - - - - commons-logging - commons-logging - 1.2 - - - - org.apache.commons - commons-text - 1.6 - - - - org.apache.commons - commons-lang3 - 3.8.1 - - - - commons-codec - commons-codec - 1.11 - - - - org.apache.commons - commons-configuration2 - 2.4 - + + + + commons-logging + commons-logging + 1.2 + + + + org.apache.commons + commons-text + 1.6 + + + + org.apache.commons + commons-lang3 + 3.8.1 + + + + commons-codec + commons-codec + 1.11 + + + + org.apache.commons + commons-configuration2 + 2.4 + - - - - org.eclipse.xtend - org.eclipse.xtend.lib - ${xtend.version} - - - com.google.guava - guava - 19.0-rc3 - - - - org.neo4j - neo4j-graphdb-api - ${neo4j.version} - - - - org.neo4j - neo4j-resource - ${neo4j.version} - - - - commons-beanutils - commons-beanutils - 1.9.3 - - - com.vividsolutions - jts - 1.13 - - - - org.junit.jupiter - junit-jupiter-api - 5.3.1 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.3.1 - test - - - org.junit.vintage - junit-vintage-engine - 5.3.1 - test - - - org.junit.platform - junit-platform-launcher - 1.1.0 - test - - - org.junit.platform - junit-platform-runner - 1.1.0 - test - - - - org.neo4j.test - neo4j-harness - 3.4.9 - test - - - - - - src - - - org.eclipse.xtend - xtend-maven-plugin - - - maven-compiler-plugin - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - org.junit.platform - junit-platform-surefire-provider - 1.1.0 - - - org.junit.jupiter - junit-jupiter-engine - 5.3.1 - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - ${basedir}/xtend-gen/:${basedir}/src/ - false - true - false - false - - - - org.codehaus.mojo - exec-maven-plugin - 1.4.0 - - - deploy - - java - - - - - java - true - true - - - -Xmx8g - -classpath - - org.getaviz.generator.Generator - -p - runtimeProject=${project.basedir} - - - - - - - - - maven-project-info-reports-plugin - 2.9 - - - - org.eclipse.xtend - xtend-maven-plugin - ${xtend.version} - - - - - - - - - - - compile - testCompile - - - - - ${basedir}/xtend-gen - ${basedir}/test-xtend-gen - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - true - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.4 - - false - false - - - - + + + + org.eclipse.xtend + org.eclipse.xtend.lib + ${xtend.version} + + + com.google.guava + guava + 19.0-rc3 + + + + org.neo4j + neo4j-graphdb-api + ${neo4j.version} + + + + org.neo4j + neo4j-resource + ${neo4j.version} + + + + commons-beanutils + commons-beanutils + 1.9.3 + + + com.vividsolutions + jts + 1.13 + + + + org.junit.jupiter + junit-jupiter-api + 5.3.1 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.3.1 + test + + + org.junit.vintage + junit-vintage-engine + 5.3.1 + test + + + org.junit.platform + junit-platform-launcher + 1.1.0 + test + + + org.junit.platform + junit-platform-runner + 1.1.0 + test + + + + org.neo4j.test + neo4j-harness + 3.4.9 + test + + + + src + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.junit.platform + junit-platform-surefire-provider + 1.1.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.3.1 + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + ${basedir}/xtend-gen/:${basedir}/src/ + false + true + false + false + + + + org.codehaus.mojo + exec-maven-plugin + 1.4.0 + + + deploy + + java + + + + + java + true + true + + + -Xmx8g + -classpath + + org.getaviz.generator.Generator + -p + runtimeProject=${project.basedir} + + + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.4 + + false + false + + + + diff --git a/generator2/org.getaviz.lib.database/pom.xml b/generator2/org.getaviz.lib.database/pom.xml index 23cb4534b..d7c9c4824 100644 --- a/generator2/org.getaviz.lib.database/pom.xml +++ b/generator2/org.getaviz.lib.database/pom.xml @@ -1,68 +1,51 @@ - 4.0.0 - - ../org.getaviz.parent/pom.xml - org.getaviz - org.getaviz.parent - 1.0.0-SNAPSHOT - - org.getaviz.lib.database - org.getaviz.lib.database - Getaviz Database Connector - - - - org.neo4j - neo4j - 3.4.9 - - - - org.neo4j - neo4j-graphdb-api - ${neo4j.version} - - - - org.eclipse.xtend - org.eclipse.xtend.lib - ${xtend.version} - - - - src - - - org.eclipse.xtend - xtend-maven-plugin - - - maven-compiler-plugin - - - default-testCompile - none - - - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-clean-plugin - ${clean.version} - - - - ${basedir}/output - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + ../org.getaviz.parent/pom.xml + org.getaviz + org.getaviz.parent + 1.0.0-SNAPSHOT + + org.getaviz.lib.database + org.getaviz.lib.database + Getaviz Database Connector + + + + org.neo4j + neo4j + 3.4.9 + + + + org.neo4j + neo4j-graphdb-api + ${neo4j.version} + + + + org.eclipse.xtend + org.eclipse.xtend.lib + ${xtend.version} + + + + src + + + org.apache.maven.plugins + maven-clean-plugin + ${clean.version} + + + + ${basedir}/output + + + + + + diff --git a/generator2/org.getaviz.parent/pom.xml b/generator2/org.getaviz.parent/pom.xml index 234ab4e4a..64a12c330 100644 --- a/generator2/org.getaviz.parent/pom.xml +++ b/generator2/org.getaviz.parent/pom.xml @@ -1,31 +1,74 @@ - 4.0.0 - org.getaviz - org.getaviz.parent - 1.0.0-SNAPSHOT - Getaviz Generator - https://github.com/getaviz/Getaviz - pom - - ../org.getaviz.lib.database - ../org.getaviz.generator - - - 2.15.0 - 3.0.0 - 2.19.1 - 3.4.9 - 5.3.1 - false - UTF-8 - - - - log4j - log4j - 1.2.17 - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + org.getaviz + org.getaviz.parent + 1.0.0-SNAPSHOT + Getaviz Generator + https://github.com/getaviz/Getaviz + pom + + ../org.getaviz.lib.database + ../org.getaviz.generator + + + 2.16.0 + 3.0.0 + 2.19.1 + 3.4.9 + 3.8.0 + 5.3.1 + false + UTF-8 + + + + log4j + log4j + 1.2.17 + + + org.eclipse.xtend + xtend-maven-plugin + ${xtend.version} + + + + + + org.eclipse.xtend + xtend-maven-plugin + ${xtend.version} + + ${basedir}/xtend-gen + ${basedir}/test-xtend-gen + + + + + compile + testCompile + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler.version} + + 1.8 + 1.8 + true + + + + default-testCompile + none + + + + + From 5487c189be1e06b8d3d23ef92072294240aee501 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 21:26:46 +0100 Subject: [PATCH 40/71] upgrade to xtext 2.15 --- generator/org.svis.generator.releng/pom.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/generator/org.svis.generator.releng/pom.xml b/generator/org.svis.generator.releng/pom.xml index bb2921b06..b955cbec5 100644 --- a/generator/org.svis.generator.releng/pom.xml +++ b/generator/org.svis.generator.releng/pom.xml @@ -28,7 +28,7 @@ ../org.svis.generator.run - 2.13.0 + 2.15.0 2.8.1 1.3.11 3.0.0 @@ -168,13 +168,6 @@ org.eclipse.xtend xtend-maven-plugin ${xtext.version} - - - org.eclipse.platform - org.eclipse.equinox.common - 3.10.0 - - From ca3e79e33bf4bf7f139bc71f20ad8a75c670a79a Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 22:00:49 +0100 Subject: [PATCH 41/71] add generator build to travis --- .travis.yml | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 485ec9336..a00c0d046 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,31 @@ -before_script: -- cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml -- mysql -e 'create database eval_server_test;' -- cd evaluationserver/ -- bundle install -env: - secure: Nyq2gajx/TWjeIZtGZSkHREgpE0BhuQg6VOscDKKrenN/CPZ/8wT/h3DYrXOTq+Pz4yOGBgDbptXdT4szu88H5lCNcCfzTnyp/Y+NE/t12nheNFrzlm2L4ryF5IvpAHEXJLYkoJRHXvD4FWTsp/SI3RPLMu9ah2J7gheGSHomZKoApYTLp1NjVSRAgrWGjodMHIYC7d40pNoMyMa/i3EDUHLQ3kNc1U3GGmzaj3Et1Ak6UMQeRE5ph9bfYOZy83Cit9DedeEdbdrnvLa23z/UVp/dmpEchd/844MOKoeX8HPpYW1x/1CovYn3/dshf/bhAkMvngTtJCgyrEpWgy9bb5bwnvjOz2FxBFB8eb/7hfK//6fynCCe5XmPahnIddp7kSNmHwaT4zwUSlFIFegaeZyr6uC5JYFue9i1rICSbAKqOc4EmrL9nKY9Mh6CvW232qiSTvNN02CiSZsAKdA61ou3H7X9UK7WeEAIC43WHkuM5Rn9leB6QC5nwp0UUqY6jbGknoDtvq87t2tVIiAy5aPmpKnrf0C4uUmaz6zZWz4vvjHok6Kuh6ut2LucwVvisCJ7wTRSXB43ubCsuOMSDkd7u4JJUPJPlzc57rQoXSBm68bnuy7SQ2l/epQbl/O9lrxkQLA52JxNF8zdMT7ZKfoGQkQZjXF1YNhp4VHmfA= -language: ruby -rvm: -- 2.5.0 -script: -- bundle exec rails db:migrate RAILS_ENV=test -- bundle exec rspec -after_failure: -- mysql -e 'show databases;' -- cat ./config/database.yml -- echo $RAILS_ENV -- bundle exec rake --version +jobs: + include: + - stage: evaluation server + before_script: + - cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml + - mysql -e 'create database eval_server_test;' + - cd evaluationserver/ + - bundle install + env: + secure: Nyq2gajx/TWjeIZtGZSkHREgpE0BhuQg6VOscDKKrenN/CPZ/8wT/h3DYrXOTq+Pz4yOGBgDbptXdT4szu88H5lCNcCfzTnyp/Y+NE/t12nheNFrzlm2L4ryF5IvpAHEXJLYkoJRHXvD4FWTsp/SI3RPLMu9ah2J7gheGSHomZKoApYTLp1NjVSRAgrWGjodMHIYC7d40pNoMyMa/i3EDUHLQ3kNc1U3GGmzaj3Et1Ak6UMQeRE5ph9bfYOZy83Cit9DedeEdbdrnvLa23z/UVp/dmpEchd/844MOKoeX8HPpYW1x/1CovYn3/dshf/bhAkMvngTtJCgyrEpWgy9bb5bwnvjOz2FxBFB8eb/7hfK//6fynCCe5XmPahnIddp7kSNmHwaT4zwUSlFIFegaeZyr6uC5JYFue9i1rICSbAKqOc4EmrL9nKY9Mh6CvW232qiSTvNN02CiSZsAKdA61ou3H7X9UK7WeEAIC43WHkuM5Rn9leB6QC5nwp0UUqY6jbGknoDtvq87t2tVIiAy5aPmpKnrf0C4uUmaz6zZWz4vvjHok6Kuh6ut2LucwVvisCJ7wTRSXB43ubCsuOMSDkd7u4JJUPJPlzc57rQoXSBm68bnuy7SQ2l/epQbl/O9lrxkQLA52JxNF8zdMT7ZKfoGQkQZjXF1YNhp4VHmfA= + language: ruby + rvm: + - 2.5.0 + script: + - bundle exec rails db:migrate RAILS_ENV=test + - bundle exec rspec + after_failure: + - mysql -e 'show databases;' + - cat ./config/database.yml + - echo $RAILS_ENV + - bundle exec rake --version + - stage: generator + before_script: + - cd cd generator/org.svis.generator.releng/ + - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc + language: java + jdk: + - oraclejdk8 + script: + - mvn clean install -fae + From 42d2da5dcd5f3ae9af257f386a4e77f7276de0f4 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 22:05:29 +0100 Subject: [PATCH 42/71] remove double cd --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a00c0d046..879ae1aa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ jobs: - bundle exec rake --version - stage: generator before_script: - - cd cd generator/org.svis.generator.releng/ + - cd generator/org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc language: java jdk: From 1fd0525891f970ee6752ca76ea1805e1e3882ae5 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 22:55:20 +0100 Subject: [PATCH 43/71] use matrix instead of jobs for travis --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 879ae1aa4..b01c57fc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ -jobs: +matrix: include: - - stage: evaluation server + - language: ruby before_script: - cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml - mysql -e 'create database eval_server_test;' @@ -19,11 +19,10 @@ jobs: - cat ./config/database.yml - echo $RAILS_ENV - bundle exec rake --version - - stage: generator + - language: java before_script: - cd generator/org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - language: java jdk: - oraclejdk8 script: From dc1e16efc22c8841929ec7e348f5515c4022ca1d Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:03:00 +0100 Subject: [PATCH 44/71] add blank line --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b01c57fc9..1571e39c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ matrix: - cat ./config/database.yml - echo $RAILS_ENV - bundle exec rake --version + - language: java before_script: - cd generator/org.svis.generator.releng/ From 24bf787e16393fd2dc02a4178033c015bf99ef02 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:16:20 +0100 Subject: [PATCH 45/71] clean up .travis.yml --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1571e39c2..0d72a048b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ matrix: - bundle install env: secure: Nyq2gajx/TWjeIZtGZSkHREgpE0BhuQg6VOscDKKrenN/CPZ/8wT/h3DYrXOTq+Pz4yOGBgDbptXdT4szu88H5lCNcCfzTnyp/Y+NE/t12nheNFrzlm2L4ryF5IvpAHEXJLYkoJRHXvD4FWTsp/SI3RPLMu9ah2J7gheGSHomZKoApYTLp1NjVSRAgrWGjodMHIYC7d40pNoMyMa/i3EDUHLQ3kNc1U3GGmzaj3Et1Ak6UMQeRE5ph9bfYOZy83Cit9DedeEdbdrnvLa23z/UVp/dmpEchd/844MOKoeX8HPpYW1x/1CovYn3/dshf/bhAkMvngTtJCgyrEpWgy9bb5bwnvjOz2FxBFB8eb/7hfK//6fynCCe5XmPahnIddp7kSNmHwaT4zwUSlFIFegaeZyr6uC5JYFue9i1rICSbAKqOc4EmrL9nKY9Mh6CvW232qiSTvNN02CiSZsAKdA61ou3H7X9UK7WeEAIC43WHkuM5Rn9leB6QC5nwp0UUqY6jbGknoDtvq87t2tVIiAy5aPmpKnrf0C4uUmaz6zZWz4vvjHok6Kuh6ut2LucwVvisCJ7wTRSXB43ubCsuOMSDkd7u4JJUPJPlzc57rQoXSBm68bnuy7SQ2l/epQbl/O9lrxkQLA52JxNF8zdMT7ZKfoGQkQZjXF1YNhp4VHmfA= - language: ruby rvm: - 2.5.0 script: @@ -21,11 +20,12 @@ matrix: - bundle exec rake --version - language: java + jdk: + - oraclejdk8 before_script: - cd generator/org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - jdk: - - oraclejdk8 script: - mvn clean install -fae - +notifications: + email: false From 839b1b06a8c9e6877592b2a703c4bd7085ebd849 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:23:53 +0100 Subject: [PATCH 46/71] change build order --- .travis.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d72a048b..fa577501e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,13 @@ matrix: include: + - language: java + jdk: + - oraclejdk8 + before_script: + - cd generator/org.svis.generator.releng/ + - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc + script: + - mvn clean install -fae - language: ruby before_script: - cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml @@ -18,14 +26,5 @@ matrix: - cat ./config/database.yml - echo $RAILS_ENV - bundle exec rake --version - - - language: java - jdk: - - oraclejdk8 - before_script: - - cd generator/org.svis.generator.releng/ - - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - script: - - mvn clean install -fae notifications: email: false From a68fb31bb0d27b0cdf92270b169d1b7200ce301f Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:26:42 +0100 Subject: [PATCH 47/71] remove mvn clean install --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa577501e..68a6a8309 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ matrix: before_script: - cd generator/org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - script: - - mvn clean install -fae - language: ruby before_script: - cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml From 189d8e8ef7ee10a9d9312669b60547d69913a745 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:28:36 +0100 Subject: [PATCH 48/71] split cd command --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 68a6a8309..0ac09c113 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ matrix: jdk: - oraclejdk8 before_script: - - cd generator/org.svis.generator.releng/ + - cd generator + - cd org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - language: ruby before_script: From 804c2f60c370cd33d2d9e0db85feb4123b1d7d7d Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:31:00 +0100 Subject: [PATCH 49/71] use before_install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0ac09c113..ae80038fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ matrix: - language: java jdk: - oraclejdk8 - before_script: + before_install: - cd generator - cd org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc From 7ce5aeca45913b4caa46ae902c54f7b4bec0a575 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:39:39 +0100 Subject: [PATCH 50/71] use names --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ae80038fe..5672dd3b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,15 @@ matrix: include: - - language: java + - name: Generator + language: java jdk: - oraclejdk8 before_install: - cd generator - cd org.svis.generator.releng/ - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - - language: ruby + - name: evaluationserver + language: ruby before_script: - cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml - mysql -e 'create database eval_server_test;' From 786233ceeb92dea21430435e9e9e10cfe0a71036 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:41:07 +0100 Subject: [PATCH 51/71] min example --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5672dd3b8..01cfbcdc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,8 @@ matrix: include: - name: Generator language: java - jdk: - - oraclejdk8 before_install: - - cd generator - - cd org.svis.generator.releng/ - - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc + - echo test - name: evaluationserver language: ruby before_script: From 39c11a841f116ba9f9570123dc8b78baa293b680 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:43:44 +0100 Subject: [PATCH 52/71] restore before_install --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 01cfbcdc3..a98e00fb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,9 @@ matrix: - name: Generator language: java before_install: - - echo test + - cd generator + - cd org.svis.generator.releng/ + - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - name: evaluationserver language: ruby before_script: From 99f16f3f7a3b18888259c7d1aa6ea229ce15b4e0 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:53:57 +0100 Subject: [PATCH 53/71] add generator2 to .travis.yml --- .travis.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a98e00fb8..196c037e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,16 @@ matrix: before_install: - cd generator - cd org.svis.generator.releng/ - - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=1g'" > ~/.mavenrc - - name: evaluationserver + script: + - mvn clean install -fae + - name: Generator2 + language: java + before_install: + - cd Generator2 + - cd org.getaviz.parent/ + script: + - mvn clean install -fae + - name: Evaluation Server language: ruby before_script: - cp evaluationserver/config/database.travis.yml evaluationserver/config/database.yml From 29f9d217ac85027e9c1514ffaaa0810a5776cf18 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 7 Jan 2019 23:56:51 +0100 Subject: [PATCH 54/71] fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 196c037e8..a6d0f5274 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ matrix: - name: Generator2 language: java before_install: - - cd Generator2 + - cd generator2 - cd org.getaviz.parent/ script: - mvn clean install -fae From 0596ec9d17afa6cd5f0ba194c22322e28821820b Mon Sep 17 00:00:00 2001 From: David Baum Date: Tue, 8 Jan 2019 00:12:04 +0100 Subject: [PATCH 55/71] reenable notifications --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a6d0f5274..28a87bd8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,5 +33,3 @@ matrix: - cat ./config/database.yml - echo $RAILS_ENV - bundle exec rake --version -notifications: - email: false From cdd291471610e0ec22f9b3382a553c218e522ee2 Mon Sep 17 00:00:00 2001 From: Aaron Sillus Date: Fri, 11 Jan 2019 14:02:47 +0100 Subject: [PATCH 56/71] Final changes AframeCanvasManipulator: -missing functions work now -problems occure when flyToEntity is called by the controller -functions work because canvasController has access to the exact camera object specified by aframe-orbit-camera-component.js -this is achieved by storing the object during its initialization into the global variable globalCamera (definition in aframe.html) added file camera-beta: -adds the line "globalCamera = this" to the aframe-orbit-camera-component aframe.html: -defines the globalCamera variable ResetViewController: -now calls the reset function of the canvasManipulator instead of executing the functions body on its own -is now compatible with aframes canvasManipulator --- ui/aframe.html | 7 +- ui/data/City bank aframe/model/model.html | 16 - ui/scripts/AframeCanvasManipulator.js | 64 +- .../CanvasResetViewController.js | 2 +- ui/scripts/camera-beta.js | 552 ++++++++++++++++++ 5 files changed, 577 insertions(+), 64 deletions(-) create mode 100644 ui/scripts/camera-beta.js diff --git a/ui/aframe.html b/ui/aframe.html index 8a36b00ec..3e91aeb73 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -81,13 +81,14 @@ - + + - + @@ -96,6 +97,8 @@ $(function(){ $("#canvas").load(encodeURI(modelUrl + "/model.html")); }); + + var globalCamera; diff --git a/ui/data/City bank aframe/model/model.html b/ui/data/City bank aframe/model/model.html index 3c8817f68..88f4238fa 100644 --- a/ui/data/City bank aframe/model/model.html +++ b/ui/data/City bank aframe/model/model.html @@ -26,22 +26,6 @@ mouse-cursor="" > - 0) { + !this.data.invertZoom ? this.dollyIn(this.getZoomScale()) : + this.dollyOut(this.getZoomScale()); + } else if (this.dollyDelta.y < 0) { + !this.data.invertZoom ? this.dollyOut(this.getZoomScale()) : + this.dollyIn(this.getZoomScale()); + } + + this.dollyStart.copy(this.dollyEnd); + + this.updateView(); + }, + + handleMouseMovePan: function (event) { + + // console.log( 'handleMouseMovePan' ); + this.panEnd.set(event.clientX, event.clientY); + this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.data.panSpeed); + this.pan(this.panDelta.x, this.panDelta.y); + this.panStart.copy(this.panEnd); + + this.updateView(); + }, + + handleMouseUp: function (event) { + // console.log( 'handleMouseUp' ); + }, + + handleMouseWheel: function (event) { + + // console.log( 'handleMouseWheel' ); + var delta = 0; + if (event.wheelDelta !== undefined) { + // WebKit / Opera / Explorer 9 + delta = event.wheelDelta; + } else if (event.detail !== undefined) { + // Firefox + delta = -event.detail; + } + + if (delta > 0) { + !this.data.invertZoom ? this.dollyOut(this.getZoomScale()) : + this.dollyIn(this.getZoomScale()); + } else if (delta < 0) { + !this.data.invertZoom ? this.dollyIn(this.getZoomScale()) : + this.dollyOut(this.getZoomScale()); + } + + this.updateView(); + }, + + /* + * Internal functions + */ + + getZoomScale: function () { + return Math.pow(0.95, this.data.zoomSpeed); + }, + + rotateLeft: function (angle) { + this.sphericalDelta.theta -= angle; + }, + + rotateUp: function (angle) { + this.sphericalDelta.phi -= angle; + }, + + panLeft: function (distance, objectMatrix) { + var v = new THREE.Vector3(); + v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix + v.multiplyScalar(-distance); + this.panOffset.add(v); + }, + + panUp: function (distance, objectMatrix) { + var v = new THREE.Vector3(); + v.setFromMatrixColumn(objectMatrix, 1); // get Y column of objectMatrix + v.multiplyScalar(distance); + this.panOffset.add(v); + }, + + pan: function (deltaX, deltaY) { // deltaX and deltaY are in pixels; right and down are positive + + var offset = new THREE.Vector3(); + var canvas = this.canvasEl === document ? this.canvasEl.body : this.canvasEl; + + var position = this.object.position; + offset.copy(position).sub(this.target); + var targetDistance = offset.length(); + // half of the fov is center to top of screen + targetDistance *= Math.tan((this.el.components.camera.data.fov / 2) * Math.PI / 180.0); + // we actually don't use screenWidth, since + this.panLeft(2 * deltaX * targetDistance / canvas.clientHeight, this.object.matrix); + // perspective camera is fixed to screen height + this.panUp(2 * deltaY * targetDistance / canvas.clientHeight, this.object.matrix); + }, + + dollyIn: function (dollyScale) { + this.scale *= dollyScale; + }, + + dollyOut: function (dollyScale) { + this.scale /= dollyScale; + }, + + lookAtTarget: function (object, target) { + var v = new THREE.Vector3(); + v.subVectors(object.position, target).add(object.position); + object.lookAt(v); + }, + + /* + * VIEW UPDATE + */ + updateView: function () { + var offset = new THREE.Vector3(); + + // so camera.up is the orbit axis + var quat = new THREE.Quaternion().setFromUnitVectors(this.dolly.up, new THREE.Vector3(0, 1, 0)); + var quatInverse = quat.clone().inverse(); + + offset.copy(this.dolly.position).sub(this.target); + offset.applyQuaternion(quat); // rotate offset to "y-axis-is-up" space + this.spherical.setFromVector3(offset); // angle from z-axis around y-axis + + this.spherical.theta += this.sphericalDelta.theta; + this.spherical.phi += this.sphericalDelta.phi; + + // restrict theta to be inside desired limits + this.spherical.theta = Math.max( + this.data.minAzimuthAngle, + Math.min( + this.data.maxAzimuthAngle, + this.spherical.theta)); + + // restrict phi to be inside desired limits + this.spherical.phi = Math.max( + this.data.minPolarAngle, + Math.min( + this.data.maxPolarAngle, + this.spherical.phi)); + + this.spherical.makeSafe(); + + + this.spherical.radius *= this.scale; + + // restrict radius to be inside desired limits + this.spherical.radius = Math.max( + this.data.minDistance, + Math.min( + this.data.maxDistance, + this.spherical.radius)); + + this.target.add(this.panOffset); // move target to panned location + + offset.setFromSpherical(this.spherical); + + // rotate offset back to "camera-up-vector-is-up" space + offset.applyQuaternion(quatInverse); + + this.dolly.position.copy(this.target).add(offset); + + this.lookAtTarget(this.dolly, this.target); + + if (this.data.enableDamping === true) { + this.sphericalDelta.theta *= (1 - this.data.dampingFactor); + this.sphericalDelta.phi *= (1 - this.data.dampingFactor); + this.panOffset.multiplyScalar(1 - this.data.dampingFactor); + } else { + this.sphericalDelta.set(0, 0, 0); + this.panOffset.set(0, 0, 0); + } + + this.scale = 1; + + // update condition is: + // min(camera displacement, camera rotation in radians)^2 > EPS + // using small-angle approximation cos(x/2) = 1 - x^2 / 8 + + if (this.zoomChanged || + this.lastPosition.distanceToSquared(this.dolly.position) > this.EPS || + 8 * (1 - this.lastQuaternion.dot(this.dolly.quaternion)) > this.EPS) { + + var hmdQuaternion = this.calculateHMDQuaternion(); + var hmdEuler = new THREE.Euler(); + hmdEuler.setFromQuaternion(hmdQuaternion, 'YXZ'); + + this.el.setAttribute('position', { + x: this.dolly.position.x, + y: this.dolly.position.y, + z: this.dolly.position.z + }); + + this.el.setAttribute('rotation', { + x: THREE.Math.radToDeg(hmdEuler.x), + y: THREE.Math.radToDeg(hmdEuler.y), + z: THREE.Math.radToDeg(hmdEuler.z) + }); + + this.lastPosition.copy(this.dolly.position); + this.lastQuaternion.copy(this.dolly.quaternion); + + this.zoomChanged = false; + + return true; + } + + return false; + }, + + calculateHMDQuaternion: (function () { + var hmdQuaternion = new THREE.Quaternion(); + return function () { + hmdQuaternion.copy(this.dolly.quaternion); + return hmdQuaternion; + }; + })() + +}); From 722508d0b3bd1d5d9bb7bb90bdccdf21ebb16030 Mon Sep 17 00:00:00 2001 From: David Baum Date: Fri, 11 Jan 2019 18:02:33 +0100 Subject: [PATCH 57/71] add aframe default example --- ui/aframe.html | 4 +- ui/setups/web_a-frame/City bank.js | 376 +++++++++++++++++++++++++++++ 2 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 ui/setups/web_a-frame/City bank.js diff --git a/ui/aframe.html b/ui/aframe.html index 3e91aeb73..c26a82082 100644 --- a/ui/aframe.html +++ b/ui/aframe.html @@ -73,6 +73,8 @@ + + @@ -88,7 +90,7 @@ - + diff --git a/ui/setups/web_a-frame/City bank.js b/ui/setups/web_a-frame/City bank.js new file mode 100644 index 000000000..e4dd3e243 --- /dev/null +++ b/ui/setups/web_a-frame/City bank.js @@ -0,0 +1,376 @@ +var setup = { + + loadPopUp: true, + + + controllers: [ + + { name: "defaultLogger", + + logInfoConsole : false, + logActionConsole : false, + logEventConsole : false + }, + + { name: "emailController", + + createHeadSection: false + }, + + { name: "canvasHoverController", + }, + + { name: "canvasMarkController", + }, + + { name: "canvasSelectController" + }, + + { name: "canvasFilterController" + }, + + { name: "canvasFlyToController" + }, + { name: "searchController" + }, + + { name: "packageExplorerController", + }, + { name: "sourceCodeController", + url: "https://raw.githubusercontent.com/softvis-research/Bank/master/src/" + }, + { name: "relationConnectorController", + + showInnerRelations: false, + sourceStartAtBorder: true, + targetEndAtBorder: true, + }, + { name: "relationTransparencyController", + }, + + { name: "relationHighlightController" + }, + { + name: "systeminfoController", + system: "Bank", + link: "https://github.com/softvis-research/Bank", + noc: true, + loc: 192 + }, + { name: "menuController", + menuMapping: [ + + { + title: "View", + subMenu: true, + items: [ + { + title: "FlyTo", + toggle: true, + eventOn: "canvasFlyToController.activate", + eventOff: "canvasFlyToController.deactivate", + }, + + { + title: "Reset Visualization", + event: "application.reset", + }, + ] + }, + + { + title: "Relations", + subMenu: true, + items: [ + { + title: "Relation Connectors", + toggle: true, + eventOn: "relationConnectorController.activate", + eventOff: "relationConnectorController.deactivate", + }, + { + title: "Relation Transparency", + toggle: true, + eventOn: "relationTransparencyController.activate", + eventOff: "relationTransparencyController.deactivate", + }, + { + title: "Relation Highlight", + toggle: true, + eventOn: "relationHighlightController.activate", + eventOff: "relationHighlightController.deactivate", + }, + ] + }, + + { + title: "Visualizations", + subMenu: true, + items: [ + { + title: "City Original", + link: true, + url: "index.php?setup=web/City freemind&model=City%20original%20freemind" + }, + { + title: "City Bricks", + link: true, + url: "index.php?setup=web/City freemind&model=City%20bricks%20freemind" + }, + { + title: "City Floors", + link: true, + url: "index.php?setup=web/City freemind&model=City%20floor%20freemind" + }, + { + title: "Recursive Disk", + link: true, + url: "index.php?setup=web/RD freemind&model=RD%20freemind" + }, { + title: "Recursive Disk 3D", + link: true, + url: "index.php?setup=web/RD reek&model=RD%203D%20reek" + }, + ] + }, + + { + title: "About", + subMenu: true, + items: [ + { + title: "University Leipzig", + link: true, + url: "https://www.wifa.uni-leipzig.de/en/information-systems-institute/se/research/softwarevisualization-in-3d-and-vr.html" + }, + { + title: "Feedback!", + event: "emailController.openMailPopUp", + }, + { + title: "Impressum", + popup: true, + text: "Universität Leipzig"+ + " "+ + "Wirtschaftswissenschaftliche Fakultät"+ + "Institut für Wirtschaftsinformatik"+ + "Grimmaische Straße 12"+ + "D - 04109 Leipzig"+ + " "+ + "Dr. Richard Müller"+ + "rmueller(-a-t-)wifa.uni-leipzig.de", + height: 200, + width: 2050, + }, + { + title: "Privacy Policy", + link: true, + url: "http://home.uni-leipzig.de/svis/privacy-policy/" + } + ] + }, + ] + }, + { + name: "legendController", + entries: [{ + name: "Package", + icon: "grayCircle" + }, { + name: "Type", + icon: "purpleCircle", + }, { + name: "Navigation", + icon: "navigation", + entries: [ + { + name: "Rotate", + icon: "leftMouseButton" + }, { + name: "Move", + icon: "midMouseButton" + }, { + name: "Zoom", + icon: "scrolling" + }] + } + ], + } + ], + + + + + uis: [ + + + { + name: "UI0", + + navigation: { + //examine, walk, fly, helicopter, lookAt, turntable, game + type: "turntable", + + //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis + typeParams: "0.0 0.0 0.001 1.5", + + //speed: 10 + }, + + + area: { + name: "top", + orientation: "horizontal", + resizable: false, + collapsible: false, + first: { + size: "25px", + collapsible: false, + controllers: [ + {name: "menuController"}, + //{name: "searchController"}, + {name: "emailController"}, + ], + }, + second: { + size: "80%", + collapsible: false, + area: { + orientation: "vertical", + name: "leftPanel", + size: "20%", + first: { + size: "20%", + area: { + size: "50%", + collapsible: false, + orientation: "horizontal", + name: "packagePanel", + first: { + collapsible: false, + size: "33%", + expanders: [ + { + name: "filterExplorer", + title: "Filter", + controllers: [ + // {name: "filterController"} + ], + } + ] + }, + second: { + size: "50%", + area: { + orientation: "horizontal", + name: "legendPanel", + size: "50%%", + collapsible: false, + first: { + size: "50%", + expanders: [ + { + name: "packageExplorer", + title: "Package Explorer", + controllers: [ + {name: "packageExplorerController"} + ], + }, + ] + }, + second: { + size: "50%", + area: { + orientation: "horizontal", + name: "legendPanel2", + size: "100%", + collapsible: false, + first: { + size: "100%", + expanders: [ + { + name: "legend", + title: "Legend", + + controllers: [ + {name: "legendController"} + ], + }, + ] + }, + second: { + + } + }, + }, + } + }, + }, + }, + second: { + collapsible: false, + area: { + orientation: "vertical", + collapsible: false, + name: "canvas", + size: "50%", + first: { + size: "80%", + collapsible: false, + canvas: {}, + controllers: [ + {name: "defaultLogger"}, + {name: "canvasSelectController"}, + {name: "canvasMarkController"}, + {name: "canvasHoverController"}, + {name: "canvasFilterController"}, + {name: "canvasFlyToController"}, + {name: "relationConnectorController"}, + {name: "relationTransparencyController"}, + {name: "relationHighlightController"}, + ], + }, + second: { + area: { + orientation: "horizontal", + collapsible: false, + name: "rightPael", + size: "80%", + first: { + size: "80%", + min: "200", + oriontation: "horizontal", + expanders: [ + { + name: "CodeViewer", + title: "CodeViewer", + controllers: [ + {name: "sourceCodeController"} + ], + }, + ], + }, + second: { + size: "20%", + min: "200", + oriontation: "horizontal", + expanders: [ + { + name: "systeminfo", + title: "Info", + controllers: [ + {name: "systeminfoController"} + ], + }, + ], + } + } + } + } + } + } + } + } + } + ] +}; From 118613098d4c3149db2753dc66aad9ea4154a3fc Mon Sep 17 00:00:00 2001 From: David Baum Date: Fri, 11 Jan 2019 18:32:27 +0100 Subject: [PATCH 58/71] remove setup file --- getaviz.setup | 182 -------------------------------------------------- 1 file changed, 182 deletions(-) delete mode 100644 getaviz.setup diff --git a/getaviz.setup b/getaviz.setup deleted file mode 100644 index 57be4b77e..000000000 --- a/getaviz.setup +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - Git connector - - - - - - Xtext & Xtend - - - - - - - - - - Define the JRE needed to compile and run the Java projects of ${scope.project.label} - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set the heap space needed to work with the projects of ${scope.project.label} - - - - - - Git-Project - - - - - - - - - - - - - - - - - From e0462056eaa2b5f4709d59e1ac3e096194eff1b1 Mon Sep 17 00:00:00 2001 From: David Baum Date: Fri, 11 Jan 2019 23:36:27 +0100 Subject: [PATCH 59/71] dockerfile for ui --- ui/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 ui/Dockerfile diff --git a/ui/Dockerfile b/ui/Dockerfile new file mode 100644 index 000000000..3894442d0 --- /dev/null +++ b/ui/Dockerfile @@ -0,0 +1,5 @@ +FROM php:7.2-apache +COPY . /var/www/html/ +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +LABEL maintainer="david.baum@uni-leipzig.de" \ + version="1.0" From 5a57df6c1c622ae167c29150a1350ba00f127314 Mon Sep 17 00:00:00 2001 From: David Baum Date: Sat, 12 Jan 2019 02:17:33 +0100 Subject: [PATCH 60/71] add subdirectory to ui dockerfile --- ui/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/Dockerfile b/ui/Dockerfile index 3894442d0..a4fe482c1 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -1,5 +1,5 @@ FROM php:7.2-apache -COPY . /var/www/html/ +COPY . /var/www/html/ui RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" LABEL maintainer="david.baum@uni-leipzig.de" \ version="1.0" From d4cc05ab96f2de1a1c2f7884a74dbfcbe96fe618 Mon Sep 17 00:00:00 2001 From: David Baum Date: Mon, 21 Jan 2019 15:49:59 +0100 Subject: [PATCH 61/71] set connecter controller settings correctly --- ui/setups/web_a-frame/City bank.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/setups/web_a-frame/City bank.js b/ui/setups/web_a-frame/City bank.js index e4dd3e243..f188b6a6a 100644 --- a/ui/setups/web_a-frame/City bank.js +++ b/ui/setups/web_a-frame/City bank.js @@ -40,10 +40,13 @@ url: "https://raw.githubusercontent.com/softvis-research/Bank/master/src/" }, { name: "relationConnectorController", - - showInnerRelations: false, + fixPositionY : false, + showInnerRelations : true, + sourceStartAtParentBorder : false, + targetEndAtParentBorder : false, sourceStartAtBorder: true, targetEndAtBorder: true, + createEndpoints : true }, { name: "relationTransparencyController", }, From 19e403b6e9ee2e62be20afe0c58b438027fe69f7 Mon Sep 17 00:00:00 2001 From: David Baum Date: Wed, 30 Jan 2019 21:21:05 +0100 Subject: [PATCH 62/71] simplify generator2 and make it available via docker and jetty --- .gitignore | 2 + docker-compose.yml | 40 ++++ evaluationserver/docker-compose.yml | 23 --- generator2/org.getaviz.generator/.classpath | 2 +- generator2/org.getaviz.generator/Dockerfile | 8 + generator2/org.getaviz.generator/pom.xml | 135 +++++++++---- .../resources/log4j-console.properties} | 6 +- .../src/main/resources/log4j.properties | 11 ++ .../main/resources}/settings.properties | 2 + .../src/main/webapp/WEB-INF/web.xml | 10 + .../src/org/getaviz/generator/Generator.java | 13 +- .../getaviz/generator/GeneratorServlet.java | 25 +++ .../generator/SettingsConfiguration.java | 7 +- .../org/getaviz/generator/city/CityUtils.java | 4 +- .../generator/city/m2m/BrickLayout.java | 6 +- .../city/m2m/BuildingSegmentComparator.java | 4 +- .../generator/city/m2m/City2City.xtend | 6 +- .../generator/city/m2m/CityLayout.java | 6 +- .../generator/city/m2t/City2AFrame.xtend | 6 +- .../getaviz/generator/city/m2t/City2X3D.xtend | 6 +- .../getaviz/generator/city/s2m/JQA2City.xtend | 6 +- .../generator}/database/Database.xtend | 22 +-- .../getaviz/generator}/database/Labels.java | 2 +- .../org/getaviz/generator}/database/Rels.java | 2 +- .../generator/jqa/EndNodeEvaluator.xtend | 2 +- .../org/getaviz/generator/jqa/JQA2JSON.xtend | 6 +- .../generator/jqa/JQAEnhancement.xtend | 6 +- .../getaviz/generator/jqa/JQAEvaluator.xtend | 6 +- .../org/getaviz/generator/rd/RDUtils.xtend | 4 +- .../rd/m2m/CircleWithInnerCircles.xtend | 6 +- .../org/getaviz/generator/rd/m2m/RD2RD.xtend | 6 +- .../getaviz/generator/rd/m2t/RD2AFrame.xtend | 6 +- .../org/getaviz/generator/rd/m2t/RD2X3D.xtend | 4 +- .../org/getaviz/generator/rd/s2m/JQA2RD.xtend | 6 +- .../org.getaviz.lib.database/.classpath | 27 --- .../org.getaviz.lib.database/.gitignore | 1 - generator2/org.getaviz.lib.database/.project | 29 --- generator2/org.getaviz.lib.database/pom.xml | 51 ----- generator2/org.getaviz.parent/.classpath | 14 -- generator2/org.getaviz.parent/.project | 11 -- .../org.getaviz.parent/Generator.launch | 16 -- generator2/org.getaviz.parent/pom.xml | 74 -------- settings.properties | 177 ++++++++++++++++++ ui/docker-compose.yml | 11 -- 44 files changed, 439 insertions(+), 378 deletions(-) create mode 100644 docker-compose.yml delete mode 100644 evaluationserver/docker-compose.yml create mode 100644 generator2/org.getaviz.generator/Dockerfile rename generator2/org.getaviz.generator/src/{log4j.properties => main/resources/log4j-console.properties} (81%) create mode 100644 generator2/org.getaviz.generator/src/main/resources/log4j.properties rename generator2/org.getaviz.generator/{ => src/main/resources}/settings.properties (99%) create mode 100644 generator2/org.getaviz.generator/src/main/webapp/WEB-INF/web.xml create mode 100644 generator2/org.getaviz.generator/src/org/getaviz/generator/GeneratorServlet.java rename generator2/{org.getaviz.lib.database/src/org/getaviz/lib => org.getaviz.generator/src/org/getaviz/generator}/database/Database.xtend (76%) rename generator2/{org.getaviz.lib.database/src/org/getaviz/lib => org.getaviz.generator/src/org/getaviz/generator}/database/Labels.java (90%) rename generator2/{org.getaviz.lib.database/src/org/getaviz/lib => org.getaviz.generator/src/org/getaviz/generator}/database/Rels.java (82%) delete mode 100644 generator2/org.getaviz.lib.database/.classpath delete mode 100644 generator2/org.getaviz.lib.database/.gitignore delete mode 100644 generator2/org.getaviz.lib.database/.project delete mode 100644 generator2/org.getaviz.lib.database/pom.xml delete mode 100644 generator2/org.getaviz.parent/.classpath delete mode 100644 generator2/org.getaviz.parent/.project delete mode 100644 generator2/org.getaviz.parent/Generator.launch delete mode 100644 generator2/org.getaviz.parent/pom.xml create mode 100644 settings.properties delete mode 100644 ui/docker-compose.yml diff --git a/.gitignore b/.gitignore index a0a5f00f4..d93d311f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.komodoproject */.idea + +\.idea/ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..27074928e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: "3" +services: + #db: + #image: mysql:5.7 + #environment: + #MYSQL_ROOT_PASSWORD: dbpassword_for_user + #MYSQL_DATABASE: eval_server_development + #MYSQL_USER: db_username + #MYSQL_PASSWORD: dbpassword_for_user + #restart: always + #eval: + #build: evaluationserver + #env_file: evaluationserver/env + #command: "./bin/wait-for-it.sh db:3306 -s -t 30 -- ./bin/docker_start" + #volumes: + #- ./evaluationserver:/usr/src/app + #ports: + #- "8081:8081" + #depends_on: + #- db + frontend: + restart: always + image: php:7.1.11-apache + volumes: + - ./ui:/var/www/html + ports: + - "8082:8082" + backend: + build: generator2/org.getaviz.generator/ + restart: always + volumes: + - ./generator2/org.getaviz.generator/target/org.getaviz.generator-1.0.0-SNAPSHOT.war:/var/lib/jetty/webapps/root.war + - ./settings.properties:/opt/config/settings.properties + - ./generator2/output:/opt/output/ + - ./generator2/databases:/opt/databases/ + ports: + - "8083:8080" +#volumes: + #bundle: + #driver: local diff --git a/evaluationserver/docker-compose.yml b/evaluationserver/docker-compose.yml deleted file mode 100644 index 4b2beb1cc..000000000 --- a/evaluationserver/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: "3" -services: - db: - image: mysql:5.7 - environment: - MYSQL_ROOT_PASSWORD: dbpassword_for_user - MYSQL_DATABASE: eval_server_development - MYSQL_USER: db_username - MYSQL_PASSWORD: dbpassword_for_user - restart: always - web: - build: . - env_file: env - command: "./bin/wait-for-it.sh db:3306 -s -t 30 -- ./bin/docker_start" - volumes: - - ./:/usr/src/app - ports: - - "8081:8081" - depends_on: - - db -volumes: - bundle: - driver: local diff --git a/generator2/org.getaviz.generator/.classpath b/generator2/org.getaviz.generator/.classpath index 505bc9da1..3e392b378 100644 --- a/generator2/org.getaviz.generator/.classpath +++ b/generator2/org.getaviz.generator/.classpath @@ -1,6 +1,6 @@ - + diff --git a/generator2/org.getaviz.generator/Dockerfile b/generator2/org.getaviz.generator/Dockerfile new file mode 100644 index 000000000..cb8ab4b4f --- /dev/null +++ b/generator2/org.getaviz.generator/Dockerfile @@ -0,0 +1,8 @@ +FROM jetty:9.4.12-jre8 +ADD target/org.getaviz.generator*.war /var/lib/jetty/webapps/root.war +USER root +RUN mkdir -p /usr/local/jetty/logs +EXPOSE 8080 +VOLUME ["/var/lib/jetty/webapps/", "/opt/config/", "/opt/databases/"] +LABEL maintainer="david.baum@uni-leipzig.de" \ + version="1.0" diff --git a/generator2/org.getaviz.generator/pom.xml b/generator2/org.getaviz.generator/pom.xml index c071633b6..7b6c1d072 100644 --- a/generator2/org.getaviz.generator/pom.xml +++ b/generator2/org.getaviz.generator/pom.xml @@ -2,29 +2,26 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - ../org.getaviz.parent/pom.xml - org.getaviz - org.getaviz.parent - 1.0.0-SNAPSHOT - + org.getaviz org.getaviz.generator + 1.0.0-SNAPSHOT Getaviz Generator + https://github.com/getaviz/Getaviz + war ${project.artifactId}-site ${project.baseUri} + + 2.16.0 + 3.5.1 + 5.3.1 + false + UTF-8 + - - - org.getaviz.lib.database - org.getaviz.lib.database - 1.0.0-SNAPSHOT - - - @@ -56,19 +53,13 @@ commons-configuration2 2.4 - - - - org.eclipse.xtend - org.eclipse.xtend.lib - ${xtend.version} - - - com.google.guava - guava - 19.0-rc3 + commons-beanutils + commons-beanutils + 1.9.3 + + org.neo4j @@ -81,11 +72,30 @@ neo4j-resource ${neo4j.version} - - commons-beanutils - commons-beanutils - 1.9.3 + org.neo4j + neo4j + ${neo4j.version} + + + + org.neo4j.test + neo4j-harness + ${neo4j.version} + test + + + + + + org.eclipse.xtend + org.eclipse.xtend.lib + ${xtend.version} + + + com.google.guava + guava + 19.0-rc3 com.vividsolutions @@ -96,25 +106,25 @@ org.junit.jupiter junit-jupiter-api - 5.3.1 + ${junit.jupiter.version} test org.junit.jupiter junit-jupiter-engine - 5.3.1 + ${junit.jupiter.version} test org.junit.vintage junit-vintage-engine - 5.3.1 + ${junit.jupiter.version} test org.junit.platform junit-platform-launcher - 1.1.0 + 1.3.2 test @@ -123,17 +133,60 @@ 1.1.0 test - + - org.neo4j.test - neo4j-harness - 3.4.9 - test + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + org.apache.logging.log4j + log4j-core + 2.11.1 + + + org.eclipse.xtend + xtend-maven-plugin + ${xtend.version} src + + org.eclipse.xtend + xtend-maven-plugin + ${xtend.version} + + ${basedir}/xtend-gen + ${basedir}/test-xtend-gen + + + + + compile + testCompile + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + true + + + + default-testCompile + none + + + org.apache.maven.plugins maven-surefire-plugin @@ -180,6 +233,7 @@ true true + -Dlog4j.configuration=file:src/main/resources/log4j-console.properties -Xmx8g -classpath @@ -190,6 +244,11 @@ + + org.apache.maven.plugins + maven-war-plugin + 3.2.2 + diff --git a/generator2/org.getaviz.generator/src/log4j.properties b/generator2/org.getaviz.generator/src/main/resources/log4j-console.properties similarity index 81% rename from generator2/org.getaviz.generator/src/log4j.properties rename to generator2/org.getaviz.generator/src/main/resources/log4j-console.properties index 90e20d4cd..62f45ea66 100644 --- a/generator2/org.getaviz.generator/src/log4j.properties +++ b/generator2/org.getaviz.generator/src/main/resources/log4j-console.properties @@ -1,5 +1,5 @@ # Root logger option -log4j.rootLogger=DEBUG, file, stdout +log4j.rootLogger=DEBUG, stdout, file log4j.logger.org.apache.commons.beanutils.converters=ERROR # Redirect log messages to console @@ -12,9 +12,7 @@ log4j.appender.stdout.Threshold=INFO # Direct log messages to a log file log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.Append=false -log4j.appender.file.File=./output/debug.log -#log4j.appender.file.MaxFileSize=50MB -#log4j.appender.file.MaxBackupIndex=10 +log4j.appender.file.File=output/debug.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n log4j.appender.file.Threshold=DEBUG diff --git a/generator2/org.getaviz.generator/src/main/resources/log4j.properties b/generator2/org.getaviz.generator/src/main/resources/log4j.properties new file mode 100644 index 000000000..c3fd0414f --- /dev/null +++ b/generator2/org.getaviz.generator/src/main/resources/log4j.properties @@ -0,0 +1,11 @@ +# Root logger option +log4j.rootLogger=DEBUG, file +log4j.logger.org.apache.commons.beanutils.converters=ERROR + + Direct log messages to a log file +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.Append=false +log4j.appender.file.File=${jetty.home}/logs/jetty.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +log4j.appender.file.Threshold=DEBUG diff --git a/generator2/org.getaviz.generator/settings.properties b/generator2/org.getaviz.generator/src/main/resources/settings.properties similarity index 99% rename from generator2/org.getaviz.generator/settings.properties rename to generator2/org.getaviz.generator/src/main/resources/settings.properties index efc3307fe..7dbd80f52 100644 --- a/generator2/org.getaviz.generator/settings.properties +++ b/generator2/org.getaviz.generator/src/main/resources/settings.properties @@ -20,6 +20,8 @@ # Directory of the used jQAssistant database, relative to the directory of this project # database_name = ../databases/graph.db +database_name = /opt/databases/graph.db + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/generator2/org.getaviz.generator/src/main/webapp/WEB-INF/web.xml b/generator2/org.getaviz.generator/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..7444bf176 --- /dev/null +++ b/generator2/org.getaviz.generator/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,10 @@ + + + Getaviz Generator + org.getaviz.generator.GeneratorServlet + + + Getaviz Generator + /* + + diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java index 58b2b7f58..981334658 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/Generator.java @@ -12,9 +12,18 @@ import org.getaviz.generator.rd.s2m.JQA2RD; public class Generator { + static SettingsConfiguration config = SettingsConfiguration.getInstance(); public static void main(String[] args) { - SettingsConfiguration config = SettingsConfiguration.getInstance(); + run(); + } + + public static void run() { + // initialize directories + //File dir = new File(config.getOutputPath()); + //dir.mkdir(); + + // start generation process new JQAEnhancement(); switch (config.getMetaphor()) { case CITY: { @@ -43,6 +52,6 @@ public static void main(String[] args) { } break; } - } + } } } diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/GeneratorServlet.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/GeneratorServlet.java new file mode 100644 index 000000000..63a670668 --- /dev/null +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/GeneratorServlet.java @@ -0,0 +1,25 @@ +package org.getaviz.generator; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GeneratorServlet extends HttpServlet { + private static final long serialVersionUID = -5343549433924172589L; + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + SettingsConfiguration.getInstance("/opt/config/settings.properties"); + + // Set response content type + response.setContentType("text/html"); + + // Actual logic goes here. + PrintWriter out = response.getWriter(); + out.println("

Hello, World!

"); + Generator.run(); + } +} diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java index b3807aaa8..2834aaa9e 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/SettingsConfiguration.java @@ -14,13 +14,10 @@ public class SettingsConfiguration { private static PropertiesConfiguration config; private static SettingsConfiguration instance = null; - private SettingsConfiguration() { - } - public static SettingsConfiguration getInstance() { if (instance == null) { instance = new SettingsConfiguration(); - loadConfig("./settings.properties"); + loadConfig("settings.properties"); } return instance; } @@ -44,7 +41,7 @@ private static void loadConfig(String path) { } public void loadDefault() { - loadConfig("./settings.properties"); + loadConfig("settings.properties"); } public Metaphor getMetaphor() { diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java index eb9d03b51..7208df17c 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/CityUtils.java @@ -11,8 +11,8 @@ import org.getaviz.generator.SettingsConfiguration.OutputFormat; import org.getaviz.generator.city.m2m.BuildingSegmentComparator; import org.getaviz.generator.city.m2m.RGBColor; -import org.getaviz.lib.database.Labels; -import org.getaviz.lib.database.Rels; +import org.getaviz.generator.database.Labels; +import org.getaviz.generator.database.Rels; public class CityUtils { diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java index 6e2877a79..384c7f06c 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BrickLayout.java @@ -8,9 +8,9 @@ import org.neo4j.graphdb.Result; import org.getaviz.generator.SettingsConfiguration; import org.getaviz.generator.city.CityUtils; -import org.getaviz.lib.database.Database; -import org.getaviz.lib.database.Labels; -import org.getaviz.lib.database.Rels; +import org.getaviz.generator.database.Labels; +import org.getaviz.generator.database.Rels; +import org.getaviz.generator.database.Database; public class BrickLayout { private static SettingsConfiguration config = SettingsConfiguration.getInstance(); diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java index b30eade2a..33f1e8a5e 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/BuildingSegmentComparator.java @@ -6,8 +6,8 @@ import org.getaviz.generator.SettingsConfiguration.Attributes; import org.getaviz.generator.SettingsConfiguration.Methods; import org.getaviz.generator.SettingsConfiguration.SortPriorities_Visibility; -import org.getaviz.lib.database.Labels; -import org.getaviz.lib.database.Rels; +import org.getaviz.generator.database.Labels; +import org.getaviz.generator.database.Rels; public class BuildingSegmentComparator implements Comparable { private Node segment; diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend index 6177e67c9..bb099d367 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/City2City.xtend @@ -2,12 +2,12 @@ package org.getaviz.generator.city.m2m import org.neo4j.graphdb.GraphDatabaseService import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Database -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Database +import org.getaviz.generator.database.Labels import org.getaviz.generator.SettingsConfiguration.BuildingType import org.neo4j.graphdb.Node import org.getaviz.generator.city.CityUtils -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.getaviz.generator.SettingsConfiguration.ClassElementsModes import org.neo4j.graphdb.Path diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java index 38d17a7e7..bb3a51a88 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2m/CityLayout.java @@ -15,9 +15,9 @@ import org.neo4j.graphdb.Transaction; import org.getaviz.generator.SettingsConfiguration; import org.getaviz.generator.city.m2m.Rectangle; -import org.getaviz.lib.database.Database; -import org.getaviz.lib.database.Labels; -import org.getaviz.lib.database.Rels; +import org.getaviz.generator.database.Labels; +import org.getaviz.generator.database.Rels; +import org.getaviz.generator.database.Database; public class CityLayout { private static boolean DEBUG = false; diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend index 964304674..314a9fd2a 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2AFrame.xtend @@ -1,11 +1,11 @@ package org.getaviz.generator.city.m2t import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Database -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Database +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import org.getaviz.generator.SettingsConfiguration.BuildingType import org.neo4j.graphdb.Transaction import org.apache.commons.logging.LogFactory diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend index e05309ace..8931ac306 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/m2t/City2X3D.xtend @@ -2,12 +2,12 @@ package org.getaviz.generator.city.m2t import org.getaviz.generator.SettingsConfiguration import org.neo4j.graphdb.Transaction -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.getaviz.generator.SettingsConfiguration.BuildingType import org.neo4j.graphdb.Node import org.neo4j.graphdb.Direction -import org.getaviz.lib.database.Rels -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Rels +import org.getaviz.generator.database.Labels import org.apache.commons.logging.LogFactory import java.io.FileWriter import org.getaviz.generator.OutputFormatHelper diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend index ef9600405..31f957e4d 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/city/s2m/JQA2City.xtend @@ -2,11 +2,11 @@ package org.getaviz.generator.city.s2m import org.neo4j.graphdb.GraphDatabaseService import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Database -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Database +import org.getaviz.generator.database.Labels import java.util.GregorianCalendar import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.getaviz.generator.SettingsConfiguration.BuildingType import org.getaviz.generator.SettingsConfiguration.ClassElementsModes diff --git a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/database/Database.xtend similarity index 76% rename from generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend rename to generator2/org.getaviz.generator/src/org/getaviz/generator/database/Database.xtend index 687aeabba..727f98aec 100644 --- a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Database.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/database/Database.xtend @@ -1,20 +1,14 @@ -package org.getaviz.lib.database +package org.getaviz.generator.database import org.neo4j.graphdb.GraphDatabaseService import java.io.File import org.neo4j.graphdb.factory.GraphDatabaseFactory -import java.util.List import org.eclipse.xtend.lib.annotations.Accessors class Database { static GraphDatabaseService graph var static GraphDatabaseService testGraph @Accessors(PUBLIC_GETTER) static String path - @Accessors(PUBLIC_GETTER) static List databases= { - val dir = new File("../databases/") - dir.mkdir - dir.listFiles.filter(file | file.directory).toList - } def static getInstance() { return graph @@ -64,20 +58,8 @@ class Database { def private static initializeDatabase(String path) { val neofile = new File(path) - val graph = new GraphDatabaseFactory().newEmbeddedDatabase(neofile) + val graph = new GraphDatabaseFactory().newEmbeddedDatabase(neofile); graph.registerShutdownHook -// val tx = graph.beginTx -// try { -// if (graph.schema.constraints.size < 3) { -// graph.schema.constraintFor(DBLabel::FAMIXELEMENT).assertPropertyIsUnique("fid").create -// graph.schema.constraintFor(DBLabel::FAMIX).assertPropertyIsUnique("snapshotID").create -// graph.schema.constraintFor(DBLabel::SYSTEM).assertPropertyIsUnique("systemID").create -// } -// tx.success -// } finally { -// tx.close -// } - return graph } diff --git a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/database/Labels.java similarity index 90% rename from generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java rename to generator2/org.getaviz.generator/src/org/getaviz/generator/database/Labels.java index 2700513e3..b5c95829c 100644 --- a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Labels.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/database/Labels.java @@ -1,4 +1,4 @@ -package org.getaviz.lib.database; +package org.getaviz.generator.database; import org.neo4j.graphdb.Label; diff --git a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java b/generator2/org.getaviz.generator/src/org/getaviz/generator/database/Rels.java similarity index 82% rename from generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java rename to generator2/org.getaviz.generator/src/org/getaviz/generator/database/Rels.java index 4a602a17e..d3a9f9f83 100644 --- a/generator2/org.getaviz.lib.database/src/org/getaviz/lib/database/Rels.java +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/database/Rels.java @@ -1,4 +1,4 @@ -package org.getaviz.lib.database; +package org.getaviz.generator.database; import org.neo4j.graphdb.RelationshipType; diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend index 18673786e..0ce61ca16 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/EndNodeEvaluator.xtend @@ -3,7 +3,7 @@ package org.getaviz.generator.jqa import org.neo4j.graphdb.Path import org.neo4j.graphdb.traversal.Evaluation import org.neo4j.graphdb.traversal.Evaluator -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels class EndNodeEvaluator implements Evaluator { var Labels label diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend index 7e96304cf..a1ecbe8df 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQA2JSON.xtend @@ -2,15 +2,15 @@ package org.getaviz.generator.jqa import java.io.Writer import java.io.FileWriter -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.neo4j.graphdb.Node import java.io.IOException import java.util.List -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.apache.commons.lang3.StringUtils import static org.apache.commons.text.StringEscapeUtils.escapeHtml4 -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import org.getaviz.generator.SettingsConfiguration import org.apache.commons.logging.LogFactory diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend index 0a1118e8b..ef5c1ca46 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEnhancement.xtend @@ -2,12 +2,12 @@ package org.getaviz.generator.jqa import org.getaviz.generator.SettingsConfiguration import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import org.apache.commons.codec.digest.DigestUtils -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.neo4j.graphdb.traversal.Uniqueness -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.apache.commons.logging.LogFactory class JQAEnhancement { diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend index 32f530281..288479b32 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/jqa/JQAEvaluator.xtend @@ -2,11 +2,9 @@ package org.getaviz.generator.jqa import org.neo4j.graphdb.traversal.Evaluator import org.neo4j.graphdb.Path -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import org.neo4j.graphdb.traversal.Evaluation -//import org.getaviz.lib.database.Database -//import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction class JQAEvaluator implements Evaluator { diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend index cd98fcd73..045507419 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/RDUtils.xtend @@ -2,8 +2,8 @@ package org.getaviz.generator.rd import org.neo4j.graphdb.Node import org.neo4j.graphdb.Direction -import org.getaviz.lib.database.Rels -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Rels +import org.getaviz.generator.database.Labels import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.Path diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend index 108e72c11..ce92749e6 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/CircleWithInnerCircles.xtend @@ -3,11 +3,11 @@ package org.getaviz.generator.rd.m2m; import java.util.ArrayList import org.eclipse.xtend.lib.annotations.Accessors import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import org.getaviz.generator.rd.RDUtils -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.apache.commons.logging.LogFactory class CircleWithInnerCircles extends Circle { diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend index 29a18cd3b..c0a54c104 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2m/RD2RD.xtend @@ -1,11 +1,11 @@ package org.getaviz.generator.rd.m2m import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.neo4j.graphdb.Node import org.neo4j.graphdb.Direction -import org.getaviz.lib.database.Rels -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Rels +import org.getaviz.generator.database.Labels import org.getaviz.generator.SettingsConfiguration.OutputFormat import org.getaviz.generator.rd.RDUtils import java.util.ArrayList diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend index 20f6827d5..67c188e0f 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2AFrame.xtend @@ -1,11 +1,11 @@ package org.getaviz.generator.rd.m2t import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import org.apache.commons.logging.LogFactory import org.getaviz.generator.OutputFormatHelper import java.io.FileWriter diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend index 45c71503a..e1eac25a9 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/m2t/RD2X3D.xtend @@ -1,9 +1,9 @@ package org.getaviz.generator.rd.m2t import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.getaviz.generator.OutputFormatHelper import java.io.FileWriter diff --git a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend index 6f475d51a..1fb350c06 100644 --- a/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend +++ b/generator2/org.getaviz.generator/src/org/getaviz/generator/rd/s2m/JQA2RD.xtend @@ -1,11 +1,11 @@ package org.getaviz.generator.rd.s2m -import org.getaviz.lib.database.Database +import org.getaviz.generator.database.Database import org.getaviz.generator.SettingsConfiguration -import org.getaviz.lib.database.Labels +import org.getaviz.generator.database.Labels import java.util.GregorianCalendar import org.neo4j.graphdb.Node -import org.getaviz.lib.database.Rels +import org.getaviz.generator.database.Rels import org.neo4j.graphdb.Direction import org.getaviz.generator.SettingsConfiguration.OutputFormat import org.apache.commons.logging.LogFactory diff --git a/generator2/org.getaviz.lib.database/.classpath b/generator2/org.getaviz.lib.database/.classpath deleted file mode 100644 index cb998e4d1..000000000 --- a/generator2/org.getaviz.lib.database/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/generator2/org.getaviz.lib.database/.gitignore b/generator2/org.getaviz.lib.database/.gitignore deleted file mode 100644 index b83d22266..000000000 --- a/generator2/org.getaviz.lib.database/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/generator2/org.getaviz.lib.database/.project b/generator2/org.getaviz.lib.database/.project deleted file mode 100644 index 4687e16ef..000000000 --- a/generator2/org.getaviz.lib.database/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - org.getaviz.lib.database - - - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.xtext.ui.shared.xtextNature - - diff --git a/generator2/org.getaviz.lib.database/pom.xml b/generator2/org.getaviz.lib.database/pom.xml deleted file mode 100644 index d7c9c4824..000000000 --- a/generator2/org.getaviz.lib.database/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - - ../org.getaviz.parent/pom.xml - org.getaviz - org.getaviz.parent - 1.0.0-SNAPSHOT - - org.getaviz.lib.database - org.getaviz.lib.database - Getaviz Database Connector - - - - org.neo4j - neo4j - 3.4.9 - - - - org.neo4j - neo4j-graphdb-api - ${neo4j.version} - - - - org.eclipse.xtend - org.eclipse.xtend.lib - ${xtend.version} - - - - src - - - org.apache.maven.plugins - maven-clean-plugin - ${clean.version} - - - - ${basedir}/output - - - - - - - diff --git a/generator2/org.getaviz.parent/.classpath b/generator2/org.getaviz.parent/.classpath deleted file mode 100644 index 248406be3..000000000 --- a/generator2/org.getaviz.parent/.classpath +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/generator2/org.getaviz.parent/.project b/generator2/org.getaviz.parent/.project deleted file mode 100644 index e2e9d9cd3..000000000 --- a/generator2/org.getaviz.parent/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - org.getaviz.parent - - - - - - org.eclipse.m2e.core.maven2Nature - - diff --git a/generator2/org.getaviz.parent/Generator.launch b/generator2/org.getaviz.parent/Generator.launch deleted file mode 100644 index 5059ef870..000000000 --- a/generator2/org.getaviz.parent/Generator.launch +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/generator2/org.getaviz.parent/pom.xml b/generator2/org.getaviz.parent/pom.xml deleted file mode 100644 index 64a12c330..000000000 --- a/generator2/org.getaviz.parent/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - 4.0.0 - org.getaviz - org.getaviz.parent - 1.0.0-SNAPSHOT - Getaviz Generator - https://github.com/getaviz/Getaviz - pom - - ../org.getaviz.lib.database - ../org.getaviz.generator - - - 2.16.0 - 3.0.0 - 2.19.1 - 3.4.9 - 3.8.0 - 5.3.1 - false - UTF-8 - - - - log4j - log4j - 1.2.17 - - - org.eclipse.xtend - xtend-maven-plugin - ${xtend.version} - - - - - - org.eclipse.xtend - xtend-maven-plugin - ${xtend.version} - - ${basedir}/xtend-gen - ${basedir}/test-xtend-gen - - - - - compile - testCompile - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${compiler.version} - - 1.8 - 1.8 - true - - - - default-testCompile - none - - - - - - diff --git a/settings.properties b/settings.properties new file mode 100644 index 000000000..c51300702 --- /dev/null +++ b/settings.properties @@ -0,0 +1,177 @@ +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# OUTPUT # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +# Output format of the generated visualization +# Possible values are x3d(default), aframe +# output.format = x3d + +# Visualization metaphor of the generated visualization +# Possible value ard rd(default), city +# metaphor = rd + +# Directory to which the visualization will be generateds, relative to the directory of this project +# output.path = ./output/ +output.path = /opt/output/ + +# If true, the x3d files is converted to multipart automatically, if InstantPlayer is installed locally +# convert_to_multipart = false + +# Directory of the used jQAssistant database, relative to the directory of this project +# database_name = ../databases/graph.db +database_name = /opt/databases/graph.db + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# CITY VISUALIZATION # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +# Possible values are original (default), panels, bricks, floor +# city.building_type = original + +# The active mode to structure +# The active mode to structure and color the methods and attributes. +# Possible values are +# types (default): The class elements are sorted and colored associated to type/functionality of the method. +# visibility: The class elements are sorted and colored corresponding to there visibility modifiers. +# city.scheme = types + +# Switch to control the elements of the classes to show. +# Possible values are methods_and_attributes (default), methods_only, attributes_only +# city.class_elements_mode = methods_and_attributes + +# Possible values are methods_first (default), unsorted, attributes_first +# city.class_elements_sort_mode_coarse = methods_first + +# The active mode, how to sort the methods or attributes separately among each other +# This means a method is only compared to another method and an attribute is only +# compared to another attribute in this comparison, according their values. +# If it is set to scheme, a secondary sorting is performed to place methods +# with high numbers of statements to the bottom. +# Possible values are scheme (default), unsorted, alphabetically, nos +# city.class_elements_sort_mode_fine = scheme + +# If set true, the order of the sorting, defined in class_elements_sort_mode_fide is reversed. +# If class_elements_sort_mode_fide is set to scheme, a secondary sorting is performed to place +# methods with high numbers of statements to the bottom. This behavior isn't influenced by this switch. +# city.class_elements_sort_mode_fine_direction_reversed = false + +# Switch to show or hide building base in panels or bricks mode. +# If set to false, only districts and buildingSegments are visible. +# city.show_building_base = true + +# Switch for showing attributes as cylinders instead of boxes. +# This setting has only an affect in panels-mode. +# city.show_attributes_as_cylinders = true + +# The active mode for the layout of the bricks/methods. +# This setting has only an affect in brick-mode. +# Possible values are progressive (default), straight, balanced +# city.brick.layout = progressive +# city.brick.size = 1.0 +# city.brick.horizontal_margin = 0.5 +# city.brick.horizontal_gap = 0.2 +# city.brick.vertical_margin = 0.2 +# city.brick.vertical_gap = 0.2 + +# The active mode for the area between panels/methods. +# Possible values are +# separator (default): Between the panels separators are placed with a fix height and color. +# none: No space between the panels and they are placed on top of each other. +# gap: The panels have a free space between them and don't touch each other. +# city.panel.separator_mode = separator + +# Multiplier for height of a panel, declared in panel.height_unit. The elements of this array +# are threshold values for the number of statements inside the method and are multiplied with the +# index+1, so the product will be the actual height of the panel. +# The values are inclusive. +# Comment property out to use default value (is 3, 6, 12, 24, 48, 96, 144, 192, 240) +# city.panel.height_treshold_nos = 3, 6, 12, 24, 48, 96, 144, 192, 240 + +## Measurements Panels + +# Height is multiplied by panel.height_treshold_nos +# city.panel.height_unit = 0.5 + +# city.panel.horizontal_margin = 0.5 +# city.panel.vertical_margin = 0.25 +# city.panel.vertical_gap = 0.125 +# city.panel.separator_height = 0.125 + +# Possible values are none (default) and nos +# city.original_building_metric = none + +# city.width_min = 1 +# city.height_min = 1 +# city.building.horizontal_margin = 3.0 +# city.building.horizontal_margin = 20.0 +# city.building.horizontal_gap = 3.0 +# city.building.horizontal_gap = 20.0 +# city.building.vertical_margin = 1.0 + +# city.package.color_start = #969696 +# city.package.color_end = #f0f0f0 +# city.class.color_start = #131615 +# city.class.color_end = #00ff00 +# city.class.color = #353559 + +# Dynamic City colors +# city.dynamic.class.color_start = #fa965c +# city.dynamic.class.color_end = #feb280 +# city.dynamic.method.color = #735eb9 +# city.dynamic.package.color_start = #23862c +# city.dynamic.package.color_end = #7bcd8d + +# city.color.blue = #99FFCC +# city.color.aqua = #99CCFF +# city.color.light_green = #CCFF99 +# city.color.dark_green = #99FF99 +# city.color.yellow = #ffff99 +# city.color.orange = #FFCC99 +# city.color.red = #FF9999 +# city.color.pink = #FF99FF +# city.color.violet = #9999FF +# city.color.light_grey = #CCCCCC +# city.color.dark_grey = #999999 +# city.color.white = #FFFFFF +# city.color.black = #000000 + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # +# RECURSIVE DISK VISUALIZATION # +# # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +# rd.data_factor = 4.0 +# rd.method_factor = 1.0 +# rd.height = 1.0 +# rd.height_boost = 8 +# rd.height_multiplicator = 50.0 +# rd.ring_width = 2.0 + +# Sets the ring width of the method disks +# Only relevant if disk of type FAMIX.Method exist +# rd.ring_width_md = 0 + +# Equal to ring_width_md but for attribute disks +# rd.ring_with_ad = 0 +# rd.min_area = 10.0 +# rd.namespace_transparency = 0 +# rd.class_transparency = 0 +# rd.method_transparency = 0 +# rd.data_transparency = 0 +# rd.color.class = #353559 +# rd.color.data = #fffc19 +# rd.color.method = #1485cc +# rd.color.namespace = #969696 + +# If true the Methods will be visualized as Disks instead of DiskSegments. +# rd.method_disks = false + +# If true Attributes will be visualized as disks. +# rd.data_disks = false diff --git a/ui/docker-compose.yml b/ui/docker-compose.yml deleted file mode 100644 index cdf60adea..000000000 --- a/ui/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -#version: "3.4" -#services: -app: - restart: always - image: php:7.1.11-apache - volumes: - - ./:/var/www/html - ports: - - "8082:80" - -# docker-compose up From b780662abdc003051098ffe24ff1016eef2b7e93 Mon Sep 17 00:00:00 2001 From: David Baum Date: Wed, 30 Jan 2019 22:08:11 +0100 Subject: [PATCH 63/71] update travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28a87bd8c..efee11cda 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,9 @@ matrix: language: java before_install: - cd generator2 - - cd org.getaviz.parent/ + - cd org.getaviz.generator/ script: - - mvn clean install -fae + - mvn clean install - name: Evaluation Server language: ruby before_script: From e723dff9a38e9266f7fa214a1fdf9e5acbeb5a3e Mon Sep 17 00:00:00 2001 From: David Baum Date: Wed, 30 Jan 2019 22:08:22 +0100 Subject: [PATCH 64/71] reenable eval server --- docker-compose.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 27074928e..9b687d3f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: "3" services: - #db: + db: #image: mysql:5.7 #environment: #MYSQL_ROOT_PASSWORD: dbpassword_for_user @@ -8,7 +8,7 @@ services: #MYSQL_USER: db_username #MYSQL_PASSWORD: dbpassword_for_user #restart: always - #eval: + eval: #build: evaluationserver #env_file: evaluationserver/env #command: "./bin/wait-for-it.sh db:3306 -s -t 30 -- ./bin/docker_start" @@ -35,6 +35,6 @@ services: - ./generator2/databases:/opt/databases/ ports: - "8083:8080" -#volumes: - #bundle: - #driver: local +volumes: + bundle: + driver: local From 5cfbf14cdf9ed450a7c87a89fa6a778a36b58079 Mon Sep 17 00:00:00 2001 From: David Baum Date: Wed, 30 Jan 2019 22:10:24 +0100 Subject: [PATCH 65/71] uncomment :-) --- docker-compose.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9b687d3f9..abe9209ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,23 @@ version: "3" services: db: - #image: mysql:5.7 - #environment: - #MYSQL_ROOT_PASSWORD: dbpassword_for_user - #MYSQL_DATABASE: eval_server_development - #MYSQL_USER: db_username - #MYSQL_PASSWORD: dbpassword_for_user - #restart: always + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: dbpassword_for_user + MYSQL_DATABASE: eval_server_development + MYSQL_USER: db_username + MYSQL_PASSWORD: dbpassword_for_user + restart: always eval: - #build: evaluationserver - #env_file: evaluationserver/env - #command: "./bin/wait-for-it.sh db:3306 -s -t 30 -- ./bin/docker_start" - #volumes: - #- ./evaluationserver:/usr/src/app - #ports: - #- "8081:8081" - #depends_on: - #- db + build: evaluationserver + env_file: evaluationserver/env + command: "./bin/wait-for-it.sh db:3306 -s -t 30 -- ./bin/docker_start" + volumes: + - ./evaluationserver:/usr/src/app + ports: + - "8081:8081" + depends_on: + - db frontend: restart: always image: php:7.1.11-apache From 6a47ae5e8985cd03ce1284d64a5427e30cd31e8e Mon Sep 17 00:00:00 2001 From: David Baum Date: Thu, 31 Jan 2019 13:45:05 +0100 Subject: [PATCH 66/71] automate dockerbuild and fix security/permission problems --- docker-compose.yml | 4 ++-- generator2/org.getaviz.generator/Dockerfile | 16 ++++++++++++---- .../src/main/resources/log4j.properties | 2 +- generator2/output/.gitignore | 1 + settings.properties | 4 ++-- 5 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 generator2/output/.gitignore diff --git a/docker-compose.yml b/docker-compose.yml index abe9209ee..64391c8bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,8 +31,8 @@ services: volumes: - ./generator2/org.getaviz.generator/target/org.getaviz.generator-1.0.0-SNAPSHOT.war:/var/lib/jetty/webapps/root.war - ./settings.properties:/opt/config/settings.properties - - ./generator2/output:/opt/output/ - - ./generator2/databases:/opt/databases/ + - ./generator2/output:/var/lib/jetty/output/ + - ./generator2/databases:/var/lib/jetty/databases/ ports: - "8083:8080" volumes: diff --git a/generator2/org.getaviz.generator/Dockerfile b/generator2/org.getaviz.generator/Dockerfile index cb8ab4b4f..c2142c2ba 100644 --- a/generator2/org.getaviz.generator/Dockerfile +++ b/generator2/org.getaviz.generator/Dockerfile @@ -1,8 +1,16 @@ +FROM maven:3.6.0-jdk-8 AS MAVEN_TOOL_CHAIN +RUN mkdir -p /tmp/generator2/ +COPY pom.xml /tmp/generator2/ +COPY src /tmp/generator2/src/ +WORKDIR /tmp/generator2/ +RUN mvn package + FROM jetty:9.4.12-jre8 -ADD target/org.getaviz.generator*.war /var/lib/jetty/webapps/root.war -USER root -RUN mkdir -p /usr/local/jetty/logs +COPY --from=MAVEN_TOOL_CHAIN /tmp/generator2/target/org.getaviz.generator*.war /var/lib/jetty/webapps/root.war +RUN mkdir -p /var/lib/jetty/logs/ +RUN mkdir -p /var/lib/jetty/databases/ +RUN mkdir -p /var/lib/jetty/output/ EXPOSE 8080 -VOLUME ["/var/lib/jetty/webapps/", "/opt/config/", "/opt/databases/"] +VOLUME ["/var/lib/jetty/webapps/", "/opt/config/", "/var/lib/jetty/databases/", "/var/lib/jetty/output/"] LABEL maintainer="david.baum@uni-leipzig.de" \ version="1.0" diff --git a/generator2/org.getaviz.generator/src/main/resources/log4j.properties b/generator2/org.getaviz.generator/src/main/resources/log4j.properties index c3fd0414f..052fd02f1 100644 --- a/generator2/org.getaviz.generator/src/main/resources/log4j.properties +++ b/generator2/org.getaviz.generator/src/main/resources/log4j.properties @@ -5,7 +5,7 @@ log4j.logger.org.apache.commons.beanutils.converters=ERROR Direct log messages to a log file log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.Append=false -log4j.appender.file.File=${jetty.home}/logs/jetty.log +log4j.appender.file.File=${jetty.base}/jetty.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n log4j.appender.file.Threshold=DEBUG diff --git a/generator2/output/.gitignore b/generator2/output/.gitignore new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/generator2/output/.gitignore @@ -0,0 +1 @@ + diff --git a/settings.properties b/settings.properties index c51300702..98c58b691 100644 --- a/settings.properties +++ b/settings.properties @@ -14,14 +14,14 @@ # Directory to which the visualization will be generateds, relative to the directory of this project # output.path = ./output/ -output.path = /opt/output/ +output.path = /var/lib/jetty/output/ # If true, the x3d files is converted to multipart automatically, if InstantPlayer is installed locally # convert_to_multipart = false # Directory of the used jQAssistant database, relative to the directory of this project # database_name = ../databases/graph.db -database_name = /opt/databases/graph.db +database_name = /var/lib/jetty/databases/graph.db # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # From 0e154c784f0a18c1950c80e6516383a6cb59797c Mon Sep 17 00:00:00 2001 From: David Baum Date: Fri, 1 Feb 2019 00:01:26 +0100 Subject: [PATCH 67/71] add launchers for eclipse --- .../org.getaviz.generator/Build war.launch | 17 +++++++++++++++++ .../org.getaviz.generator/Run Generator.launch | 17 +++++++++++++++++ .../src/main/resources/settings.properties | 2 -- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 generator2/org.getaviz.generator/Build war.launch create mode 100644 generator2/org.getaviz.generator/Run Generator.launch diff --git a/generator2/org.getaviz.generator/Build war.launch b/generator2/org.getaviz.generator/Build war.launch new file mode 100644 index 000000000..9d809ca6f --- /dev/null +++ b/generator2/org.getaviz.generator/Build war.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/generator2/org.getaviz.generator/Run Generator.launch b/generator2/org.getaviz.generator/Run Generator.launch new file mode 100644 index 000000000..0ddc80c4f --- /dev/null +++ b/generator2/org.getaviz.generator/Run Generator.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/generator2/org.getaviz.generator/src/main/resources/settings.properties b/generator2/org.getaviz.generator/src/main/resources/settings.properties index 7dbd80f52..efc3307fe 100644 --- a/generator2/org.getaviz.generator/src/main/resources/settings.properties +++ b/generator2/org.getaviz.generator/src/main/resources/settings.properties @@ -20,8 +20,6 @@ # Directory of the used jQAssistant database, relative to the directory of this project # database_name = ../databases/graph.db -database_name = /opt/databases/graph.db - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # From d1ce40cd4a5d691ead5a91975bbd89cbb8612db0 Mon Sep 17 00:00:00 2001 From: David Baum Date: Sat, 2 Feb 2019 22:07:34 +0100 Subject: [PATCH 68/71] fix docker compose --- docker-compose.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 64391c8bc..2b1631e71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,12 +19,11 @@ services: depends_on: - db frontend: - restart: always - image: php:7.1.11-apache + build: ui/ volumes: - - ./ui:/var/www/html + - ./ui:/var/www/html/ui ports: - - "8082:8082" + - "8082:80" backend: build: generator2/org.getaviz.generator/ restart: always From d9feddd73bd6a9f37add979b6175092828970489 Mon Sep 17 00:00:00 2001 From: David Baum Date: Sat, 2 Feb 2019 22:08:27 +0100 Subject: [PATCH 69/71] remove unused setup files --- ui/setups/web/City freemind.js | 384 ------------------------------- ui/setups/web/RD bank.js | 397 --------------------------------- ui/setups/web/RD freemind.js | 394 -------------------------------- ui/setups/web/RD reek.js | 396 -------------------------------- ui/setups/web/mrt-demo.js | 289 ------------------------ ui/setups/web/mrt.js | 181 --------------- 6 files changed, 2041 deletions(-) delete mode 100644 ui/setups/web/City freemind.js delete mode 100644 ui/setups/web/RD bank.js delete mode 100644 ui/setups/web/RD freemind.js delete mode 100644 ui/setups/web/RD reek.js delete mode 100644 ui/setups/web/mrt-demo.js delete mode 100644 ui/setups/web/mrt.js diff --git a/ui/setups/web/City freemind.js b/ui/setups/web/City freemind.js deleted file mode 100644 index 49cc1ea74..000000000 --- a/ui/setups/web/City freemind.js +++ /dev/null @@ -1,384 +0,0 @@ -var setup = { - - loadPopUp: true, - - - controllers: [ - - { name: "defaultLogger", - - logInfoConsole : false, - logActionConsole : false, - logEventConsole : false - }, - - { name: "emailController", - - createHeadSection: false - }, - - { name: "canvasHoverController", - }, - - { name: "canvasMarkController", - }, - - { name: "canvasSelectController" - }, - - { name: "canvasFilterController" - }, - - { name: "canvasFlyToController" - }, - { - name: 'filterController', - devMode: false, - configuration: 'default.json' - }, - { name: "searchController" - }, - - { name: "packageExplorerController", - }, - { name: "sourceCodeController", - url: "https://raw.githubusercontent.com/softvis-research/freemind-mmx/master/freemind/" - }, - { name: "relationConnectorController", - - showInnerRelations: false, - sourceStartAtBorder: true, - targetEndAtBorder: true, - }, - { name: "relationTransparencyController", - }, - - { name: "relationHighlightController" - }, - { - name: "systeminfoController", - system: "Freemind", - link: "https://freemind.sf.net", - noc: true, - loc: 72329 - }, - { name: "menuController", - menuMapping: [ - - { - title: "View", - subMenu: true, - items: [ - { - title: "FlyTo", - toggle: true, - eventOn: "canvasFlyToController.activate", - eventOff: "canvasFlyToController.deactivate", - }, - - { - title: "Reset Visualization", - event: "application.reset", - }, - ] - }, - - { - title: "Relations", - subMenu: true, - items: [ - { - title: "Relation Connectors", - toggle: true, - eventOn: "relationConnectorController.activate", - eventOff: "relationConnectorController.deactivate", - }, - { - title: "Relation Transparency", - toggle: true, - eventOn: "relationTransparencyController.activate", - eventOff: "relationTransparencyController.deactivate", - }, - { - title: "Relation Highlight", - toggle: true, - eventOn: "relationHighlightController.activate", - eventOff: "relationHighlightController.deactivate", - }, - ] - }, - - { - title: "Visualizations", - subMenu: true, - items: [ - { - title: "City Original", - link: true, - url: "index.php?setup=web/City freemind&model=City%20original%20freemind" - }, - { - title: "City Bricks", - link: true, - url: "index.php?setup=web/City freemind&model=City%20bricks%20freemind" - }, - { - title: "City Floors", - link: true, - url: "index.php?setup=web/City freemind&model=City%20floor%20freemind" - }, - { - title: "Recursive Disk", - link: true, - url: "index.php?setup=web/RD freemind&model=RD%20freemind" - }, { - title: "Recursive Disk 3D", - link: true, - url: "index.php?setup=web/RD reek&model=RD%203D%20reek" - }, - ] - }, - - { - title: "About", - subMenu: true, - items: [ - { - title: "University Leipzig", - link: true, - url: "https://www.wifa.uni-leipzig.de/en/information-systems-institute/se/research/softwarevisualization-in-3d-and-vr.html" - }, - { - title: "Feedback!", - event: "emailController.openMailPopUp", - }, - { - title: "Impressum", - popup: true, - text: "Universität Leipzig"+ - " "+ - "Wirtschaftswissenschaftliche Fakultät"+ - "Institut für Wirtschaftsinformatik"+ - "Grimmaische Straße 12"+ - "D - 04109 Leipzig"+ - " "+ - "Dr. Richard Müller"+ - "rmueller(-a-t-)wifa.uni-leipzig.de", - height: 200, - width: 2050, - }, - { - title: "Privacy Policy", - link: true, - url: "http://home.uni-leipzig.de/svis/privacy-policy/" - } - ] - }, - ] - }, - { - name: "legendController", - entries: [{ - name: "Package", - icon: "grayCircle" - }, { - name: "Type", - icon: "purpleCircle", - }, { - name: "Navigation", - icon: "navigation", - entries: [ - { - name: "Rotate", - icon: "leftMouseButton" - }, { - name: "Center", - icon: "doubleClick" - }, { - name: "Move", - icon: "midMouseButton" - }, { - name: "Zoom", - icon: "scrolling" - }] - } - ], - } - ], - - - - - uis: [ - - - { - name: "UI0", - - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "turntable", - - //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis - typeParams: "0.0 0.0 0.001 1.5", - - //speed: 10 - }, - - - area: { - name: "top", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - size: "25px", - collapsible: false, - controllers: [ - {name: "menuController"}, - //{name: "searchController"}, - {name: "emailController"}, - ], - }, - second: { - size: "80%", - collapsible: false, - area: { - orientation: "vertical", - name: "leftPanel", - size: "20%", - first: { - size: "20%", - area: { - size: "50%", - collapsible: false, - orientation: "horizontal", - name: "packagePanel", - first: { - collapsible: false, - size: "33%", - expanders: [ - { - name: "filterExplorer", - title: "Filter", - controllers: [ - {name: "filterController"} - ], - } - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel", - size: "50%%", - collapsible: false, - first: { - size: "50%", - expanders: [ - { - name: "packageExplorer", - title: "Package Explorer", - controllers: [ - {name: "packageExplorerController"} - ], - }, - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel2", - size: "100%", - collapsible: false, - first: { - size: "100%", - expanders: [ - { - name: "legend", - title: "Legend", - - controllers: [ - {name: "legendController"} - ], - }, - ] - }, - second: { - - } - }, - }, - } - }, - }, - }, - second: { - collapsible: false, - area: { - orientation: "vertical", - collapsible: false, - name: "canvas", - size: "50%", - first: { - size: "80%", - collapsible: false, - canvas: {}, - controllers: [ - {name: "defaultLogger"}, - {name: "canvasSelectController"}, - {name: "canvasMarkController"}, - {name: "canvasHoverController"}, - {name: "canvasFilterController"}, - {name: "canvasFlyToController"}, - {name: "relationConnectorController"}, - {name: "relationTransparencyController"}, - {name: "relationHighlightController"}, - ], - }, - second: { - area: { - orientation: "horizontal", - collapsible: false, - name: "rightPael", - size: "80%", - first: { - size: "80%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "CodeViewer", - title: "CodeViewer", - controllers: [ - {name: "sourceCodeController"} - ], - }, - ], - }, - second: { - size: "20%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "systeminfo", - title: "Info", - controllers: [ - {name: "systeminfoController"} - ], - }, - ], - } - } - } - } - } - } - } - } - } - ] -}; diff --git a/ui/setups/web/RD bank.js b/ui/setups/web/RD bank.js deleted file mode 100644 index 1bfd0ba5d..000000000 --- a/ui/setups/web/RD bank.js +++ /dev/null @@ -1,397 +0,0 @@ -var setup = { - - loadPopUp: true, - - - controllers: [ - - { name: "defaultLogger", - - logInfoConsole : false, - logActionConsole : false, - logEventConsole : false - }, - - { name: "emailController", - - createHeadSection: false - }, - - { - name: 'canvasFilterController' - }, - - { name: "canvasHoverController", - }, - - { name: "canvasMarkController", - }, - - { name: "canvasSelectController" - }, - { - name: 'filterController', - devMode: false, - configuration: 'default.json' - }, - { name: "canvasFlyToController" - }, - - { name: "searchController" - }, - - { name: "packageExplorerController", - }, - { name: "sourceCodeController", - url: "https://raw.githubusercontent.com/softvis-research/Bank/master/src/" - }, - - { name: "relationConnectorController", - - fixPositionZ : 1, - showInnerRelations : true, - elementShape : "circle", - sourceStartAtParentBorder : true, - targetEndAtParentBorder : false, - createEndpoints: true, - }, - - { name: "relationTransparencyController", - }, - - { name: "relationHighlightController" - }, - { - name: "systeminfoController", - system: "Bank", - link: "https://github.com/softvis-research/Bank", - noc: true, - loc: 192 - }, - { name: "menuController", - menuMapping: [ - - { - title: "View", - subMenu: true, - items: [ - { - title: "FlyTo", - toggle: true, - eventOn: "canvasFlyToController.activate", - eventOff: "canvasFlyToController.deactivate", - }, - - { - title: "Reset Visualization", - event: "application.reset", - }, - ] - }, - - { - title: "Relations", - subMenu: true, - items: [ - { - title: "Relation Connectors", - toggle: true, - eventOn: "relationConnectorController.activate", - eventOff: "relationConnectorController.deactivate", - }, - { - title: "Relation Transparency", - toggle: true, - eventOn: "relationTransparencyController.activate", - eventOff: "relationTransparencyController.deactivate", - }, - { - title: "Relation Highlight", - toggle: true, - eventOn: "relationHighlightController.activate", - eventOff: "relationHighlightController.deactivate", - }, - ] - }, - - { - title: "Visualizations", - subMenu: true, - items: [ - { - title: "City Original", - link: true, - url: "index.php?setup=web/City freemind&model=City%20original%20freemind" - }, - { - title: "City Bricks", - link: true, - url: "index.php?setup=web/City freemind&model=City%20bricks%20freemind" - }, - { - title: "City Floors", - link: true, - url: "index.php?setup=web/City freemind&model=City%20floor%20freemind" - }, - { - title: "Recursive Disk", - link: true, - url: "index.php?setup=web/RD freemind&model=RD%20freemind" - }, - { - title: "Recursive Disk 3D", - link: true, - url: "index.php?setup=web/RD reek&model=RD%203D%20reek" - }, - ] - }, - - { - title: "About", - subMenu: true, - items: [ - { - title: "University Leipzig", - link: true, - url: "https://www.wifa.uni-leipzig.de/en/information-systems-institute/se/research/softwarevisualization-in-3d-and-vr.html" - }, - { - title: "Feedback!", - event: "emailController.openMailPopUp", - }, - { - title: "Impressum", - popup: true, - text: "Universität Leipzig"+ - " "+ - "Wirtschaftswissenschaftliche Fakultät"+ - "Institut für Wirtschaftsinformatik"+ - "Grimmaische Straße 12"+ - "D - 04109 Leipzig"+ - " "+ - "Dr. Richard Müller"+ - "rmueller(-a-t-)wifa.uni-leipzig.de", - height: 200, - width: 2050, - }, - { - title: "Privacy Policy", - link: true, - url: "http://home.uni-leipzig.de/svis/privacy-policy/" - } - ] - }, - ] - }, - { - name: "legendController", - entries: [{ - name: "Package", - icon: "grayCircle" - }, { - name: "Type", - icon: "purpleCircle", - }, { - name: "Method", - icon: "lightBlueCircle", - }, { - name: "Field", - icon: "yellowCircle", - }, { - name: "Navigation", - icon: "navigation", - entries: [ - { - name: "Rotate", - icon: "leftMouseButton" - }, { - name: "Center", - icon: "doubleClick" - }, { - name: "Move", - icon: "midMouseButton" - }, { - name: "Zoom", - icon: "scrolling" - }] - } - ], - } - ], - - - - - uis: [ - - - { - name: "UI0", - - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "turntable", - - //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis - typeParams: "0.0 0.0 0.001 1.5", - - //speed: 10 - }, - - - area: { - name: "top", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - size: "25px", - collapsible: false, - controllers: [ - {name: "menuController"}, - //{name: "searchController"}, - {name: "emailController"}, - ], - }, - second: { - size: "80%", - collapsible: false, - area: { - orientation: "vertical", - name: "leftPanel", - size: "20%", - first: { - size: "20%", - area: { - size: "50%", - collapsible: false, - orientation: "horizontal", - name: "packagePanel", - first: { - collapsible: false, - size: "33%", - expanders: [ - { - name: "filterExplorer", - title: "Filter", - controllers: [ - {name: "filterController"} - ], - } - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel", - size: "50%%", - collapsible: false, - first: { - size: "50%", - expanders: [ - { - name: "packageExplorer", - title: "Package Explorer", - controllers: [ - {name: "packageExplorerController"} - ], - }, - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel2", - size: "100%", - collapsible: false, - first: { - size: "100%", - expanders: [ - { - name: "legend", - title: "Legend", - - controllers: [ - {name: "legendController"} - ], - }, - ] - }, - second: { - - } - }, - }, - } - }, - }, - }, - second: { - collapsible: false, - area: { - orientation: "vertical", - collapsible: false, - name: "canvas", - size: "50%", - first: { - size: "80%", - collapsible: false, - canvas: {}, - controllers: [ - {name: "defaultLogger"}, - {name: "canvasSelectController"}, - {name: "canvasMarkController"}, - {name: "canvasHoverController"}, - {name: "canvasFilterController"}, - {name: "canvasFlyToController"}, - {name: "relationConnectorController"}, - {name: "relationTransparencyController"}, - {name: "relationHighlightController"}, - ], - }, - second: { - area: { - orientation: "horizontal", - collapsible: false, - name: "rightPael", - size: "80%", - first: { - size: "80%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "CodeViewer", - title: "CodeViewer", - controllers: [ - {name: "sourceCodeController"} - ], - }, - ], - }, - second: { - size: "20%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "systeminfo", - title: "Info", - controllers: [ - {name: "systeminfoController"} - ], - }, - ], - } - } - } - } - } - } - } - } - } - ] -}; diff --git a/ui/setups/web/RD freemind.js b/ui/setups/web/RD freemind.js deleted file mode 100644 index 156ab5c24..000000000 --- a/ui/setups/web/RD freemind.js +++ /dev/null @@ -1,394 +0,0 @@ -var setup = { - - loadPopUp: true, - - - controllers: [ - - { name: "defaultLogger", - - logInfoConsole : false, - logActionConsole : false, - logEventConsole : false - }, - - { name: "emailController", - - createHeadSection: false - }, - - { name: "canvasHoverController", - }, - - { name: "canvasMarkController", - }, - - { name: "canvasSelectController" - }, - - { name: "canvasFilterController" - }, - - { name: "canvasFlyToController" - }, - { - name: 'filterController', - devMode: false, - configuration: 'default.json' - }, - { name: "searchController" - }, - - { name: "packageExplorerController", - }, - { name: "sourceCodeController", - url: "https://raw.githubusercontent.com/softvis-research/freemind-mmx/master/freemind/" - }, - { name: "relationConnectorController", - - fixPositionZ : 1, - showInnerRelations : true, - elementShape : "circle", - sourceStartAtParentBorder : true, - targetEndAtParentBorder : false, - createEndpoints: true, - }, - - { name: "relationTransparencyController", - }, - - { name: "relationHighlightController" - }, - { - name: "systeminfoController", - system: "Freemind", - link: "https://freemind.sf.net", - noc: true, - loc: 72329 - }, - { name: "menuController", - menuMapping: [ - - { - title: "View", - subMenu: true, - items: [ - { - title: "FlyTo", - toggle: true, - eventOn: "canvasFlyToController.activate", - eventOff: "canvasFlyToController.deactivate", - }, - - { - title: "Reset Visualization", - event: "application.reset", - }, - ] - }, - - { - title: "Relations", - subMenu: true, - items: [ - { - title: "Relation Connectors", - toggle: true, - eventOn: "relationConnectorController.activate", - eventOff: "relationConnectorController.deactivate", - }, - { - title: "Relation Transparency", - toggle: true, - eventOn: "relationTransparencyController.activate", - eventOff: "relationTransparencyController.deactivate", - }, - { - title: "Relation Highlight", - toggle: true, - eventOn: "relationHighlightController.activate", - eventOff: "relationHighlightController.deactivate", - }, - ] - }, - - { - title: "Visualizations", - subMenu: true, - items: [ - { - title: "City Original", - link: true, - url: "index.php?setup=web/City freemind&model=City%20original%20freemind" - }, - { - title: "City Bricks", - link: true, - url: "index.php?setup=web/City freemind&model=City%20bricks%20freemind" - }, - { - title: "City Floors", - link: true, - url: "index.php?setup=web/City freemind&model=City%20floor%20freeminds" - }, - { - title: "Recursive Disk", - link: true, - url: "index.php?setup=web/RD freemind&model=RD%20freemind" - }, { - title: "Recursive Disk 3D", - link: true, - url: "index.php?setup=web/RD reek&model=RD%203D%20reek" - }, - ] - }, - - { - title: "About", - subMenu: true, - items: [ - { - title: "University Leipzig", - link: true, - url: "https://www.wifa.uni-leipzig.de/en/information-systems-institute/se/research/softwarevisualization-in-3d-and-vr.html" - }, - { - title: "Feedback!", - event: "emailController.openMailPopUp", - }, - { - title: "Impressum", - popup: true, - text: "Universität Leipzig"+ - " "+ - "Wirtschaftswissenschaftliche Fakultät"+ - "Institut für Wirtschaftsinformatik"+ - "Grimmaische Straße 12"+ - "D - 04109 Leipzig"+ - " "+ - "Dr. Richard Müller"+ - "rmueller(-a-t-)wifa.uni-leipzig.de", - height: 200, - width: 2050, - }, - { - title: "Privacy Policy", - link: true, - url: "http://home.uni-leipzig.de/svis/privacy-policy/" - } - ] - }, - ] - }, - { - name: "legendController", - entries: [{ - name: "Package", - icon: "grayCircle" - }, { - name: "Type", - icon: "purpleCircle", - }, { - name: "Method", - icon: "lightBlueCircle", - }, { - name: "Field", - icon: "yellowCircle", - }, { - name: "Navigation", - icon: "navigation", - entries: [ - { - name: "Rotate", - icon: "leftMouseButton" - }, { - name: "Center", - icon: "doubleClick" - }, { - name: "Move", - icon: "midMouseButton" - }, { - name: "Zoom", - icon: "scrolling" - }] - } - ], - } - ], - - - - - uis: [ - - - { - name: "UI0", - - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "turntable", - - //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis - typeParams: "0.0 0.0 0.001 1.5", - - //speed: 10 - }, - - - area: { - name: "top", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - size: "25px", - collapsible: false, - controllers: [ - {name: "menuController"}, - //{name: "searchController"}, - {name: "emailController"}, - ], - }, - second: { - size: "80%", - collapsible: false, - area: { - orientation: "vertical", - name: "leftPanel", - size: "20%", - first: { - size: "20%", - area: { - size: "50%", - collapsible: false, - orientation: "horizontal", - name: "packagePanel", - first: { - collapsible: false, - size: "33%", - expanders: [ - { - name: "filterExplorer", - title: "Filter", - controllers: [ - {name: "filterController"} - ], - } - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel", - size: "50%%", - collapsible: false, - first: { - size: "50%", - expanders: [ - { - name: "packageExplorer", - title: "Package Explorer", - controllers: [ - {name: "packageExplorerController"} - ], - }, - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel2", - size: "100%", - collapsible: false, - first: { - size: "100%", - expanders: [ - { - name: "legend", - title: "Legend", - - controllers: [ - {name: "legendController"} - ], - }, - ] - }, - second: { - - } - }, - }, - } - }, - }, - }, - second: { - collapsible: false, - area: { - orientation: "vertical", - collapsible: false, - name: "canvas", - size: "50%", - first: { - size: "80%", - collapsible: false, - canvas: {}, - controllers: [ - {name: "defaultLogger"}, - {name: "canvasSelectController"}, - {name: "canvasMarkController"}, - {name: "canvasHoverController"}, - {name: "canvasFilterController"}, - {name: "canvasFlyToController"}, - {name: "relationConnectorController"}, - {name: "relationTransparencyController"}, - {name: "relationHighlightController"}, - ], - }, - second: { - area: { - orientation: "horizontal", - collapsible: false, - name: "rightPael", - size: "80%", - first: { - size: "80%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "CodeViewer", - title: "CodeViewer", - controllers: [ - {name: "sourceCodeController"} - ], - }, - ], - }, - second: { - size: "20%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "systeminfo", - title: "Info", - controllers: [ - {name: "systeminfoController"} - ], - }, - ], - } - } - } - } - } - } - } - } - } - ] -}; diff --git a/ui/setups/web/RD reek.js b/ui/setups/web/RD reek.js deleted file mode 100644 index bde390e56..000000000 --- a/ui/setups/web/RD reek.js +++ /dev/null @@ -1,396 +0,0 @@ -var setup = { - - loadPopUp: true, - - - controllers: [ - - { name: "defaultLogger", - - logInfoConsole : false, - logActionConsole : false, - logEventConsole : false - }, - - { name: "emailController", - - createHeadSection: false - }, - - { name: "canvasHoverController", - }, - - { name: "canvasMarkController", - }, - - { name: "canvasSelectController" - }, - - { name: "canvasFilterController" - }, - - { name: "canvasFlyToController" - }, - { - name: 'filterController', - devMode: false, - configuration: 'default.json' - }, - { name: "searchController" - }, - - { name: "packageExplorerController", - }, - { name: "sourceCodeController", - url: "https://raw.githubusercontent.com/troessner/reek/master/lib/", - fileType: "rb" - }, - - { name: "relationConnectorController", - - fixPositionZ : 1, - showInnerRelations : true, - elementShape : "circle", - sourceStartAtParentBorder : true, - targetEndAtParentBorder : false, - createEndpoints: true, - }, - - { name: "relationTransparencyController", - }, - - { name: "relationHighlightController" - }, - { - name: "systeminfoController", - system: "Reek", - link: "https://github.com/troessner/reek", - noc: true, - loc: 13952 - }, - { name: "menuController", - menuMapping: [ - - { - title: "View", - subMenu: true, - items: [ - { - title: "FlyTo", - toggle: true, - eventOn: "canvasFlyToController.activate", - eventOff: "canvasFlyToController.deactivate", - }, - - { - title: "Reset Visualization", - event: "application.reset", - }, - ] - }, - - { - title: "Relations", - subMenu: true, - items: [ - { - title: "Relation Connectors", - toggle: true, - eventOn: "relationConnectorController.activate", - eventOff: "relationConnectorController.deactivate", - }, - { - title: "Relation Transparency", - toggle: true, - eventOn: "relationTransparencyController.activate", - eventOff: "relationTransparencyController.deactivate", - }, - { - title: "Relation Highlight", - toggle: true, - eventOn: "relationHighlightController.activate", - eventOff: "relationHighlightController.deactivate", - }, - ] - }, - - { - title: "Visualizations", - subMenu: true, - items: [ - { - title: "City Original", - link: true, - url: "index.php?setup=web/City freemind&model=City%20original%20freemind" - }, - { - title: "City Bricks", - link: true, - url: "index.php?setup=web/City freemind&model=City%20bricks%20freemind" - }, - { - title: "City Floors", - link: true, - url: "index.php?setup=web/City freemind&model=City%20floor%20freemind" - }, - { - title: "Recursive Disk", - link: true, - url: "index.php?setup=web/RD freemind&model=RD%20freemind" - }, { - title: "Recursive Disk 3D", - link: true, - url: "index.php?setup=web/RD reek&model=RD%203D%20reek" - }, - ] - }, - - { - title: "About", - subMenu: true, - items: [ - { - title: "University Leipzig", - link: true, - url: "https://www.wifa.uni-leipzig.de/en/information-systems-institute/se/research/softwarevisualization-in-3d-and-vr.html" - }, - { - title: "Feedback!", - event: "emailController.openMailPopUp", - }, - { - title: "Impressum", - popup: true, - text: "Universität Leipzig"+ - " "+ - "Wirtschaftswissenschaftliche Fakultät"+ - "Institut für Wirtschaftsinformatik"+ - "Grimmaische Straße 12"+ - "D - 04109 Leipzig"+ - " "+ - "Dr. Richard Müller"+ - "rmueller(-a-t-)wifa.uni-leipzig.de", - height: 200, - width: 2050, - }, - { - title: "Privacy Policy", - link: true, - url: "http://home.uni-leipzig.de/svis/privacy-policy/" - } - ] - }, - ] - }, - { - name: "legendController", - entries: [{ - name: "Package", - icon: "grayCircle" - }, { - name: "Type", - icon: "purpleCircle", - }, { - name: "Method", - icon: "lightBlueCircle", - }, { - name: "Field", - icon: "yellowCircle", - }, { - name: "Navigation", - icon: "navigation", - entries: [ - { - name: "Rotate", - icon: "leftMouseButton" - }, { - name: "Center", - icon: "doubleClick" - }, { - name: "Move", - icon: "midMouseButton" - }, { - name: "Zoom", - icon: "scrolling" - }] - } - ], - } - ], - - - - - uis: [ - - - { - name: "UI0", - - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "turntable", - - //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis - typeParams: "0.0 0.0 0.001 1.5", - - //speed: 10 - }, - - - area: { - name: "top", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - size: "25px", - collapsible: false, - controllers: [ - {name: "menuController"}, - //{name: "searchController"}, - {name: "emailController"}, - ], - }, - second: { - size: "80%", - collapsible: false, - area: { - orientation: "vertical", - name: "leftPanel", - size: "20%", - first: { - size: "20%", - area: { - size: "50%", - collapsible: false, - orientation: "horizontal", - name: "packagePanel", - first: { - collapsible: false, - size: "33%", - expanders: [ - { - name: "filterExplorer", - title: "Filter", - controllers: [ - {name: "filterController"} - ], - } - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel", - size: "50%%", - collapsible: false, - first: { - size: "50%", - expanders: [ - { - name: "packageExplorer", - title: "Package Explorer", - controllers: [ - {name: "packageExplorerController"} - ], - }, - ] - }, - second: { - size: "50%", - area: { - orientation: "horizontal", - name: "legendPanel2", - size: "100%", - collapsible: false, - first: { - size: "100%", - expanders: [ - { - name: "legend", - title: "Legend", - - controllers: [ - {name: "legendController"} - ], - }, - ] - }, - second: { - - } - }, - }, - } - }, - }, - }, - second: { - collapsible: false, - area: { - orientation: "vertical", - collapsible: false, - name: "canvas", - size: "50%", - first: { - size: "80%", - collapsible: false, - canvas: {}, - controllers: [ - {name: "defaultLogger"}, - {name: "canvasSelectController"}, - {name: "canvasMarkController"}, - {name: "canvasHoverController"}, - {name: "canvasFilterController"}, - {name: "canvasFlyToController"}, - {name: "relationConnectorController"}, - {name: "relationTransparencyController"}, - {name: "relationHighlightController"}, - ], - }, - second: { - area: { - orientation: "horizontal", - collapsible: false, - name: "rightPael", - size: "80%", - first: { - size: "80%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "CodeViewer", - title: "CodeViewer", - controllers: [ - {name: "sourceCodeController"} - ], - }, - ], - }, - second: { - size: "20%", - min: "200", - oriontation: "horizontal", - expanders: [ - { - name: "systeminfo", - title: "Info", - controllers: [ - {name: "systeminfoController"} - ], - }, - ], - } - } - } - } - } - } - } - } - } - ] -}; diff --git a/ui/setups/web/mrt-demo.js b/ui/setups/web/mrt-demo.js deleted file mode 100644 index 066078d0a..000000000 --- a/ui/setups/web/mrt-demo.js +++ /dev/null @@ -1,289 +0,0 @@ -var setup = { - - controllers: [ - - { name: "defaultLogger", - - logActionConsole : false, - logActionEventConsole : true, - logEventConsole : false, - logInfoConsole : true, - logWarningConsole: true, - logErrorConsole: true, - }, - { - name: "configurationController", - changeFrequency: true, - issues: true - }, - { name: "canvasHoverController", - hoverColor: "#833f88", - showVersion: false, - showIssues: true - }, - { name: "canvasFilterController" - }, - { name: "canvasFlyToController" , - targetType: "Namespace" - }, - { name: "canvasResetViewController" - }, - { name: "searchController" - }, - { name: "packageExplorerController", - projectIcon: "scripts/PackageExplorer/images/circle_black.png", - typeIcon: "scripts/PackageExplorer/images/type.png", - elementsSelectable: false - }, - { name: "issueExplorerController", - }, { - name: 'experimentController', - taskTextButtonTime: 0, - taskTime: 0, - stepOrder: [0, 10, 20, 30, 40], - steps: [ - { - number: 0, - text: [ - 'Welcome to the Getaviz tutorial', - '', - '', - 'Getaviz is an open source application for exploring thee-dimensional software visualizations. ' + - 'This tutorial will explain the "Software MRT" to you, a visualization for identifying problem areas in complex software visualizations.', - '', - 'Press Done to go to the next step.' - ] - }, - { - number: 10, - text: [ - 'Tutorial: Visualization', - '', - 'The visualization represents the structure of a software system. ' + - 'Packages are represented by grey disks, which can contain inner packages as well. ' + - 'Classes are visualized by smaller disks inside the package disks. ' + - // 'The color, ranging from gray to blue, represents how often the class has been changed. ' + - 'The size represents the lines of code.' + - 'The height depicts the number of issues in which the class is referenced. ' + - 'The blue bar represents open issues, that are not security relevant. ' + - 'The orange bar represents open security issues.' + - 'If a class has no open issues at all, only the blue class disk is shown. ', - '', - 'Press Done if you are familiar with the visualization and the legend.' - - ] - }, - { - number: 20, - text: [ - 'Tutorial: Navigation', - '', - '', - 'While pressing the left mouse button, you can rotate the visualization.', - 'While pressing the middle mouse button, you can move the visualization without rotation.', - 'You can zoom in and zoom out by scrolling down and scrolling up.', - '', - 'Press Done if you are familiar with the navigation.' - ] - }, - { - number: 30, - text: [ - 'Tutorial: Package Explorer and Search', - '', - 'On the left panel you find the Package Explorer which shows all packages and classes. ' + - //'You can hide elements. ' + - //'By clicking on an element, the corresponding disk is highlighted.' + - 'Additionally, you can search for elements using the search bar.', - '', - 'Press Done if you are familiar with the Package Explorer.' - ] - }, - { - number: 40, - text: [ - 'Tutorial: Issue Explorer', - '', - 'On the right panel you find the Issue Explorer which lists all issues from an issue tracker. ' + - 'The issues are categorized in "open" and "closed" as well as "security relevant" and "not security relevant".' + - 'By selecting an issue all classes related with this issue are highlighted. ', - '', - 'Congratulations! You have finished the tutorial.' - ] - }, - { - number: 50, - text: [ - 'Tutorial: Configuration', - '', - 'On the right panel you also find some configuration option to filter which classes are shown' + - '' + - 'By increasing the minimal change classes that have been rarely changed will be hidden.' + - '' + - 'If you only want to see classes that have at least one open issue or at least one security issue, select the corresponding option' + - '', - 'Congratulations! You have finished the tutorial.' - ] - }, - ] - },{ - name: "legendController", - entries: [{ - name: "Project", - icon: "blackCircle" - }, { - name: "Package", - icon: "grayCircle" - }, { - name: "Class", - icon: "purpleCircle", - entries: [{ - name: "Lines of Code", - icon: "circleWidth" - },{ - name: "Number of open issues", - icon: "blueCylinderHeight" - },{ - name: "Number of open security issues", - icon: "orangeCylinderHeight" - } - ] - }, { - name: "Navigation", - icon: "navigation", - entries: [ - { - name: "Rotate", - icon: "leftMouseButton" - }, { - name: "Move", - icon: "midMouseButton" - }, { - name: "Zoom", - icon: "scrolling" - }] - } - ], - }], - - uis: [{ - name: "MRT", - // navigation: { type: "examine" }, - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "turntable", - - //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis - typeParams: "0.0 0.0 0.001 1.5", - - //speed: 10 - }, - area: { - name: "top", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - name: "top", - size: "125px", - collapsible: false, - controllers: [ - {name: "experimentController"} - ] - }, - second: { - size: "50px", - collapsible: false, - area: { - name: "top2", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - name: "top3", - size: "50px", - collapsible: false, - controllers: [{name: "searchController"}] - }, - second: { - size: "80%", - collapsible: false, - area: { - // orientation: "vertical", - name: "topDown", - size: "20%", - first: { - size: "20%", - expanders: [{ - name: "packageExplorer", - title: "Package Explorer", - controllers: [{name: "packageExplorerController"}] - }] - }, - second: { - size: "60%", - collapsible: false, - area: { - name: "canvas", - orientation: "vertical", - collapsible: false, - first: { - size: "80%", - canvas: {}, - collapsible: false, - controllers: [ - {name: "defaultLogger"}, - {name: "canvasHoverController"}, - {name: "canvasFilterController"}, - {name: "canvasFlyToController"} - ] - }, - second: { - size: "100%", - collapsible: false, - area: { - orientation: "horizontal", - first: { - //size: "33%", - collapsible: false, - expanders: [{ - name: "issueExplorer", - title: "Issue Explorer", - controllers: [{name: "issueExplorerController"}], - }] - }, - second: { - orientation: "horizontal", - area: { - orientation: "horizontal", - collapsible: false, - first: { - size: "36%", - collapsible: false, - expanders: [{ - name: "Configuration", - title: "Configuration", - controllers: [{name: "configurationController"}], - }] - }, - second: { - orientation: "horizontal", - expanders: [{ - name: "legend", - title: "Legend", - controllers: [{name: "legendController"}] - }], - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }], -}; diff --git a/ui/setups/web/mrt.js b/ui/setups/web/mrt.js deleted file mode 100644 index ced03c332..000000000 --- a/ui/setups/web/mrt.js +++ /dev/null @@ -1,181 +0,0 @@ -var setup = { - - controllers: [ - - { name: "defaultLogger", - - logActionConsole : false, - logActionEventConsole : true, - logEventConsole : false, - logInfoConsole : true, - logWarningConsole: true, - logErrorConsole: true, - }, - { - name: "configurationController", - changeFrequency: true, - issues: true - }, - { name: "canvasHoverController", - hoverColor: "#833f88", - showVersion: false, - showIssues: true - }, - { name: "canvasFilterController" - }, - { name: "canvasFlyToController" , - targetType: "Namespace" - }, - { name: "canvasResetViewController" - }, - { name: "searchController" - }, - { name: "packageExplorerController", - projectIcon: "scripts/PackageExplorer/images/circle_black.png", - typeIcon: "scripts/PackageExplorer/images/type.png", - elementsSelectable: false - }, - { name: "issueExplorerController", - }, { - name: "legendController", - entries: [{ - name: "Project", - icon: "blackCircle" - }, { - name: "Package", - icon: "grayCircle" - }, { - name: "Class", - icon: "purpleCircle", - entries: [{ - name: "Lines of Code", - icon: "circleWidth" - },{ - name: "Number of open issues", - icon: "blueCylinderHeight" - },{ - name: "Number of open security issues", - icon: "orangeCylinderHeight" - } - ] - }, { - name: "Navigation", - icon: "navigation", - entries: [ - { - name: "Rotate", - icon: "leftMouseButton" - }, { - name: "Move", - icon: "midMouseButton" - }, { - name: "Zoom", - icon: "scrolling" - }] - } - ], - }], - - uis: [{ - name: "MRT", - // navigation: { type: "examine" }, - navigation: { - //examine, walk, fly, helicopter, lookAt, turntable, game - type: "turntable", - - //turntable last 2 values - accepted values are between 0 and PI - 0.0 - 1,5 at Y-axis - typeParams: "0.0 0.0 0.001 1.5", - - //speed: 10 - }, - area: { - name: "top", - orientation: "horizontal", - resizable: false, - collapsible: false, - first: { - name: "top", - size: "50px", - collapsible: false, - controllers: [{name: "searchController"}] - }, - second: { - size: "80%", - collapsible: false, - area: { - // orientation: "vertical", - name: "topDown", - size: "20%", - first: { - size: "20%", - expanders: [{ - name: "packageExplorer", - title: "Package Explorer", - controllers: [{name: "packageExplorerController"}] - }] - }, - second: { - size: "60%", - collapsible: false, - area: { - name: "canvas", - orientation: "vertical", - collapsible: false, - first: { - size: "80%", - canvas: {}, - collapsible: false, - controllers: [ - {name: "defaultLogger"}, - {name: "canvasHoverController"}, - {name: "canvasFilterController"}, - {name: "canvasFlyToController"} - ] - }, - second: { - size: "100%", - collapsible: false, - area: { - orientation: "horizontal", - first: { - //size: "33%", - collapsible: false, - expanders: [{ - name: "issueExplorer", - title: "Issue Explorer", - controllers: [{name: "issueExplorerController"}], - }] - }, - second: { - orientation: "horizontal", - area: { - orientation: "horizontal", - collapsible: false, - first: { - size: "45%", - collapsible: false, - expanders: [{ - name: "Configuration", - title: "Configuration", - controllers: [{name: "configurationController"}], - }] - }, - second: { - orientation: "horizontal", - expanders: [{ - name: "legend", - title: "Legend", - controllers: [{name: "legendController"}] - }], - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }], -}; From cb9a278ad61ca55d98367647499d3a14f92b1722 Mon Sep 17 00:00:00 2001 From: David Baum Date: Sat, 2 Feb 2019 22:08:41 +0100 Subject: [PATCH 70/71] remove deprecated links from setup --- ui/setups/default.js | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/ui/setups/default.js b/ui/setups/default.js index f2dc642b7..cb7b69f77 100644 --- a/ui/setups/default.js +++ b/ui/setups/default.js @@ -109,38 +109,6 @@ ] }, - { - title: "Visualizations", - subMenu: true, - items: [ - { - title: "City Original", - link: true, - url: "index.php?setup=web/City freemind&model=City%20original%20freemind" - }, - { - title: "City Bricks", - link: true, - url: "index.php?setup=web/City freemind&model=City%20bricks%20freemind" - }, - { - title: "City Floors", - link: true, - url: "index.php?setup=web/City freemind&model=City%20floor%20freemind" - }, - { - title: "Recursive Disk", - link: true, - url: "index.php?setup=web/RD freemind&model=RD%20freemind" - }, - { - title: "Recursive Disk 3D", - link: true, - url: "index.php?setup=web/RD reek&model=RD%203D%20reek" - }, - ] - }, - { title: "About", subMenu: true, From 7c2c90d4e905538f82be1c165ae1e55f3d45b655 Mon Sep 17 00:00:00 2001 From: David Baum Date: Sun, 3 Feb 2019 11:19:39 +0100 Subject: [PATCH 71/71] autorestart services via docker compose --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 2b1631e71..e5bf6212d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: restart: always eval: build: evaluationserver + restart: always env_file: evaluationserver/env command: "./bin/wait-for-it.sh db:3306 -s -t 30 -- ./bin/docker_start" volumes: @@ -20,6 +21,7 @@ services: - db frontend: build: ui/ + restart: always volumes: - ./ui:/var/www/html/ui ports: