";
-
- parent.appendChild(overflowEl);
- };
- this.$renderLine = function(parent, row, foldLine) {
- if (!foldLine && foldLine != false)
- foldLine = this.session.getFoldLine(row);
-
- if (foldLine)
- var tokens = this.$getFoldLineTokens(row, foldLine);
- else
- var tokens = this.session.getTokens(row);
-
- var lastLineEl = parent;
- if (tokens.length) {
- var splits = this.session.getRowSplitData(row);
- if (splits && splits.length) {
- this.$renderWrappedLine(parent, tokens, splits);
- var lastLineEl = parent.lastChild;
- } else {
- var lastLineEl = parent;
- if (this.$useLineGroups()) {
- lastLineEl = this.$createLineElement();
- parent.appendChild(lastLineEl);
- }
- this.$renderSimpleLine(lastLineEl, tokens);
- }
- } else if (this.$useLineGroups()) {
- lastLineEl = this.$createLineElement();
- parent.appendChild(lastLineEl);
- }
-
- if (this.showEOL && lastLineEl) {
- if (foldLine)
- row = foldLine.end.row;
-
- var invisibleEl = this.dom.createElement("span");
- invisibleEl.className = "ace_invisible ace_invisible_eol";
- invisibleEl.textContent = row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR;
-
- lastLineEl.appendChild(invisibleEl);
- }
- };
-
- this.$getFoldLineTokens = function(row, foldLine) {
- var session = this.session;
- var renderTokens = [];
-
- function addTokens(tokens, from, to) {
- var idx = 0, col = 0;
- while ((col + tokens[idx].value.length) < from) {
- col += tokens[idx].value.length;
- idx++;
-
- if (idx == tokens.length)
- return;
- }
- if (col != from) {
- var value = tokens[idx].value.substring(from - col);
- if (value.length > (to - from))
- value = value.substring(0, to - from);
-
- renderTokens.push({
- type: tokens[idx].type,
- value: value
- });
-
- col = from + value.length;
- idx += 1;
- }
-
- while (col < to && idx < tokens.length) {
- var value = tokens[idx].value;
- if (value.length + col > to) {
- renderTokens.push({
- type: tokens[idx].type,
- value: value.substring(0, to - col)
- });
- } else
- renderTokens.push(tokens[idx]);
- col += value.length;
- idx += 1;
- }
- }
-
- var tokens = session.getTokens(row);
- foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
- if (placeholder != null) {
- renderTokens.push({
- type: "fold",
- value: placeholder
- });
- } else {
- if (isNewRow)
- tokens = session.getTokens(row);
-
- if (tokens.length)
- addTokens(tokens, lastColumn, column);
- }
- }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
-
- return renderTokens;
- };
-
- this.$useLineGroups = function() {
- return this.session.getUseWrapMode();
- };
-
- this.destroy = function() {};
-}).call(Text.prototype);
-
-exports.Text = Text;
-
-});
-
-define("ace/layer/cursor",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
-"use strict";
-
-var dom = require("../lib/dom");
-
-var Cursor = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_cursor-layer";
- parentEl.appendChild(this.element);
-
- this.isVisible = false;
- this.isBlinking = true;
- this.blinkInterval = 1000;
- this.smoothBlinking = false;
-
- this.cursors = [];
- this.cursor = this.addCursor();
- dom.addCssClass(this.element, "ace_hidden-cursors");
- this.$updateCursors = this.$updateOpacity.bind(this);
-};
-
-(function() {
-
- this.$updateOpacity = function(val) {
- var cursors = this.cursors;
- for (var i = cursors.length; i--; )
- dom.setStyle(cursors[i].style, "opacity", val ? "" : "0");
- };
-
- this.$startCssAnimation = function() {
- var cursors = this.cursors;
- for (var i = cursors.length; i--; )
- cursors[i].style.animationDuration = this.blinkInterval + "ms";
-
- this.$isAnimating = true;
- setTimeout(function() {
- if (this.$isAnimating) {
- dom.addCssClass(this.element, "ace_animate-blinking");
- }
- }.bind(this));
- };
-
- this.$stopCssAnimation = function() {
- this.$isAnimating = false;
- dom.removeCssClass(this.element, "ace_animate-blinking");
- };
-
- this.$padding = 0;
- this.setPadding = function(padding) {
- this.$padding = padding;
- };
-
- this.setSession = function(session) {
- this.session = session;
- };
-
- this.setBlinking = function(blinking) {
- if (blinking != this.isBlinking) {
- this.isBlinking = blinking;
- this.restartTimer();
- }
- };
-
- this.setBlinkInterval = function(blinkInterval) {
- if (blinkInterval != this.blinkInterval) {
- this.blinkInterval = blinkInterval;
- this.restartTimer();
- }
- };
-
- this.setSmoothBlinking = function(smoothBlinking) {
- if (smoothBlinking != this.smoothBlinking) {
- this.smoothBlinking = smoothBlinking;
- dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
- this.$updateCursors(true);
- this.restartTimer();
- }
- };
-
- this.addCursor = function() {
- var el = dom.createElement("div");
- el.className = "ace_cursor";
- this.element.appendChild(el);
- this.cursors.push(el);
- return el;
- };
-
- this.removeCursor = function() {
- if (this.cursors.length > 1) {
- var el = this.cursors.pop();
- el.parentNode.removeChild(el);
- return el;
- }
- };
-
- this.hideCursor = function() {
- this.isVisible = false;
- dom.addCssClass(this.element, "ace_hidden-cursors");
- this.restartTimer();
- };
-
- this.showCursor = function() {
- this.isVisible = true;
- dom.removeCssClass(this.element, "ace_hidden-cursors");
- this.restartTimer();
- };
-
- this.restartTimer = function() {
- var update = this.$updateCursors;
- clearInterval(this.intervalId);
- clearTimeout(this.timeoutId);
- this.$stopCssAnimation();
-
- if (this.smoothBlinking) {
- this.$isSmoothBlinking = false;
- dom.removeCssClass(this.element, "ace_smooth-blinking");
- }
-
- update(true);
-
- if (!this.isBlinking || !this.blinkInterval || !this.isVisible) {
- this.$stopCssAnimation();
- return;
- }
-
- if (this.smoothBlinking) {
- this.$isSmoothBlinking = true;
- setTimeout(function() {
- if (this.$isSmoothBlinking) {
- dom.addCssClass(this.element, "ace_smooth-blinking");
- }
- }.bind(this));
- }
-
- if (dom.HAS_CSS_ANIMATION) {
- this.$startCssAnimation();
- } else {
- var blink = function(){
- this.timeoutId = setTimeout(function() {
- update(false);
- }, 0.6 * this.blinkInterval);
- }.bind(this);
-
- this.intervalId = setInterval(function() {
- update(true);
- blink();
- }, this.blinkInterval);
- blink();
- }
- };
-
- this.getPixelPosition = function(position, onScreen) {
- if (!this.config || !this.session)
- return {left : 0, top : 0};
-
- if (!position)
- position = this.session.selection.getCursor();
- var pos = this.session.documentToScreenPosition(position);
- var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position.row)
- ? this.session.$bidiHandler.getPosLeft(pos.column)
- : pos.column * this.config.characterWidth);
-
- var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
- this.config.lineHeight;
-
- return {left : cursorLeft, top : cursorTop};
- };
-
- this.isCursorInView = function(pixelPos, config) {
- return pixelPos.top >= 0 && pixelPos.top < config.maxHeight;
- };
-
- this.update = function(config) {
- this.config = config;
-
- var selections = this.session.$selectionMarkers;
- var i = 0, cursorIndex = 0;
-
- if (selections === undefined || selections.length === 0){
- selections = [{cursor: null}];
- }
-
- for (var i = 0, n = selections.length; i < n; i++) {
- var pixelPos = this.getPixelPosition(selections[i].cursor, true);
- if ((pixelPos.top > config.height + config.offset ||
- pixelPos.top < 0) && i > 1) {
- continue;
- }
-
- var element = this.cursors[cursorIndex++] || this.addCursor();
- var style = element.style;
-
- if (!this.drawCursor) {
- if (!this.isCursorInView(pixelPos, config)) {
- dom.setStyle(style, "display", "none");
- } else {
- dom.setStyle(style, "display", "block");
- dom.translate(element, pixelPos.left, pixelPos.top);
- dom.setStyle(style, "width", Math.round(config.characterWidth) + "px");
- dom.setStyle(style, "height", config.lineHeight + "px");
- }
- } else {
- this.drawCursor(element, pixelPos, config, selections[i], this.session);
- }
- }
- while (this.cursors.length > cursorIndex)
- this.removeCursor();
-
- var overwrite = this.session.getOverwrite();
- this.$setOverwrite(overwrite);
- this.$pixelPos = pixelPos;
- this.restartTimer();
- };
-
- this.drawCursor = null;
-
- this.$setOverwrite = function(overwrite) {
- if (overwrite != this.overwrite) {
- this.overwrite = overwrite;
- if (overwrite)
- dom.addCssClass(this.element, "ace_overwrite-cursors");
- else
- dom.removeCssClass(this.element, "ace_overwrite-cursors");
- }
- };
-
- this.destroy = function() {
- clearInterval(this.intervalId);
- clearTimeout(this.timeoutId);
- };
-
-}).call(Cursor.prototype);
-
-exports.Cursor = Cursor;
-
-});
-
-define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"], function(require, exports, module) {
-"use strict";
-
-var oop = require("./lib/oop");
-var dom = require("./lib/dom");
-var event = require("./lib/event");
-var EventEmitter = require("./lib/event_emitter").EventEmitter;
-var MAX_SCROLL_H = 0x8000;
-var ScrollBar = function(parent) {
- this.element = dom.createElement("div");
- this.element.className = "ace_scrollbar ace_scrollbar" + this.classSuffix;
-
- this.inner = dom.createElement("div");
- this.inner.className = "ace_scrollbar-inner";
- this.inner.textContent = "\xa0";
- this.element.appendChild(this.inner);
-
- parent.appendChild(this.element);
-
- this.setVisible(false);
- this.skipEvent = false;
-
- event.addListener(this.element, "scroll", this.onScroll.bind(this));
- event.addListener(this.element, "mousedown", event.preventDefault);
-};
-
-(function() {
- oop.implement(this, EventEmitter);
-
- this.setVisible = function(isVisible) {
- this.element.style.display = isVisible ? "" : "none";
- this.isVisible = isVisible;
- this.coeff = 1;
- };
-}).call(ScrollBar.prototype);
-var VScrollBar = function(parent, renderer) {
- ScrollBar.call(this, parent);
- this.scrollTop = 0;
- this.scrollHeight = 0;
- renderer.$scrollbarWidth =
- this.width = dom.scrollbarWidth(parent.ownerDocument);
- this.inner.style.width =
- this.element.style.width = (this.width || 15) + 5 + "px";
- this.$minWidth = 0;
-};
-
-oop.inherits(VScrollBar, ScrollBar);
-
-(function() {
-
- this.classSuffix = '-v';
- this.onScroll = function() {
- if (!this.skipEvent) {
- this.scrollTop = this.element.scrollTop;
- if (this.coeff != 1) {
- var h = this.element.clientHeight / this.scrollHeight;
- this.scrollTop = this.scrollTop * (1 - h) / (this.coeff - h);
- }
- this._emit("scroll", {data: this.scrollTop});
- }
- this.skipEvent = false;
- };
- this.getWidth = function() {
- return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
- };
- this.setHeight = function(height) {
- this.element.style.height = height + "px";
- };
- this.setInnerHeight =
- this.setScrollHeight = function(height) {
- this.scrollHeight = height;
- if (height > MAX_SCROLL_H) {
- this.coeff = MAX_SCROLL_H / height;
- height = MAX_SCROLL_H;
- } else if (this.coeff != 1) {
- this.coeff = 1;
- }
- this.inner.style.height = height + "px";
- };
- this.setScrollTop = function(scrollTop) {
- if (this.scrollTop != scrollTop) {
- this.skipEvent = true;
- this.scrollTop = scrollTop;
- this.element.scrollTop = scrollTop * this.coeff;
- }
- };
-
-}).call(VScrollBar.prototype);
-var HScrollBar = function(parent, renderer) {
- ScrollBar.call(this, parent);
- this.scrollLeft = 0;
- this.height = renderer.$scrollbarWidth;
- this.inner.style.height =
- this.element.style.height = (this.height || 15) + 5 + "px";
-};
-
-oop.inherits(HScrollBar, ScrollBar);
-
-(function() {
-
- this.classSuffix = '-h';
- this.onScroll = function() {
- if (!this.skipEvent) {
- this.scrollLeft = this.element.scrollLeft;
- this._emit("scroll", {data: this.scrollLeft});
- }
- this.skipEvent = false;
- };
- this.getHeight = function() {
- return this.isVisible ? this.height : 0;
- };
- this.setWidth = function(width) {
- this.element.style.width = width + "px";
- };
- this.setInnerWidth = function(width) {
- this.inner.style.width = width + "px";
- };
- this.setScrollWidth = function(width) {
- this.inner.style.width = width + "px";
- };
- this.setScrollLeft = function(scrollLeft) {
- if (this.scrollLeft != scrollLeft) {
- this.skipEvent = true;
- this.scrollLeft = this.element.scrollLeft = scrollLeft;
- }
- };
-
-}).call(HScrollBar.prototype);
-
-
-exports.ScrollBar = VScrollBar; // backward compatibility
-exports.ScrollBarV = VScrollBar; // backward compatibility
-exports.ScrollBarH = HScrollBar; // backward compatibility
-
-exports.VScrollBar = VScrollBar;
-exports.HScrollBar = HScrollBar;
-});
-
-define("ace/renderloop",["require","exports","module","ace/lib/event"], function(require, exports, module) {
-"use strict";
-
-var event = require("./lib/event");
-
-
-var RenderLoop = function(onRender, win) {
- this.onRender = onRender;
- this.pending = false;
- this.changes = 0;
- this.$recursionLimit = 2;
- this.window = win || window;
- var _self = this;
- this._flush = function(ts) {
- _self.pending = false;
- var changes = _self.changes;
-
- if (changes) {
- event.blockIdle(100);
- _self.changes = 0;
- _self.onRender(changes);
- }
-
- if (_self.changes) {
- if (_self.$recursionLimit-- < 0) return;
- _self.schedule();
- } else {
- _self.$recursionLimit = 2;
- }
- };
-};
-
-(function() {
-
- this.schedule = function(change) {
- this.changes = this.changes | change;
- if (this.changes && !this.pending) {
- event.nextFrame(this._flush);
- this.pending = true;
- }
- };
-
- this.clear = function(change) {
- var changes = this.changes;
- this.changes = 0;
- return changes;
- };
-
-}).call(RenderLoop.prototype);
-
-exports.RenderLoop = RenderLoop;
-});
-
-define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"], function(require, exports, module) {
-
-var oop = require("../lib/oop");
-var dom = require("../lib/dom");
-var lang = require("../lib/lang");
-var event = require("../lib/event");
-var useragent = require("../lib/useragent");
-var EventEmitter = require("../lib/event_emitter").EventEmitter;
-
-var CHAR_COUNT = 256;
-var USE_OBSERVER = typeof ResizeObserver == "function";
-var L = 200;
-
-var FontMetrics = exports.FontMetrics = function(parentEl) {
- this.el = dom.createElement("div");
- this.$setMeasureNodeStyles(this.el.style, true);
-
- this.$main = dom.createElement("div");
- this.$setMeasureNodeStyles(this.$main.style);
-
- this.$measureNode = dom.createElement("div");
- this.$setMeasureNodeStyles(this.$measureNode.style);
-
-
- this.el.appendChild(this.$main);
- this.el.appendChild(this.$measureNode);
- parentEl.appendChild(this.el);
-
- this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT);
-
- this.$characterSize = {width: 0, height: 0};
-
-
- if (USE_OBSERVER)
- this.$addObserver();
- else
- this.checkForSizeChanges();
-};
-
-(function() {
-
- oop.implement(this, EventEmitter);
-
- this.$characterSize = {width: 0, height: 0};
-
- this.$setMeasureNodeStyles = function(style, isRoot) {
- style.width = style.height = "auto";
- style.left = style.top = "0px";
- style.visibility = "hidden";
- style.position = "absolute";
- style.whiteSpace = "pre";
-
- if (useragent.isIE < 8) {
- style["font-family"] = "inherit";
- } else {
- style.font = "inherit";
- }
- style.overflow = isRoot ? "hidden" : "visible";
- };
-
- this.checkForSizeChanges = function(size) {
- if (size === undefined)
- size = this.$measureSizes();
- if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
- this.$measureNode.style.fontWeight = "bold";
- var boldSize = this.$measureSizes();
- this.$measureNode.style.fontWeight = "";
- this.$characterSize = size;
- this.charSizes = Object.create(null);
- this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
- this._emit("changeCharacterSize", {data: size});
- }
- };
-
- this.$addObserver = function() {
- var self = this;
- this.$observer = new window.ResizeObserver(function(e) {
- self.checkForSizeChanges();
- });
- this.$observer.observe(this.$measureNode);
- };
-
- this.$pollSizeChanges = function() {
- if (this.$pollSizeChangesTimer || this.$observer)
- return this.$pollSizeChangesTimer;
- var self = this;
-
- return this.$pollSizeChangesTimer = event.onIdle(function cb() {
- self.checkForSizeChanges();
- event.onIdle(cb, 500);
- }, 500);
- };
-
- this.setPolling = function(val) {
- if (val) {
- this.$pollSizeChanges();
- } else if (this.$pollSizeChangesTimer) {
- clearInterval(this.$pollSizeChangesTimer);
- this.$pollSizeChangesTimer = 0;
- }
- };
-
- this.$measureSizes = function(node) {
- var size = {
- height: (node || this.$measureNode).clientHeight,
- width: (node || this.$measureNode).clientWidth / CHAR_COUNT
- };
- if (size.width === 0 || size.height === 0)
- return null;
- return size;
- };
-
- this.$measureCharWidth = function(ch) {
- this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT);
- var rect = this.$main.getBoundingClientRect();
- return rect.width / CHAR_COUNT;
- };
-
- this.getCharacterWidth = function(ch) {
- var w = this.charSizes[ch];
- if (w === undefined) {
- w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;
- }
- return w;
- };
-
- this.destroy = function() {
- clearInterval(this.$pollSizeChangesTimer);
- if (this.$observer)
- this.$observer.disconnect();
- if (this.el && this.el.parentNode)
- this.el.parentNode.removeChild(this.el);
- };
-
-
- this.$getZoom = function getZoom(element) {
- if (!element || !element.parentElement) return 1;
- return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement);
- };
- this.$initTransformMeasureNodes = function() {
- var t = function(t, l) {
- return ["div", {
- style: "position: absolute;top:" + t + "px;left:" + l + "px;"
- }];
- };
- this.els = dom.buildDom([t(0, 0), t(L, 0), t(0, L), t(L, L)], this.el);
- };
- this.transformCoordinates = function(clientPos, elPos) {
- if (clientPos) {
- var zoom = this.$getZoom(this.el);
- clientPos = mul(1 / zoom, clientPos);
- }
- function solve(l1, l2, r) {
- var det = l1[1] * l2[0] - l1[0] * l2[1];
- return [
- (-l2[1] * r[0] + l2[0] * r[1]) / det,
- (+l1[1] * r[0] - l1[0] * r[1]) / det
- ];
- }
- function sub(a, b) { return [a[0] - b[0], a[1] - b[1]]; }
- function add(a, b) { return [a[0] + b[0], a[1] + b[1]]; }
- function mul(a, b) { return [a * b[0], a * b[1]]; }
-
- if (!this.els)
- this.$initTransformMeasureNodes();
-
- function p(el) {
- var r = el.getBoundingClientRect();
- return [r.left, r.top];
- }
-
- var a = p(this.els[0]);
- var b = p(this.els[1]);
- var c = p(this.els[2]);
- var d = p(this.els[3]);
-
- var h = solve(sub(d, b), sub(d, c), sub(add(b, c), add(d, a)));
-
- var m1 = mul(1 + h[0], sub(b, a));
- var m2 = mul(1 + h[1], sub(c, a));
-
- if (elPos) {
- var x = elPos;
- var k = h[0] * x[0] / L + h[1] * x[1] / L + 1;
- var ut = add(mul(x[0], m1), mul(x[1], m2));
- return add(mul(1 / k / L, ut), a);
- }
- var u = sub(clientPos, a);
- var f = solve(sub(m1, mul(h[0], u)), sub(m2, mul(h[1], u)), u);
- return mul(L, f);
- };
-
-}).call(FontMetrics.prototype);
-
-});
-
-define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/lib/useragent"], function(require, exports, module) {
-"use strict";
-
-var oop = require("./lib/oop");
-var dom = require("./lib/dom");
-var config = require("./config");
-var GutterLayer = require("./layer/gutter").Gutter;
-var MarkerLayer = require("./layer/marker").Marker;
-var TextLayer = require("./layer/text").Text;
-var CursorLayer = require("./layer/cursor").Cursor;
-var HScrollBar = require("./scrollbar").HScrollBar;
-var VScrollBar = require("./scrollbar").VScrollBar;
-var RenderLoop = require("./renderloop").RenderLoop;
-var FontMetrics = require("./layer/font_metrics").FontMetrics;
-var EventEmitter = require("./lib/event_emitter").EventEmitter;
-var editorCss = "\
-.ace_br1 {border-top-left-radius : 3px;}\
-.ace_br2 {border-top-right-radius : 3px;}\
-.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\
-.ace_br4 {border-bottom-right-radius: 3px;}\
-.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\
-.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\
-.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\
-.ace_br8 {border-bottom-left-radius : 3px;}\
-.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\
-.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\
-.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\
-.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
-.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
-.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
-.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
-.ace_editor {\
-position: relative;\
-overflow: hidden;\
-padding: 0;\
-font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
-direction: ltr;\
-text-align: left;\
--webkit-tap-highlight-color: rgba(0, 0, 0, 0);\
-}\
-.ace_scroller {\
-position: absolute;\
-overflow: hidden;\
-top: 0;\
-bottom: 0;\
-background-color: inherit;\
--ms-user-select: none;\
--moz-user-select: none;\
--webkit-user-select: none;\
-user-select: none;\
-cursor: text;\
-}\
-.ace_content {\
-position: absolute;\
-box-sizing: border-box;\
-min-width: 100%;\
-contain: style size layout;\
-font-variant-ligatures: no-common-ligatures;\
-}\
-.ace_dragging .ace_scroller:before{\
-position: absolute;\
-top: 0;\
-left: 0;\
-right: 0;\
-bottom: 0;\
-content: '';\
-background: rgba(250, 250, 250, 0.01);\
-z-index: 1000;\
-}\
-.ace_dragging.ace_dark .ace_scroller:before{\
-background: rgba(0, 0, 0, 0.01);\
-}\
-.ace_selecting, .ace_selecting * {\
-cursor: text !important;\
-}\
-.ace_gutter {\
-position: absolute;\
-overflow : hidden;\
-width: auto;\
-top: 0;\
-bottom: 0;\
-left: 0;\
-cursor: default;\
-z-index: 4;\
--ms-user-select: none;\
--moz-user-select: none;\
--webkit-user-select: none;\
-user-select: none;\
-contain: style size layout;\
-}\
-.ace_gutter-active-line {\
-position: absolute;\
-left: 0;\
-right: 0;\
-}\
-.ace_scroller.ace_scroll-left {\
-box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\
-}\
-.ace_gutter-cell {\
-position: absolute;\
-top: 0;\
-left: 0;\
-right: 0;\
-padding-left: 19px;\
-padding-right: 6px;\
-background-repeat: no-repeat;\
-}\
-.ace_gutter-cell.ace_error {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\");\
-background-repeat: no-repeat;\
-background-position: 2px center;\
-}\
-.ace_gutter-cell.ace_warning {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\");\
-background-position: 2px center;\
-}\
-.ace_gutter-cell.ace_info {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\");\
-background-position: 2px center;\
-}\
-.ace_dark .ace_gutter-cell.ace_info {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\");\
-}\
-.ace_scrollbar {\
-contain: strict;\
-position: absolute;\
-right: 0;\
-bottom: 0;\
-z-index: 6;\
-}\
-.ace_scrollbar-inner {\
-position: absolute;\
-cursor: text;\
-left: 0;\
-top: 0;\
-}\
-.ace_scrollbar-v{\
-overflow-x: hidden;\
-overflow-y: scroll;\
-top: 0;\
-}\
-.ace_scrollbar-h {\
-overflow-x: scroll;\
-overflow-y: hidden;\
-left: 0;\
-}\
-.ace_print-margin {\
-position: absolute;\
-height: 100%;\
-}\
-.ace_text-input {\
-position: absolute;\
-z-index: 0;\
-width: 0.5em;\
-height: 1em;\
-opacity: 0;\
-background: transparent;\
--moz-appearance: none;\
-appearance: none;\
-border: none;\
-resize: none;\
-outline: none;\
-overflow: hidden;\
-font: inherit;\
-padding: 0 1px;\
-margin: 0 -1px;\
-contain: strict;\
--ms-user-select: text;\
--moz-user-select: text;\
--webkit-user-select: text;\
-user-select: text;\
-white-space: pre!important;\
-}\
-.ace_text-input.ace_composition {\
-background: transparent;\
-color: inherit;\
-z-index: 1000;\
-opacity: 1;\
-}\
-.ace_composition_placeholder { color: transparent }\
-.ace_composition_marker { \
-border-bottom: 1px solid;\
-position: absolute;\
-border-radius: 0;\
-margin-top: 1px;\
-}\
-[ace_nocontext=true] {\
-transform: none!important;\
-filter: none!important;\
-clip-path: none!important;\
-mask : none!important;\
-contain: none!important;\
-perspective: none!important;\
-mix-blend-mode: initial!important;\
-z-index: auto;\
-}\
-.ace_layer {\
-z-index: 1;\
-position: absolute;\
-overflow: hidden;\
-word-wrap: normal;\
-white-space: pre;\
-height: 100%;\
-width: 100%;\
-box-sizing: border-box;\
-pointer-events: none;\
-}\
-.ace_gutter-layer {\
-position: relative;\
-width: auto;\
-text-align: right;\
-pointer-events: auto;\
-height: 1000000px;\
-contain: style size layout;\
-}\
-.ace_text-layer {\
-font: inherit !important;\
-position: absolute;\
-height: 1000000px;\
-width: 1000000px;\
-contain: style size layout;\
-}\
-.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\
-contain: style size layout;\
-position: absolute;\
-top: 0;\
-left: 0;\
-right: 0;\
-}\
-.ace_hidpi .ace_text-layer,\
-.ace_hidpi .ace_gutter-layer,\
-.ace_hidpi .ace_content,\
-.ace_hidpi .ace_gutter {\
-contain: strict;\
-will-change: transform;\
-}\
-.ace_hidpi .ace_text-layer > .ace_line, \
-.ace_hidpi .ace_text-layer > .ace_line_group {\
-contain: strict;\
-}\
-.ace_cjk {\
-display: inline-block;\
-text-align: center;\
-}\
-.ace_cursor-layer {\
-z-index: 4;\
-}\
-.ace_cursor {\
-z-index: 4;\
-position: absolute;\
-box-sizing: border-box;\
-border-left: 2px solid;\
-transform: translatez(0);\
-}\
-.ace_multiselect .ace_cursor {\
-border-left-width: 1px;\
-}\
-.ace_slim-cursors .ace_cursor {\
-border-left-width: 1px;\
-}\
-.ace_overwrite-cursors .ace_cursor {\
-border-left-width: 0;\
-border-bottom: 1px solid;\
-}\
-.ace_hidden-cursors .ace_cursor {\
-opacity: 0.2;\
-}\
-.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\
-opacity: 0;\
-}\
-.ace_smooth-blinking .ace_cursor {\
-transition: opacity 0.18s;\
-}\
-.ace_animate-blinking .ace_cursor {\
-animation-duration: 1000ms;\
-animation-timing-function: step-end;\
-animation-name: blink-ace-animate;\
-animation-iteration-count: infinite;\
-}\
-.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\
-animation-duration: 1000ms;\
-animation-timing-function: ease-in-out;\
-animation-name: blink-ace-animate-smooth;\
-}\
-@keyframes blink-ace-animate {\
-from, to { opacity: 1; }\
-60% { opacity: 0; }\
-}\
-@keyframes blink-ace-animate-smooth {\
-from, to { opacity: 1; }\
-45% { opacity: 1; }\
-60% { opacity: 0; }\
-85% { opacity: 0; }\
-}\
-.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\
-position: absolute;\
-z-index: 3;\
-}\
-.ace_marker-layer .ace_selection {\
-position: absolute;\
-z-index: 5;\
-}\
-.ace_marker-layer .ace_bracket {\
-position: absolute;\
-z-index: 6;\
-}\
-.ace_marker-layer .ace_error_bracket {\
-position: absolute;\
-border-bottom: 1px solid #DE5555;\
-border-radius: 0;\
-}\
-.ace_marker-layer .ace_active-line {\
-position: absolute;\
-z-index: 2;\
-}\
-.ace_marker-layer .ace_selected-word {\
-position: absolute;\
-z-index: 4;\
-box-sizing: border-box;\
-}\
-.ace_line .ace_fold {\
-box-sizing: border-box;\
-display: inline-block;\
-height: 11px;\
-margin-top: -2px;\
-vertical-align: middle;\
-background-image:\
-url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
-url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\");\
-background-repeat: no-repeat, repeat-x;\
-background-position: center center, top left;\
-color: transparent;\
-border: 1px solid black;\
-border-radius: 2px;\
-cursor: pointer;\
-pointer-events: auto;\
-}\
-.ace_dark .ace_fold {\
-}\
-.ace_fold:hover{\
-background-image:\
-url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
-url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\");\
-}\
-.ace_tooltip {\
-background-color: #FFF;\
-background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\
-border: 1px solid gray;\
-border-radius: 1px;\
-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\
-color: black;\
-max-width: 100%;\
-padding: 3px 4px;\
-position: fixed;\
-z-index: 999999;\
-box-sizing: border-box;\
-cursor: default;\
-white-space: pre;\
-word-wrap: break-word;\
-line-height: normal;\
-font-style: normal;\
-font-weight: normal;\
-letter-spacing: normal;\
-pointer-events: none;\
-}\
-.ace_folding-enabled > .ace_gutter-cell {\
-padding-right: 13px;\
-}\
-.ace_fold-widget {\
-box-sizing: border-box;\
-margin: 0 -12px 0 1px;\
-display: none;\
-width: 11px;\
-vertical-align: top;\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\");\
-background-repeat: no-repeat;\
-background-position: center;\
-border-radius: 3px;\
-border: 1px solid transparent;\
-cursor: pointer;\
-}\
-.ace_folding-enabled .ace_fold-widget {\
-display: inline-block; \
-}\
-.ace_fold-widget.ace_end {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\");\
-}\
-.ace_fold-widget.ace_closed {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\");\
-}\
-.ace_fold-widget:hover {\
-border: 1px solid rgba(0, 0, 0, 0.3);\
-background-color: rgba(255, 255, 255, 0.2);\
-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
-}\
-.ace_fold-widget:active {\
-border: 1px solid rgba(0, 0, 0, 0.4);\
-background-color: rgba(0, 0, 0, 0.05);\
-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
-}\
-.ace_dark .ace_fold-widget {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\
-}\
-.ace_dark .ace_fold-widget.ace_end {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\
-}\
-.ace_dark .ace_fold-widget.ace_closed {\
-background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\
-}\
-.ace_dark .ace_fold-widget:hover {\
-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
-background-color: rgba(255, 255, 255, 0.1);\
-}\
-.ace_dark .ace_fold-widget:active {\
-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
-}\
-.ace_inline_button {\
-border: 1px solid lightgray;\
-display: inline-block;\
-margin: -1px 8px;\
-padding: 0 5px;\
-pointer-events: auto;\
-cursor: pointer;\
-}\
-.ace_inline_button:hover {\
-border-color: gray;\
-background: rgba(200,200,200,0.2);\
-display: inline-block;\
-pointer-events: auto;\
-}\
-.ace_fold-widget.ace_invalid {\
-background-color: #FFB4B4;\
-border-color: #DE5555;\
-}\
-.ace_fade-fold-widgets .ace_fold-widget {\
-transition: opacity 0.4s ease 0.05s;\
-opacity: 0;\
-}\
-.ace_fade-fold-widgets:hover .ace_fold-widget {\
-transition: opacity 0.05s ease 0.05s;\
-opacity:1;\
-}\
-.ace_underline {\
-text-decoration: underline;\
-}\
-.ace_bold {\
-font-weight: bold;\
-}\
-.ace_nobold .ace_bold {\
-font-weight: normal;\
-}\
-.ace_italic {\
-font-style: italic;\
-}\
-.ace_error-marker {\
-background-color: rgba(255, 0, 0,0.2);\
-position: absolute;\
-z-index: 9;\
-}\
-.ace_highlight-marker {\
-background-color: rgba(255, 255, 0,0.2);\
-position: absolute;\
-z-index: 8;\
-}\
-.ace_mobile-menu {\
-position: absolute;\
-line-height: 1.5;\
-border-radius: 4px;\
--ms-user-select: none;\
--moz-user-select: none;\
--webkit-user-select: none;\
-user-select: none;\
-background: white;\
-box-shadow: 1px 3px 2px grey;\
-border: 1px solid #dcdcdc;\
-color: black;\
-}\
-.ace_dark > .ace_mobile-menu {\
-background: #333;\
-color: #ccc;\
-box-shadow: 1px 3px 2px grey;\
-border: 1px solid #444;\
-}\
-.ace_mobile-button {\
-padding: 2px;\
-cursor: pointer;\
-overflow: hidden;\
-}\
-.ace_mobile-button:hover {\
-background-color: #eee;\
-opacity:1;\
-}\
-.ace_mobile-button:active {\
-background-color: #ddd;\
-}\
-.ace_placeholder {\
-font-family: arial;\
-transform: scale(0.9);\
-transform-origin: left;\
-white-space: pre;\
-opacity: 0.7;\
-margin: 0 10px;\
-}";
-
-var useragent = require("./lib/useragent");
-var HIDE_TEXTAREA = useragent.isIE;
-
-dom.importCssString(editorCss, "ace_editor.css", false);
-
-var VirtualRenderer = function(container, theme) {
- var _self = this;
-
- this.container = container || dom.createElement("div");
-
- dom.addCssClass(this.container, "ace_editor");
- if (dom.HI_DPI) dom.addCssClass(this.container, "ace_hidpi");
-
- this.setTheme(theme);
- if (config.get("useStrictCSP") == null)
- config.set("useStrictCSP", false);
-
- this.$gutter = dom.createElement("div");
- this.$gutter.className = "ace_gutter";
- this.container.appendChild(this.$gutter);
- this.$gutter.setAttribute("aria-hidden", true);
-
- this.scroller = dom.createElement("div");
- this.scroller.className = "ace_scroller";
-
- this.container.appendChild(this.scroller);
-
- this.content = dom.createElement("div");
- this.content.className = "ace_content";
- this.scroller.appendChild(this.content);
-
- this.$gutterLayer = new GutterLayer(this.$gutter);
- this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
-
- this.$markerBack = new MarkerLayer(this.content);
-
- var textLayer = this.$textLayer = new TextLayer(this.content);
- this.canvas = textLayer.element;
-
- this.$markerFront = new MarkerLayer(this.content);
-
- this.$cursorLayer = new CursorLayer(this.content);
- this.$horizScroll = false;
- this.$vScroll = false;
-
- this.scrollBar =
- this.scrollBarV = new VScrollBar(this.container, this);
- this.scrollBarH = new HScrollBar(this.container, this);
- this.scrollBarV.on("scroll", function(e) {
- if (!_self.$scrollAnimation)
- _self.session.setScrollTop(e.data - _self.scrollMargin.top);
- });
- this.scrollBarH.on("scroll", function(e) {
- if (!_self.$scrollAnimation)
- _self.session.setScrollLeft(e.data - _self.scrollMargin.left);
- });
-
- this.scrollTop = 0;
- this.scrollLeft = 0;
-
- this.cursorPos = {
- row : 0,
- column : 0
- };
-
- this.$fontMetrics = new FontMetrics(this.container);
- this.$textLayer.$setFontMetrics(this.$fontMetrics);
- this.$textLayer.on("changeCharacterSize", function(e) {
- _self.updateCharacterSize();
- _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
- _self._signal("changeCharacterSize", e);
- });
-
- this.$size = {
- width: 0,
- height: 0,
- scrollerHeight: 0,
- scrollerWidth: 0,
- $dirty: true
- };
-
- this.layerConfig = {
- width : 1,
- padding : 0,
- firstRow : 0,
- firstRowScreen: 0,
- lastRow : 0,
- lineHeight : 0,
- characterWidth : 0,
- minHeight : 1,
- maxHeight : 1,
- offset : 0,
- height : 1,
- gutterOffset: 1
- };
-
- this.scrollMargin = {
- left: 0,
- right: 0,
- top: 0,
- bottom: 0,
- v: 0,
- h: 0
- };
-
- this.margin = {
- left: 0,
- right: 0,
- top: 0,
- bottom: 0,
- v: 0,
- h: 0
- };
-
- this.$keepTextAreaAtCursor = !useragent.isIOS;
-
- this.$loop = new RenderLoop(
- this.$renderChanges.bind(this),
- this.container.ownerDocument.defaultView
- );
- this.$loop.schedule(this.CHANGE_FULL);
-
- this.updateCharacterSize();
- this.setPadding(4);
- config.resetOptions(this);
- config._signal("renderer", this);
-};
-
-(function() {
-
- this.CHANGE_CURSOR = 1;
- this.CHANGE_MARKER = 2;
- this.CHANGE_GUTTER = 4;
- this.CHANGE_SCROLL = 8;
- this.CHANGE_LINES = 16;
- this.CHANGE_TEXT = 32;
- this.CHANGE_SIZE = 64;
- this.CHANGE_MARKER_BACK = 128;
- this.CHANGE_MARKER_FRONT = 256;
- this.CHANGE_FULL = 512;
- this.CHANGE_H_SCROLL = 1024;
-
- oop.implement(this, EventEmitter);
-
- this.updateCharacterSize = function() {
- if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
- this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
- this.setStyle("ace_nobold", !this.$allowBoldFonts);
- }
-
- this.layerConfig.characterWidth =
- this.characterWidth = this.$textLayer.getCharacterWidth();
- this.layerConfig.lineHeight =
- this.lineHeight = this.$textLayer.getLineHeight();
- this.$updatePrintMargin();
- dom.setStyle(this.scroller.style, "line-height", this.lineHeight + "px");
- };
- this.setSession = function(session) {
- if (this.session)
- this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
-
- this.session = session;
- if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
- session.setScrollTop(-this.scrollMargin.top);
-
- this.$cursorLayer.setSession(session);
- this.$markerBack.setSession(session);
- this.$markerFront.setSession(session);
- this.$gutterLayer.setSession(session);
- this.$textLayer.setSession(session);
- if (!session)
- return;
-
- this.$loop.schedule(this.CHANGE_FULL);
- this.session.$setFontMetrics(this.$fontMetrics);
- this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
-
- this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
- this.onChangeNewLineMode();
- this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
- };
- this.updateLines = function(firstRow, lastRow, force) {
- if (lastRow === undefined)
- lastRow = Infinity;
-
- if (!this.$changedLines) {
- this.$changedLines = {
- firstRow: firstRow,
- lastRow: lastRow
- };
- }
- else {
- if (this.$changedLines.firstRow > firstRow)
- this.$changedLines.firstRow = firstRow;
-
- if (this.$changedLines.lastRow < lastRow)
- this.$changedLines.lastRow = lastRow;
- }
- if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
- if (force)
- this.$changedLines.lastRow = this.layerConfig.lastRow;
- else
- return;
- }
- if (this.$changedLines.firstRow > this.layerConfig.lastRow)
- return;
- this.$loop.schedule(this.CHANGE_LINES);
- };
-
- this.onChangeNewLineMode = function() {
- this.$loop.schedule(this.CHANGE_TEXT);
- this.$textLayer.$updateEolChar();
- this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR);
- };
-
- this.onChangeTabSize = function() {
- this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
- this.$textLayer.onChangeTabSize();
- };
- this.updateText = function() {
- this.$loop.schedule(this.CHANGE_TEXT);
- };
- this.updateFull = function(force) {
- if (force)
- this.$renderChanges(this.CHANGE_FULL, true);
- else
- this.$loop.schedule(this.CHANGE_FULL);
- };
- this.updateFontSize = function() {
- this.$textLayer.checkForSizeChanges();
- };
-
- this.$changes = 0;
- this.$updateSizeAsync = function() {
- if (this.$loop.pending)
- this.$size.$dirty = true;
- else
- this.onResize();
- };
- this.onResize = function(force, gutterWidth, width, height) {
- if (this.resizing > 2)
- return;
- else if (this.resizing > 0)
- this.resizing++;
- else
- this.resizing = force ? 1 : 0;
- var el = this.container;
- if (!height)
- height = el.clientHeight || el.scrollHeight;
- if (!width)
- width = el.clientWidth || el.scrollWidth;
- var changes = this.$updateCachedSize(force, gutterWidth, width, height);
-
-
- if (!this.$size.scrollerHeight || (!width && !height))
- return this.resizing = 0;
-
- if (force)
- this.$gutterLayer.$padding = null;
-
- if (force)
- this.$renderChanges(changes | this.$changes, true);
- else
- this.$loop.schedule(changes | this.$changes);
-
- if (this.resizing)
- this.resizing = 0;
- this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
- };
-
- this.$updateCachedSize = function(force, gutterWidth, width, height) {
- height -= (this.$extraHeight || 0);
- var changes = 0;
- var size = this.$size;
- var oldSize = {
- width: size.width,
- height: size.height,
- scrollerHeight: size.scrollerHeight,
- scrollerWidth: size.scrollerWidth
- };
- if (height && (force || size.height != height)) {
- size.height = height;
- changes |= this.CHANGE_SIZE;
-
- size.scrollerHeight = size.height;
- if (this.$horizScroll)
- size.scrollerHeight -= this.scrollBarH.getHeight();
- this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
-
- changes = changes | this.CHANGE_SCROLL;
- }
-
- if (width && (force || size.width != width)) {
- changes |= this.CHANGE_SIZE;
- size.width = width;
-
- if (gutterWidth == null)
- gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
-
- this.gutterWidth = gutterWidth;
-
- dom.setStyle(this.scrollBarH.element.style, "left", gutterWidth + "px");
- dom.setStyle(this.scroller.style, "left", gutterWidth + this.margin.left + "px");
- size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth() - this.margin.h);
- dom.setStyle(this.$gutter.style, "left", this.margin.left + "px");
-
- var right = this.scrollBarV.getWidth() + "px";
- dom.setStyle(this.scrollBarH.element.style, "right", right);
- dom.setStyle(this.scroller.style, "right", right);
- dom.setStyle(this.scroller.style, "bottom", this.scrollBarH.getHeight());
-
- if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) {
- changes |= this.CHANGE_FULL;
- }
- }
-
- size.$dirty = !width || !height;
-
- if (changes)
- this._signal("resize", oldSize);
-
- return changes;
- };
-
- this.onGutterResize = function(width) {
- var gutterWidth = this.$showGutter ? width : 0;
- if (gutterWidth != this.gutterWidth)
- this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
-
- if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
- this.$loop.schedule(this.CHANGE_FULL);
- } else if (this.$size.$dirty) {
- this.$loop.schedule(this.CHANGE_FULL);
- } else {
- this.$computeLayerConfig();
- }
- };
- this.adjustWrapLimit = function() {
- var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
- var limit = Math.floor(availableWidth / this.characterWidth);
- return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);
- };
- this.setAnimatedScroll = function(shouldAnimate){
- this.setOption("animatedScroll", shouldAnimate);
- };
- this.getAnimatedScroll = function() {
- return this.$animatedScroll;
- };
- this.setShowInvisibles = function(showInvisibles) {
- this.setOption("showInvisibles", showInvisibles);
- this.session.$bidiHandler.setShowInvisibles(showInvisibles);
- };
- this.getShowInvisibles = function() {
- return this.getOption("showInvisibles");
- };
- this.getDisplayIndentGuides = function() {
- return this.getOption("displayIndentGuides");
- };
-
- this.setDisplayIndentGuides = function(display) {
- this.setOption("displayIndentGuides", display);
- };
- this.setShowPrintMargin = function(showPrintMargin) {
- this.setOption("showPrintMargin", showPrintMargin);
- };
- this.getShowPrintMargin = function() {
- return this.getOption("showPrintMargin");
- };
- this.setPrintMarginColumn = function(showPrintMargin) {
- this.setOption("printMarginColumn", showPrintMargin);
- };
- this.getPrintMarginColumn = function() {
- return this.getOption("printMarginColumn");
- };
- this.getShowGutter = function(){
- return this.getOption("showGutter");
- };
- this.setShowGutter = function(show){
- return this.setOption("showGutter", show);
- };
-
- this.getFadeFoldWidgets = function(){
- return this.getOption("fadeFoldWidgets");
- };
-
- this.setFadeFoldWidgets = function(show) {
- this.setOption("fadeFoldWidgets", show);
- };
-
- this.setHighlightGutterLine = function(shouldHighlight) {
- this.setOption("highlightGutterLine", shouldHighlight);
- };
-
- this.getHighlightGutterLine = function() {
- return this.getOption("highlightGutterLine");
- };
-
- this.$updatePrintMargin = function() {
- if (!this.$showPrintMargin && !this.$printMarginEl)
- return;
-
- if (!this.$printMarginEl) {
- var containerEl = dom.createElement("div");
- containerEl.className = "ace_layer ace_print-margin-layer";
- this.$printMarginEl = dom.createElement("div");
- this.$printMarginEl.className = "ace_print-margin";
- containerEl.appendChild(this.$printMarginEl);
- this.content.insertBefore(containerEl, this.content.firstChild);
- }
-
- var style = this.$printMarginEl.style;
- style.left = Math.round(this.characterWidth * this.$printMarginColumn + this.$padding) + "px";
- style.visibility = this.$showPrintMargin ? "visible" : "hidden";
-
- if (this.session && this.session.$wrap == -1)
- this.adjustWrapLimit();
- };
- this.getContainerElement = function() {
- return this.container;
- };
- this.getMouseEventTarget = function() {
- return this.scroller;
- };
- this.getTextAreaContainer = function() {
- return this.container;
- };
- this.$moveTextAreaToCursor = function() {
- if (this.$isMousePressed) return;
- var style = this.textarea.style;
- var composition = this.$composition;
- if (!this.$keepTextAreaAtCursor && !composition) {
- dom.translate(this.textarea, -100, 0);
- return;
- }
- var pixelPos = this.$cursorLayer.$pixelPos;
- if (!pixelPos)
- return;
- if (composition && composition.markerRange)
- pixelPos = this.$cursorLayer.getPixelPosition(composition.markerRange.start, true);
-
- var config = this.layerConfig;
- var posTop = pixelPos.top;
- var posLeft = pixelPos.left;
- posTop -= config.offset;
-
- var h = composition && composition.useTextareaForIME ? this.lineHeight : HIDE_TEXTAREA ? 0 : 1;
- if (posTop < 0 || posTop > config.height - h) {
- dom.translate(this.textarea, 0, 0);
- return;
- }
-
- var w = 1;
- var maxTop = this.$size.height - h;
- if (!composition) {
- posTop += this.lineHeight;
- }
- else {
- if (composition.useTextareaForIME) {
- var val = this.textarea.value;
- w = this.characterWidth * (this.session.$getStringScreenWidth(val)[0]);
- }
- else {
- posTop += this.lineHeight + 2;
- }
- }
-
- posLeft -= this.scrollLeft;
- if (posLeft > this.$size.scrollerWidth - w)
- posLeft = this.$size.scrollerWidth - w;
-
- posLeft += this.gutterWidth + this.margin.left;
-
- dom.setStyle(style, "height", h + "px");
- dom.setStyle(style, "width", w + "px");
- dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, maxTop));
- };
- this.getFirstVisibleRow = function() {
- return this.layerConfig.firstRow;
- };
- this.getFirstFullyVisibleRow = function() {
- return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
- };
- this.getLastFullyVisibleRow = function() {
- var config = this.layerConfig;
- var lastRow = config.lastRow;
- var top = this.session.documentToScreenRow(lastRow, 0) * config.lineHeight;
- if (top - this.session.getScrollTop() > config.height - config.lineHeight)
- return lastRow - 1;
- return lastRow;
- };
- this.getLastVisibleRow = function() {
- return this.layerConfig.lastRow;
- };
-
- this.$padding = null;
- this.setPadding = function(padding) {
- this.$padding = padding;
- this.$textLayer.setPadding(padding);
- this.$cursorLayer.setPadding(padding);
- this.$markerFront.setPadding(padding);
- this.$markerBack.setPadding(padding);
- this.$loop.schedule(this.CHANGE_FULL);
- this.$updatePrintMargin();
- };
-
- this.setScrollMargin = function(top, bottom, left, right) {
- var sm = this.scrollMargin;
- sm.top = top|0;
- sm.bottom = bottom|0;
- sm.right = right|0;
- sm.left = left|0;
- sm.v = sm.top + sm.bottom;
- sm.h = sm.left + sm.right;
- if (sm.top && this.scrollTop <= 0 && this.session)
- this.session.setScrollTop(-sm.top);
- this.updateFull();
- };
-
- this.setMargin = function(top, bottom, left, right) {
- var sm = this.margin;
- sm.top = top|0;
- sm.bottom = bottom|0;
- sm.right = right|0;
- sm.left = left|0;
- sm.v = sm.top + sm.bottom;
- sm.h = sm.left + sm.right;
- this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height);
- this.updateFull();
- };
- this.getHScrollBarAlwaysVisible = function() {
- return this.$hScrollBarAlwaysVisible;
- };
- this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
- this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
- };
- this.getVScrollBarAlwaysVisible = function() {
- return this.$vScrollBarAlwaysVisible;
- };
- this.setVScrollBarAlwaysVisible = function(alwaysVisible) {
- this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
- };
-
- this.$updateScrollBarV = function() {
- var scrollHeight = this.layerConfig.maxHeight;
- var scrollerHeight = this.$size.scrollerHeight;
- if (!this.$maxLines && this.$scrollPastEnd) {
- scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
- if (this.scrollTop > scrollHeight - scrollerHeight) {
- scrollHeight = this.scrollTop + scrollerHeight;
- this.scrollBarV.scrollTop = null;
- }
- }
- this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
- this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
- };
- this.$updateScrollBarH = function() {
- this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
- this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
- };
-
- this.$frozen = false;
- this.freeze = function() {
- this.$frozen = true;
- };
-
- this.unfreeze = function() {
- this.$frozen = false;
- };
-
- this.$renderChanges = function(changes, force) {
- if (this.$changes) {
- changes |= this.$changes;
- this.$changes = 0;
- }
- if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {
- this.$changes |= changes;
- return;
- }
- if (this.$size.$dirty) {
- this.$changes |= changes;
- return this.onResize(true);
- }
- if (!this.lineHeight) {
- this.$textLayer.checkForSizeChanges();
- }
-
- this._signal("beforeRender", changes);
-
- if (this.session && this.session.$bidiHandler)
- this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
-
- var config = this.layerConfig;
- if (changes & this.CHANGE_FULL ||
- changes & this.CHANGE_SIZE ||
- changes & this.CHANGE_TEXT ||
- changes & this.CHANGE_LINES ||
- changes & this.CHANGE_SCROLL ||
- changes & this.CHANGE_H_SCROLL
- ) {
- changes |= this.$computeLayerConfig() | this.$loop.clear();
- if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {
- var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;
- if (st > 0) {
- this.scrollTop = st;
- changes = changes | this.CHANGE_SCROLL;
- changes |= this.$computeLayerConfig() | this.$loop.clear();
- }
- }
- config = this.layerConfig;
- this.$updateScrollBarV();
- if (changes & this.CHANGE_H_SCROLL)
- this.$updateScrollBarH();
-
- dom.translate(this.content, -this.scrollLeft, -config.offset);
-
- var width = config.width + 2 * this.$padding + "px";
- var height = config.minHeight + "px";
-
- dom.setStyle(this.content.style, "width", width);
- dom.setStyle(this.content.style, "height", height);
- }
- if (changes & this.CHANGE_H_SCROLL) {
- dom.translate(this.content, -this.scrollLeft, -config.offset);
- this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
- }
- if (changes & this.CHANGE_FULL) {
- this.$changedLines = null;
- this.$textLayer.update(config);
- if (this.$showGutter)
- this.$gutterLayer.update(config);
- this.$markerBack.update(config);
- this.$markerFront.update(config);
- this.$cursorLayer.update(config);
- this.$moveTextAreaToCursor();
- this._signal("afterRender", changes);
- return;
- }
- if (changes & this.CHANGE_SCROLL) {
- this.$changedLines = null;
- if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
- this.$textLayer.update(config);
- else
- this.$textLayer.scrollLines(config);
-
- if (this.$showGutter) {
- if (changes & this.CHANGE_GUTTER || changes & this.CHANGE_LINES)
- this.$gutterLayer.update(config);
- else
- this.$gutterLayer.scrollLines(config);
- }
- this.$markerBack.update(config);
- this.$markerFront.update(config);
- this.$cursorLayer.update(config);
- this.$moveTextAreaToCursor();
- this._signal("afterRender", changes);
- return;
- }
-
- if (changes & this.CHANGE_TEXT) {
- this.$changedLines = null;
- this.$textLayer.update(config);
- if (this.$showGutter)
- this.$gutterLayer.update(config);
- }
- else if (changes & this.CHANGE_LINES) {
- if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)
- this.$gutterLayer.update(config);
- }
- else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
- if (this.$showGutter)
- this.$gutterLayer.update(config);
- }
- else if (changes & this.CHANGE_CURSOR) {
- if (this.$highlightGutterLine)
- this.$gutterLayer.updateLineHighlight(config);
- }
-
- if (changes & this.CHANGE_CURSOR) {
- this.$cursorLayer.update(config);
- this.$moveTextAreaToCursor();
- }
-
- if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
- this.$markerFront.update(config);
- }
-
- if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
- this.$markerBack.update(config);
- }
-
- this._signal("afterRender", changes);
- };
-
-
- this.$autosize = function() {
- var height = this.session.getScreenLength() * this.lineHeight;
- var maxHeight = this.$maxLines * this.lineHeight;
- var desiredHeight = Math.min(maxHeight,
- Math.max((this.$minLines || 1) * this.lineHeight, height)
- ) + this.scrollMargin.v + (this.$extraHeight || 0);
- if (this.$horizScroll)
- desiredHeight += this.scrollBarH.getHeight();
- if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight)
- desiredHeight = this.$maxPixelHeight;
-
- var hideScrollbars = desiredHeight <= 2 * this.lineHeight;
- var vScroll = !hideScrollbars && height > maxHeight;
-
- if (desiredHeight != this.desiredHeight ||
- this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {
- if (vScroll != this.$vScroll) {
- this.$vScroll = vScroll;
- this.scrollBarV.setVisible(vScroll);
- }
-
- var w = this.container.clientWidth;
- this.container.style.height = desiredHeight + "px";
- this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);
- this.desiredHeight = desiredHeight;
-
- this._signal("autosize");
- }
- };
-
- this.$computeLayerConfig = function() {
- var session = this.session;
- var size = this.$size;
-
- var hideScrollbars = size.height <= 2 * this.lineHeight;
- var screenLines = this.session.getScreenLength();
- var maxHeight = screenLines * this.lineHeight;
-
- var longestLine = this.$getLongestLine();
-
- var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||
- size.scrollerWidth - longestLine - 2 * this.$padding < 0);
-
- var hScrollChanged = this.$horizScroll !== horizScroll;
- if (hScrollChanged) {
- this.$horizScroll = horizScroll;
- this.scrollBarH.setVisible(horizScroll);
- }
- var vScrollBefore = this.$vScroll; // autosize can change vscroll value in which case we need to update longestLine
- if (this.$maxLines && this.lineHeight > 1)
- this.$autosize();
-
- var minHeight = size.scrollerHeight + this.lineHeight;
-
- var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd
- ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
- : 0;
- maxHeight += scrollPastEnd;
-
- var sm = this.scrollMargin;
- this.session.setScrollTop(Math.max(-sm.top,
- Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom)));
-
- this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft,
- longestLine + 2 * this.$padding - size.scrollerWidth + sm.right)));
-
- var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
- size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);
- var vScrollChanged = vScrollBefore !== vScroll;
- if (vScrollChanged) {
- this.$vScroll = vScroll;
- this.scrollBarV.setVisible(vScroll);
- }
-
- var offset = this.scrollTop % this.lineHeight;
- var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
- var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
- var lastRow = firstRow + lineCount;
- var firstRowScreen, firstRowHeight;
- var lineHeight = this.lineHeight;
- firstRow = session.screenToDocumentRow(firstRow, 0);
- var foldLine = session.getFoldLine(firstRow);
- if (foldLine) {
- firstRow = foldLine.start.row;
- }
-
- firstRowScreen = session.documentToScreenRow(firstRow, 0);
- firstRowHeight = session.getRowLength(firstRow) * lineHeight;
-
- lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
- minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
- firstRowHeight;
-
- offset = this.scrollTop - firstRowScreen * lineHeight;
-
- var changes = 0;
- if (this.layerConfig.width != longestLine || hScrollChanged)
- changes = this.CHANGE_H_SCROLL;
- if (hScrollChanged || vScrollChanged) {
- changes |= this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
- this._signal("scrollbarVisibilityChanged");
- if (vScrollChanged)
- longestLine = this.$getLongestLine();
- }
-
- this.layerConfig = {
- width : longestLine,
- padding : this.$padding,
- firstRow : firstRow,
- firstRowScreen: firstRowScreen,
- lastRow : lastRow,
- lineHeight : lineHeight,
- characterWidth : this.characterWidth,
- minHeight : minHeight,
- maxHeight : maxHeight,
- offset : offset,
- gutterOffset : lineHeight ? Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)) : 0,
- height : this.$size.scrollerHeight
- };
-
- if (this.session.$bidiHandler)
- this.session.$bidiHandler.setContentWidth(longestLine - this.$padding);
-
- return changes;
- };
-
- this.$updateLines = function() {
- if (!this.$changedLines) return;
- var firstRow = this.$changedLines.firstRow;
- var lastRow = this.$changedLines.lastRow;
- this.$changedLines = null;
-
- var layerConfig = this.layerConfig;
-
- if (firstRow > layerConfig.lastRow + 1) { return; }
- if (lastRow < layerConfig.firstRow) { return; }
- if (lastRow === Infinity) {
- if (this.$showGutter)
- this.$gutterLayer.update(layerConfig);
- this.$textLayer.update(layerConfig);
- return;
- }
- this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
- return true;
- };
-
- this.$getLongestLine = function() {
- var charCount = this.session.getScreenWidth();
- if (this.showInvisibles && !this.session.$useWrapMode)
- charCount += 1;
-
- if (this.$textLayer && charCount > this.$textLayer.MAX_LINE_LENGTH)
- charCount = this.$textLayer.MAX_LINE_LENGTH + 30;
-
- return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
- };
- this.updateFrontMarkers = function() {
- this.$markerFront.setMarkers(this.session.getMarkers(true));
- this.$loop.schedule(this.CHANGE_MARKER_FRONT);
- };
- this.updateBackMarkers = function() {
- this.$markerBack.setMarkers(this.session.getMarkers());
- this.$loop.schedule(this.CHANGE_MARKER_BACK);
- };
- this.addGutterDecoration = function(row, className){
- this.$gutterLayer.addGutterDecoration(row, className);
- };
- this.removeGutterDecoration = function(row, className){
- this.$gutterLayer.removeGutterDecoration(row, className);
- };
- this.updateBreakpoints = function(rows) {
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
- this.setAnnotations = function(annotations) {
- this.$gutterLayer.setAnnotations(annotations);
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
- this.updateCursor = function() {
- this.$loop.schedule(this.CHANGE_CURSOR);
- };
- this.hideCursor = function() {
- this.$cursorLayer.hideCursor();
- };
- this.showCursor = function() {
- this.$cursorLayer.showCursor();
- };
-
- this.scrollSelectionIntoView = function(anchor, lead, offset) {
- this.scrollCursorIntoView(anchor, offset);
- this.scrollCursorIntoView(lead, offset);
- };
- this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {
- if (this.$size.scrollerHeight === 0)
- return;
-
- var pos = this.$cursorLayer.getPixelPosition(cursor);
-
- var left = pos.left;
- var top = pos.top;
-
- var topMargin = $viewMargin && $viewMargin.top || 0;
- var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
-
- var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
-
- if (scrollTop + topMargin > top) {
- if (offset && scrollTop + topMargin > top + this.lineHeight)
- top -= offset * this.$size.scrollerHeight;
- if (top === 0)
- top = -this.scrollMargin.top;
- this.session.setScrollTop(top);
- } else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {
- if (offset && scrollTop + this.$size.scrollerHeight - bottomMargin < top - this.lineHeight)
- top += offset * this.$size.scrollerHeight;
- this.session.setScrollTop(top + this.lineHeight + bottomMargin - this.$size.scrollerHeight);
- }
-
- var scrollLeft = this.scrollLeft;
-
- if (scrollLeft > left) {
- if (left < this.$padding + 2 * this.layerConfig.characterWidth)
- left = -this.scrollMargin.left;
- this.session.setScrollLeft(left);
- } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
- this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
- } else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) {
- this.session.setScrollLeft(0);
- }
- };
- this.getScrollTop = function() {
- return this.session.getScrollTop();
- };
- this.getScrollLeft = function() {
- return this.session.getScrollLeft();
- };
- this.getScrollTopRow = function() {
- return this.scrollTop / this.lineHeight;
- };
- this.getScrollBottomRow = function() {
- return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
- };
- this.scrollToRow = function(row) {
- this.session.setScrollTop(row * this.lineHeight);
- };
-
- this.alignCursor = function(cursor, alignment) {
- if (typeof cursor == "number")
- cursor = {row: cursor, column: 0};
-
- var pos = this.$cursorLayer.getPixelPosition(cursor);
- var h = this.$size.scrollerHeight - this.lineHeight;
- var offset = pos.top - h * (alignment || 0);
-
- this.session.setScrollTop(offset);
- return offset;
- };
-
- this.STEPS = 8;
- this.$calcSteps = function(fromValue, toValue){
- var i = 0;
- var l = this.STEPS;
- var steps = [];
-
- var func = function(t, x_min, dx) {
- return dx * (Math.pow(t - 1, 3) + 1) + x_min;
- };
-
- for (i = 0; i < l; ++i)
- steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
-
- return steps;
- };
- this.scrollToLine = function(line, center, animate, callback) {
- var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
- var offset = pos.top;
- if (center)
- offset -= this.$size.scrollerHeight / 2;
-
- var initialScroll = this.scrollTop;
- this.session.setScrollTop(offset);
- if (animate !== false)
- this.animateScrolling(initialScroll, callback);
- };
-
- this.animateScrolling = function(fromValue, callback) {
- var toValue = this.scrollTop;
- if (!this.$animatedScroll)
- return;
- var _self = this;
-
- if (fromValue == toValue)
- return;
-
- if (this.$scrollAnimation) {
- var oldSteps = this.$scrollAnimation.steps;
- if (oldSteps.length) {
- fromValue = oldSteps[0];
- if (fromValue == toValue)
- return;
- }
- }
-
- var steps = _self.$calcSteps(fromValue, toValue);
- this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};
-
- clearInterval(this.$timer);
-
- _self.session.setScrollTop(steps.shift());
- _self.session.$scrollTop = toValue;
- this.$timer = setInterval(function() {
- if (!_self.session)
- return clearInterval(_self.$timer);
- if (steps.length) {
- _self.session.setScrollTop(steps.shift());
- _self.session.$scrollTop = toValue;
- } else if (toValue != null) {
- _self.session.$scrollTop = -1;
- _self.session.setScrollTop(toValue);
- toValue = null;
- } else {
- _self.$timer = clearInterval(_self.$timer);
- _self.$scrollAnimation = null;
- callback && callback();
- }
- }, 10);
- };
- this.scrollToY = function(scrollTop) {
- if (this.scrollTop !== scrollTop) {
- this.$loop.schedule(this.CHANGE_SCROLL);
- this.scrollTop = scrollTop;
- }
- };
- this.scrollToX = function(scrollLeft) {
- if (this.scrollLeft !== scrollLeft)
- this.scrollLeft = scrollLeft;
- this.$loop.schedule(this.CHANGE_H_SCROLL);
- };
- this.scrollTo = function(x, y) {
- this.session.setScrollTop(y);
- this.session.setScrollLeft(x);
- };
- this.scrollBy = function(deltaX, deltaY) {
- deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
- deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
- };
- this.isScrollableBy = function(deltaX, deltaY) {
- if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
- return true;
- if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
- - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
- return true;
- if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
- return true;
- if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth
- - this.layerConfig.width < -1 + this.scrollMargin.right)
- return true;
- };
-
- this.pixelToScreenCoordinates = function(x, y) {
- var canvasPos;
- if (this.$hasCssTransforms) {
- canvasPos = {top:0, left: 0};
- var p = this.$fontMetrics.transformCoordinates([x, y]);
- x = p[1] - this.gutterWidth - this.margin.left;
- y = p[0];
- } else {
- canvasPos = this.scroller.getBoundingClientRect();
- }
-
- var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;
- var offset = offsetX / this.characterWidth;
- var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
- var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset);
-
- return {row: row, column: col, side: offset - col > 0 ? 1 : -1, offsetX: offsetX};
- };
-
- this.screenToTextCoordinates = function(x, y) {
- var canvasPos;
- if (this.$hasCssTransforms) {
- canvasPos = {top:0, left: 0};
- var p = this.$fontMetrics.transformCoordinates([x, y]);
- x = p[1] - this.gutterWidth - this.margin.left;
- y = p[0];
- } else {
- canvasPos = this.scroller.getBoundingClientRect();
- }
-
- var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;
- var offset = offsetX / this.characterWidth;
- var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset);
-
- var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
-
- return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX);
- };
- this.textToScreenCoordinates = function(row, column) {
- var canvasPos = this.scroller.getBoundingClientRect();
- var pos = this.session.documentToScreenPosition(row, column);
-
- var x = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row)
- ? this.session.$bidiHandler.getPosLeft(pos.column)
- : Math.round(pos.column * this.characterWidth));
-
- var y = pos.row * this.lineHeight;
-
- return {
- pageX: canvasPos.left + x - this.scrollLeft,
- pageY: canvasPos.top + y - this.scrollTop
- };
- };
- this.visualizeFocus = function() {
- dom.addCssClass(this.container, "ace_focus");
- };
- this.visualizeBlur = function() {
- dom.removeCssClass(this.container, "ace_focus");
- };
- this.showComposition = function(composition) {
- this.$composition = composition;
- if (!composition.cssText) {
- composition.cssText = this.textarea.style.cssText;
- }
- if (composition.useTextareaForIME == undefined)
- composition.useTextareaForIME = this.$useTextareaForIME;
-
- if (this.$useTextareaForIME) {
- dom.addCssClass(this.textarea, "ace_composition");
- this.textarea.style.cssText = "";
- this.$moveTextAreaToCursor();
- this.$cursorLayer.element.style.display = "none";
- }
- else {
- composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
- }
- };
- this.setCompositionText = function(text) {
- var cursor = this.session.selection.cursor;
- this.addToken(text, "composition_placeholder", cursor.row, cursor.column);
- this.$moveTextAreaToCursor();
- };
- this.hideComposition = function() {
- if (!this.$composition)
- return;
-
- if (this.$composition.markerId)
- this.session.removeMarker(this.$composition.markerId);
-
- dom.removeCssClass(this.textarea, "ace_composition");
- this.textarea.style.cssText = this.$composition.cssText;
- var cursor = this.session.selection.cursor;
- this.removeExtraToken(cursor.row, cursor.column);
- this.$composition = null;
- this.$cursorLayer.element.style.display = "";
- };
-
- this.addToken = function(text, type, row, column) {
- var session = this.session;
- session.bgTokenizer.lines[row] = null;
- var newToken = {type: type, value: text};
- var tokens = session.getTokens(row);
- if (column == null) {
- tokens.push(newToken);
- } else {
- var l = 0;
- for (var i =0; i < tokens.length; i++) {
- var token = tokens[i];
- l += token.value.length;
- if (column <= l) {
- var diff = token.value.length - (l - column);
- var before = token.value.slice(0, diff);
- var after = token.value.slice(diff);
-
- tokens.splice(i, 1, {type: token.type, value: before}, newToken, {type: token.type, value: after});
- break;
- }
- }
- }
- this.updateLines(row, row);
- };
-
- this.removeExtraToken = function(row, column) {
- this.updateLines(row, row);
- };
- this.setTheme = function(theme, cb) {
- var _self = this;
- this.$themeId = theme;
- _self._dispatchEvent('themeChange',{theme:theme});
-
- if (!theme || typeof theme == "string") {
- var moduleName = theme || this.$options.theme.initialValue;
- config.loadModule(["theme", moduleName], afterLoad);
- } else {
- afterLoad(theme);
- }
-
- function afterLoad(module) {
- if (_self.$themeId != theme)
- return cb && cb();
- if (!module || !module.cssClass)
- throw new Error("couldn't load module " + theme + " or it didn't call define");
- if (module.$id)
- _self.$themeId = module.$id;
- dom.importCssString(
- module.cssText,
- module.cssClass,
- _self.container
- );
-
- if (_self.theme)
- dom.removeCssClass(_self.container, _self.theme.cssClass);
-
- var padding = "padding" in module ? module.padding
- : "padding" in (_self.theme || {}) ? 4 : _self.$padding;
- if (_self.$padding && padding != _self.$padding)
- _self.setPadding(padding);
- _self.$theme = module.cssClass;
-
- _self.theme = module;
- dom.addCssClass(_self.container, module.cssClass);
- dom.setCssClass(_self.container, "ace_dark", module.isDark);
- if (_self.$size) {
- _self.$size.width = 0;
- _self.$updateSizeAsync();
- }
-
- _self._dispatchEvent('themeLoaded', {theme:module});
- cb && cb();
- }
- };
- this.getTheme = function() {
- return this.$themeId;
- };
- this.setStyle = function(style, include) {
- dom.setCssClass(this.container, style, include !== false);
- };
- this.unsetStyle = function(style) {
- dom.removeCssClass(this.container, style);
- };
-
- this.setCursorStyle = function(style) {
- dom.setStyle(this.scroller.style, "cursor", style);
- };
- this.setMouseCursor = function(cursorStyle) {
- dom.setStyle(this.scroller.style, "cursor", cursorStyle);
- };
-
- this.attachToShadowRoot = function() {
- dom.importCssString(editorCss, "ace_editor.css", this.container);
- };
- this.destroy = function() {
- this.freeze();
- this.$fontMetrics.destroy();
- this.$cursorLayer.destroy();
- this.removeAllListeners();
- this.container.textContent = "";
- };
-
-}).call(VirtualRenderer.prototype);
-
-
-config.defineOptions(VirtualRenderer.prototype, "renderer", {
- animatedScroll: {initialValue: false},
- showInvisibles: {
- set: function(value) {
- if (this.$textLayer.setShowInvisibles(value))
- this.$loop.schedule(this.CHANGE_TEXT);
- },
- initialValue: false
- },
- showPrintMargin: {
- set: function() { this.$updatePrintMargin(); },
- initialValue: true
- },
- printMarginColumn: {
- set: function() { this.$updatePrintMargin(); },
- initialValue: 80
- },
- printMargin: {
- set: function(val) {
- if (typeof val == "number")
- this.$printMarginColumn = val;
- this.$showPrintMargin = !!val;
- this.$updatePrintMargin();
- },
- get: function() {
- return this.$showPrintMargin && this.$printMarginColumn;
- }
- },
- showGutter: {
- set: function(show){
- this.$gutter.style.display = show ? "block" : "none";
- this.$loop.schedule(this.CHANGE_FULL);
- this.onGutterResize();
- },
- initialValue: true
- },
- fadeFoldWidgets: {
- set: function(show) {
- dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
- },
- initialValue: false
- },
- showFoldWidgets: {
- set: function(show) {
- this.$gutterLayer.setShowFoldWidgets(show);
- this.$loop.schedule(this.CHANGE_GUTTER);
- },
- initialValue: true
- },
- displayIndentGuides: {
- set: function(show) {
- if (this.$textLayer.setDisplayIndentGuides(show))
- this.$loop.schedule(this.CHANGE_TEXT);
- },
- initialValue: true
- },
- highlightGutterLine: {
- set: function(shouldHighlight) {
- this.$gutterLayer.setHighlightGutterLine(shouldHighlight);
- this.$loop.schedule(this.CHANGE_GUTTER);
- },
- initialValue: true
- },
- hScrollBarAlwaysVisible: {
- set: function(val) {
- if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
- this.$loop.schedule(this.CHANGE_SCROLL);
- },
- initialValue: false
- },
- vScrollBarAlwaysVisible: {
- set: function(val) {
- if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
- this.$loop.schedule(this.CHANGE_SCROLL);
- },
- initialValue: false
- },
- fontSize: {
- set: function(size) {
- if (typeof size == "number")
- size = size + "px";
- this.container.style.fontSize = size;
- this.updateFontSize();
- },
- initialValue: 12
- },
- fontFamily: {
- set: function(name) {
- this.container.style.fontFamily = name;
- this.updateFontSize();
- }
- },
- maxLines: {
- set: function(val) {
- this.updateFull();
- }
- },
- minLines: {
- set: function(val) {
- if (!(this.$minLines < 0x1ffffffffffff))
- this.$minLines = 0;
- this.updateFull();
- }
- },
- maxPixelHeight: {
- set: function(val) {
- this.updateFull();
- },
- initialValue: 0
- },
- scrollPastEnd: {
- set: function(val) {
- val = +val || 0;
- if (this.$scrollPastEnd == val)
- return;
- this.$scrollPastEnd = val;
- this.$loop.schedule(this.CHANGE_SCROLL);
- },
- initialValue: 0,
- handlesSet: true
- },
- fixedWidthGutter: {
- set: function(val) {
- this.$gutterLayer.$fixedWidth = !!val;
- this.$loop.schedule(this.CHANGE_GUTTER);
- }
- },
- theme: {
- set: function(val) { this.setTheme(val); },
- get: function() { return this.$themeId || this.theme; },
- initialValue: "./theme/textmate",
- handlesSet: true
- },
- hasCssTransforms: {
- },
- useTextareaForIME: {
- initialValue: !useragent.isMobile && !useragent.isIE
- }
-});
-
-exports.VirtualRenderer = VirtualRenderer;
-});
-
-define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"], function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var net = require("../lib/net");
-var EventEmitter = require("../lib/event_emitter").EventEmitter;
-var config = require("../config");
-
-function $workerBlob(workerUrl) {
- var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
- try {
- return new Blob([script], {"type": "application/javascript"});
- } catch (e) { // Backwards-compatibility
- var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
- var blobBuilder = new BlobBuilder();
- blobBuilder.append(script);
- return blobBuilder.getBlob("application/javascript");
- }
-}
-
-function createWorker(workerUrl) {
- if (typeof Worker == "undefined")
- return { postMessage: function() {}, terminate: function() {} };
- if (config.get("loadWorkerFromBlob")) {
- var blob = $workerBlob(workerUrl);
- var URL = window.URL || window.webkitURL;
- var blobURL = URL.createObjectURL(blob);
- return new Worker(blobURL);
- }
- return new Worker(workerUrl);
-}
-
-var WorkerClient = function(worker) {
- if (!worker.postMessage)
- worker = this.$createWorkerFromOldConfig.apply(this, arguments);
-
- this.$worker = worker;
- this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
- this.changeListener = this.changeListener.bind(this);
- this.onMessage = this.onMessage.bind(this);
-
- this.callbackId = 1;
- this.callbacks = {};
-
- this.$worker.onmessage = this.onMessage;
-};
-
-(function(){
-
- oop.implement(this, EventEmitter);
-
- this.$createWorkerFromOldConfig = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) {
- if (require.nameToUrl && !require.toUrl)
- require.toUrl = require.nameToUrl;
-
- if (config.get("packaged") || !require.toUrl) {
- workerUrl = workerUrl || config.moduleUrl(mod, "worker");
- } else {
- var normalizePath = this.$normalizePath;
- workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_"));
-
- var tlns = {};
- topLevelNamespaces.forEach(function(ns) {
- tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
- });
- }
-
- this.$worker = createWorker(workerUrl);
- if (importScripts) {
- this.send("importScripts", importScripts);
- }
- this.$worker.postMessage({
- init : true,
- tlns : tlns,
- module : mod,
- classname : classname
- });
- return this.$worker;
- };
-
- this.onMessage = function(e) {
- var msg = e.data;
- switch (msg.type) {
- case "event":
- this._signal(msg.name, {data: msg.data});
- break;
- case "call":
- var callback = this.callbacks[msg.id];
- if (callback) {
- callback(msg.data);
- delete this.callbacks[msg.id];
- }
- break;
- case "error":
- this.reportError(msg.data);
- break;
- case "log":
- window.console && console.log && console.log.apply(console, msg.data);
- break;
- }
- };
-
- this.reportError = function(err) {
- window.console && console.error && console.error(err);
- };
-
- this.$normalizePath = function(path) {
- return net.qualifyURL(path);
- };
-
- this.terminate = function() {
- this._signal("terminate", {});
- this.deltaQueue = null;
- this.$worker.terminate();
- this.$worker = null;
- if (this.$doc)
- this.$doc.off("change", this.changeListener);
- this.$doc = null;
- };
-
- this.send = function(cmd, args) {
- this.$worker.postMessage({command: cmd, args: args});
- };
-
- this.call = function(cmd, args, callback) {
- if (callback) {
- var id = this.callbackId++;
- this.callbacks[id] = callback;
- args.push(id);
- }
- this.send(cmd, args);
- };
-
- this.emit = function(event, data) {
- try {
- if (data.data && data.data.err)
- data.data.err = {message: data.data.err.message, stack: data.data.err.stack, code: data.data.err.code};
- this.$worker.postMessage({event: event, data: {data: data.data}});
- }
- catch(ex) {
- console.error(ex.stack);
- }
- };
-
- this.attachToDocument = function(doc) {
- if (this.$doc)
- this.terminate();
-
- this.$doc = doc;
- this.call("setValue", [doc.getValue()]);
- doc.on("change", this.changeListener);
- };
-
- this.changeListener = function(delta) {
- if (!this.deltaQueue) {
- this.deltaQueue = [];
- setTimeout(this.$sendDeltaQueue, 0);
- }
- if (delta.action == "insert")
- this.deltaQueue.push(delta.start, delta.lines);
- else
- this.deltaQueue.push(delta.start, delta.end);
- };
-
- this.$sendDeltaQueue = function() {
- var q = this.deltaQueue;
- if (!q) return;
- this.deltaQueue = null;
- if (q.length > 50 && q.length > this.$doc.getLength() >> 1) {
- this.call("setValue", [this.$doc.getValue()]);
- } else
- this.emit("change", {data: q});
- };
-
-}).call(WorkerClient.prototype);
-
-
-var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
- var main = null;
- var emitSync = false;
- var sender = Object.create(EventEmitter);
-
- var messageBuffer = [];
- var workerClient = new WorkerClient({
- messageBuffer: messageBuffer,
- terminate: function() {},
- postMessage: function(e) {
- messageBuffer.push(e);
- if (!main) return;
- if (emitSync)
- setTimeout(processNext);
- else
- processNext();
- }
- });
-
- workerClient.setEmitSync = function(val) { emitSync = val; };
-
- var processNext = function() {
- var msg = messageBuffer.shift();
- if (msg.command)
- main[msg.command].apply(main, msg.args);
- else if (msg.event)
- sender._signal(msg.event, msg.data);
- };
-
- sender.postMessage = function(msg) {
- workerClient.onMessage({data: msg});
- };
- sender.callback = function(data, callbackId) {
- this.postMessage({type: "call", id: callbackId, data: data});
- };
- sender.emit = function(name, data) {
- this.postMessage({type: "event", name: name, data: data});
- };
-
- config.loadModule(["worker", mod], function(Main) {
- main = new Main[classname](sender);
- while (messageBuffer.length)
- processNext();
- });
-
- return workerClient;
-};
-
-exports.UIWorkerClient = UIWorkerClient;
-exports.WorkerClient = WorkerClient;
-exports.createWorker = createWorker;
-
-
-});
-
-define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"], function(require, exports, module) {
-"use strict";
-
-var Range = require("./range").Range;
-var EventEmitter = require("./lib/event_emitter").EventEmitter;
-var oop = require("./lib/oop");
-
-var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
- var _self = this;
- this.length = length;
- this.session = session;
- this.doc = session.getDocument();
- this.mainClass = mainClass;
- this.othersClass = othersClass;
- this.$onUpdate = this.onUpdate.bind(this);
- this.doc.on("change", this.$onUpdate);
- this.$others = others;
-
- this.$onCursorChange = function() {
- setTimeout(function() {
- _self.onCursorChange();
- });
- };
-
- this.$pos = pos;
- var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
- this.$undoStackDepth = undoStack.length;
- this.setup();
-
- session.selection.on("changeCursor", this.$onCursorChange);
-};
-
-(function() {
-
- oop.implement(this, EventEmitter);
- this.setup = function() {
- var _self = this;
- var doc = this.doc;
- var session = this.session;
-
- this.selectionBefore = session.selection.toJSON();
- if (session.selection.inMultiSelectMode)
- session.selection.toSingleRange();
-
- this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);
- var pos = this.pos;
- pos.$insertRight = true;
- pos.detach();
- pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
- this.others = [];
- this.$others.forEach(function(other) {
- var anchor = doc.createAnchor(other.row, other.column);
- anchor.$insertRight = true;
- anchor.detach();
- _self.others.push(anchor);
- });
- session.setUndoSelect(false);
- };
- this.showOtherMarkers = function() {
- if (this.othersActive) return;
- var session = this.session;
- var _self = this;
- this.othersActive = true;
- this.others.forEach(function(anchor) {
- anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
- });
- };
- this.hideOtherMarkers = function() {
- if (!this.othersActive) return;
- this.othersActive = false;
- for (var i = 0; i < this.others.length; i++) {
- this.session.removeMarker(this.others[i].markerId);
- }
- };
- this.onUpdate = function(delta) {
- if (this.$updating)
- return this.updateAnchors(delta);
-
- var range = delta;
- if (range.start.row !== range.end.row) return;
- if (range.start.row !== this.pos.row) return;
- this.$updating = true;
- var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column;
- var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1;
- var distanceFromStart = range.start.column - this.pos.column;
-
- this.updateAnchors(delta);
-
- if (inMainRange)
- this.length += lengthDiff;
-
- if (inMainRange && !this.session.$fromUndo) {
- if (delta.action === 'insert') {
- for (var i = this.others.length - 1; i >= 0; i--) {
- var otherPos = this.others[i];
- var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
- this.doc.insertMergedLines(newPos, delta.lines);
- }
- } else if (delta.action === 'remove') {
- for (var i = this.others.length - 1; i >= 0; i--) {
- var otherPos = this.others[i];
- var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
- this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
- }
- }
- }
-
- this.$updating = false;
- this.updateMarkers();
- };
-
- this.updateAnchors = function(delta) {
- this.pos.onChange(delta);
- for (var i = this.others.length; i--;)
- this.others[i].onChange(delta);
- this.updateMarkers();
- };
-
- this.updateMarkers = function() {
- if (this.$updating)
- return;
- var _self = this;
- var session = this.session;
- var updateMarker = function(pos, className) {
- session.removeMarker(pos.markerId);
- pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false);
- };
- updateMarker(this.pos, this.mainClass);
- for (var i = this.others.length; i--;)
- updateMarker(this.others[i], this.othersClass);
- };
-
- this.onCursorChange = function(event) {
- if (this.$updating || !this.session) return;
- var pos = this.session.selection.getCursor();
- if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
- this.showOtherMarkers();
- this._emit("cursorEnter", event);
- } else {
- this.hideOtherMarkers();
- this._emit("cursorLeave", event);
- }
- };
- this.detach = function() {
- this.session.removeMarker(this.pos && this.pos.markerId);
- this.hideOtherMarkers();
- this.doc.off("change", this.$onUpdate);
- this.session.selection.off("changeCursor", this.$onCursorChange);
- this.session.setUndoSelect(true);
- this.session = null;
- };
- this.cancel = function() {
- if (this.$undoStackDepth === -1)
- return;
- var undoManager = this.session.getUndoManager();
- var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
- for (var i = 0; i < undosRequired; i++) {
- undoManager.undo(this.session, true);
- }
- if (this.selectionBefore)
- this.session.selection.fromJSON(this.selectionBefore);
- };
-}).call(PlaceHolder.prototype);
-
-
-exports.PlaceHolder = PlaceHolder;
-});
-
-define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"], function(require, exports, module) {
-
-var event = require("../lib/event");
-var useragent = require("../lib/useragent");
-function isSamePoint(p1, p2) {
- return p1.row == p2.row && p1.column == p2.column;
-}
-
-function onMouseDown(e) {
- var ev = e.domEvent;
- var alt = ev.altKey;
- var shift = ev.shiftKey;
- var ctrl = ev.ctrlKey;
- var accel = e.getAccelKey();
- var button = e.getButton();
-
- if (ctrl && useragent.isMac)
- button = ev.button;
-
- if (e.editor.inMultiSelectMode && button == 2) {
- e.editor.textInput.onContextMenu(e.domEvent);
- return;
- }
-
- if (!ctrl && !alt && !accel) {
- if (button === 0 && e.editor.inMultiSelectMode)
- e.editor.exitMultiSelectMode();
- return;
- }
-
- if (button !== 0)
- return;
-
- var editor = e.editor;
- var selection = editor.selection;
- var isMultiSelect = editor.inMultiSelectMode;
- var pos = e.getDocumentPosition();
- var cursor = selection.getCursor();
- var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));
-
- var mouseX = e.x, mouseY = e.y;
- var onMouseSelection = function(e) {
- mouseX = e.clientX;
- mouseY = e.clientY;
- };
-
- var session = editor.session;
- var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
- var screenCursor = screenAnchor;
-
- var selectionMode;
- if (editor.$mouseHandler.$enableJumpToDef) {
- if (ctrl && alt || accel && alt)
- selectionMode = shift ? "block" : "add";
- else if (alt && editor.$blockSelectEnabled)
- selectionMode = "block";
- } else {
- if (accel && !alt) {
- selectionMode = "add";
- if (!isMultiSelect && shift)
- return;
- } else if (alt && editor.$blockSelectEnabled) {
- selectionMode = "block";
- }
- }
-
- if (selectionMode && useragent.isMac && ev.ctrlKey) {
- editor.$mouseHandler.cancelContextMenu();
- }
-
- if (selectionMode == "add") {
- if (!isMultiSelect && inSelection)
- return; // dragging
-
- if (!isMultiSelect) {
- var range = selection.toOrientedRange();
- editor.addSelectionMarker(range);
- }
-
- var oldRange = selection.rangeList.rangeAtPoint(pos);
-
- editor.inVirtualSelectionMode = true;
-
- if (shift) {
- oldRange = null;
- range = selection.ranges[0] || range;
- editor.removeSelectionMarker(range);
- }
- editor.once("mouseup", function() {
- var tmpSel = selection.toOrientedRange();
-
- if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
- selection.substractPoint(tmpSel.cursor);
- else {
- if (shift) {
- selection.substractPoint(range.cursor);
- } else if (range) {
- editor.removeSelectionMarker(range);
- selection.addRange(range);
- }
- selection.addRange(tmpSel);
- }
- editor.inVirtualSelectionMode = false;
- });
-
- } else if (selectionMode == "block") {
- e.stop();
- editor.inVirtualSelectionMode = true;
- var initialRange;
- var rectSel = [];
- var blockSelect = function() {
- var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
- var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX);
-
- if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))
- return;
- screenCursor = newCursor;
-
- editor.selection.moveToPosition(cursor);
- editor.renderer.scrollCursorIntoView();
-
- editor.removeSelectionMarkers(rectSel);
- rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
- if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())
- rectSel[0] = editor.$mouseHandler.$clickSelection.clone();
- rectSel.forEach(editor.addSelectionMarker, editor);
- editor.updateSelectionMarkers();
- };
- if (isMultiSelect && !accel) {
- selection.toSingleRange();
- } else if (!isMultiSelect && accel) {
- initialRange = selection.toOrientedRange();
- editor.addSelectionMarker(initialRange);
- }
-
- if (shift)
- screenAnchor = session.documentToScreenPosition(selection.lead);
- else
- selection.moveToPosition(pos);
-
- screenCursor = {row: -1, column: -1};
-
- var onMouseSelectionEnd = function(e) {
- blockSelect();
- clearInterval(timerId);
- editor.removeSelectionMarkers(rectSel);
- if (!rectSel.length)
- rectSel = [selection.toOrientedRange()];
- if (initialRange) {
- editor.removeSelectionMarker(initialRange);
- selection.toSingleRange(initialRange);
- }
- for (var i = 0; i < rectSel.length; i++)
- selection.addRange(rectSel[i]);
- editor.inVirtualSelectionMode = false;
- editor.$mouseHandler.$clickSelection = null;
- };
-
- var onSelectionInterval = blockSelect;
-
- event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
- var timerId = setInterval(function() {onSelectionInterval();}, 20);
-
- return e.preventDefault();
- }
-}
-
-
-exports.onMouseDown = onMouseDown;
-
-});
-
-define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"], function(require, exports, module) {
-exports.defaultCommands = [{
- name: "addCursorAbove",
- description: "Add cursor above",
- exec: function(editor) { editor.selectMoreLines(-1); },
- bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "addCursorBelow",
- description: "Add cursor below",
- exec: function(editor) { editor.selectMoreLines(1); },
- bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "addCursorAboveSkipCurrent",
- description: "Add cursor above (skip current)",
- exec: function(editor) { editor.selectMoreLines(-1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "addCursorBelowSkipCurrent",
- description: "Add cursor below (skip current)",
- exec: function(editor) { editor.selectMoreLines(1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "selectMoreBefore",
- description: "Select more before",
- exec: function(editor) { editor.selectMore(-1); },
- bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "selectMoreAfter",
- description: "Select more after",
- exec: function(editor) { editor.selectMore(1); },
- bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "selectNextBefore",
- description: "Select next before",
- exec: function(editor) { editor.selectMore(-1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "selectNextAfter",
- description: "Select next after",
- exec: function(editor) { editor.selectMore(1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
- scrollIntoView: "cursor",
- readOnly: true
-}, {
- name: "toggleSplitSelectionIntoLines",
- description: "Split into lines",
- exec: function(editor) {
- if (editor.multiSelect.rangeCount > 1)
- editor.multiSelect.joinSelections();
- else
- editor.multiSelect.splitIntoLines();
- },
- bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
- readOnly: true
-}, {
- name: "splitSelectionIntoLines",
- description: "Split into lines",
- exec: function(editor) { editor.multiSelect.splitIntoLines(); },
- readOnly: true
-}, {
- name: "alignCursors",
- description: "Align cursors",
- exec: function(editor) { editor.alignCursors(); },
- bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"},
- scrollIntoView: "cursor"
-}, {
- name: "findAll",
- description: "Find all",
- exec: function(editor) { editor.findAll(); },
- bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
- scrollIntoView: "cursor",
- readOnly: true
-}];
-exports.multiSelectCommands = [{
- name: "singleSelection",
- description: "Single selection",
- bindKey: "esc",
- exec: function(editor) { editor.exitMultiSelectMode(); },
- scrollIntoView: "cursor",
- readOnly: true,
- isAvailable: function(editor) {return editor && editor.inMultiSelectMode;}
-}];
-
-var HashHandler = require("../keyboard/hash_handler").HashHandler;
-exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
-
-});
-
-define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"], function(require, exports, module) {
-
-var RangeList = require("./range_list").RangeList;
-var Range = require("./range").Range;
-var Selection = require("./selection").Selection;
-var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
-var event = require("./lib/event");
-var lang = require("./lib/lang");
-var commands = require("./commands/multi_select_commands");
-exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
-var Search = require("./search").Search;
-var search = new Search();
-
-function find(session, needle, dir) {
- search.$options.wrap = true;
- search.$options.needle = needle;
- search.$options.backwards = dir == -1;
- return search.find(session);
-}
-var EditSession = require("./edit_session").EditSession;
-(function() {
- this.getSelectionMarkers = function() {
- return this.$selectionMarkers;
- };
-}).call(EditSession.prototype);
-(function() {
- this.ranges = null;
- this.rangeList = null;
- this.addRange = function(range, $blockChangeEvents) {
- if (!range)
- return;
-
- if (!this.inMultiSelectMode && this.rangeCount === 0) {
- var oldRange = this.toOrientedRange();
- this.rangeList.add(oldRange);
- this.rangeList.add(range);
- if (this.rangeList.ranges.length != 2) {
- this.rangeList.removeAll();
- return $blockChangeEvents || this.fromOrientedRange(range);
- }
- this.rangeList.removeAll();
- this.rangeList.add(oldRange);
- this.$onAddRange(oldRange);
- }
-
- if (!range.cursor)
- range.cursor = range.end;
-
- var removed = this.rangeList.add(range);
-
- this.$onAddRange(range);
-
- if (removed.length)
- this.$onRemoveRange(removed);
-
- if (this.rangeCount > 1 && !this.inMultiSelectMode) {
- this._signal("multiSelect");
- this.inMultiSelectMode = true;
- this.session.$undoSelect = false;
- this.rangeList.attach(this.session);
- }
-
- return $blockChangeEvents || this.fromOrientedRange(range);
- };
- this.toSingleRange = function(range) {
- range = range || this.ranges[0];
- var removed = this.rangeList.removeAll();
- if (removed.length)
- this.$onRemoveRange(removed);
-
- range && this.fromOrientedRange(range);
- };
- this.substractPoint = function(pos) {
- var removed = this.rangeList.substractPoint(pos);
- if (removed) {
- this.$onRemoveRange(removed);
- return removed[0];
- }
- };
- this.mergeOverlappingRanges = function() {
- var removed = this.rangeList.merge();
- if (removed.length)
- this.$onRemoveRange(removed);
- };
-
- this.$onAddRange = function(range) {
- this.rangeCount = this.rangeList.ranges.length;
- this.ranges.unshift(range);
- this._signal("addRange", {range: range});
- };
-
- this.$onRemoveRange = function(removed) {
- this.rangeCount = this.rangeList.ranges.length;
- if (this.rangeCount == 1 && this.inMultiSelectMode) {
- var lastRange = this.rangeList.ranges.pop();
- removed.push(lastRange);
- this.rangeCount = 0;
- }
-
- for (var i = removed.length; i--; ) {
- var index = this.ranges.indexOf(removed[i]);
- this.ranges.splice(index, 1);
- }
-
- this._signal("removeRange", {ranges: removed});
-
- if (this.rangeCount === 0 && this.inMultiSelectMode) {
- this.inMultiSelectMode = false;
- this._signal("singleSelect");
- this.session.$undoSelect = true;
- this.rangeList.detach(this.session);
- }
-
- lastRange = lastRange || this.ranges[0];
- if (lastRange && !lastRange.isEqual(this.getRange()))
- this.fromOrientedRange(lastRange);
- };
- this.$initRangeList = function() {
- if (this.rangeList)
- return;
-
- this.rangeList = new RangeList();
- this.ranges = [];
- this.rangeCount = 0;
- };
- this.getAllRanges = function() {
- return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
- };
- this.splitIntoLines = function () {
- var ranges = this.ranges.length ? this.ranges : [this.getRange()];
- var newRanges = [];
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i];
- var row = range.start.row;
- var endRow = range.end.row;
- if (row === endRow) {
- newRanges.push(range.clone());
- } else {
- newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length));
- while (++row < endRow)
- newRanges.push(this.getLineRange(row, true));
- newRanges.push(new Range(endRow, 0, endRow, range.end.column));
- }
- if (i == 0 && !this.isBackwards())
- newRanges = newRanges.reverse();
- }
- this.toSingleRange();
- for (var i = newRanges.length; i--;)
- this.addRange(newRanges[i]);
- };
-
- this.joinSelections = function () {
- var ranges = this.rangeList.ranges;
- var lastRange = ranges[ranges.length - 1];
- var range = Range.fromPoints(ranges[0].start, lastRange.end);
-
- this.toSingleRange();
- this.setSelectionRange(range, lastRange.cursor == lastRange.start);
- };
- this.toggleBlockSelection = function () {
- if (this.rangeCount > 1) {
- var ranges = this.rangeList.ranges;
- var lastRange = ranges[ranges.length - 1];
- var range = Range.fromPoints(ranges[0].start, lastRange.end);
-
- this.toSingleRange();
- this.setSelectionRange(range, lastRange.cursor == lastRange.start);
- } else {
- var cursor = this.session.documentToScreenPosition(this.cursor);
- var anchor = this.session.documentToScreenPosition(this.anchor);
-
- var rectSel = this.rectangularRangeBlock(cursor, anchor);
- rectSel.forEach(this.addRange, this);
- }
- };
- this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
- var rectSel = [];
-
- var xBackwards = screenCursor.column < screenAnchor.column;
- if (xBackwards) {
- var startColumn = screenCursor.column;
- var endColumn = screenAnchor.column;
- var startOffsetX = screenCursor.offsetX;
- var endOffsetX = screenAnchor.offsetX;
- } else {
- var startColumn = screenAnchor.column;
- var endColumn = screenCursor.column;
- var startOffsetX = screenAnchor.offsetX;
- var endOffsetX = screenCursor.offsetX;
- }
-
- var yBackwards = screenCursor.row < screenAnchor.row;
- if (yBackwards) {
- var startRow = screenCursor.row;
- var endRow = screenAnchor.row;
- } else {
- var startRow = screenAnchor.row;
- var endRow = screenCursor.row;
- }
-
- if (startColumn < 0)
- startColumn = 0;
- if (startRow < 0)
- startRow = 0;
-
- if (startRow == endRow)
- includeEmptyLines = true;
-
- var docEnd;
- for (var row = startRow; row <= endRow; row++) {
- var range = Range.fromPoints(
- this.session.screenToDocumentPosition(row, startColumn, startOffsetX),
- this.session.screenToDocumentPosition(row, endColumn, endOffsetX)
- );
- if (range.isEmpty()) {
- if (docEnd && isSamePoint(range.end, docEnd))
- break;
- docEnd = range.end;
- }
- range.cursor = xBackwards ? range.start : range.end;
- rectSel.push(range);
- }
-
- if (yBackwards)
- rectSel.reverse();
-
- if (!includeEmptyLines) {
- var end = rectSel.length - 1;
- while (rectSel[end].isEmpty() && end > 0)
- end--;
- if (end > 0) {
- var start = 0;
- while (rectSel[start].isEmpty())
- start++;
- }
- for (var i = end; i >= start; i--) {
- if (rectSel[i].isEmpty())
- rectSel.splice(i, 1);
- }
- }
-
- return rectSel;
- };
-}).call(Selection.prototype);
-var Editor = require("./editor").Editor;
-(function() {
- this.updateSelectionMarkers = function() {
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
- this.addSelectionMarker = function(orientedRange) {
- if (!orientedRange.cursor)
- orientedRange.cursor = orientedRange.end;
-
- var style = this.getSelectionStyle();
- orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style);
-
- this.session.$selectionMarkers.push(orientedRange);
- this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
- return orientedRange;
- };
- this.removeSelectionMarker = function(range) {
- if (!range.marker)
- return;
- this.session.removeMarker(range.marker);
- var index = this.session.$selectionMarkers.indexOf(range);
- if (index != -1)
- this.session.$selectionMarkers.splice(index, 1);
- this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
- };
-
- this.removeSelectionMarkers = function(ranges) {
- var markerList = this.session.$selectionMarkers;
- for (var i = ranges.length; i--; ) {
- var range = ranges[i];
- if (!range.marker)
- continue;
- this.session.removeMarker(range.marker);
- var index = markerList.indexOf(range);
- if (index != -1)
- markerList.splice(index, 1);
- }
- this.session.selectionMarkerCount = markerList.length;
- };
-
- this.$onAddRange = function(e) {
- this.addSelectionMarker(e.range);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onRemoveRange = function(e) {
- this.removeSelectionMarkers(e.ranges);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onMultiSelect = function(e) {
- if (this.inMultiSelectMode)
- return;
- this.inMultiSelectMode = true;
-
- this.setStyle("ace_multiselect");
- this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
- this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
-
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onSingleSelect = function(e) {
- if (this.session.multiSelect.inVirtualMode)
- return;
- this.inMultiSelectMode = false;
-
- this.unsetStyle("ace_multiselect");
- this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
-
- this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- this._emit("changeSelection");
- };
-
- this.$onMultiSelectExec = function(e) {
- var command = e.command;
- var editor = e.editor;
- if (!editor.multiSelect)
- return;
- if (!command.multiSelectAction) {
- var result = command.exec(editor, e.args || {});
- editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
- editor.multiSelect.mergeOverlappingRanges();
- } else if (command.multiSelectAction == "forEach") {
- result = editor.forEachSelection(command, e.args);
- } else if (command.multiSelectAction == "forEachLine") {
- result = editor.forEachSelection(command, e.args, true);
- } else if (command.multiSelectAction == "single") {
- editor.exitMultiSelectMode();
- result = command.exec(editor, e.args || {});
- } else {
- result = command.multiSelectAction(editor, e.args || {});
- }
- return result;
- };
- this.forEachSelection = function(cmd, args, options) {
- if (this.inVirtualSelectionMode)
- return;
- var keepOrder = options && options.keepOrder;
- var $byLines = options == true || options && options.$byLines;
- var session = this.session;
- var selection = this.selection;
- var rangeList = selection.rangeList;
- var ranges = (keepOrder ? selection : rangeList).ranges;
- var result;
-
- if (!ranges.length)
- return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
-
- var reg = selection._eventRegistry;
- selection._eventRegistry = {};
-
- var tmpSel = new Selection(session);
- this.inVirtualSelectionMode = true;
- for (var i = ranges.length; i--;) {
- if ($byLines) {
- while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)
- i--;
- }
- tmpSel.fromOrientedRange(ranges[i]);
- tmpSel.index = i;
- this.selection = session.selection = tmpSel;
- var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
- if (!result && cmdResult !== undefined)
- result = cmdResult;
- tmpSel.toOrientedRange(ranges[i]);
- }
- tmpSel.detach();
-
- this.selection = session.selection = selection;
- this.inVirtualSelectionMode = false;
- selection._eventRegistry = reg;
- selection.mergeOverlappingRanges();
- if (selection.ranges[0])
- selection.fromOrientedRange(selection.ranges[0]);
-
- var anim = this.renderer.$scrollAnimation;
- this.onCursorChange();
- this.onSelectionChange();
- if (anim && anim.from == anim.to)
- this.renderer.animateScrolling(anim.from);
-
- return result;
- };
- this.exitMultiSelectMode = function() {
- if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
- return;
- this.multiSelect.toSingleRange();
- };
-
- this.getSelectedText = function() {
- var text = "";
- if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
- var ranges = this.multiSelect.rangeList.ranges;
- var buf = [];
- for (var i = 0; i < ranges.length; i++) {
- buf.push(this.session.getTextRange(ranges[i]));
- }
- var nl = this.session.getDocument().getNewLineCharacter();
- text = buf.join(nl);
- if (text.length == (buf.length - 1) * nl.length)
- text = "";
- } else if (!this.selection.isEmpty()) {
- text = this.session.getTextRange(this.getSelectionRange());
- }
- return text;
- };
-
- this.$checkMultiselectChange = function(e, anchor) {
- if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
- var range = this.multiSelect.ranges[0];
- if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)
- return;
- var pos = anchor == this.multiSelect.anchor
- ? range.cursor == range.start ? range.end : range.start
- : range.cursor;
- if (pos.row != anchor.row
- || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
- this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
- else
- this.multiSelect.mergeOverlappingRanges();
- }
- };
- this.findAll = function(needle, options, additive) {
- options = options || {};
- options.needle = needle || options.needle;
- if (options.needle == undefined) {
- var range = this.selection.isEmpty()
- ? this.selection.getWordRange()
- : this.selection.getRange();
- options.needle = this.session.getTextRange(range);
- }
- this.$search.set(options);
-
- var ranges = this.$search.findAll(this.session);
- if (!ranges.length)
- return 0;
-
- var selection = this.multiSelect;
-
- if (!additive)
- selection.toSingleRange(ranges[0]);
-
- for (var i = ranges.length; i--; )
- selection.addRange(ranges[i], true);
- if (range && selection.rangeList.rangeAtPoint(range.start))
- selection.addRange(range, true);
-
- return ranges.length;
- };
- this.selectMoreLines = function(dir, skip) {
- var range = this.selection.toOrientedRange();
- var isBackwards = range.cursor == range.end;
-
- var screenLead = this.session.documentToScreenPosition(range.cursor);
- if (this.selection.$desiredColumn)
- screenLead.column = this.selection.$desiredColumn;
-
- var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
-
- if (!range.isEmpty()) {
- var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);
- var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
- } else {
- var anchor = lead;
- }
-
- if (isBackwards) {
- var newRange = Range.fromPoints(lead, anchor);
- newRange.cursor = newRange.start;
- } else {
- var newRange = Range.fromPoints(anchor, lead);
- newRange.cursor = newRange.end;
- }
-
- newRange.desiredColumn = screenLead.column;
- if (!this.selection.inMultiSelectMode) {
- this.selection.addRange(range);
- } else {
- if (skip)
- var toRemove = range.cursor;
- }
-
- this.selection.addRange(newRange);
- if (toRemove)
- this.selection.substractPoint(toRemove);
- };
- this.transposeSelections = function(dir) {
- var session = this.session;
- var sel = session.multiSelect;
- var all = sel.ranges;
-
- for (var i = all.length; i--; ) {
- var range = all[i];
- if (range.isEmpty()) {
- var tmp = session.getWordRange(range.start.row, range.start.column);
- range.start.row = tmp.start.row;
- range.start.column = tmp.start.column;
- range.end.row = tmp.end.row;
- range.end.column = tmp.end.column;
- }
- }
- sel.mergeOverlappingRanges();
-
- var words = [];
- for (var i = all.length; i--; ) {
- var range = all[i];
- words.unshift(session.getTextRange(range));
- }
-
- if (dir < 0)
- words.unshift(words.pop());
- else
- words.push(words.shift());
-
- for (var i = all.length; i--; ) {
- var range = all[i];
- var tmp = range.clone();
- session.replace(range, words[i]);
- range.start.row = tmp.start.row;
- range.start.column = tmp.start.column;
- }
- sel.fromOrientedRange(sel.ranges[0]);
- };
- this.selectMore = function(dir, skip, stopAtFirst) {
- var session = this.session;
- var sel = session.multiSelect;
-
- var range = sel.toOrientedRange();
- if (range.isEmpty()) {
- range = session.getWordRange(range.start.row, range.start.column);
- range.cursor = dir == -1 ? range.start : range.end;
- this.multiSelect.addRange(range);
- if (stopAtFirst)
- return;
- }
- var needle = session.getTextRange(range);
-
- var newRange = find(session, needle, dir);
- if (newRange) {
- newRange.cursor = dir == -1 ? newRange.start : newRange.end;
- this.session.unfold(newRange);
- this.multiSelect.addRange(newRange);
- this.renderer.scrollCursorIntoView(null, 0.5);
- }
- if (skip)
- this.multiSelect.substractPoint(range.cursor);
- };
- this.alignCursors = function() {
- var session = this.session;
- var sel = session.multiSelect;
- var ranges = sel.ranges;
- var row = -1;
- var sameRowRanges = ranges.filter(function(r) {
- if (r.cursor.row == row)
- return true;
- row = r.cursor.row;
- });
-
- if (!ranges.length || sameRowRanges.length == ranges.length - 1) {
- var range = this.selection.getRange();
- var fr = range.start.row, lr = range.end.row;
- var guessRange = fr == lr;
- if (guessRange) {
- var max = this.session.getLength();
- var line;
- do {
- line = this.session.getLine(lr);
- } while (/[=:]/.test(line) && ++lr < max);
- do {
- line = this.session.getLine(fr);
- } while (/[=:]/.test(line) && --fr > 0);
-
- if (fr < 0) fr = 0;
- if (lr >= max) lr = max - 1;
- }
- var lines = this.session.removeFullLines(fr, lr);
- lines = this.$reAlignText(lines, guessRange);
- this.session.insert({row: fr, column: 0}, lines.join("\n") + "\n");
- if (!guessRange) {
- range.start.column = 0;
- range.end.column = lines[lines.length - 1].length;
- }
- this.selection.setRange(range);
- } else {
- sameRowRanges.forEach(function(r) {
- sel.substractPoint(r.cursor);
- });
-
- var maxCol = 0;
- var minSpace = Infinity;
- var spaceOffsets = ranges.map(function(r) {
- var p = r.cursor;
- var line = session.getLine(p.row);
- var spaceOffset = line.substr(p.column).search(/\S/g);
- if (spaceOffset == -1)
- spaceOffset = 0;
-
- if (p.column > maxCol)
- maxCol = p.column;
- if (spaceOffset < minSpace)
- minSpace = spaceOffset;
- return spaceOffset;
- });
- ranges.forEach(function(r, i) {
- var p = r.cursor;
- var l = maxCol - p.column;
- var d = spaceOffsets[i] - minSpace;
- if (l > d)
- session.insert(p, lang.stringRepeat(" ", l - d));
- else
- session.remove(new Range(p.row, p.column, p.row, p.column - l + d));
-
- r.start.column = r.end.column = maxCol;
- r.start.row = r.end.row = p.row;
- r.cursor = r.end;
- });
- sel.fromOrientedRange(ranges[0]);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- }
- };
-
- this.$reAlignText = function(lines, forceLeft) {
- var isLeftAligned = true, isRightAligned = true;
- var startW, textW, endW;
-
- return lines.map(function(line) {
- var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/);
- if (!m)
- return [line];
-
- if (startW == null) {
- startW = m[1].length;
- textW = m[2].length;
- endW = m[3].length;
- return m;
- }
-
- if (startW + textW + endW != m[1].length + m[2].length + m[3].length)
- isRightAligned = false;
- if (startW != m[1].length)
- isLeftAligned = false;
-
- if (startW > m[1].length)
- startW = m[1].length;
- if (textW < m[2].length)
- textW = m[2].length;
- if (endW > m[3].length)
- endW = m[3].length;
-
- return m;
- }).map(forceLeft ? alignLeft :
- isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
-
- function spaces(n) {
- return lang.stringRepeat(" ", n);
- }
-
- function alignLeft(m) {
- return !m[2] ? m[0] : spaces(startW) + m[2]
- + spaces(textW - m[2].length + endW)
- + m[4].replace(/^([=:])\s+/, "$1 ");
- }
- function alignRight(m) {
- return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2]
- + spaces(endW)
- + m[4].replace(/^([=:])\s+/, "$1 ");
- }
- function unAlign(m) {
- return !m[2] ? m[0] : spaces(startW) + m[2]
- + spaces(endW)
- + m[4].replace(/^([=:])\s+/, "$1 ");
- }
- };
-}).call(Editor.prototype);
-
-
-function isSamePoint(p1, p2) {
- return p1.row == p2.row && p1.column == p2.column;
-}
-exports.onSessionChange = function(e) {
- var session = e.session;
- if (session && !session.multiSelect) {
- session.$selectionMarkers = [];
- session.selection.$initRangeList();
- session.multiSelect = session.selection;
- }
- this.multiSelect = session && session.multiSelect;
-
- var oldSession = e.oldSession;
- if (oldSession) {
- oldSession.multiSelect.off("addRange", this.$onAddRange);
- oldSession.multiSelect.off("removeRange", this.$onRemoveRange);
- oldSession.multiSelect.off("multiSelect", this.$onMultiSelect);
- oldSession.multiSelect.off("singleSelect", this.$onSingleSelect);
- oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange);
- oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange);
- }
-
- if (session) {
- session.multiSelect.on("addRange", this.$onAddRange);
- session.multiSelect.on("removeRange", this.$onRemoveRange);
- session.multiSelect.on("multiSelect", this.$onMultiSelect);
- session.multiSelect.on("singleSelect", this.$onSingleSelect);
- session.multiSelect.lead.on("change", this.$checkMultiselectChange);
- session.multiSelect.anchor.on("change", this.$checkMultiselectChange);
- }
-
- if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {
- if (session.selection.inMultiSelectMode)
- this.$onMultiSelect();
- else
- this.$onSingleSelect();
- }
-};
-function MultiSelect(editor) {
- if (editor.$multiselectOnSessionChange)
- return;
- editor.$onAddRange = editor.$onAddRange.bind(editor);
- editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
- editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
- editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
- editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);
- editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);
-
- editor.$multiselectOnSessionChange(editor);
- editor.on("changeSession", editor.$multiselectOnSessionChange);
-
- editor.on("mousedown", onMouseDown);
- editor.commands.addCommands(commands.defaultCommands);
-
- addAltCursorListeners(editor);
-}
-
-function addAltCursorListeners(editor){
- if (!editor.textInput) return;
- var el = editor.textInput.getElement();
- var altCursor = false;
- event.addListener(el, "keydown", function(e) {
- var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey);
- if (editor.$blockSelectEnabled && altDown) {
- if (!altCursor) {
- editor.renderer.setMouseCursor("crosshair");
- altCursor = true;
- }
- } else if (altCursor) {
- reset();
- }
- }, editor);
-
- event.addListener(el, "keyup", reset, editor);
- event.addListener(el, "blur", reset, editor);
- function reset(e) {
- if (altCursor) {
- editor.renderer.setMouseCursor("");
- altCursor = false;
- }
- }
-}
-
-exports.MultiSelect = MultiSelect;
-
-
-require("./config").defineOptions(Editor.prototype, "editor", {
- enableMultiselect: {
- set: function(val) {
- MultiSelect(this);
- if (val) {
- this.on("changeSession", this.$multiselectOnSessionChange);
- this.on("mousedown", onMouseDown);
- } else {
- this.off("changeSession", this.$multiselectOnSessionChange);
- this.off("mousedown", onMouseDown);
- }
- },
- value: true
- },
- enableBlockSelect: {
- set: function(val) {
- this.$blockSelectEnabled = val;
- },
- value: true
- }
-});
-
-
-
-});
-
-define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"], function(require, exports, module) {
-"use strict";
-
-var Range = require("../../range").Range;
-
-var FoldMode = exports.FoldMode = function() {};
-
-(function() {
-
- this.foldingStartMarker = null;
- this.foldingStopMarker = null;
- this.getFoldWidget = function(session, foldStyle, row) {
- var line = session.getLine(row);
- if (this.foldingStartMarker.test(line))
- return "start";
- if (foldStyle == "markbeginend"
- && this.foldingStopMarker
- && this.foldingStopMarker.test(line))
- return "end";
- return "";
- };
-
- this.getFoldWidgetRange = function(session, foldStyle, row) {
- return null;
- };
-
- this.indentationBlock = function(session, row, column) {
- var re = /\S/;
- var line = session.getLine(row);
- var startLevel = line.search(re);
- if (startLevel == -1)
- return;
-
- var startColumn = column || line.length;
- var maxRow = session.getLength();
- var startRow = row;
- var endRow = row;
-
- while (++row < maxRow) {
- var level = session.getLine(row).search(re);
-
- if (level == -1)
- continue;
-
- if (level <= startLevel) {
- var token = session.getTokenAt(row, 0);
- if (!token || token.type !== "string")
- break;
- }
-
- endRow = row;
- }
-
- if (endRow > startRow) {
- var endColumn = session.getLine(endRow).length;
- return new Range(startRow, startColumn, endRow, endColumn);
- }
- };
-
- this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
- var start = {row: row, column: column + 1};
- var end = session.$findClosingBracket(bracket, start, typeRe);
- if (!end)
- return;
-
- var fw = session.foldWidgets[end.row];
- if (fw == null)
- fw = session.getFoldWidget(end.row);
-
- if (fw == "start" && end.row > start.row) {
- end.row --;
- end.column = session.getLine(end.row).length;
- }
- return Range.fromPoints(start, end);
- };
-
- this.closingBracketBlock = function(session, bracket, row, column, typeRe) {
- var end = {row: row, column: column};
- var start = session.$findOpeningBracket(bracket, end);
-
- if (!start)
- return;
-
- start.column++;
- end.column--;
-
- return Range.fromPoints(start, end);
- };
-}).call(FoldMode.prototype);
-
-});
-
-define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
-"use strict";
-
-exports.isDark = false;
-exports.cssClass = "ace-tm";
-exports.cssText = ".ace-tm .ace_gutter {\
-background: #f0f0f0;\
-color: #333;\
-}\
-.ace-tm .ace_print-margin {\
-width: 1px;\
-background: #e8e8e8;\
-}\
-.ace-tm .ace_fold {\
-background-color: #6B72E6;\
-}\
-.ace-tm {\
-background-color: #FFFFFF;\
-color: black;\
-}\
-.ace-tm .ace_cursor {\
-color: black;\
-}\
-.ace-tm .ace_invisible {\
-color: rgb(191, 191, 191);\
-}\
-.ace-tm .ace_storage,\
-.ace-tm .ace_keyword {\
-color: blue;\
-}\
-.ace-tm .ace_constant {\
-color: rgb(197, 6, 11);\
-}\
-.ace-tm .ace_constant.ace_buildin {\
-color: rgb(88, 72, 246);\
-}\
-.ace-tm .ace_constant.ace_language {\
-color: rgb(88, 92, 246);\
-}\
-.ace-tm .ace_constant.ace_library {\
-color: rgb(6, 150, 14);\
-}\
-.ace-tm .ace_invalid {\
-background-color: rgba(255, 0, 0, 0.1);\
-color: red;\
-}\
-.ace-tm .ace_support.ace_function {\
-color: rgb(60, 76, 114);\
-}\
-.ace-tm .ace_support.ace_constant {\
-color: rgb(6, 150, 14);\
-}\
-.ace-tm .ace_support.ace_type,\
-.ace-tm .ace_support.ace_class {\
-color: rgb(109, 121, 222);\
-}\
-.ace-tm .ace_keyword.ace_operator {\
-color: rgb(104, 118, 135);\
-}\
-.ace-tm .ace_string {\
-color: rgb(3, 106, 7);\
-}\
-.ace-tm .ace_comment {\
-color: rgb(76, 136, 107);\
-}\
-.ace-tm .ace_comment.ace_doc {\
-color: rgb(0, 102, 255);\
-}\
-.ace-tm .ace_comment.ace_doc.ace_tag {\
-color: rgb(128, 159, 191);\
-}\
-.ace-tm .ace_constant.ace_numeric {\
-color: rgb(0, 0, 205);\
-}\
-.ace-tm .ace_variable {\
-color: rgb(49, 132, 149);\
-}\
-.ace-tm .ace_xml-pe {\
-color: rgb(104, 104, 91);\
-}\
-.ace-tm .ace_entity.ace_name.ace_function {\
-color: #0000A2;\
-}\
-.ace-tm .ace_heading {\
-color: rgb(12, 7, 255);\
-}\
-.ace-tm .ace_list {\
-color:rgb(185, 6, 144);\
-}\
-.ace-tm .ace_meta.ace_tag {\
-color:rgb(0, 22, 142);\
-}\
-.ace-tm .ace_string.ace_regex {\
-color: rgb(255, 0, 0)\
-}\
-.ace-tm .ace_marker-layer .ace_selection {\
-background: rgb(181, 213, 255);\
-}\
-.ace-tm.ace_multiselect .ace_selection.ace_start {\
-box-shadow: 0 0 3px 0px white;\
-}\
-.ace-tm .ace_marker-layer .ace_step {\
-background: rgb(252, 255, 0);\
-}\
-.ace-tm .ace_marker-layer .ace_stack {\
-background: rgb(164, 229, 101);\
-}\
-.ace-tm .ace_marker-layer .ace_bracket {\
-margin: -1px 0 0 -1px;\
-border: 1px solid rgb(192, 192, 192);\
-}\
-.ace-tm .ace_marker-layer .ace_active-line {\
-background: rgba(0, 0, 0, 0.07);\
-}\
-.ace-tm .ace_gutter-active-line {\
-background-color : #dcdcdc;\
-}\
-.ace-tm .ace_marker-layer .ace_selected-word {\
-background: rgb(250, 250, 255);\
-border: 1px solid rgb(200, 200, 250);\
-}\
-.ace-tm .ace_indent-guide {\
-background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
-}\
-";
-exports.$id = "ace/theme/textmate";
-
-var dom = require("../lib/dom");
-dom.importCssString(exports.cssText, exports.cssClass, false);
-});
-
-define("ace/line_widgets",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
-"use strict";
-
-var dom = require("./lib/dom");
-
-function LineWidgets(session) {
- this.session = session;
- this.session.widgetManager = this;
- this.session.getRowLength = this.getRowLength;
- this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;
- this.updateOnChange = this.updateOnChange.bind(this);
- this.renderWidgets = this.renderWidgets.bind(this);
- this.measureWidgets = this.measureWidgets.bind(this);
- this.session._changedWidgets = [];
- this.$onChangeEditor = this.$onChangeEditor.bind(this);
-
- this.session.on("change", this.updateOnChange);
- this.session.on("changeFold", this.updateOnFold);
- this.session.on("changeEditor", this.$onChangeEditor);
-}
-
-(function() {
- this.getRowLength = function(row) {
- var h;
- if (this.lineWidgets)
- h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
- else
- h = 0;
- if (!this.$useWrapMode || !this.$wrapData[row]) {
- return 1 + h;
- } else {
- return this.$wrapData[row].length + 1 + h;
- }
- };
-
- this.$getWidgetScreenLength = function() {
- var screenRows = 0;
- this.lineWidgets.forEach(function(w){
- if (w && w.rowCount && !w.hidden)
- screenRows += w.rowCount;
- });
- return screenRows;
- };
-
- this.$onChangeEditor = function(e) {
- this.attach(e.editor);
- };
-
- this.attach = function(editor) {
- if (editor && editor.widgetManager && editor.widgetManager != this)
- editor.widgetManager.detach();
-
- if (this.editor == editor)
- return;
-
- this.detach();
- this.editor = editor;
-
- if (editor) {
- editor.widgetManager = this;
- editor.renderer.on("beforeRender", this.measureWidgets);
- editor.renderer.on("afterRender", this.renderWidgets);
- }
- };
- this.detach = function(e) {
- var editor = this.editor;
- if (!editor)
- return;
-
- this.editor = null;
- editor.widgetManager = null;
-
- editor.renderer.off("beforeRender", this.measureWidgets);
- editor.renderer.off("afterRender", this.renderWidgets);
- var lineWidgets = this.session.lineWidgets;
- lineWidgets && lineWidgets.forEach(function(w) {
- if (w && w.el && w.el.parentNode) {
- w._inDocument = false;
- w.el.parentNode.removeChild(w.el);
- }
- });
- };
-
- this.updateOnFold = function(e, session) {
- var lineWidgets = session.lineWidgets;
- if (!lineWidgets || !e.action)
- return;
- var fold = e.data;
- var start = fold.start.row;
- var end = fold.end.row;
- var hide = e.action == "add";
- for (var i = start + 1; i < end; i++) {
- if (lineWidgets[i])
- lineWidgets[i].hidden = hide;
- }
- if (lineWidgets[end]) {
- if (hide) {
- if (!lineWidgets[start])
- lineWidgets[start] = lineWidgets[end];
- else
- lineWidgets[end].hidden = hide;
- } else {
- if (lineWidgets[start] == lineWidgets[end])
- lineWidgets[start] = undefined;
- lineWidgets[end].hidden = hide;
- }
- }
- };
-
- this.updateOnChange = function(delta) {
- var lineWidgets = this.session.lineWidgets;
- if (!lineWidgets) return;
-
- var startRow = delta.start.row;
- var len = delta.end.row - startRow;
-
- if (len === 0) {
- } else if (delta.action == "remove") {
- var removed = lineWidgets.splice(startRow + 1, len);
- if (!lineWidgets[startRow] && removed[removed.length - 1]) {
- lineWidgets[startRow] = removed.pop();
- }
- removed.forEach(function(w) {
- w && this.removeLineWidget(w);
- }, this);
- this.$updateRows();
- } else {
- var args = new Array(len);
- if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {
- if (delta.start.column > lineWidgets[startRow].column)
- startRow++;
- }
- args.unshift(startRow, 0);
- lineWidgets.splice.apply(lineWidgets, args);
- this.$updateRows();
- }
- };
-
- this.$updateRows = function() {
- var lineWidgets = this.session.lineWidgets;
- if (!lineWidgets) return;
- var noWidgets = true;
- lineWidgets.forEach(function(w, i) {
- if (w) {
- noWidgets = false;
- w.row = i;
- while (w.$oldWidget) {
- w.$oldWidget.row = i;
- w = w.$oldWidget;
- }
- }
- });
- if (noWidgets)
- this.session.lineWidgets = null;
- };
-
- this.$registerLineWidget = function(w) {
- if (!this.session.lineWidgets)
- this.session.lineWidgets = new Array(this.session.getLength());
-
- var old = this.session.lineWidgets[w.row];
- if (old) {
- w.$oldWidget = old;
- if (old.el && old.el.parentNode) {
- old.el.parentNode.removeChild(old.el);
- old._inDocument = false;
- }
- }
-
- this.session.lineWidgets[w.row] = w;
- return w;
- };
-
- this.addLineWidget = function(w) {
- this.$registerLineWidget(w);
- w.session = this.session;
-
- if (!this.editor) return w;
-
- var renderer = this.editor.renderer;
- if (w.html && !w.el) {
- w.el = dom.createElement("div");
- w.el.innerHTML = w.html;
- }
- if (w.el) {
- dom.addCssClass(w.el, "ace_lineWidgetContainer");
- w.el.style.position = "absolute";
- w.el.style.zIndex = 5;
- renderer.container.appendChild(w.el);
- w._inDocument = true;
-
- if (!w.coverGutter) {
- w.el.style.zIndex = 3;
- }
- if (w.pixelHeight == null) {
- w.pixelHeight = w.el.offsetHeight;
- }
- }
- if (w.rowCount == null) {
- w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
- }
-
- var fold = this.session.getFoldAt(w.row, 0);
- w.$fold = fold;
- if (fold) {
- var lineWidgets = this.session.lineWidgets;
- if (w.row == fold.end.row && !lineWidgets[fold.start.row])
- lineWidgets[fold.start.row] = w;
- else
- w.hidden = true;
- }
-
- this.session._emit("changeFold", {data:{start:{row: w.row}}});
-
- this.$updateRows();
- this.renderWidgets(null, renderer);
- this.onWidgetChanged(w);
- return w;
- };
-
- this.removeLineWidget = function(w) {
- w._inDocument = false;
- w.session = null;
- if (w.el && w.el.parentNode)
- w.el.parentNode.removeChild(w.el);
- if (w.editor && w.editor.destroy) try {
- w.editor.destroy();
- } catch(e){}
- if (this.session.lineWidgets) {
- var w1 = this.session.lineWidgets[w.row];
- if (w1 == w) {
- this.session.lineWidgets[w.row] = w.$oldWidget;
- if (w.$oldWidget)
- this.onWidgetChanged(w.$oldWidget);
- } else {
- while (w1) {
- if (w1.$oldWidget == w) {
- w1.$oldWidget = w.$oldWidget;
- break;
- }
- w1 = w1.$oldWidget;
- }
- }
- }
- this.session._emit("changeFold", {data:{start:{row: w.row}}});
- this.$updateRows();
- };
-
- this.getWidgetsAtRow = function(row) {
- var lineWidgets = this.session.lineWidgets;
- var w = lineWidgets && lineWidgets[row];
- var list = [];
- while (w) {
- list.push(w);
- w = w.$oldWidget;
- }
- return list;
- };
-
- this.onWidgetChanged = function(w) {
- this.session._changedWidgets.push(w);
- this.editor && this.editor.renderer.updateFull();
- };
-
- this.measureWidgets = function(e, renderer) {
- var changedWidgets = this.session._changedWidgets;
- var config = renderer.layerConfig;
-
- if (!changedWidgets || !changedWidgets.length) return;
- var min = Infinity;
- for (var i = 0; i < changedWidgets.length; i++) {
- var w = changedWidgets[i];
- if (!w || !w.el) continue;
- if (w.session != this.session) continue;
- if (!w._inDocument) {
- if (this.session.lineWidgets[w.row] != w)
- continue;
- w._inDocument = true;
- renderer.container.appendChild(w.el);
- }
-
- w.h = w.el.offsetHeight;
-
- if (!w.fixedWidth) {
- w.w = w.el.offsetWidth;
- w.screenWidth = Math.ceil(w.w / config.characterWidth);
- }
-
- var rowCount = w.h / config.lineHeight;
- if (w.coverLine) {
- rowCount -= this.session.getRowLineCount(w.row);
- if (rowCount < 0)
- rowCount = 0;
- }
- if (w.rowCount != rowCount) {
- w.rowCount = rowCount;
- if (w.row < min)
- min = w.row;
- }
- }
- if (min != Infinity) {
- this.session._emit("changeFold", {data:{start:{row: min}}});
- this.session.lineWidgetWidth = null;
- }
- this.session._changedWidgets = [];
- };
-
- this.renderWidgets = function(e, renderer) {
- var config = renderer.layerConfig;
- var lineWidgets = this.session.lineWidgets;
- if (!lineWidgets)
- return;
- var first = Math.min(this.firstRow, config.firstRow);
- var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length);
-
- while (first > 0 && !lineWidgets[first])
- first--;
-
- this.firstRow = config.firstRow;
- this.lastRow = config.lastRow;
-
- renderer.$cursorLayer.config = config;
- for (var i = first; i <= last; i++) {
- var w = lineWidgets[i];
- if (!w || !w.el) continue;
- if (w.hidden) {
- w.el.style.top = -100 - (w.pixelHeight || 0) + "px";
- continue;
- }
- if (!w._inDocument) {
- w._inDocument = true;
- renderer.container.appendChild(w.el);
- }
- var top = renderer.$cursorLayer.getPixelPosition({row: i, column:0}, true).top;
- if (!w.coverLine)
- top += config.lineHeight * this.session.getRowLineCount(w.row);
- w.el.style.top = top - config.offset + "px";
-
- var left = w.coverGutter ? 0 : renderer.gutterWidth;
- if (!w.fixedWidth)
- left -= renderer.scrollLeft;
- w.el.style.left = left + "px";
-
- if (w.fullWidth && w.screenWidth) {
- w.el.style.minWidth = config.width + 2 * config.padding + "px";
- }
-
- if (w.fixedWidth) {
- w.el.style.right = renderer.scrollBar.getWidth() + "px";
- } else {
- w.el.style.right = "";
- }
- }
- };
-
-}).call(LineWidgets.prototype);
-
-
-exports.LineWidgets = LineWidgets;
-
-});
-
-define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"], function(require, exports, module) {
-"use strict";
-var LineWidgets = require("../line_widgets").LineWidgets;
-var dom = require("../lib/dom");
-var Range = require("../range").Range;
-
-function binarySearch(array, needle, comparator) {
- var first = 0;
- var last = array.length - 1;
-
- while (first <= last) {
- var mid = (first + last) >> 1;
- var c = comparator(needle, array[mid]);
- if (c > 0)
- first = mid + 1;
- else if (c < 0)
- last = mid - 1;
- else
- return mid;
- }
- return -(first + 1);
-}
-
-function findAnnotations(session, row, dir) {
- var annotations = session.getAnnotations().sort(Range.comparePoints);
- if (!annotations.length)
- return;
-
- var i = binarySearch(annotations, {row: row, column: -1}, Range.comparePoints);
- if (i < 0)
- i = -i - 1;
-
- if (i >= annotations.length)
- i = dir > 0 ? 0 : annotations.length - 1;
- else if (i === 0 && dir < 0)
- i = annotations.length - 1;
-
- var annotation = annotations[i];
- if (!annotation || !dir)
- return;
-
- if (annotation.row === row) {
- do {
- annotation = annotations[i += dir];
- } while (annotation && annotation.row === row);
- if (!annotation)
- return annotations.slice();
- }
-
-
- var matched = [];
- row = annotation.row;
- do {
- matched[dir < 0 ? "unshift" : "push"](annotation);
- annotation = annotations[i += dir];
- } while (annotation && annotation.row == row);
- return matched.length && matched;
-}
-
-exports.showErrorMarker = function(editor, dir) {
- var session = editor.session;
- if (!session.widgetManager) {
- session.widgetManager = new LineWidgets(session);
- session.widgetManager.attach(editor);
- }
-
- var pos = editor.getCursorPosition();
- var row = pos.row;
- var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) {
- return w.type == "errorMarker";
- })[0];
- if (oldWidget) {
- oldWidget.destroy();
- } else {
- row -= dir;
- }
- var annotations = findAnnotations(session, row, dir);
- var gutterAnno;
- if (annotations) {
- var annotation = annotations[0];
- pos.column = (annotation.pos && typeof annotation.column != "number"
- ? annotation.pos.sc
- : annotation.column) || 0;
- pos.row = annotation.row;
- gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];
- } else if (oldWidget) {
- return;
- } else {
- gutterAnno = {
- text: ["Looks good!"],
- className: "ace_ok"
- };
- }
- editor.session.unfold(pos.row);
- editor.selection.moveToPosition(pos);
-
- var w = {
- row: pos.row,
- fixedWidth: true,
- coverGutter: true,
- el: dom.createElement("div"),
- type: "errorMarker"
- };
- var el = w.el.appendChild(dom.createElement("div"));
- var arrow = w.el.appendChild(dom.createElement("div"));
- arrow.className = "error_widget_arrow " + gutterAnno.className;
-
- var left = editor.renderer.$cursorLayer
- .getPixelPosition(pos).left;
- arrow.style.left = left + editor.renderer.gutterWidth - 5 + "px";
-
- w.el.className = "error_widget_wrapper";
- el.className = "error_widget " + gutterAnno.className;
- el.innerHTML = gutterAnno.text.join("
");
-
- el.appendChild(dom.createElement("div"));
-
- var kb = function(_, hashId, keyString) {
- if (hashId === 0 && (keyString === "esc" || keyString === "return")) {
- w.destroy();
- return {command: "null"};
- }
- };
-
- w.destroy = function() {
- if (editor.$mouseHandler.isMousePressed)
- return;
- editor.keyBinding.removeKeyboardHandler(kb);
- session.widgetManager.removeLineWidget(w);
- editor.off("changeSelection", w.destroy);
- editor.off("changeSession", w.destroy);
- editor.off("mouseup", w.destroy);
- editor.off("change", w.destroy);
- };
-
- editor.keyBinding.addKeyboardHandler(kb);
- editor.on("changeSelection", w.destroy);
- editor.on("changeSession", w.destroy);
- editor.on("mouseup", w.destroy);
- editor.on("change", w.destroy);
-
- editor.session.widgetManager.addLineWidget(w);
-
- w.el.onmousedown = editor.focus.bind(editor);
-
- editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight});
-};
-
-
-dom.importCssString("\
- .error_widget_wrapper {\
- background: inherit;\
- color: inherit;\
- border:none\
- }\
- .error_widget {\
- border-top: solid 2px;\
- border-bottom: solid 2px;\
- margin: 5px 0;\
- padding: 10px 40px;\
- white-space: pre-wrap;\
- }\
- .error_widget.ace_error, .error_widget_arrow.ace_error{\
- border-color: #ff5a5a\
- }\
- .error_widget.ace_warning, .error_widget_arrow.ace_warning{\
- border-color: #F1D817\
- }\
- .error_widget.ace_info, .error_widget_arrow.ace_info{\
- border-color: #5a5a5a\
- }\
- .error_widget.ace_ok, .error_widget_arrow.ace_ok{\
- border-color: #5aaa5a\
- }\
- .error_widget_arrow {\
- position: absolute;\
- border: solid 5px;\
- border-top-color: transparent!important;\
- border-right-color: transparent!important;\
- border-left-color: transparent!important;\
- top: -5px;\
- }\
-", "error_marker.css", false);
-
-});
-
-define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"], function(require, exports, module) {
-"use strict";
-
-require("./lib/fixoldbrowsers");
-
-var dom = require("./lib/dom");
-var event = require("./lib/event");
-
-var Range = require("./range").Range;
-var Editor = require("./editor").Editor;
-var EditSession = require("./edit_session").EditSession;
-var UndoManager = require("./undomanager").UndoManager;
-var Renderer = require("./virtual_renderer").VirtualRenderer;
-require("./worker/worker_client");
-require("./keyboard/hash_handler");
-require("./placeholder");
-require("./multi_select");
-require("./mode/folding/fold_mode");
-require("./theme/textmate");
-require("./ext/error_marker");
-
-exports.config = require("./config");
-exports.require = require;
-
-if (typeof define === "function")
- exports.define = define;
-exports.edit = function(el, options) {
- if (typeof el == "string") {
- var _id = el;
- el = document.getElementById(_id);
- if (!el)
- throw new Error("ace.edit can't find div #" + _id);
- }
-
- if (el && el.env && el.env.editor instanceof Editor)
- return el.env.editor;
-
- var value = "";
- if (el && /input|textarea/i.test(el.tagName)) {
- var oldNode = el;
- value = oldNode.value;
- el = dom.createElement("pre");
- oldNode.parentNode.replaceChild(el, oldNode);
- } else if (el) {
- value = el.textContent;
- el.innerHTML = "";
- }
-
- var doc = exports.createEditSession(value);
-
- var editor = new Editor(new Renderer(el), doc, options);
-
- var env = {
- document: doc,
- editor: editor,
- onResize: editor.resize.bind(editor, null)
- };
- if (oldNode) env.textarea = oldNode;
- event.addListener(window, "resize", env.onResize);
- editor.on("destroy", function() {
- event.removeListener(window, "resize", env.onResize);
- env.editor.container.env = null; // prevent memory leak on old ie
- });
- editor.container.env = editor.env = env;
- return editor;
-};
-exports.createEditSession = function(text, mode) {
- var doc = new EditSession(text, mode);
- doc.setUndoManager(new UndoManager());
- return doc;
-};
-exports.Range = Range;
-exports.Editor = Editor;
-exports.EditSession = EditSession;
-exports.UndoManager = UndoManager;
-exports.VirtualRenderer = Renderer;
-exports.version = exports.config.version;
-}); (function() {
- window.require(["ace/ace"], function(a) {
- if (a) {
- a.config.init(true);
- a.define = window.define;
- }
- if (!window.ace)
- window.ace = a;
- for (var key in a) if (a.hasOwnProperty(key))
- window.ace[key] = a[key];
- window.ace["default"] = window.ace;
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = window.ace;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/ace/ext-prompt.js b/GameDev/bin/Release/editor/ace/ext-prompt.js
deleted file mode 100644
index 34d7e36d..00000000
--- a/GameDev/bin/Release/editor/ace/ext-prompt.js
+++ /dev/null
@@ -1,2806 +0,0 @@
-define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"], function(require, exports, module) {
-"use strict";
-var keys = require("../../lib/keys");
-module.exports.getEditorKeybordShortcuts = function(editor) {
- var KEY_MODS = keys.KEY_MODS;
- var keybindings = [];
- var commandMap = {};
- editor.keyBinding.$handlers.forEach(function(handler) {
- var ckb = handler.commandKeyBinding;
- for (var i in ckb) {
- var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); });
- var commands = ckb[i];
- if (!Array.isArray(commands))
- commands = [commands];
- commands.forEach(function(command) {
- if (typeof command != "string")
- command = command.name;
- if (commandMap[command]) {
- commandMap[command].key += "|" + key;
- } else {
- commandMap[command] = {key: key, command: command};
- keybindings.push(commandMap[command]);
- }
- });
- }
- });
- return keybindings;
-};
-
-});
-
-define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"], function(require, exports, module) {
-"use strict";
-
-var Renderer = require("../virtual_renderer").VirtualRenderer;
-var Editor = require("../editor").Editor;
-var Range = require("../range").Range;
-var event = require("../lib/event");
-var lang = require("../lib/lang");
-var dom = require("../lib/dom");
-
-var $singleLineEditor = function(el) {
- var renderer = new Renderer(el);
-
- renderer.$maxLines = 4;
-
- var editor = new Editor(renderer);
-
- editor.setHighlightActiveLine(false);
- editor.setShowPrintMargin(false);
- editor.renderer.setShowGutter(false);
- editor.renderer.setHighlightGutterLine(false);
-
- editor.$mouseHandler.$focusTimeout = 0;
- editor.$highlightTagPending = true;
-
- return editor;
-};
-
-var AcePopup = function(parentNode) {
- var el = dom.createElement("div");
- var popup = new $singleLineEditor(el);
-
- if (parentNode)
- parentNode.appendChild(el);
- el.style.display = "none";
- popup.renderer.content.style.cursor = "default";
- popup.renderer.setStyle("ace_autocomplete");
-
- popup.setOption("displayIndentGuides", false);
- popup.setOption("dragDelay", 150);
-
- var noop = function(){};
-
- popup.focus = noop;
- popup.$isFocused = true;
-
- popup.renderer.$cursorLayer.restartTimer = noop;
- popup.renderer.$cursorLayer.element.style.opacity = 0;
-
- popup.renderer.$maxLines = 8;
- popup.renderer.$keepTextAreaAtCursor = false;
-
- popup.setHighlightActiveLine(false);
- popup.session.highlight("");
- popup.session.$searchHighlight.clazz = "ace_highlight-marker";
-
- popup.on("mousedown", function(e) {
- var pos = e.getDocumentPosition();
- popup.selection.moveToPosition(pos);
- selectionMarker.start.row = selectionMarker.end.row = pos.row;
- e.stop();
- });
-
- var lastMouseEvent;
- var hoverMarker = new Range(-1,0,-1,Infinity);
- var selectionMarker = new Range(-1,0,-1,Infinity);
- selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
- popup.setSelectOnHover = function(val) {
- if (!val) {
- hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
- } else if (hoverMarker.id) {
- popup.session.removeMarker(hoverMarker.id);
- hoverMarker.id = null;
- }
- };
- popup.setSelectOnHover(false);
- popup.on("mousemove", function(e) {
- if (!lastMouseEvent) {
- lastMouseEvent = e;
- return;
- }
- if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
- return;
- }
- lastMouseEvent = e;
- lastMouseEvent.scrollTop = popup.renderer.scrollTop;
- var row = lastMouseEvent.getDocumentPosition().row;
- if (hoverMarker.start.row != row) {
- if (!hoverMarker.id)
- popup.setRow(row);
- setHoverMarker(row);
- }
- });
- popup.renderer.on("beforeRender", function() {
- if (lastMouseEvent && hoverMarker.start.row != -1) {
- lastMouseEvent.$pos = null;
- var row = lastMouseEvent.getDocumentPosition().row;
- if (!hoverMarker.id)
- popup.setRow(row);
- setHoverMarker(row, true);
- }
- });
- popup.renderer.on("afterRender", function() {
- var row = popup.getRow();
- var t = popup.renderer.$textLayer;
- var selected = t.element.childNodes[row - t.config.firstRow];
- if (selected !== t.selectedNode && t.selectedNode)
- dom.removeCssClass(t.selectedNode, "ace_selected");
- t.selectedNode = selected;
- if (selected)
- dom.addCssClass(selected, "ace_selected");
- });
- var hideHoverMarker = function() { setHoverMarker(-1); };
- var setHoverMarker = function(row, suppressRedraw) {
- if (row !== hoverMarker.start.row) {
- hoverMarker.start.row = hoverMarker.end.row = row;
- if (!suppressRedraw)
- popup.session._emit("changeBackMarker");
- popup._emit("changeHoverMarker");
- }
- };
- popup.getHoveredRow = function() {
- return hoverMarker.start.row;
- };
-
- event.addListener(popup.container, "mouseout", hideHoverMarker);
- popup.on("hide", hideHoverMarker);
- popup.on("changeSelection", hideHoverMarker);
-
- popup.session.doc.getLength = function() {
- return popup.data.length;
- };
- popup.session.doc.getLine = function(i) {
- var data = popup.data[i];
- if (typeof data == "string")
- return data;
- return (data && data.value) || "";
- };
-
- var bgTokenizer = popup.session.bgTokenizer;
- bgTokenizer.$tokenizeRow = function(row) {
- var data = popup.data[row];
- var tokens = [];
- if (!data)
- return tokens;
- if (typeof data == "string")
- data = {value: data};
- var caption = data.caption || data.value || data.name;
-
- function addToken(value, className) {
- value && tokens.push({
- type: (data.className || "") + (className || ""),
- value: value
- });
- }
-
- var lower = caption.toLowerCase();
- var filterText = (popup.filterText || "").toLowerCase();
- var lastIndex = 0;
- var lastI = 0;
- for (var i = 0; i <= filterText.length; i++) {
- if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
- var sub = filterText.slice(lastI, i);
- lastI = i;
- var index = lower.indexOf(sub, lastIndex);
- if (index == -1) continue;
- addToken(caption.slice(lastIndex, index), "");
- lastIndex = index + sub.length;
- addToken(caption.slice(index, lastIndex), "completion-highlight");
- }
- }
- addToken(caption.slice(lastIndex, caption.length), "");
-
- if (data.meta)
- tokens.push({type: "completion-meta", value: data.meta});
- if (data.message)
- tokens.push({type: "completion-message", value: data.message});
-
- return tokens;
- };
- bgTokenizer.$updateOnChange = noop;
- bgTokenizer.start = noop;
-
- popup.session.$computeWidth = function() {
- return this.screenWidth = 0;
- };
- popup.isOpen = false;
- popup.isTopdown = false;
- popup.autoSelect = true;
- popup.filterText = "";
-
- popup.data = [];
- popup.setData = function(list, filterText) {
- popup.filterText = filterText || "";
- popup.setValue(lang.stringRepeat("\n", list.length), -1);
- popup.data = list || [];
- popup.setRow(0);
- };
- popup.getData = function(row) {
- return popup.data[row];
- };
-
- popup.getRow = function() {
- return selectionMarker.start.row;
- };
- popup.setRow = function(line) {
- line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line));
- if (selectionMarker.start.row != line) {
- popup.selection.clearSelection();
- selectionMarker.start.row = selectionMarker.end.row = line || 0;
- popup.session._emit("changeBackMarker");
- popup.moveCursorTo(line || 0, 0);
- if (popup.isOpen)
- popup._signal("select");
- }
- };
-
- popup.on("changeSelection", function() {
- if (popup.isOpen)
- popup.setRow(popup.selection.lead.row);
- popup.renderer.scrollCursorIntoView();
- });
-
- popup.hide = function() {
- this.container.style.display = "none";
- this._signal("hide");
- popup.isOpen = false;
- };
- popup.show = function(pos, lineHeight, topdownOnly) {
- var el = this.container;
- var screenHeight = window.innerHeight;
- var screenWidth = window.innerWidth;
- var renderer = this.renderer;
- var maxH = renderer.$maxLines * lineHeight * 1.4;
- var top = pos.top + this.$borderSize;
- var allowTopdown = top > screenHeight / 2 && !topdownOnly;
- if (allowTopdown && top + lineHeight + maxH > screenHeight) {
- renderer.$maxPixelHeight = top - 2 * this.$borderSize;
- el.style.top = "";
- el.style.bottom = screenHeight - top + "px";
- popup.isTopdown = false;
- } else {
- top += lineHeight;
- renderer.$maxPixelHeight = screenHeight - top - 0.2 * lineHeight;
- el.style.top = top + "px";
- el.style.bottom = "";
- popup.isTopdown = true;
- }
-
- el.style.display = "";
-
- var left = pos.left;
- if (left + el.offsetWidth > screenWidth)
- left = screenWidth - el.offsetWidth;
-
- el.style.left = left + "px";
-
- this._signal("show");
- lastMouseEvent = null;
- popup.isOpen = true;
- };
-
- popup.goTo = function(where) {
- var row = this.getRow();
- var max = this.session.getLength() - 1;
-
- switch(where) {
- case "up": row = row <= 0 ? max : row - 1; break;
- case "down": row = row >= max ? -1 : row + 1; break;
- case "start": row = 0; break;
- case "end": row = max; break;
- }
-
- this.setRow(row);
- };
-
-
- popup.getTextLeftOffset = function() {
- return this.$borderSize + this.renderer.$padding + this.$imageSize;
- };
-
- popup.$imageSize = 0;
- popup.$borderSize = 1;
-
- return popup;
-};
-
-dom.importCssString("\
-.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
- background-color: #CAD6FA;\
- z-index: 1;\
-}\
-.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
- background-color: #3a674e;\
-}\
-.ace_editor.ace_autocomplete .ace_line-hover {\
- border: 1px solid #abbffe;\
- margin-top: -1px;\
- background: rgba(233,233,253,0.4);\
- position: absolute;\
- z-index: 2;\
-}\
-.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\
- border: 1px solid rgba(109, 150, 13, 0.8);\
- background: rgba(58, 103, 78, 0.62);\
-}\
-.ace_completion-meta {\
- opacity: 0.5;\
- margin: 0.9em;\
-}\
-.ace_completion-message {\
- color: blue;\
-}\
-.ace_editor.ace_autocomplete .ace_completion-highlight{\
- color: #2d69c7;\
-}\
-.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\
- color: #93ca12;\
-}\
-.ace_editor.ace_autocomplete {\
- width: 300px;\
- z-index: 200000;\
- border: 1px lightgray solid;\
- position: fixed;\
- box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
- line-height: 1.4;\
- background: #fefefe;\
- color: #111;\
-}\
-.ace_dark.ace_editor.ace_autocomplete {\
- border: 1px #484747 solid;\
- box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\
- line-height: 1.4;\
- background: #25282c;\
- color: #c1c1c1;\
-}", "autocompletion.css", false);
-
-exports.AcePopup = AcePopup;
-exports.$singleLineEditor = $singleLineEditor;
-});
-
-define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module) {
-"use strict";
-
-exports.parForEach = function(array, fn, callback) {
- var completed = 0;
- var arLength = array.length;
- if (arLength === 0)
- callback();
- for (var i = 0; i < arLength; i++) {
- fn(array[i], function(result, err) {
- completed++;
- if (completed === arLength)
- callback(result, err);
- });
- }
-};
-
-var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
-
-exports.retrievePrecedingIdentifier = function(text, pos, regex) {
- regex = regex || ID_REGEX;
- var buf = [];
- for (var i = pos-1; i >= 0; i--) {
- if (regex.test(text[i]))
- buf.push(text[i]);
- else
- break;
- }
- return buf.reverse().join("");
-};
-
-exports.retrieveFollowingIdentifier = function(text, pos, regex) {
- regex = regex || ID_REGEX;
- var buf = [];
- for (var i = pos; i < text.length; i++) {
- if (regex.test(text[i]))
- buf.push(text[i]);
- else
- break;
- }
- return buf;
-};
-
-exports.getCompletionPrefix = function (editor) {
- var pos = editor.getCursorPosition();
- var line = editor.session.getLine(pos.row);
- var prefix;
- editor.completers.forEach(function(completer) {
- if (completer.identifierRegexps) {
- completer.identifierRegexps.forEach(function(identifierRegex) {
- if (!prefix && identifierRegex)
- prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
- }.bind(this));
- }
- }.bind(this));
- return prefix || this.retrievePrecedingIdentifier(line, pos.column);
-};
-
-});
-
-define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) {
-"use strict";
-var dom = require("./lib/dom");
-var oop = require("./lib/oop");
-var EventEmitter = require("./lib/event_emitter").EventEmitter;
-var lang = require("./lib/lang");
-var Range = require("./range").Range;
-var RangeList = require("./range_list").RangeList;
-var HashHandler = require("./keyboard/hash_handler").HashHandler;
-var Tokenizer = require("./tokenizer").Tokenizer;
-var clipboard = require("./clipboard");
-
-var VARIABLES = {
- CURRENT_WORD: function(editor) {
- return editor.session.getTextRange(editor.session.getWordRange());
- },
- SELECTION: function(editor, name, indentation) {
- var text = editor.session.getTextRange();
- if (indentation)
- return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
- return text;
- },
- CURRENT_LINE: function(editor) {
- return editor.session.getLine(editor.getCursorPosition().row);
- },
- PREV_LINE: function(editor) {
- return editor.session.getLine(editor.getCursorPosition().row - 1);
- },
- LINE_INDEX: function(editor) {
- return editor.getCursorPosition().row;
- },
- LINE_NUMBER: function(editor) {
- return editor.getCursorPosition().row + 1;
- },
- SOFT_TABS: function(editor) {
- return editor.session.getUseSoftTabs() ? "YES" : "NO";
- },
- TAB_SIZE: function(editor) {
- return editor.session.getTabSize();
- },
- CLIPBOARD: function(editor) {
- return clipboard.getText && clipboard.getText();
- },
- FILENAME: function(editor) {
- return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
- },
- FILENAME_BASE: function(editor) {
- return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
- },
- DIRECTORY: function(editor) {
- return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
- },
- FILEPATH: function(editor) { return "/not implemented.txt"; },
- WORKSPACE_NAME: function() { return "Unknown"; },
- FULLNAME: function() { return "Unknown"; },
- BLOCK_COMMENT_START: function(editor) {
- var mode = editor.session.$mode || {};
- return mode.blockComment && mode.blockComment.start || "";
- },
- BLOCK_COMMENT_END: function(editor) {
- var mode = editor.session.$mode || {};
- return mode.blockComment && mode.blockComment.end || "";
- },
- LINE_COMMENT: function(editor) {
- var mode = editor.session.$mode || {};
- return mode.lineCommentStart || "";
- },
- CURRENT_YEAR: date.bind(null, {year: "numeric"}),
- CURRENT_YEAR_SHORT: date.bind(null, {year: "2-digit"}),
- CURRENT_MONTH: date.bind(null, {month: "numeric"}),
- CURRENT_MONTH_NAME: date.bind(null, {month: "long"}),
- CURRENT_MONTH_NAME_SHORT: date.bind(null, {month: "short"}),
- CURRENT_DATE: date.bind(null, {day: "2-digit"}),
- CURRENT_DAY_NAME: date.bind(null, {weekday: "long"}),
- CURRENT_DAY_NAME_SHORT: date.bind(null, {weekday: "short"}),
- CURRENT_HOUR: date.bind(null, {hour: "2-digit", hour12: false}),
- CURRENT_MINUTE: date.bind(null, {minute: "2-digit"}),
- CURRENT_SECOND: date.bind(null, {second: "2-digit"})
-};
-
-VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
-
-function date(dateFormat) {
- var str = new Date().toLocaleString("en-us", dateFormat);
- return str.length == 1 ? "0" + str : str;
-}
-
-var SnippetManager = function() {
- this.snippetMap = {};
- this.snippetNameMap = {};
-};
-
-(function() {
- oop.implement(this, EventEmitter);
-
- this.getTokenizer = function() {
- return SnippetManager.$tokenizer || this.createTokenizer();
- };
-
- this.createTokenizer = function() {
- function TabstopToken(str) {
- str = str.substr(1);
- if (/^\d+$/.test(str))
- return [{tabstopId: parseInt(str, 10)}];
- return [{text: str}];
- }
- function escape(ch) {
- return "(?:[^\\\\" + ch + "]|\\\\.)";
- }
- var formatMatcher = {
- regex: "/(" + escape("/") + "+)/",
- onMatch: function(val, state, stack) {
- var ts = stack[0];
- ts.fmtString = true;
- ts.guard = val.slice(1, -1);
- ts.flag = "";
- return "";
- },
- next: "formatString"
- };
-
- SnippetManager.$tokenizer = new Tokenizer({
- start: [
- {regex: /\\./, onMatch: function(val, state, stack) {
- var ch = val[1];
- if (ch == "}" && stack.length) {
- val = ch;
- } else if ("`$\\".indexOf(ch) != -1) {
- val = ch;
- }
- return [val];
- }},
- {regex: /}/, onMatch: function(val, state, stack) {
- return [stack.length ? stack.shift() : val];
- }},
- {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
- {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
- var t = TabstopToken(str.substr(1));
- stack.unshift(t[0]);
- return t;
- }, next: "snippetVar"},
- {regex: /\n/, token: "newline", merge: false}
- ],
- snippetVar: [
- {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
- var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
- return operator.length == 2 ? operator[1] : "\x00";
- }).split("\x00").map(function(value){
- return {value: value};
- });
- stack[0].choices = choices;
- return [choices[0]];
- }, next: "start"},
- formatMatcher,
- {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
- ],
- formatString: [
- {regex: /:/, onMatch: function(val, state, stack) {
- if (stack.length && stack[0].expectElse) {
- stack[0].expectElse = false;
- stack[0].ifEnd = {elseEnd: stack[0]};
- return [stack[0].ifEnd];
- }
- return ":";
- }},
- {regex: /\\./, onMatch: function(val, state, stack) {
- var ch = val[1];
- if (ch == "}" && stack.length)
- val = ch;
- else if ("`$\\".indexOf(ch) != -1)
- val = ch;
- else if (ch == "n")
- val = "\n";
- else if (ch == "t")
- val = "\t";
- else if ("ulULE".indexOf(ch) != -1)
- val = {changeCase: ch, local: ch > "a"};
- return [val];
- }},
- {regex: "/\\w*}", onMatch: function(val, state, stack) {
- var next = stack.shift();
- if (next)
- next.flag = val.slice(1, -1);
- this.next = next && next.tabstopId ? "start" : "";
- return [next || val];
- }, next: "start"},
- {regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
- return [{text: val.slice(1)}];
- }},
- {regex: /\${\w+/, onMatch: function(val, state, stack) {
- var token = {text: val.slice(2)};
- stack.unshift(token);
- return [token];
- }, next: "formatStringVar"},
- {regex: /\n/, token: "newline", merge: false},
- {regex: /}/, onMatch: function(val, state, stack) {
- var next = stack.shift();
- this.next = next && next.tabstopId ? "start" : "";
- return [next || val];
- }, next: "start"}
- ],
- formatStringVar: [
- {regex: /:\/\w+}/, onMatch: function(val, state, stack) {
- var ts = stack[0];
- ts.formatFunction = val.slice(2, -1);
- return [stack.shift()];
- }, next: "formatString"},
- formatMatcher,
- {regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
- if (val[1] == "+")
- stack[0].ifEnd = stack[0];
- if (val[1] == "?")
- stack[0].expectElse = true;
- }, next: "formatString"},
- {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString"}
- ]
- });
- return SnippetManager.$tokenizer;
- };
-
- this.tokenizeTmSnippet = function(str, startState) {
- return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
- return x.value || x;
- });
- };
-
- this.getVariableValue = function(editor, name, indentation) {
- if (/^\d+$/.test(name))
- return (this.variables.__ || {})[name] || "";
- if (/^[A-Z]\d+$/.test(name))
- return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
-
- name = name.replace(/^TM_/, "");
- if (!this.variables.hasOwnProperty(name))
- return "";
- var value = this.variables[name];
- if (typeof value == "function")
- value = this.variables[name](editor, name, indentation);
- return value == null ? "" : value;
- };
-
- this.variables = VARIABLES;
- this.tmStrFormat = function(str, ch, editor) {
- if (!ch.fmt) return str;
- var flag = ch.flag || "";
- var re = ch.guard;
- re = new RegExp(re, flag.replace(/[^gim]/g, ""));
- var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
- var _self = this;
- var formatted = str.replace(re, function() {
- var oldArgs = _self.variables.__;
- _self.variables.__ = [].slice.call(arguments);
- var fmtParts = _self.resolveVariables(fmtTokens, editor);
- var gChangeCase = "E";
- for (var i = 0; i < fmtParts.length; i++) {
- var ch = fmtParts[i];
- if (typeof ch == "object") {
- fmtParts[i] = "";
- if (ch.changeCase && ch.local) {
- var next = fmtParts[i + 1];
- if (next && typeof next == "string") {
- if (ch.changeCase == "u")
- fmtParts[i] = next[0].toUpperCase();
- else
- fmtParts[i] = next[0].toLowerCase();
- fmtParts[i + 1] = next.substr(1);
- }
- } else if (ch.changeCase) {
- gChangeCase = ch.changeCase;
- }
- } else if (gChangeCase == "U") {
- fmtParts[i] = ch.toUpperCase();
- } else if (gChangeCase == "L") {
- fmtParts[i] = ch.toLowerCase();
- }
- }
- _self.variables.__ = oldArgs;
- return fmtParts.join("");
- });
- return formatted;
- };
-
- this.tmFormatFunction = function(str, ch, editor) {
- if (ch.formatFunction == "upcase")
- return str.toUpperCase();
- if (ch.formatFunction == "downcase")
- return str.toLowerCase();
- return str;
- };
-
- this.resolveVariables = function(snippet, editor) {
- var result = [];
- var indentation = "";
- var afterNewLine = true;
- for (var i = 0; i < snippet.length; i++) {
- var ch = snippet[i];
- if (typeof ch == "string") {
- result.push(ch);
- if (ch == "\n") {
- afterNewLine = true;
- indentation = "";
- }
- else if (afterNewLine) {
- indentation = /^\t*/.exec(ch)[0];
- afterNewLine = /\S/.test(ch);
- }
- continue;
- }
- if (!ch) continue;
- afterNewLine = false;
-
- if (ch.fmtString) {
- var j = snippet.indexOf(ch, i + 1);
- if (j == -1) j = snippet.length;
- ch.fmt = snippet.slice(i + 1, j);
- i = j;
- }
-
- if (ch.text) {
- var value = this.getVariableValue(editor, ch.text, indentation) + "";
- if (ch.fmtString)
- value = this.tmStrFormat(value, ch, editor);
- if (ch.formatFunction)
- value = this.tmFormatFunction(value, ch, editor);
-
- if (value && !ch.ifEnd) {
- result.push(value);
- gotoNext(ch);
- } else if (!value && ch.ifEnd) {
- gotoNext(ch.ifEnd);
- }
- } else if (ch.elseEnd) {
- gotoNext(ch.elseEnd);
- } else if (ch.tabstopId != null) {
- result.push(ch);
- } else if (ch.changeCase != null) {
- result.push(ch);
- }
- }
- function gotoNext(ch) {
- var i1 = snippet.indexOf(ch, i + 1);
- if (i1 != -1)
- i = i1;
- }
- return result;
- };
-
- this.insertSnippetForSelection = function(editor, snippetText) {
- var cursor = editor.getCursorPosition();
- var line = editor.session.getLine(cursor.row);
- var tabString = editor.session.getTabString();
- var indentString = line.match(/^\s*/)[0];
-
- if (cursor.column < indentString.length)
- indentString = indentString.slice(0, cursor.column);
-
- snippetText = snippetText.replace(/\r/g, "");
- var tokens = this.tokenizeTmSnippet(snippetText);
- tokens = this.resolveVariables(tokens, editor);
- tokens = tokens.map(function(x) {
- if (x == "\n")
- return x + indentString;
- if (typeof x == "string")
- return x.replace(/\t/g, tabString);
- return x;
- });
- var tabstops = [];
- tokens.forEach(function(p, i) {
- if (typeof p != "object")
- return;
- var id = p.tabstopId;
- var ts = tabstops[id];
- if (!ts) {
- ts = tabstops[id] = [];
- ts.index = id;
- ts.value = "";
- ts.parents = {};
- }
- if (ts.indexOf(p) !== -1)
- return;
- if (p.choices && !ts.choices)
- ts.choices = p.choices;
- ts.push(p);
- var i1 = tokens.indexOf(p, i + 1);
- if (i1 === -1)
- return;
-
- var value = tokens.slice(i + 1, i1);
- var isNested = value.some(function(t) {return typeof t === "object";});
- if (isNested && !ts.value) {
- ts.value = value;
- } else if (value.length && (!ts.value || typeof ts.value !== "string")) {
- ts.value = value.join("");
- }
- });
- tabstops.forEach(function(ts) {ts.length = 0;});
- var expanding = {};
- function copyValue(val) {
- var copy = [];
- for (var i = 0; i < val.length; i++) {
- var p = val[i];
- if (typeof p == "object") {
- if (expanding[p.tabstopId])
- continue;
- var j = val.lastIndexOf(p, i - 1);
- p = copy[j] || {tabstopId: p.tabstopId};
- }
- copy[i] = p;
- }
- return copy;
- }
- for (var i = 0; i < tokens.length; i++) {
- var p = tokens[i];
- if (typeof p != "object")
- continue;
- var id = p.tabstopId;
- var ts = tabstops[id];
- var i1 = tokens.indexOf(p, i + 1);
- if (expanding[id]) {
- if (expanding[id] === p) {
- delete expanding[id];
- Object.keys(expanding).forEach(function(parentId) {
- ts.parents[parentId] = true;
- });
- }
- continue;
- }
- expanding[id] = p;
- var value = ts.value;
- if (typeof value !== "string")
- value = copyValue(value);
- else if (p.fmt)
- value = this.tmStrFormat(value, p, editor);
- tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
-
- if (ts.indexOf(p) === -1)
- ts.push(p);
- }
- var row = 0, column = 0;
- var text = "";
- tokens.forEach(function(t) {
- if (typeof t === "string") {
- var lines = t.split("\n");
- if (lines.length > 1){
- column = lines[lines.length - 1].length;
- row += lines.length - 1;
- } else
- column += t.length;
- text += t;
- } else if (t) {
- if (!t.start)
- t.start = {row: row, column: column};
- else
- t.end = {row: row, column: column};
- }
- });
- var range = editor.getSelectionRange();
- var end = editor.session.replace(range, text);
-
- var tabstopManager = new TabstopManager(editor);
- var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
- tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
- };
-
- this.insertSnippet = function(editor, snippetText) {
- var self = this;
- if (editor.inVirtualSelectionMode)
- return self.insertSnippetForSelection(editor, snippetText);
-
- editor.forEachSelection(function() {
- self.insertSnippetForSelection(editor, snippetText);
- }, null, {keepOrder: true});
-
- if (editor.tabstopManager)
- editor.tabstopManager.tabNext();
- };
-
- this.$getScope = function(editor) {
- var scope = editor.session.$mode.$id || "";
- scope = scope.split("/").pop();
- if (scope === "html" || scope === "php") {
- if (scope === "php" && !editor.session.$mode.inlinePhp)
- scope = "html";
- var c = editor.getCursorPosition();
- var state = editor.session.getState(c.row);
- if (typeof state === "object") {
- state = state[0];
- }
- if (state.substring) {
- if (state.substring(0, 3) == "js-")
- scope = "javascript";
- else if (state.substring(0, 4) == "css-")
- scope = "css";
- else if (state.substring(0, 4) == "php-")
- scope = "php";
- }
- }
-
- return scope;
- };
-
- this.getActiveScopes = function(editor) {
- var scope = this.$getScope(editor);
- var scopes = [scope];
- var snippetMap = this.snippetMap;
- if (snippetMap[scope] && snippetMap[scope].includeScopes) {
- scopes.push.apply(scopes, snippetMap[scope].includeScopes);
- }
- scopes.push("_");
- return scopes;
- };
-
- this.expandWithTab = function(editor, options) {
- var self = this;
- var result = editor.forEachSelection(function() {
- return self.expandSnippetForSelection(editor, options);
- }, null, {keepOrder: true});
- if (result && editor.tabstopManager)
- editor.tabstopManager.tabNext();
- return result;
- };
-
- this.expandSnippetForSelection = function(editor, options) {
- var cursor = editor.getCursorPosition();
- var line = editor.session.getLine(cursor.row);
- var before = line.substring(0, cursor.column);
- var after = line.substr(cursor.column);
-
- var snippetMap = this.snippetMap;
- var snippet;
- this.getActiveScopes(editor).some(function(scope) {
- var snippets = snippetMap[scope];
- if (snippets)
- snippet = this.findMatchingSnippet(snippets, before, after);
- return !!snippet;
- }, this);
- if (!snippet)
- return false;
- if (options && options.dryRun)
- return true;
- editor.session.doc.removeInLine(cursor.row,
- cursor.column - snippet.replaceBefore.length,
- cursor.column + snippet.replaceAfter.length
- );
-
- this.variables.M__ = snippet.matchBefore;
- this.variables.T__ = snippet.matchAfter;
- this.insertSnippetForSelection(editor, snippet.content);
-
- this.variables.M__ = this.variables.T__ = null;
- return true;
- };
-
- this.findMatchingSnippet = function(snippetList, before, after) {
- for (var i = snippetList.length; i--;) {
- var s = snippetList[i];
- if (s.startRe && !s.startRe.test(before))
- continue;
- if (s.endRe && !s.endRe.test(after))
- continue;
- if (!s.startRe && !s.endRe)
- continue;
-
- s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
- s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
- s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
- s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
- return s;
- }
- };
-
- this.snippetMap = {};
- this.snippetNameMap = {};
- this.register = function(snippets, scope) {
- var snippetMap = this.snippetMap;
- var snippetNameMap = this.snippetNameMap;
- var self = this;
-
- if (!snippets)
- snippets = [];
-
- function wrapRegexp(src) {
- if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
- src = "(?:" + src + ")";
-
- return src || "";
- }
- function guardedRegexp(re, guard, opening) {
- re = wrapRegexp(re);
- guard = wrapRegexp(guard);
- if (opening) {
- re = guard + re;
- if (re && re[re.length - 1] != "$")
- re = re + "$";
- } else {
- re = re + guard;
- if (re && re[0] != "^")
- re = "^" + re;
- }
- return new RegExp(re);
- }
-
- function addSnippet(s) {
- if (!s.scope)
- s.scope = scope || "_";
- scope = s.scope;
- if (!snippetMap[scope]) {
- snippetMap[scope] = [];
- snippetNameMap[scope] = {};
- }
-
- var map = snippetNameMap[scope];
- if (s.name) {
- var old = map[s.name];
- if (old)
- self.unregister(old);
- map[s.name] = s;
- }
- snippetMap[scope].push(s);
-
- if (s.prefix)
- s.tabTrigger = s.prefix;
-
- if (!s.content && s.body)
- s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
-
- if (s.tabTrigger && !s.trigger) {
- if (!s.guard && /^\w/.test(s.tabTrigger))
- s.guard = "\\b";
- s.trigger = lang.escapeRegExp(s.tabTrigger);
- }
-
- if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
- return;
-
- s.startRe = guardedRegexp(s.trigger, s.guard, true);
- s.triggerRe = new RegExp(s.trigger);
-
- s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
- s.endTriggerRe = new RegExp(s.endTrigger);
- }
-
- if (Array.isArray(snippets)) {
- snippets.forEach(addSnippet);
- } else {
- Object.keys(snippets).forEach(function(key) {
- addSnippet(snippets[key]);
- });
- }
-
- this._signal("registerSnippets", {scope: scope});
- };
- this.unregister = function(snippets, scope) {
- var snippetMap = this.snippetMap;
- var snippetNameMap = this.snippetNameMap;
-
- function removeSnippet(s) {
- var nameMap = snippetNameMap[s.scope||scope];
- if (nameMap && nameMap[s.name]) {
- delete nameMap[s.name];
- var map = snippetMap[s.scope||scope];
- var i = map && map.indexOf(s);
- if (i >= 0)
- map.splice(i, 1);
- }
- }
- if (snippets.content)
- removeSnippet(snippets);
- else if (Array.isArray(snippets))
- snippets.forEach(removeSnippet);
- };
- this.parseSnippetFile = function(str) {
- str = str.replace(/\r/g, "");
- var list = [], snippet = {};
- var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
- var m;
- while (m = re.exec(str)) {
- if (m[1]) {
- try {
- snippet = JSON.parse(m[1]);
- list.push(snippet);
- } catch (e) {}
- } if (m[4]) {
- snippet.content = m[4].replace(/^\t/gm, "");
- list.push(snippet);
- snippet = {};
- } else {
- var key = m[2], val = m[3];
- if (key == "regex") {
- var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
- snippet.guard = guardRe.exec(val)[1];
- snippet.trigger = guardRe.exec(val)[1];
- snippet.endTrigger = guardRe.exec(val)[1];
- snippet.endGuard = guardRe.exec(val)[1];
- } else if (key == "snippet") {
- snippet.tabTrigger = val.match(/^\S*/)[0];
- if (!snippet.name)
- snippet.name = val;
- } else if (key) {
- snippet[key] = val;
- }
- }
- }
- return list;
- };
- this.getSnippetByName = function(name, editor) {
- var snippetMap = this.snippetNameMap;
- var snippet;
- this.getActiveScopes(editor).some(function(scope) {
- var snippets = snippetMap[scope];
- if (snippets)
- snippet = snippets[name];
- return !!snippet;
- }, this);
- return snippet;
- };
-
-}).call(SnippetManager.prototype);
-
-
-var TabstopManager = function(editor) {
- if (editor.tabstopManager)
- return editor.tabstopManager;
- editor.tabstopManager = this;
- this.$onChange = this.onChange.bind(this);
- this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
- this.$onChangeSession = this.onChangeSession.bind(this);
- this.$onAfterExec = this.onAfterExec.bind(this);
- this.attach(editor);
-};
-(function() {
- this.attach = function(editor) {
- this.index = 0;
- this.ranges = [];
- this.tabstops = [];
- this.$openTabstops = null;
- this.selectedTabstop = null;
-
- this.editor = editor;
- this.editor.on("change", this.$onChange);
- this.editor.on("changeSelection", this.$onChangeSelection);
- this.editor.on("changeSession", this.$onChangeSession);
- this.editor.commands.on("afterExec", this.$onAfterExec);
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
- };
- this.detach = function() {
- this.tabstops.forEach(this.removeTabstopMarkers, this);
- this.ranges = null;
- this.tabstops = null;
- this.selectedTabstop = null;
- this.editor.removeListener("change", this.$onChange);
- this.editor.removeListener("changeSelection", this.$onChangeSelection);
- this.editor.removeListener("changeSession", this.$onChangeSession);
- this.editor.commands.removeListener("afterExec", this.$onAfterExec);
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
- this.editor.tabstopManager = null;
- this.editor = null;
- };
-
- this.onChange = function(delta) {
- var isRemove = delta.action[0] == "r";
- var selectedTabstop = this.selectedTabstop || {};
- var parents = selectedTabstop.parents || {};
- var tabstops = (this.tabstops || []).slice();
- for (var i = 0; i < tabstops.length; i++) {
- var ts = tabstops[i];
- var active = ts == selectedTabstop || parents[ts.index];
- ts.rangeList.$bias = active ? 0 : 1;
-
- if (delta.action == "remove" && ts !== selectedTabstop) {
- var parentActive = ts.parents && ts.parents[selectedTabstop.index];
- var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
- startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
- var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
- endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
- var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
- for (var j = 0; j < toRemove.length; j++)
- this.removeRange(toRemove[j]);
- }
- ts.rangeList.$onChange(delta);
- }
- var session = this.editor.session;
- if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
- this.detach();
- };
- this.updateLinkedFields = function() {
- var ts = this.selectedTabstop;
- if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
- return;
- this.$inChange = true;
- var session = this.editor.session;
- var text = session.getTextRange(ts.firstNonLinked);
- for (var i = 0; i < ts.length; i++) {
- var range = ts[i];
- if (!range.linked)
- continue;
- var original = range.original;
- var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
- session.replace(range, fmt);
- }
- this.$inChange = false;
- };
- this.onAfterExec = function(e) {
- if (e.command && !e.command.readOnly)
- this.updateLinkedFields();
- };
- this.onChangeSelection = function() {
- if (!this.editor)
- return;
- var lead = this.editor.selection.lead;
- var anchor = this.editor.selection.anchor;
- var isEmpty = this.editor.selection.isEmpty();
- for (var i = 0; i < this.ranges.length; i++) {
- if (this.ranges[i].linked)
- continue;
- var containsLead = this.ranges[i].contains(lead.row, lead.column);
- var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
- if (containsLead && containsAnchor)
- return;
- }
- this.detach();
- };
- this.onChangeSession = function() {
- this.detach();
- };
- this.tabNext = function(dir) {
- var max = this.tabstops.length;
- var index = this.index + (dir || 1);
- index = Math.min(Math.max(index, 1), max);
- if (index == max)
- index = 0;
- this.selectTabstop(index);
- if (index === 0)
- this.detach();
- };
- this.selectTabstop = function(index) {
- this.$openTabstops = null;
- var ts = this.tabstops[this.index];
- if (ts)
- this.addTabstopMarkers(ts);
- this.index = index;
- ts = this.tabstops[this.index];
- if (!ts || !ts.length)
- return;
-
- this.selectedTabstop = ts;
- var range = ts.firstNonLinked || ts;
- if (ts.choices) range.cursor = range.start;
- if (!this.editor.inVirtualSelectionMode) {
- var sel = this.editor.multiSelect;
- sel.toSingleRange(range);
- for (var i = 0; i < ts.length; i++) {
- if (ts.hasLinkedRanges && ts[i].linked)
- continue;
- sel.addRange(ts[i].clone(), true);
- }
- } else {
- this.editor.selection.fromOrientedRange(range);
- }
-
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
- if (this.selectedTabstop && this.selectedTabstop.choices)
- this.editor.execCommand("startAutocomplete", {matches: this.selectedTabstop.choices});
- };
- this.addTabstops = function(tabstops, start, end) {
- var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
-
- if (!this.$openTabstops)
- this.$openTabstops = [];
- if (!tabstops[0]) {
- var p = Range.fromPoints(end, end);
- moveRelative(p.start, start);
- moveRelative(p.end, start);
- tabstops[0] = [p];
- tabstops[0].index = 0;
- }
-
- var i = this.index;
- var arg = [i + 1, 0];
- var ranges = this.ranges;
- tabstops.forEach(function(ts, index) {
- var dest = this.$openTabstops[index] || ts;
-
- for (var i = 0; i < ts.length; i++) {
- var p = ts[i];
- var range = Range.fromPoints(p.start, p.end || p.start);
- movePoint(range.start, start);
- movePoint(range.end, start);
- range.original = p;
- range.tabstop = dest;
- ranges.push(range);
- if (dest != ts)
- dest.unshift(range);
- else
- dest[i] = range;
- if (p.fmtString || (dest.firstNonLinked && useLink)) {
- range.linked = true;
- dest.hasLinkedRanges = true;
- } else if (!dest.firstNonLinked)
- dest.firstNonLinked = range;
- }
- if (!dest.firstNonLinked)
- dest.hasLinkedRanges = false;
- if (dest === ts) {
- arg.push(dest);
- this.$openTabstops[index] = dest;
- }
- this.addTabstopMarkers(dest);
- dest.rangeList = dest.rangeList || new RangeList();
- dest.rangeList.$bias = 0;
- dest.rangeList.addList(dest);
- }, this);
-
- if (arg.length > 2) {
- if (this.tabstops.length)
- arg.push(arg.splice(2, 1)[0]);
- this.tabstops.splice.apply(this.tabstops, arg);
- }
- };
-
- this.addTabstopMarkers = function(ts) {
- var session = this.editor.session;
- ts.forEach(function(range) {
- if (!range.markerId)
- range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
- });
- };
- this.removeTabstopMarkers = function(ts) {
- var session = this.editor.session;
- ts.forEach(function(range) {
- session.removeMarker(range.markerId);
- range.markerId = null;
- });
- };
- this.removeRange = function(range) {
- var i = range.tabstop.indexOf(range);
- if (i != -1) range.tabstop.splice(i, 1);
- i = this.ranges.indexOf(range);
- if (i != -1) this.ranges.splice(i, 1);
- i = range.tabstop.rangeList.ranges.indexOf(range);
- if (i != -1) range.tabstop.splice(i, 1);
- this.editor.session.removeMarker(range.markerId);
- if (!range.tabstop.length) {
- i = this.tabstops.indexOf(range.tabstop);
- if (i != -1)
- this.tabstops.splice(i, 1);
- if (!this.tabstops.length)
- this.detach();
- }
- };
-
- this.keyboardHandler = new HashHandler();
- this.keyboardHandler.bindKeys({
- "Tab": function(editor) {
- if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
- return;
- editor.tabstopManager.tabNext(1);
- editor.renderer.scrollCursorIntoView();
- },
- "Shift-Tab": function(editor) {
- editor.tabstopManager.tabNext(-1);
- editor.renderer.scrollCursorIntoView();
- },
- "Esc": function(editor) {
- editor.tabstopManager.detach();
- }
- });
-}).call(TabstopManager.prototype);
-
-
-
-var movePoint = function(point, diff) {
- if (point.row == 0)
- point.column += diff.column;
- point.row += diff.row;
-};
-
-var moveRelative = function(point, start) {
- if (point.row == start.row)
- point.column -= start.column;
- point.row -= start.row;
-};
-
-
-dom.importCssString("\
-.ace_snippet-marker {\
- -moz-box-sizing: border-box;\
- box-sizing: border-box;\
- background: rgba(194, 193, 208, 0.09);\
- border: 1px dotted rgba(211, 208, 235, 0.62);\
- position: absolute;\
-}", "snippets.css", false);
-
-exports.snippetManager = new SnippetManager();
-
-
-var Editor = require("./editor").Editor;
-(function() {
- this.insertSnippet = function(content, options) {
- return exports.snippetManager.insertSnippet(this, content, options);
- };
- this.expandSnippet = function(options) {
- return exports.snippetManager.expandWithTab(this, options);
- };
-}).call(Editor.prototype);
-
-});
-
-define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"], function(require, exports, module) {
-"use strict";
-
-var HashHandler = require("./keyboard/hash_handler").HashHandler;
-var AcePopup = require("./autocomplete/popup").AcePopup;
-var util = require("./autocomplete/util");
-var lang = require("./lib/lang");
-var dom = require("./lib/dom");
-var snippetManager = require("./snippets").snippetManager;
-var config = require("./config");
-
-var Autocomplete = function() {
- this.autoInsert = false;
- this.autoSelect = true;
- this.exactMatch = false;
- this.gatherCompletionsId = 0;
- this.keyboardHandler = new HashHandler();
- this.keyboardHandler.bindKeys(this.commands);
-
- this.blurListener = this.blurListener.bind(this);
- this.changeListener = this.changeListener.bind(this);
- this.mousedownListener = this.mousedownListener.bind(this);
- this.mousewheelListener = this.mousewheelListener.bind(this);
-
- this.changeTimer = lang.delayedCall(function() {
- this.updateCompletions(true);
- }.bind(this));
-
- this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
-};
-
-(function() {
-
- this.$init = function() {
- this.popup = new AcePopup(document.body || document.documentElement);
- this.popup.on("click", function(e) {
- this.insertMatch();
- e.stop();
- }.bind(this));
- this.popup.focus = this.editor.focus.bind(this.editor);
- this.popup.on("show", this.tooltipTimer.bind(null, null));
- this.popup.on("select", this.tooltipTimer.bind(null, null));
- this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
- return this.popup;
- };
-
- this.getPopup = function() {
- return this.popup || this.$init();
- };
-
- this.openPopup = function(editor, prefix, keepPopupPosition) {
- if (!this.popup)
- this.$init();
-
- this.popup.autoSelect = this.autoSelect;
-
- this.popup.setData(this.completions.filtered, this.completions.filterText);
-
- editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
-
- var renderer = editor.renderer;
- this.popup.setRow(this.autoSelect ? 0 : -1);
- if (!keepPopupPosition) {
- this.popup.setTheme(editor.getTheme());
- this.popup.setFontSize(editor.getFontSize());
-
- var lineHeight = renderer.layerConfig.lineHeight;
-
- var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
- pos.left -= this.popup.getTextLeftOffset();
-
- var rect = editor.container.getBoundingClientRect();
- pos.top += rect.top - renderer.layerConfig.offset;
- pos.left += rect.left - editor.renderer.scrollLeft;
- pos.left += renderer.gutterWidth;
-
- this.popup.show(pos, lineHeight);
- } else if (keepPopupPosition && !prefix) {
- this.detach();
- }
- this.changeTimer.cancel();
- };
-
- this.detach = function() {
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
- this.editor.off("changeSelection", this.changeListener);
- this.editor.off("blur", this.blurListener);
- this.editor.off("mousedown", this.mousedownListener);
- this.editor.off("mousewheel", this.mousewheelListener);
- this.changeTimer.cancel();
- this.hideDocTooltip();
-
- this.gatherCompletionsId += 1;
- if (this.popup && this.popup.isOpen)
- this.popup.hide();
-
- if (this.base)
- this.base.detach();
- this.activated = false;
- this.completions = this.base = null;
- };
-
- this.changeListener = function(e) {
- var cursor = this.editor.selection.lead;
- if (cursor.row != this.base.row || cursor.column < this.base.column) {
- this.detach();
- }
- if (this.activated)
- this.changeTimer.schedule();
- else
- this.detach();
- };
-
- this.blurListener = function(e) {
- var el = document.activeElement;
- var text = this.editor.textInput.getElement();
- var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
- var container = this.popup && this.popup.container;
- if (el != text && el.parentNode != container && !fromTooltip
- && el != this.tooltipNode && e.relatedTarget != text
- ) {
- this.detach();
- }
- };
-
- this.mousedownListener = function(e) {
- this.detach();
- };
-
- this.mousewheelListener = function(e) {
- this.detach();
- };
-
- this.goTo = function(where) {
- this.popup.goTo(where);
- };
-
- this.insertMatch = function(data, options) {
- if (!data)
- data = this.popup.getData(this.popup.getRow());
- if (!data)
- return false;
-
- var completions = this.completions;
- this.editor.startOperation({command: {name: "insertMatch"}});
- if (data.completer && data.completer.insertMatch) {
- data.completer.insertMatch(this.editor, data);
- } else {
- if (completions.filterText) {
- var ranges = this.editor.selection.getAllRanges();
- for (var i = 0, range; range = ranges[i]; i++) {
- range.start.column -= completions.filterText.length;
- this.editor.session.remove(range);
- }
- }
- if (data.snippet)
- snippetManager.insertSnippet(this.editor, data.snippet);
- else
- this.editor.execCommand("insertstring", data.value || data);
- }
- if (this.completions == completions)
- this.detach();
- this.editor.endOperation();
- };
-
-
- this.commands = {
- "Up": function(editor) { editor.completer.goTo("up"); },
- "Down": function(editor) { editor.completer.goTo("down"); },
- "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
- "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
-
- "Esc": function(editor) { editor.completer.detach(); },
- "Return": function(editor) { return editor.completer.insertMatch(); },
- "Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },
- "Tab": function(editor) {
- var result = editor.completer.insertMatch();
- if (!result && !editor.tabstopManager)
- editor.completer.goTo("down");
- else
- return result;
- },
-
- "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
- "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
- };
-
- this.gatherCompletions = function(editor, callback) {
- var session = editor.getSession();
- var pos = editor.getCursorPosition();
-
- var prefix = util.getCompletionPrefix(editor);
-
- this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
- this.base.$insertRight = true;
-
- var matches = [];
- var total = editor.completers.length;
- editor.completers.forEach(function(completer, i) {
- completer.getCompletions(editor, session, pos, prefix, function(err, results) {
- if (!err && results)
- matches = matches.concat(results);
- callback(null, {
- prefix: util.getCompletionPrefix(editor),
- matches: matches,
- finished: (--total === 0)
- });
- });
- });
- return true;
- };
-
- this.showPopup = function(editor, options) {
- if (this.editor)
- this.detach();
-
- this.activated = true;
-
- this.editor = editor;
- if (editor.completer != this) {
- if (editor.completer)
- editor.completer.detach();
- editor.completer = this;
- }
-
- editor.on("changeSelection", this.changeListener);
- editor.on("blur", this.blurListener);
- editor.on("mousedown", this.mousedownListener);
- editor.on("mousewheel", this.mousewheelListener);
-
- this.updateCompletions(false, options);
- };
-
- this.updateCompletions = function(keepPopupPosition, options) {
- if (keepPopupPosition && this.base && this.completions) {
- var pos = this.editor.getCursorPosition();
- var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
- if (prefix == this.completions.filterText)
- return;
- this.completions.setFilter(prefix);
- if (!this.completions.filtered.length)
- return this.detach();
- if (this.completions.filtered.length == 1
- && this.completions.filtered[0].value == prefix
- && !this.completions.filtered[0].snippet)
- return this.detach();
- this.openPopup(this.editor, prefix, keepPopupPosition);
- return;
- }
-
- if (options && options.matches) {
- var pos = this.editor.getSelectionRange().start;
- this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
- this.base.$insertRight = true;
- this.completions = new FilteredList(options.matches);
- return this.openPopup(this.editor, "", keepPopupPosition);
- }
- var _id = this.gatherCompletionsId;
- var detachIfFinished = function(results) {
- if (!results.finished) return;
- return this.detach();
- }.bind(this);
-
- var processResults = function(results) {
- var prefix = results.prefix;
- var matches = results.matches;
-
- this.completions = new FilteredList(matches);
-
- if (this.exactMatch)
- this.completions.exactMatch = true;
-
- this.completions.setFilter(prefix);
- var filtered = this.completions.filtered;
- if (!filtered.length)
- return detachIfFinished(results);
- if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
- return detachIfFinished(results);
- if (this.autoInsert && filtered.length == 1 && results.finished)
- return this.insertMatch(filtered[0]);
-
- this.openPopup(this.editor, prefix, keepPopupPosition);
- }.bind(this);
-
- var isImmediate = true;
- var immediateResults = null;
- this.gatherCompletions(this.editor, function(err, results) {
- var prefix = results.prefix;
- var matches = results && results.matches;
-
- if (!matches || !matches.length)
- return detachIfFinished(results);
- if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
- return;
- if (isImmediate) {
- immediateResults = results;
- return;
- }
-
- processResults(results);
- }.bind(this));
-
- isImmediate = false;
- if (immediateResults) {
- var results = immediateResults;
- immediateResults = null;
- processResults(results);
- }
- };
-
- this.cancelContextMenu = function() {
- this.editor.$mouseHandler.cancelContextMenu();
- };
-
- this.updateDocTooltip = function() {
- var popup = this.popup;
- var all = popup.data;
- var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
- var doc = null;
- if (!selected || !this.editor || !this.popup.isOpen)
- return this.hideDocTooltip();
- this.editor.completers.some(function(completer) {
- if (completer.getDocTooltip)
- doc = completer.getDocTooltip(selected);
- return doc;
- });
- if (!doc && typeof selected != "string")
- doc = selected;
-
- if (typeof doc == "string")
- doc = {docText: doc};
- if (!doc || !(doc.docHTML || doc.docText))
- return this.hideDocTooltip();
- this.showDocTooltip(doc);
- };
-
- this.showDocTooltip = function(item) {
- if (!this.tooltipNode) {
- this.tooltipNode = dom.createElement("div");
- this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
- this.tooltipNode.style.margin = 0;
- this.tooltipNode.style.pointerEvents = "auto";
- this.tooltipNode.tabIndex = -1;
- this.tooltipNode.onblur = this.blurListener.bind(this);
- this.tooltipNode.onclick = this.onTooltipClick.bind(this);
- }
-
- var tooltipNode = this.tooltipNode;
- if (item.docHTML) {
- tooltipNode.innerHTML = item.docHTML;
- } else if (item.docText) {
- tooltipNode.textContent = item.docText;
- }
-
- if (!tooltipNode.parentNode)
- document.body.appendChild(tooltipNode);
- var popup = this.popup;
- var rect = popup.container.getBoundingClientRect();
- tooltipNode.style.top = popup.container.style.top;
- tooltipNode.style.bottom = popup.container.style.bottom;
-
- tooltipNode.style.display = "block";
- if (window.innerWidth - rect.right < 320) {
- if (rect.left < 320) {
- if(popup.isTopdown) {
- tooltipNode.style.top = rect.bottom + "px";
- tooltipNode.style.left = rect.left + "px";
- tooltipNode.style.right = "";
- tooltipNode.style.bottom = "";
- } else {
- tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
- tooltipNode.style.left = rect.left + "px";
- tooltipNode.style.right = "";
- tooltipNode.style.bottom = "";
- }
- } else {
- tooltipNode.style.right = window.innerWidth - rect.left + "px";
- tooltipNode.style.left = "";
- }
- } else {
- tooltipNode.style.left = (rect.right + 1) + "px";
- tooltipNode.style.right = "";
- }
- };
-
- this.hideDocTooltip = function() {
- this.tooltipTimer.cancel();
- if (!this.tooltipNode) return;
- var el = this.tooltipNode;
- if (!this.editor.isFocused() && document.activeElement == el)
- this.editor.focus();
- this.tooltipNode = null;
- if (el.parentNode)
- el.parentNode.removeChild(el);
- };
-
- this.onTooltipClick = function(e) {
- var a = e.target;
- while (a && a != this.tooltipNode) {
- if (a.nodeName == "A" && a.href) {
- a.rel = "noreferrer";
- a.target = "_blank";
- break;
- }
- a = a.parentNode;
- }
- };
-
- this.destroy = function() {
- this.detach();
- if (this.popup) {
- this.popup.destroy();
- var el = this.popup.container;
- if (el && el.parentNode)
- el.parentNode.removeChild(el);
- }
- if (this.editor && this.editor.completer == this)
- this.editor.completer == null;
- this.popup = null;
- };
-
-}).call(Autocomplete.prototype);
-
-
-Autocomplete.for = function(editor) {
- if (editor.completer) {
- return editor.completer;
- }
- if (config.get("sharedPopups")) {
- if (!Autocomplete.$shared)
- Autocomplete.$sharedInstance = new Autocomplete();
- editor.completer = Autocomplete.$sharedInstance;
- } else {
- editor.completer = new Autocomplete();
- editor.once("destroy", function(e, editor) {
- editor.completer.destroy();
- });
- }
- return editor.completer;
-};
-
-Autocomplete.startCommand = {
- name: "startAutocomplete",
- exec: function(editor, options) {
- var completer = Autocomplete.for(editor);
- completer.autoInsert = false;
- completer.autoSelect = true;
- completer.showPopup(editor, options);
- completer.cancelContextMenu();
- },
- bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
-};
-
-var FilteredList = function(array, filterText) {
- this.all = array;
- this.filtered = array;
- this.filterText = filterText || "";
- this.exactMatch = false;
-};
-(function(){
- this.setFilter = function(str) {
- if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
- var matches = this.filtered;
- else
- var matches = this.all;
-
- this.filterText = str;
- matches = this.filterCompletions(matches, this.filterText);
- matches = matches.sort(function(a, b) {
- return b.exactMatch - a.exactMatch || b.$score - a.$score
- || (a.caption || a.value).localeCompare(b.caption || b.value);
- });
- var prev = null;
- matches = matches.filter(function(item){
- var caption = item.snippet || item.caption || item.value;
- if (caption === prev) return false;
- prev = caption;
- return true;
- });
-
- this.filtered = matches;
- };
- this.filterCompletions = function(items, needle) {
- var results = [];
- var upper = needle.toUpperCase();
- var lower = needle.toLowerCase();
- loop: for (var i = 0, item; item = items[i]; i++) {
- var caption = item.caption || item.value || item.snippet;
- if (!caption) continue;
- var lastIndex = -1;
- var matchMask = 0;
- var penalty = 0;
- var index, distance;
-
- if (this.exactMatch) {
- if (needle !== caption.substr(0, needle.length))
- continue loop;
- } else {
- var fullMatchIndex = caption.toLowerCase().indexOf(lower);
- if (fullMatchIndex > -1) {
- penalty = fullMatchIndex;
- } else {
- for (var j = 0; j < needle.length; j++) {
- var i1 = caption.indexOf(lower[j], lastIndex + 1);
- var i2 = caption.indexOf(upper[j], lastIndex + 1);
- index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
- if (index < 0)
- continue loop;
- distance = index - lastIndex - 1;
- if (distance > 0) {
- if (lastIndex === -1)
- penalty += 10;
- penalty += distance;
- matchMask = matchMask | (1 << j);
- }
- lastIndex = index;
- }
- }
- }
- item.matchMask = matchMask;
- item.exactMatch = penalty ? 0 : 1;
- item.$score = (item.score || 0) - penalty;
- results.push(item);
- }
- return results;
- };
-}).call(FilteredList.prototype);
-
-exports.Autocomplete = Autocomplete;
-exports.FilteredList = FilteredList;
-
-});
-
-define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
-'use strict';
-var dom = require("../../lib/dom");
-var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
-background-color: #F7F7F7;\
-color: black;\
-box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
-padding: 1em 0.5em 2em 1em;\
-overflow: auto;\
-position: absolute;\
-margin: 0;\
-bottom: 0;\
-right: 0;\
-top: 0;\
-z-index: 9991;\
-cursor: default;\
-}\
-.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
-box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
-background-color: rgba(255, 255, 255, 0.6);\
-color: black;\
-}\
-.ace_optionsMenuEntry:hover {\
-background-color: rgba(100, 100, 100, 0.1);\
-transition: all 0.3s\
-}\
-.ace_closeButton {\
-background: rgba(245, 146, 146, 0.5);\
-border: 1px solid #F48A8A;\
-border-radius: 50%;\
-padding: 7px;\
-position: absolute;\
-right: -8px;\
-top: -8px;\
-z-index: 100000;\
-}\
-.ace_closeButton{\
-background: rgba(245, 146, 146, 0.9);\
-}\
-.ace_optionsMenuKey {\
-color: darkslateblue;\
-font-weight: bold;\
-}\
-.ace_optionsMenuCommand {\
-color: darkcyan;\
-font-weight: normal;\
-}\
-.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\
-vertical-align: middle;\
-}\
-.ace_optionsMenuEntry button[ace_selected_button=true] {\
-background: #e7e7e7;\
-box-shadow: 1px 0px 2px 0px #adadad inset;\
-border-color: #adadad;\
-}\
-.ace_optionsMenuEntry button {\
-background: white;\
-border: 1px solid lightgray;\
-margin: 0px;\
-}\
-.ace_optionsMenuEntry button:hover{\
-background: #f0f0f0;\
-}";
-dom.importCssString(cssText, "settings_menu.css", false);
-
-module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
- var closer = document.createElement('div');
- var ignoreFocusOut = false;
-
- function documentEscListener(e) {
- if (e.keyCode === 27) {
- close();
- }
- }
-
- function close() {
- if (!closer) return;
- document.removeEventListener('keydown', documentEscListener);
- closer.parentNode.removeChild(closer);
- if (editor) {
- editor.focus();
- }
- closer = null;
- callback && callback();
- }
- function setIgnoreFocusOut(ignore) {
- ignoreFocusOut = ignore;
- if (ignore) {
- closer.style.pointerEvents = "none";
- contentElement.style.pointerEvents = "auto";
- }
- }
-
- closer.style.cssText = 'margin: 0; padding: 0; ' +
- 'position: fixed; top:0; bottom:0; left:0; right:0;' +
- 'z-index: 9990; ' +
- (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
- closer.addEventListener('click', function(e) {
- if (!ignoreFocusOut) {
- close();
- }
- });
- document.addEventListener('keydown', documentEscListener);
-
- contentElement.addEventListener('click', function (e) {
- e.stopPropagation();
- });
-
- closer.appendChild(contentElement);
- document.body.appendChild(closer);
- if (editor) {
- editor.blur();
- }
- return {
- close: close,
- setIgnoreFocusOut: setIgnoreFocusOut
- };
-};
-
-});
-
-define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
-"use strict";
-
-var modes = [];
-function getModeForPath(path) {
- var mode = modesByName.text;
- var fileName = path.split(/[\/\\]/).pop();
- for (var i = 0; i < modes.length; i++) {
- if (modes[i].supportsFile(fileName)) {
- mode = modes[i];
- break;
- }
- }
- return mode;
-}
-
-var Mode = function(name, caption, extensions) {
- this.name = name;
- this.caption = caption;
- this.mode = "ace/mode/" + name;
- this.extensions = extensions;
- var re;
- if (/\^/.test(extensions)) {
- re = extensions.replace(/\|(\^)?/g, function(a, b){
- return "$|" + (b ? "^" : "^.*\\.");
- }) + "$";
- } else {
- re = "^.*\\.(" + extensions + ")$";
- }
-
- this.extRe = new RegExp(re, "gi");
-};
-
-Mode.prototype.supportsFile = function(filename) {
- return filename.match(this.extRe);
-};
-var supportedModes = {
- ABAP: ["abap"],
- ABC: ["abc"],
- ActionScript:["as"],
- ADA: ["ada|adb"],
- Alda: ["alda"],
- Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
- Apex: ["apex|cls|trigger|tgr"],
- AQL: ["aql"],
- AsciiDoc: ["asciidoc|adoc"],
- ASL: ["dsl|asl|asl.json"],
- Assembly_x86:["asm|a"],
- AutoHotKey: ["ahk"],
- BatchFile: ["bat|cmd"],
- C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
- C9Search: ["c9search_results"],
- Cirru: ["cirru|cr"],
- Clojure: ["clj|cljs"],
- Cobol: ["CBL|COB"],
- coffee: ["coffee|cf|cson|^Cakefile"],
- ColdFusion: ["cfm"],
- Crystal: ["cr"],
- CSharp: ["cs"],
- Csound_Document: ["csd"],
- Csound_Orchestra: ["orc"],
- Csound_Score: ["sco"],
- CSS: ["css"],
- Curly: ["curly"],
- D: ["d|di"],
- Dart: ["dart"],
- Diff: ["diff|patch"],
- Dockerfile: ["^Dockerfile"],
- Dot: ["dot"],
- Drools: ["drl"],
- Edifact: ["edi"],
- Eiffel: ["e|ge"],
- EJS: ["ejs"],
- Elixir: ["ex|exs"],
- Elm: ["elm"],
- Erlang: ["erl|hrl"],
- Forth: ["frt|fs|ldr|fth|4th"],
- Fortran: ["f|f90"],
- FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
- FSL: ["fsl"],
- FTL: ["ftl"],
- Gcode: ["gcode"],
- Gherkin: ["feature"],
- Gitignore: ["^.gitignore"],
- Glsl: ["glsl|frag|vert"],
- Gobstones: ["gbs"],
- golang: ["go"],
- GraphQLSchema: ["gql"],
- Groovy: ["groovy"],
- HAML: ["haml"],
- Handlebars: ["hbs|handlebars|tpl|mustache"],
- Haskell: ["hs"],
- Haskell_Cabal: ["cabal"],
- haXe: ["hx"],
- Hjson: ["hjson"],
- HTML: ["html|htm|xhtml|vue|we|wpy"],
- HTML_Elixir: ["eex|html.eex"],
- HTML_Ruby: ["erb|rhtml|html.erb"],
- INI: ["ini|conf|cfg|prefs"],
- Io: ["io"],
- Jack: ["jack"],
- Jade: ["jade|pug"],
- Java: ["java"],
- JavaScript: ["js|jsm|jsx"],
- JSON: ["json"],
- JSON5: ["json5"],
- JSONiq: ["jq"],
- JSP: ["jsp"],
- JSSM: ["jssm|jssm_state"],
- JSX: ["jsx"],
- Julia: ["jl"],
- Kotlin: ["kt|kts"],
- LaTeX: ["tex|latex|ltx|bib"],
- Latte: ["latte"],
- LESS: ["less"],
- Liquid: ["liquid"],
- Lisp: ["lisp"],
- LiveScript: ["ls"],
- LogiQL: ["logic|lql"],
- LSL: ["lsl"],
- Lua: ["lua"],
- LuaPage: ["lp"],
- Lucene: ["lucene"],
- Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
- Markdown: ["md|markdown"],
- Mask: ["mask"],
- MATLAB: ["matlab"],
- Maze: ["mz"],
- MediaWiki: ["wiki|mediawiki"],
- MEL: ["mel"],
- MIPS: ["s|asm"],
- MIXAL: ["mixal"],
- MUSHCode: ["mc|mush"],
- MySQL: ["mysql"],
- Nginx: ["nginx|conf"],
- Nim: ["nim"],
- Nix: ["nix"],
- NSIS: ["nsi|nsh"],
- Nunjucks: ["nunjucks|nunjs|nj|njk"],
- ObjectiveC: ["m|mm"],
- OCaml: ["ml|mli"],
- Pascal: ["pas|p"],
- Perl: ["pl|pm"],
- pgSQL: ["pgsql"],
- PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
- PHP_Laravel_blade: ["blade.php"],
- Pig: ["pig"],
- Powershell: ["ps1"],
- Praat: ["praat|praatscript|psc|proc"],
- Prisma: ["prisma"],
- Prolog: ["plg|prolog"],
- Properties: ["properties"],
- Protobuf: ["proto"],
- Puppet: ["epp|pp"],
- Python: ["py"],
- QML: ["qml"],
- R: ["r"],
- Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"],
- Razor: ["cshtml|asp"],
- RDoc: ["Rd"],
- Red: ["red|reds"],
- RHTML: ["Rhtml"],
- RST: ["rst"],
- Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
- Rust: ["rs"],
- SASS: ["sass"],
- SCAD: ["scad"],
- Scala: ["scala|sbt"],
- Scheme: ["scm|sm|rkt|oak|scheme"],
- Scrypt: ["scrypt"],
- SCSS: ["scss"],
- SH: ["sh|bash|^.bashrc"],
- SJS: ["sjs"],
- Slim: ["slim|skim"],
- Smarty: ["smarty|tpl"],
- Smithy: ["smithy"],
- snippets: ["snippets"],
- Soy_Template:["soy"],
- Space: ["space"],
- SQL: ["sql"],
- SQLServer: ["sqlserver"],
- Stylus: ["styl|stylus"],
- SVG: ["svg"],
- Swift: ["swift"],
- Tcl: ["tcl"],
- Terraform: ["tf", "tfvars", "terragrunt"],
- Tex: ["tex"],
- Text: ["txt"],
- Textile: ["textile"],
- Toml: ["toml"],
- TSX: ["tsx"],
- Twig: ["twig|swig"],
- Typescript: ["ts|typescript|str"],
- Vala: ["vala"],
- VBScript: ["vbs|vb"],
- Velocity: ["vm"],
- Verilog: ["v|vh|sv|svh"],
- VHDL: ["vhd|vhdl"],
- Visualforce: ["vfp|component|page"],
- Wollok: ["wlk|wpgm|wtest"],
- XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
- XQuery: ["xq"],
- YAML: ["yaml|yml"],
- Zeek: ["zeek|bro"],
- Django: ["html"]
-};
-
-var nameOverrides = {
- ObjectiveC: "Objective-C",
- CSharp: "C#",
- golang: "Go",
- C_Cpp: "C and C++",
- Csound_Document: "Csound Document",
- Csound_Orchestra: "Csound",
- Csound_Score: "Csound Score",
- coffee: "CoffeeScript",
- HTML_Ruby: "HTML (Ruby)",
- HTML_Elixir: "HTML (Elixir)",
- FTL: "FreeMarker",
- PHP_Laravel_blade: "PHP (Blade Template)",
- Perl6: "Perl 6",
- AutoHotKey: "AutoHotkey / AutoIt"
-};
-
-var modesByName = {};
-for (var name in supportedModes) {
- var data = supportedModes[name];
- var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
- var filename = name.toLowerCase();
- var mode = new Mode(filename, displayName, data[0]);
- modesByName[filename] = mode;
- modes.push(mode);
-}
-
-module.exports = {
- getModeForPath: getModeForPath,
- modes: modes,
- modesByName: modesByName
-};
-
-});
-
-define("ace/ext/prompt",["require","exports","module","ace/range","ace/lib/dom","ace/ext/menu_tools/get_editor_keyboard_shortcuts","ace/autocomplete","ace/autocomplete/popup","ace/autocomplete/popup","ace/undomanager","ace/tokenizer","ace/ext/menu_tools/overlay_page","ace/ext/modelist"], function(require, exports, module) {
-"use strict";
-
-var Range = require("../range").Range;
-var dom = require("../lib/dom");
-var shortcuts = require("../ext/menu_tools/get_editor_keyboard_shortcuts");
-var FilteredList= require("../autocomplete").FilteredList;
-var AcePopup = require('../autocomplete/popup').AcePopup;
-var $singleLineEditor = require('../autocomplete/popup').$singleLineEditor;
-var UndoManager = require("../undomanager").UndoManager;
-var Tokenizer = require("../tokenizer").Tokenizer;
-var overlayPage = require("./menu_tools/overlay_page").overlayPage;
-var modelist = require("./modelist");
-var openPrompt;
-
-function prompt(editor, message, options, callback) {
- if (typeof message == "object") {
- return prompt(editor, "", message, options);
- }
- if (openPrompt) {
- var lastPrompt = openPrompt;
- editor = lastPrompt.editor;
- lastPrompt.close();
- if (lastPrompt.name && lastPrompt.name == options.name)
- return;
- }
- if (options.$type)
- return prompt[options.$type](editor, callback);
-
- var cmdLine = $singleLineEditor();
- cmdLine.session.setUndoManager(new UndoManager());
-
- var el = dom.buildDom(["div", {class: "ace_prompt_container" + (options.hasDescription ? " input-box-with-description" : "")}]);
- var overlay = overlayPage(editor, el, done);
- el.appendChild(cmdLine.container);
-
- if (editor) {
- editor.cmdLine = cmdLine;
- cmdLine.setOption("fontSize", editor.getOption("fontSize"));
- }
- if (message) {
- cmdLine.setValue(message, 1);
- }
- if (options.selection) {
- cmdLine.selection.setRange({
- start: cmdLine.session.doc.indexToPosition(options.selection[0]),
- end: cmdLine.session.doc.indexToPosition(options.selection[1])
- });
- }
-
- if (options.getCompletions) {
- var popup = new AcePopup();
- popup.renderer.setStyle("ace_autocomplete_inline");
- popup.container.style.display = "block";
- popup.container.style.maxWidth = "600px";
- popup.container.style.width = "100%";
- popup.container.style.marginTop = "3px";
- popup.renderer.setScrollMargin(2, 2, 0, 0);
- popup.autoSelect = false;
- popup.renderer.$maxLines = 15;
- popup.setRow(-1);
- popup.on("click", function(e) {
- var data = popup.getData(popup.getRow());
- if (!data.error) {
- cmdLine.setValue(data.value || data.name || data);
- accept();
- e.stop();
- }
- });
- el.appendChild(popup.container);
- updateCompletions();
- }
-
- if (options.$rules) {
- var tokenizer = new Tokenizer(options.$rules);
- cmdLine.session.bgTokenizer.setTokenizer(tokenizer);
- }
-
- if (options.placeholder) {
- cmdLine.setOption("placeholder", options.placeholder);
- }
-
- if (options.hasDescription) {
- var promptTextContainer = dom.buildDom(["div", {class: "ace_prompt_text_container"}]);
- dom.buildDom(options.prompt || "Press 'Enter' to confirm or 'Escape' to cancel", promptTextContainer);
- el.appendChild(promptTextContainer);
- }
-
- overlay.setIgnoreFocusOut(options.ignoreFocusOut);
-
- function accept() {
- var val;
- if (popup && popup.getCursorPosition().row > 0) {
- val = valueFromRecentList();
- } else {
- val = cmdLine.getValue();
- }
- var curData = popup ? popup.getData(popup.getRow()) : val;
- if (curData && !curData.error) {
- done();
- options.onAccept && options.onAccept({
- value: val,
- item: curData
- }, cmdLine);
- }
- }
-
- var keys = {
- "Enter": accept,
- "Esc|Shift-Esc": function() {
- options.onCancel && options.onCancel(cmdLine.getValue(), cmdLine);
- done();
- }
- };
-
- if (popup) {
- Object.assign(keys, {
- "Up": function(editor) { popup.goTo("up"); valueFromRecentList();},
- "Down": function(editor) { popup.goTo("down"); valueFromRecentList();},
- "Ctrl-Up|Ctrl-Home": function(editor) { popup.goTo("start"); valueFromRecentList();},
- "Ctrl-Down|Ctrl-End": function(editor) { popup.goTo("end"); valueFromRecentList();},
- "Tab": function(editor) {
- popup.goTo("down"); valueFromRecentList();
- },
- "PageUp": function(editor) { popup.gotoPageUp(); valueFromRecentList();},
- "PageDown": function(editor) { popup.gotoPageDown(); valueFromRecentList();}
- });
- }
-
- cmdLine.commands.bindKeys(keys);
-
- function done() {
- overlay.close();
- callback && callback();
- openPrompt = null;
- }
-
- cmdLine.on("input", function() {
- options.onInput && options.onInput();
- updateCompletions();
- });
-
- function updateCompletions() {
- if (options.getCompletions) {
- var prefix;
- if (options.getPrefix) {
- prefix = options.getPrefix(cmdLine);
- }
-
- var completions = options.getCompletions(cmdLine);
- popup.setData(completions, prefix);
- popup.resize(true);
- }
- }
-
- function valueFromRecentList() {
- var current = popup.getData(popup.getRow());
- if (current && !current.error)
- return current.value || current.caption || current;
- }
-
- cmdLine.resize(true);
- if (popup) {
- popup.resize(true);
- }
- cmdLine.focus();
-
- openPrompt = {
- close: done,
- name: options.name,
- editor: editor
- };
-}
-
-prompt.gotoLine = function(editor, callback) {
- function stringifySelection(selection) {
- if (!Array.isArray(selection))
- selection = [selection];
- return selection.map(function(r) {
- var cursor = r.isBackwards ? r.start: r.end;
- var anchor = r.isBackwards ? r.end: r.start;
- var row = anchor.row;
- var s = (row + 1) + ":" + anchor.column;
-
- if (anchor.row == cursor.row) {
- if (anchor.column != cursor.column)
- s += ">" + ":" + cursor.column;
- } else {
- s += ">" + (cursor.row + 1) + ":" + cursor.column;
- }
- return s;
- }).reverse().join(", ");
- }
-
- prompt(editor, ":" + stringifySelection(editor.selection.toJSON()), {
- name: "gotoLine",
- selection: [1, Number.MAX_VALUE],
- onAccept: function(data) {
- var value = data.value;
- var _history = prompt.gotoLine._history;
- if (!_history)
- prompt.gotoLine._history = _history = [];
- if (_history.indexOf(value) != -1)
- _history.splice(_history.indexOf(value), 1);
- _history.unshift(value);
- if (_history.length > 20) _history.length = 20;
-
-
- var pos = editor.getCursorPosition();
- var ranges = [];
- value.replace(/^:/, "").split(/,/).map(function(str) {
- var parts = str.split(/([<>:+-]|c?\d+)|[^c\d<>:+-]+/).filter(Boolean);
- var i = 0;
- function readPosition() {
- var c = parts[i++];
- if (!c) return;
- if (c[0] == "c") {
- var index = parseInt(c.slice(1)) || 0;
- return editor.session.doc.indexToPosition(index);
- }
- var row = pos.row;
- var column = 0;
- if (/\d/.test(c)) {
- row = parseInt(c) - 1;
- c = parts[i++];
- }
- if (c == ":") {
- c = parts[i++];
- if (/\d/.test(c)) {
- column = parseInt(c) || 0;
- }
- }
- return {row: row, column: column};
- }
- pos = readPosition();
- var range = Range.fromPoints(pos, pos);
- if (parts[i] == ">") {
- i++;
- range.end = readPosition();
- }
- else if (parts[i] == "<") {
- i++;
- range.start = readPosition();
- }
- ranges.unshift(range);
- });
- editor.selection.fromJSON(ranges);
- var scrollTop = editor.renderer.scrollTop;
- editor.renderer.scrollSelectionIntoView(
- editor.selection.anchor,
- editor.selection.cursor,
- 0.5
- );
- editor.renderer.animateScrolling(scrollTop);
- },
- history: function() {
- var undoManager = editor.session.getUndoManager();
- if (!prompt.gotoLine._history)
- return [];
- return prompt.gotoLine._history;
-
- },
- getCompletions: function(cmdLine) {
- var value = cmdLine.getValue();
- var m = value.replace(/^:/, "").split(":");
- var row = Math.min(parseInt(m[0]) || 1, editor.session.getLength()) - 1;
- var line = editor.session.getLine(row);
- var current = value + " " + line;
- return [current].concat(this.history());
- },
- $rules: {
- start: [{
- regex: /\d+/,
- token: "string"
- }, {
- regex: /[:,><+\-c]/,
- token: "keyword"
- }]
- }
- });
-};
-
-prompt.commands = function(editor, callback) {
- function normalizeName(name) {
- return (name || "").replace(/^./, function(x) {
- return x.toUpperCase(x);
- }).replace(/[a-z][A-Z]/g, function(x) {
- return x[0] + " " + x[1].toLowerCase(x);
- });
- }
- function getEditorCommandsByName(excludeCommands) {
- var commandsByName = [];
- var commandMap = {};
- editor.keyBinding.$handlers.forEach(function(handler) {
- var platform = handler.platform;
- var cbn = handler.byName;
- for (var i in cbn) {
- var key = cbn[i].bindKey;
- if (typeof key !== "string") {
- key = key && key[platform] || "";
- }
- var commands = cbn[i];
- var description = commands.description || normalizeName(commands.name);
- if (!Array.isArray(commands))
- commands = [commands];
- commands.forEach(function(command) {
- if (typeof command != "string")
- command = command.name;
- var needle = excludeCommands.find(function(el) {
- return el === command;
- });
- if (!needle) {
- if (commandMap[command]) {
- commandMap[command].key += "|" + key;
- } else {
- commandMap[command] = {key: key, command: command, description: description};
- commandsByName.push(commandMap[command]);
- }
- }
- });
- }
- });
- return commandsByName;
- }
- var excludeCommandsList = ["insertstring", "inserttext", "setIndentation", "paste"];
- var shortcutsArray = getEditorCommandsByName(excludeCommandsList);
- shortcutsArray = shortcutsArray.map(function(item) {
- return {value: item.description, meta: item.key, command: item.command};
- });
- prompt(editor, "", {
- name: "commands",
- selection: [0, Number.MAX_VALUE],
- maxHistoryCount: 5,
- onAccept: function(data) {
- if (data.item) {
- var commandName = data.item.command;
- this.addToHistory(data.item);
-
- editor.execCommand(commandName);
- }
- },
- addToHistory: function(item) {
- var history = this.history();
- history.unshift(item);
- delete item.message;
- for (var i = 1; i < history.length; i++) {
- if (history[i]["command"] == item.command ) {
- history.splice(i, 1);
- break;
- }
- }
- if (this.maxHistoryCount > 0 && history.length > this.maxHistoryCount) {
- history.splice(history.length - 1, 1);
- }
- prompt.commands.history = history;
- },
- history: function() {
- return prompt.commands.history || [];
- },
- getPrefix: function(cmdLine) {
- var currentPos = cmdLine.getCursorPosition();
- var filterValue = cmdLine.getValue();
- return filterValue.substring(0, currentPos.column);
- },
- getCompletions: function(cmdLine) {
- function getFilteredCompletions(commands, prefix) {
- var resultCommands = JSON.parse(JSON.stringify(commands));
-
- var filtered = new FilteredList(resultCommands);
- return filtered.filterCompletions(resultCommands, prefix);
- }
-
- function getUniqueCommandList(commands, usedCommands) {
- if (!usedCommands || !usedCommands.length) {
- return commands;
- }
- var excludeCommands = [];
- usedCommands.forEach(function(item) {
- excludeCommands.push(item.command);
- });
-
- var resultCommands = [];
-
- commands.forEach(function(item) {
- if (excludeCommands.indexOf(item.command) === -1) {
- resultCommands.push(item);
- }
- });
-
- return resultCommands;
- }
-
- var prefix = this.getPrefix(cmdLine);
- var recentlyUsedCommands = getFilteredCompletions(this.history(), prefix);
- var otherCommands = getUniqueCommandList(shortcutsArray, recentlyUsedCommands);
- otherCommands = getFilteredCompletions(otherCommands, prefix);
-
- if (recentlyUsedCommands.length && otherCommands.length) {
- recentlyUsedCommands[0]["message"] = " Recently used";
- otherCommands[0]["message"] = " Other commands";
- }
-
- var completions = recentlyUsedCommands.concat(otherCommands);
- return completions.length > 0 ? completions : [{
- value: "No matching commands",
- error: 1
- }];
- }
- });
-};
-
-prompt.modes = function(editor, callback) {
- var modesArray = modelist.modes;
- modesArray = modesArray.map(function(item) {
- return {value: item.caption, mode: item.name};
- });
- prompt(editor, "", {
- name: "modes",
- selection: [0, Number.MAX_VALUE],
- onAccept: function(data) {
- if (data.item) {
- var modeName = "ace/mode/" + data.item.mode;
- editor.session.setMode(modeName);
- }
- },
- getPrefix: function(cmdLine) {
- var currentPos = cmdLine.getCursorPosition();
- var filterValue = cmdLine.getValue();
- return filterValue.substring(0, currentPos.column);
- },
- getCompletions: function(cmdLine) {
- function getFilteredCompletions(modes, prefix) {
- var resultCommands = JSON.parse(JSON.stringify(modes));
-
- var filtered = new FilteredList(resultCommands);
- return filtered.filterCompletions(resultCommands, prefix);
- }
-
- var prefix = this.getPrefix(cmdLine);
- var completions = getFilteredCompletions(modesArray, prefix);
- return completions.length > 0 ? completions : [{
- "caption": "No mode matching",
- "value": "No mode matching",
- "error": 1
- }];
- }
- });
-};
-
-dom.importCssString(".ace_prompt_container {\
- max-width: 600px;\
- width: 100%;\
- margin: 20px auto;\
- padding: 3px;\
- background: white;\
- border-radius: 2px;\
- box-shadow: 0px 2px 3px 0px #555;\
-}", "promtp.css", false);
-
-
-exports.prompt = prompt;
-
-}); (function() {
- window.require(["ace/ext/prompt"], function(m) {
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = m;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/ace/ext-searchbox.js b/GameDev/bin/Release/editor/ace/ext-searchbox.js
deleted file mode 100644
index 8be7e8c1..00000000
--- a/GameDev/bin/Release/editor/ace/ext-searchbox.js
+++ /dev/null
@@ -1,514 +0,0 @@
-define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
-"use strict";
-
-var dom = require("../lib/dom");
-var lang = require("../lib/lang");
-var event = require("../lib/event");
-var searchboxCss = "\
-.ace_search {\
-background-color: #ddd;\
-color: #666;\
-border: 1px solid #cbcbcb;\
-border-top: 0 none;\
-overflow: hidden;\
-margin: 0;\
-padding: 4px 6px 0 4px;\
-position: absolute;\
-top: 0;\
-z-index: 99;\
-white-space: normal;\
-}\
-.ace_search.left {\
-border-left: 0 none;\
-border-radius: 0px 0px 5px 0px;\
-left: 0;\
-}\
-.ace_search.right {\
-border-radius: 0px 0px 0px 5px;\
-border-right: 0 none;\
-right: 0;\
-}\
-.ace_search_form, .ace_replace_form {\
-margin: 0 20px 4px 0;\
-overflow: hidden;\
-line-height: 1.9;\
-}\
-.ace_replace_form {\
-margin-right: 0;\
-}\
-.ace_search_form.ace_nomatch {\
-outline: 1px solid red;\
-}\
-.ace_search_field {\
-border-radius: 3px 0 0 3px;\
-background-color: white;\
-color: black;\
-border: 1px solid #cbcbcb;\
-border-right: 0 none;\
-outline: 0;\
-padding: 0;\
-font-size: inherit;\
-margin: 0;\
-line-height: inherit;\
-padding: 0 6px;\
-min-width: 17em;\
-vertical-align: top;\
-min-height: 1.8em;\
-box-sizing: content-box;\
-}\
-.ace_searchbtn {\
-border: 1px solid #cbcbcb;\
-line-height: inherit;\
-display: inline-block;\
-padding: 0 6px;\
-background: #fff;\
-border-right: 0 none;\
-border-left: 1px solid #dcdcdc;\
-cursor: pointer;\
-margin: 0;\
-position: relative;\
-color: #666;\
-}\
-.ace_searchbtn:last-child {\
-border-radius: 0 3px 3px 0;\
-border-right: 1px solid #cbcbcb;\
-}\
-.ace_searchbtn:disabled {\
-background: none;\
-cursor: default;\
-}\
-.ace_searchbtn:hover {\
-background-color: #eef1f6;\
-}\
-.ace_searchbtn.prev, .ace_searchbtn.next {\
-padding: 0px 0.7em\
-}\
-.ace_searchbtn.prev:after, .ace_searchbtn.next:after {\
-content: \"\";\
-border: solid 2px #888;\
-width: 0.5em;\
-height: 0.5em;\
-border-width: 2px 0 0 2px;\
-display:inline-block;\
-transform: rotate(-45deg);\
-}\
-.ace_searchbtn.next:after {\
-border-width: 0 2px 2px 0 ;\
-}\
-.ace_searchbtn_close {\
-background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
-border-radius: 50%;\
-border: 0 none;\
-color: #656565;\
-cursor: pointer;\
-font: 16px/16px Arial;\
-padding: 0;\
-height: 14px;\
-width: 14px;\
-top: 9px;\
-right: 7px;\
-position: absolute;\
-}\
-.ace_searchbtn_close:hover {\
-background-color: #656565;\
-background-position: 50% 100%;\
-color: white;\
-}\
-.ace_button {\
-margin-left: 2px;\
-cursor: pointer;\
--webkit-user-select: none;\
--moz-user-select: none;\
--o-user-select: none;\
--ms-user-select: none;\
-user-select: none;\
-overflow: hidden;\
-opacity: 0.7;\
-border: 1px solid rgba(100,100,100,0.23);\
-padding: 1px;\
-box-sizing: border-box!important;\
-color: black;\
-}\
-.ace_button:hover {\
-background-color: #eee;\
-opacity:1;\
-}\
-.ace_button:active {\
-background-color: #ddd;\
-}\
-.ace_button.checked {\
-border-color: #3399ff;\
-opacity:1;\
-}\
-.ace_search_options{\
-margin-bottom: 3px;\
-text-align: right;\
--webkit-user-select: none;\
--moz-user-select: none;\
--o-user-select: none;\
--ms-user-select: none;\
-user-select: none;\
-clear: both;\
-}\
-.ace_search_counter {\
-float: left;\
-font-family: arial;\
-padding: 0 8px;\
-}";
-var HashHandler = require("../keyboard/hash_handler").HashHandler;
-var keyUtil = require("../lib/keys");
-
-var MAX_COUNT = 999;
-
-dom.importCssString(searchboxCss, "ace_searchbox", false);
-
-var SearchBox = function(editor, range, showReplaceForm) {
- var div = dom.createElement("div");
- dom.buildDom(["div", {class:"ace_search right"},
- ["span", {action: "hide", class: "ace_searchbtn_close"}],
- ["div", {class: "ace_search_form"},
- ["input", {class: "ace_search_field", placeholder: "Search for", spellcheck: "false"}],
- ["span", {action: "findPrev", class: "ace_searchbtn prev"}, "\u200b"],
- ["span", {action: "findNext", class: "ace_searchbtn next"}, "\u200b"],
- ["span", {action: "findAll", class: "ace_searchbtn", title: "Alt-Enter"}, "All"]
- ],
- ["div", {class: "ace_replace_form"},
- ["input", {class: "ace_search_field", placeholder: "Replace with", spellcheck: "false"}],
- ["span", {action: "replaceAndFindNext", class: "ace_searchbtn"}, "Replace"],
- ["span", {action: "replaceAll", class: "ace_searchbtn"}, "All"]
- ],
- ["div", {class: "ace_search_options"},
- ["span", {action: "toggleReplace", class: "ace_button", title: "Toggle Replace mode",
- style: "float:left;margin-top:-2px;padding:0 5px;"}, "+"],
- ["span", {class: "ace_search_counter"}],
- ["span", {action: "toggleRegexpMode", class: "ace_button", title: "RegExp Search"}, ".*"],
- ["span", {action: "toggleCaseSensitive", class: "ace_button", title: "CaseSensitive Search"}, "Aa"],
- ["span", {action: "toggleWholeWords", class: "ace_button", title: "Whole Word Search"}, "\\b"],
- ["span", {action: "searchInSelection", class: "ace_button", title: "Search In Selection"}, "S"]
- ]
- ], div);
- this.element = div.firstChild;
-
- this.setSession = this.setSession.bind(this);
-
- this.$init();
- this.setEditor(editor);
- dom.importCssString(searchboxCss, "ace_searchbox", editor.container);
-};
-
-(function() {
- this.setEditor = function(editor) {
- editor.searchBox = this;
- editor.renderer.scroller.appendChild(this.element);
- this.editor = editor;
- };
-
- this.setSession = function(e) {
- this.searchRange = null;
- this.$syncOptions(true);
- };
-
- this.$initElements = function(sb) {
- this.searchBox = sb.querySelector(".ace_search_form");
- this.replaceBox = sb.querySelector(".ace_replace_form");
- this.searchOption = sb.querySelector("[action=searchInSelection]");
- this.replaceOption = sb.querySelector("[action=toggleReplace]");
- this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
- this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
- this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
- this.searchInput = this.searchBox.querySelector(".ace_search_field");
- this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
- this.searchCounter = sb.querySelector(".ace_search_counter");
- };
-
- this.$init = function() {
- var sb = this.element;
-
- this.$initElements(sb);
-
- var _this = this;
- event.addListener(sb, "mousedown", function(e) {
- setTimeout(function(){
- _this.activeInput.focus();
- }, 0);
- event.stopPropagation(e);
- });
- event.addListener(sb, "click", function(e) {
- var t = e.target || e.srcElement;
- var action = t.getAttribute("action");
- if (action && _this[action])
- _this[action]();
- else if (_this.$searchBarKb.commands[action])
- _this.$searchBarKb.commands[action].exec(_this);
- event.stopPropagation(e);
- });
-
- event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
- var keyString = keyUtil.keyCodeToString(keyCode);
- var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
- if (command && command.exec) {
- command.exec(_this);
- event.stopEvent(e);
- }
- });
-
- this.$onChange = lang.delayedCall(function() {
- _this.find(false, false);
- });
-
- event.addListener(this.searchInput, "input", function() {
- _this.$onChange.schedule(20);
- });
- event.addListener(this.searchInput, "focus", function() {
- _this.activeInput = _this.searchInput;
- _this.searchInput.value && _this.highlight();
- });
- event.addListener(this.replaceInput, "focus", function() {
- _this.activeInput = _this.replaceInput;
- _this.searchInput.value && _this.highlight();
- });
- };
- this.$closeSearchBarKb = new HashHandler([{
- bindKey: "Esc",
- name: "closeSearchBar",
- exec: function(editor) {
- editor.searchBox.hide();
- }
- }]);
- this.$searchBarKb = new HashHandler();
- this.$searchBarKb.bindKeys({
- "Ctrl-f|Command-f": function(sb) {
- var isReplace = sb.isReplace = !sb.isReplace;
- sb.replaceBox.style.display = isReplace ? "" : "none";
- sb.replaceOption.checked = false;
- sb.$syncOptions();
- sb.searchInput.focus();
- },
- "Ctrl-H|Command-Option-F": function(sb) {
- if (sb.editor.getReadOnly())
- return;
- sb.replaceOption.checked = true;
- sb.$syncOptions();
- sb.replaceInput.focus();
- },
- "Ctrl-G|Command-G": function(sb) {
- sb.findNext();
- },
- "Ctrl-Shift-G|Command-Shift-G": function(sb) {
- sb.findPrev();
- },
- "esc": function(sb) {
- setTimeout(function() { sb.hide();});
- },
- "Return": function(sb) {
- if (sb.activeInput == sb.replaceInput)
- sb.replace();
- sb.findNext();
- },
- "Shift-Return": function(sb) {
- if (sb.activeInput == sb.replaceInput)
- sb.replace();
- sb.findPrev();
- },
- "Alt-Return": function(sb) {
- if (sb.activeInput == sb.replaceInput)
- sb.replaceAll();
- sb.findAll();
- },
- "Tab": function(sb) {
- (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
- }
- });
-
- this.$searchBarKb.addCommands([{
- name: "toggleRegexpMode",
- bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
- exec: function(sb) {
- sb.regExpOption.checked = !sb.regExpOption.checked;
- sb.$syncOptions();
- }
- }, {
- name: "toggleCaseSensitive",
- bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
- exec: function(sb) {
- sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
- sb.$syncOptions();
- }
- }, {
- name: "toggleWholeWords",
- bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
- exec: function(sb) {
- sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
- sb.$syncOptions();
- }
- }, {
- name: "toggleReplace",
- exec: function(sb) {
- sb.replaceOption.checked = !sb.replaceOption.checked;
- sb.$syncOptions();
- }
- }, {
- name: "searchInSelection",
- exec: function(sb) {
- sb.searchOption.checked = !sb.searchRange;
- sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange());
- sb.$syncOptions();
- }
- }]);
-
- this.setSearchRange = function(range) {
- this.searchRange = range;
- if (range) {
- this.searchRangeMarker = this.editor.session.addMarker(range, "ace_active-line");
- } else if (this.searchRangeMarker) {
- this.editor.session.removeMarker(this.searchRangeMarker);
- this.searchRangeMarker = null;
- }
- };
-
- this.$syncOptions = function(preventScroll) {
- dom.setCssClass(this.replaceOption, "checked", this.searchRange);
- dom.setCssClass(this.searchOption, "checked", this.searchOption.checked);
- this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+";
- dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
- dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
- dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
- var readOnly = this.editor.getReadOnly();
- this.replaceOption.style.display = readOnly ? "none" : "";
- this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none";
- this.find(false, false, preventScroll);
- };
-
- this.highlight = function(re) {
- this.editor.session.highlight(re || this.editor.$search.$options.re);
- this.editor.renderer.updateBackMarkers();
- };
- this.find = function(skipCurrent, backwards, preventScroll) {
- var range = this.editor.find(this.searchInput.value, {
- skipCurrent: skipCurrent,
- backwards: backwards,
- wrap: true,
- regExp: this.regExpOption.checked,
- caseSensitive: this.caseSensitiveOption.checked,
- wholeWord: this.wholeWordOption.checked,
- preventScroll: preventScroll,
- range: this.searchRange
- });
- var noMatch = !range && this.searchInput.value;
- dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
- this.editor._emit("findSearchBox", { match: !noMatch });
- this.highlight();
- this.updateCounter();
- };
- this.updateCounter = function() {
- var editor = this.editor;
- var regex = editor.$search.$options.re;
- var all = 0;
- var before = 0;
- if (regex) {
- var value = this.searchRange
- ? editor.session.getTextRange(this.searchRange)
- : editor.getValue();
-
- var offset = editor.session.doc.positionToIndex(editor.selection.anchor);
- if (this.searchRange)
- offset -= editor.session.doc.positionToIndex(this.searchRange.start);
-
- var last = regex.lastIndex = 0;
- var m;
- while ((m = regex.exec(value))) {
- all++;
- last = m.index;
- if (last <= offset)
- before++;
- if (all > MAX_COUNT)
- break;
- if (!m[0]) {
- regex.lastIndex = last += 1;
- if (last >= value.length)
- break;
- }
- }
- }
- this.searchCounter.textContent = before + " of " + (all > MAX_COUNT ? MAX_COUNT + "+" : all);
- };
- this.findNext = function() {
- this.find(true, false);
- };
- this.findPrev = function() {
- this.find(true, true);
- };
- this.findAll = function(){
- var range = this.editor.findAll(this.searchInput.value, {
- regExp: this.regExpOption.checked,
- caseSensitive: this.caseSensitiveOption.checked,
- wholeWord: this.wholeWordOption.checked
- });
- var noMatch = !range && this.searchInput.value;
- dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
- this.editor._emit("findSearchBox", { match: !noMatch });
- this.highlight();
- this.hide();
- };
- this.replace = function() {
- if (!this.editor.getReadOnly())
- this.editor.replace(this.replaceInput.value);
- };
- this.replaceAndFindNext = function() {
- if (!this.editor.getReadOnly()) {
- this.editor.replace(this.replaceInput.value);
- this.findNext();
- }
- };
- this.replaceAll = function() {
- if (!this.editor.getReadOnly())
- this.editor.replaceAll(this.replaceInput.value);
- };
-
- this.hide = function() {
- this.active = false;
- this.setSearchRange(null);
- this.editor.off("changeSession", this.setSession);
-
- this.element.style.display = "none";
- this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
- this.editor.focus();
- };
- this.show = function(value, isReplace) {
- this.active = true;
- this.editor.on("changeSession", this.setSession);
- this.element.style.display = "";
- this.replaceOption.checked = isReplace;
-
- if (value)
- this.searchInput.value = value;
-
- this.searchInput.focus();
- this.searchInput.select();
-
- this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
-
- this.$syncOptions(true);
- };
-
- this.isFocused = function() {
- var el = document.activeElement;
- return el == this.searchInput || el == this.replaceInput;
- };
-}).call(SearchBox.prototype);
-
-exports.SearchBox = SearchBox;
-
-exports.Search = function(editor, isReplace) {
- var sb = editor.searchBox || new SearchBox(editor);
- sb.show(editor.session.getTextRange(), isReplace);
-};
-
-}); (function() {
- window.require(["ace/ext/searchbox"], function(m) {
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = m;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/ace/mode-javascript.js b/GameDev/bin/Release/editor/ace/mode-javascript.js
deleted file mode 100644
index 9aa6bab0..00000000
--- a/GameDev/bin/Release/editor/ace/mode-javascript.js
+++ /dev/null
@@ -1,720 +0,0 @@
-ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-var DocCommentHighlightRules = function () {
- this.$rules = {
- "start": [{
- token: "comment.doc.tag",
- regex: "@[\\w\\d_]+" // TODO: fix email addresses
- },
- DocCommentHighlightRules.getTagRule(),
- {
- defaultToken: "comment.doc",
- caseInsensitive: true
- }]
- };
-};
-oop.inherits(DocCommentHighlightRules, TextHighlightRules);
-DocCommentHighlightRules.getTagRule = function (start) {
- return {
- token: "comment.doc.tag.storage.type",
- regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
- };
-};
-DocCommentHighlightRules.getStartRule = function (start) {
- return {
- token: "comment.doc",
- regex: "\\/\\*(?=\\*)",
- next: start
- };
-};
-DocCommentHighlightRules.getEndRule = function (start) {
- return {
- token: "comment.doc",
- regex: "\\*\\/",
- next: start
- };
-};
-exports.DocCommentHighlightRules = DocCommentHighlightRules;
-
-});
-
-ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
-var JavaScriptHighlightRules = function (options) {
- var keywordMapper = this.createKeywordMapper({
- "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
- "Namespace|QName|XML|XMLList|" + // E4X
- "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
- "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
- "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
- "SyntaxError|TypeError|URIError|" +
- "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
- "isNaN|parseFloat|parseInt|" +
- "JSON|Math|" + // Other
- "this|arguments|prototype|window|document",
- "keyword": "const|yield|import|get|set|async|await|" +
- "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
- "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
- "__parent__|__count__|escape|unescape|with|__proto__|" +
- "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
- "storage.type": "const|let|var|function",
- "constant.language": "null|Infinity|NaN|undefined",
- "support.function": "alert",
- "constant.language.boolean": "true|false"
- }, "identifier");
- var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
- var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
- "u[0-9a-fA-F]{4}|" + // unicode
- "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
- "[0-2][0-7]{0,2}|" + // oct
- "3[0-7][0-7]?|" + // oct
- "[4-7][0-7]?|" + //oct
- ".)";
- this.$rules = {
- "no_regex": [
- DocCommentHighlightRules.getStartRule("doc-start"),
- comments("no_regex"),
- {
- token: "string",
- regex: "'(?=.)",
- next: "qstring"
- }, {
- token: "string",
- regex: '"(?=.)',
- next: "qqstring"
- }, {
- token: "constant.numeric",
- regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
- }, {
- token: "constant.numeric",
- regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
- }, {
- token: [
- "storage.type", "punctuation.operator", "support.function",
- "punctuation.operator", "entity.name.function", "text", "keyword.operator"
- ],
- regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)",
- next: "function_arguments"
- }, {
- token: [
- "storage.type", "punctuation.operator", "entity.name.function", "text",
- "keyword.operator", "text", "storage.type", "text", "paren.lparen"
- ],
- regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: [
- "entity.name.function", "text", "keyword.operator", "text", "storage.type",
- "text", "paren.lparen"
- ],
- regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: [
- "storage.type", "punctuation.operator", "entity.name.function", "text",
- "keyword.operator", "text",
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
- ],
- regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: [
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
- ],
- regex: "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: [
- "entity.name.function", "text", "punctuation.operator",
- "text", "storage.type", "text", "paren.lparen"
- ],
- regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: [
- "text", "text", "storage.type", "text", "paren.lparen"
- ],
- regex: "(:)(\\s*)(function)(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: "keyword",
- regex: "from(?=\\s*('|\"))"
- }, {
- token: "keyword",
- regex: "(?:" + kwBeforeRe + ")\\b",
- next: "start"
- }, {
- token: ["support.constant"],
- regex: /that\b/
- }, {
- token: ["storage.type", "punctuation.operator", "support.function.firebug"],
- regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
- }, {
- token: keywordMapper,
- regex: identifierRe
- }, {
- token: "punctuation.operator",
- regex: /[.](?![.])/,
- next: "property"
- }, {
- token: "storage.type",
- regex: /=>/,
- next: "start"
- }, {
- token: "keyword.operator",
- regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
- next: "start"
- }, {
- token: "punctuation.operator",
- regex: /[?:,;.]/,
- next: "start"
- }, {
- token: "paren.lparen",
- regex: /[\[({]/,
- next: "start"
- }, {
- token: "paren.rparen",
- regex: /[\])}]/
- }, {
- token: "comment",
- regex: /^#!.*$/
- }
- ],
- property: [{
- token: "text",
- regex: "\\s+"
- }, {
- token: [
- "storage.type", "punctuation.operator", "entity.name.function", "text",
- "keyword.operator", "text",
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
- ],
- regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
- next: "function_arguments"
- }, {
- token: "punctuation.operator",
- regex: /[.](?![.])/
- }, {
- token: "support.function",
- regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
- }, {
- token: "support.function.dom",
- regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
- }, {
- token: "support.constant",
- regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
- }, {
- token: "identifier",
- regex: identifierRe
- }, {
- regex: "",
- token: "empty",
- next: "no_regex"
- }
- ],
- "start": [
- DocCommentHighlightRules.getStartRule("doc-start"),
- comments("start"),
- {
- token: "string.regexp",
- regex: "\\/",
- next: "regex"
- }, {
- token: "text",
- regex: "\\s+|^$",
- next: "start"
- }, {
- token: "empty",
- regex: "",
- next: "no_regex"
- }
- ],
- "regex": [
- {
- token: "regexp.keyword.operator",
- regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
- }, {
- token: "string.regexp",
- regex: "/[sxngimy]*",
- next: "no_regex"
- }, {
- token: "invalid",
- regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
- }, {
- token: "constant.language.escape",
- regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
- }, {
- token: "constant.language.delimiter",
- regex: /\|/
- }, {
- token: "constant.language.escape",
- regex: /\[\^?/,
- next: "regex_character_class"
- }, {
- token: "empty",
- regex: "$",
- next: "no_regex"
- }, {
- defaultToken: "string.regexp"
- }
- ],
- "regex_character_class": [
- {
- token: "regexp.charclass.keyword.operator",
- regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
- }, {
- token: "constant.language.escape",
- regex: "]",
- next: "regex"
- }, {
- token: "constant.language.escape",
- regex: "-"
- }, {
- token: "empty",
- regex: "$",
- next: "no_regex"
- }, {
- defaultToken: "string.regexp.charachterclass"
- }
- ],
- "function_arguments": [
- {
- token: "variable.parameter",
- regex: identifierRe
- }, {
- token: "punctuation.operator",
- regex: "[, ]+"
- }, {
- token: "punctuation.operator",
- regex: "$"
- }, {
- token: "empty",
- regex: "",
- next: "no_regex"
- }
- ],
- "qqstring": [
- {
- token: "constant.language.escape",
- regex: escapedRe
- }, {
- token: "string",
- regex: "\\\\$",
- consumeLineEnd: true
- }, {
- token: "string",
- regex: '"|$',
- next: "no_regex"
- }, {
- defaultToken: "string"
- }
- ],
- "qstring": [
- {
- token: "constant.language.escape",
- regex: escapedRe
- }, {
- token: "string",
- regex: "\\\\$",
- consumeLineEnd: true
- }, {
- token: "string",
- regex: "'|$",
- next: "no_regex"
- }, {
- defaultToken: "string"
- }
- ]
- };
- if (!options || !options.noES6) {
- this.$rules.no_regex.unshift({
- regex: "[{}]", onMatch: function (val, state, stack) {
- this.next = val == "{" ? this.nextState : "";
- if (val == "{" && stack.length) {
- stack.unshift("start", state);
- }
- else if (val == "}" && stack.length) {
- stack.shift();
- this.next = stack.shift();
- if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
- return "paren.quasi.end";
- }
- return val == "{" ? "paren.lparen" : "paren.rparen";
- },
- nextState: "start"
- }, {
- token: "string.quasi.start",
- regex: /`/,
- push: [{
- token: "constant.language.escape",
- regex: escapedRe
- }, {
- token: "paren.quasi.start",
- regex: /\${/,
- push: "start"
- }, {
- token: "string.quasi.end",
- regex: /`/,
- next: "pop"
- }, {
- defaultToken: "string.quasi"
- }]
- });
- if (!options || options.jsx != false)
- JSX.call(this);
- }
- this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
- this.normalizeRules();
-};
-oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
-function JSX() {
- var tagRegex = identifierRe.replace("\\d", "\\d\\-");
- var jsxTag = {
- onMatch: function (val, state, stack) {
- var offset = val.charAt(1) == "/" ? 2 : 1;
- if (offset == 1) {
- if (state != this.nextState)
- stack.unshift(this.next, this.nextState, 0);
- else
- stack.unshift(this.next);
- stack[2]++;
- }
- else if (offset == 2) {
- if (state == this.nextState) {
- stack[1]--;
- if (!stack[1] || stack[1] < 0) {
- stack.shift();
- stack.shift();
- }
- }
- }
- return [{
- type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
- value: val.slice(0, offset)
- }, {
- type: "meta.tag.tag-name.xml",
- value: val.substr(offset)
- }];
- },
- regex: "?" + tagRegex + "",
- next: "jsxAttributes",
- nextState: "jsx"
- };
- this.$rules.start.unshift(jsxTag);
- var jsxJsRule = {
- regex: "{",
- token: "paren.quasi.start",
- push: "start"
- };
- this.$rules.jsx = [
- jsxJsRule,
- jsxTag,
- { include: "reference" },
- { defaultToken: "string" }
- ];
- this.$rules.jsxAttributes = [{
- token: "meta.tag.punctuation.tag-close.xml",
- regex: "/?>",
- onMatch: function (value, currentState, stack) {
- if (currentState == stack[0])
- stack.shift();
- if (value.length == 2) {
- if (stack[0] == this.nextState)
- stack[1]--;
- if (!stack[1] || stack[1] < 0) {
- stack.splice(0, 2);
- }
- }
- this.next = stack[0] || "start";
- return [{ type: this.token, value: value }];
- },
- nextState: "jsx"
- },
- jsxJsRule,
- comments("jsxAttributes"),
- {
- token: "entity.other.attribute-name.xml",
- regex: tagRegex
- }, {
- token: "keyword.operator.attribute-equals.xml",
- regex: "="
- }, {
- token: "text.tag-whitespace.xml",
- regex: "\\s+"
- }, {
- token: "string.attribute-value.xml",
- regex: "'",
- stateName: "jsx_attr_q",
- push: [
- { token: "string.attribute-value.xml", regex: "'", next: "pop" },
- { include: "reference" },
- { defaultToken: "string.attribute-value.xml" }
- ]
- }, {
- token: "string.attribute-value.xml",
- regex: '"',
- stateName: "jsx_attr_qq",
- push: [
- { token: "string.attribute-value.xml", regex: '"', next: "pop" },
- { include: "reference" },
- { defaultToken: "string.attribute-value.xml" }
- ]
- },
- jsxTag
- ];
- this.$rules.reference = [{
- token: "constant.language.escape.reference.xml",
- regex: "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
- }];
-}
-function comments(next) {
- return [
- {
- token: "comment",
- regex: /\/\*/,
- next: [
- DocCommentHighlightRules.getTagRule(),
- { token: "comment", regex: "\\*\\/", next: next || "pop" },
- { defaultToken: "comment", caseInsensitive: true }
- ]
- }, {
- token: "comment",
- regex: "\\/\\/",
- next: [
- DocCommentHighlightRules.getTagRule(),
- { token: "comment", regex: "$|^", next: next || "pop" },
- { defaultToken: "comment", caseInsensitive: true }
- ]
- }
- ];
-}
-exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
-
-});
-
-ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
-var Range = require("../range").Range;
-var MatchingBraceOutdent = function () { };
-(function () {
- this.checkOutdent = function (line, input) {
- if (!/^\s+$/.test(line))
- return false;
- return /^\s*\}/.test(input);
- };
- this.autoOutdent = function (doc, row) {
- var line = doc.getLine(row);
- var match = line.match(/^(\s*\})/);
- if (!match)
- return 0;
- var column = match[1].length;
- var openBracePos = doc.findMatchingBracket({ row: row, column: column });
- if (!openBracePos || openBracePos.row == row)
- return 0;
- var indent = this.$getIndent(doc.getLine(openBracePos.row));
- doc.replace(new Range(row, 0, row, column - 1), indent);
- };
- this.$getIndent = function (line) {
- return line.match(/^\s*/)[0];
- };
-}).call(MatchingBraceOutdent.prototype);
-exports.MatchingBraceOutdent = MatchingBraceOutdent;
-
-});
-
-ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
-var oop = require("../../lib/oop");
-var Range = require("../../range").Range;
-var BaseFoldMode = require("./fold_mode").FoldMode;
-var FoldMode = exports.FoldMode = function (commentRegex) {
- if (commentRegex) {
- this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
- this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
- }
-};
-oop.inherits(FoldMode, BaseFoldMode);
-(function () {
- this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
- this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
- this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
- this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
- this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
- this._getFoldWidgetBase = this.getFoldWidget;
- this.getFoldWidget = function (session, foldStyle, row) {
- var line = session.getLine(row);
- if (this.singleLineBlockCommentRe.test(line)) {
- if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
- return "";
- }
- var fw = this._getFoldWidgetBase(session, foldStyle, row);
- if (!fw && this.startRegionRe.test(line))
- return "start"; // lineCommentRegionStart
- return fw;
- };
- this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
- var line = session.getLine(row);
- if (this.startRegionRe.test(line))
- return this.getCommentRegionBlock(session, line, row);
- var match = line.match(this.foldingStartMarker);
- if (match) {
- var i = match.index;
- if (match[1])
- return this.openingBracketBlock(session, match[1], row, i);
- var range = session.getCommentFoldRange(row, i + match[0].length, 1);
- if (range && !range.isMultiLine()) {
- if (forceMultiline) {
- range = this.getSectionRange(session, row);
- }
- else if (foldStyle != "all")
- range = null;
- }
- return range;
- }
- if (foldStyle === "markbegin")
- return;
- var match = line.match(this.foldingStopMarker);
- if (match) {
- var i = match.index + match[0].length;
- if (match[1])
- return this.closingBracketBlock(session, match[1], row, i);
- return session.getCommentFoldRange(row, i, -1);
- }
- };
- this.getSectionRange = function (session, row) {
- var line = session.getLine(row);
- var startIndent = line.search(/\S/);
- var startRow = row;
- var startColumn = line.length;
- row = row + 1;
- var endRow = row;
- var maxRow = session.getLength();
- while (++row < maxRow) {
- line = session.getLine(row);
- var indent = line.search(/\S/);
- if (indent === -1)
- continue;
- if (startIndent > indent)
- break;
- var subRange = this.getFoldWidgetRange(session, "all", row);
- if (subRange) {
- if (subRange.start.row <= startRow) {
- break;
- }
- else if (subRange.isMultiLine()) {
- row = subRange.end.row;
- }
- else if (startIndent == indent) {
- break;
- }
- }
- endRow = row;
- }
- return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
- };
- this.getCommentRegionBlock = function (session, line, row) {
- var startColumn = line.search(/\s*$/);
- var maxRow = session.getLength();
- var startRow = row;
- var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
- var depth = 1;
- while (++row < maxRow) {
- line = session.getLine(row);
- var m = re.exec(line);
- if (!m)
- continue;
- if (m[1])
- depth--;
- else
- depth++;
- if (!depth)
- break;
- }
- var endRow = row;
- if (endRow > startRow) {
- return new Range(startRow, startColumn, endRow, line.length);
- }
- };
-}).call(FoldMode.prototype);
-
-});
-
-ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var TextMode = require("./text").Mode;
-var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
-var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
-var WorkerClient = require("../worker/worker_client").WorkerClient;
-var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
-var CStyleFoldMode = require("./folding/cstyle").FoldMode;
-var Mode = function () {
- this.HighlightRules = JavaScriptHighlightRules;
- this.$outdent = new MatchingBraceOutdent();
- this.$behaviour = new CstyleBehaviour();
- this.foldingRules = new CStyleFoldMode();
-};
-oop.inherits(Mode, TextMode);
-(function () {
- this.lineCommentStart = "//";
- this.blockComment = { start: "/*", end: "*/" };
- this.$quotes = { '"': '"', "'": "'", "`": "`" };
- this.getNextLineIndent = function (state, line, tab) {
- var indent = this.$getIndent(line);
- var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
- var tokens = tokenizedLine.tokens;
- var endState = tokenizedLine.state;
- if (tokens.length && tokens[tokens.length - 1].type == "comment") {
- return indent;
- }
- if (state == "start" || state == "no_regex") {
- var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
- if (match) {
- indent += tab;
- }
- }
- else if (state == "doc-start") {
- if (endState == "start" || endState == "no_regex") {
- return "";
- }
- var match = line.match(/^\s*(\/?)\*/);
- if (match) {
- if (match[1]) {
- indent += " ";
- }
- indent += "* ";
- }
- }
- return indent;
- };
- this.checkOutdent = function (state, line, input) {
- return this.$outdent.checkOutdent(line, input);
- };
- this.autoOutdent = function (state, doc, row) {
- this.$outdent.autoOutdent(doc, row);
- };
- this.createWorker = function (session) {
- var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
- worker.attachToDocument(session.getDocument());
- worker.on("annotate", function (results) {
- session.setAnnotations(results.data);
- });
- worker.on("terminate", function () {
- session.clearAnnotations();
- });
- return worker;
- };
- this.$id = "ace/mode/javascript";
- this.snippetFileId = "ace/snippets/javascript";
-}).call(Mode.prototype);
-exports.Mode = Mode;
-
-}); (function() {
- ace.require(["ace/mode/javascript"], function(m) {
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = m;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/ace/mode-json.js b/GameDev/bin/Release/editor/ace/mode-json.js
deleted file mode 100644
index 1585dea2..00000000
--- a/GameDev/bin/Release/editor/ace/mode-json.js
+++ /dev/null
@@ -1,276 +0,0 @@
-ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-var JsonHighlightRules = function () {
- this.$rules = {
- "start": [
- {
- token: "variable",
- regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
- }, {
- token: "string",
- regex: '"',
- next: "string"
- }, {
- token: "constant.numeric",
- regex: "0[xX][0-9a-fA-F]+\\b"
- }, {
- token: "constant.numeric",
- regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
- }, {
- token: "constant.language.boolean",
- regex: "(?:true|false)\\b"
- }, {
- token: "text",
- regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
- }, {
- token: "comment",
- regex: "\\/\\/.*$"
- }, {
- token: "comment.start",
- regex: "\\/\\*",
- next: "comment"
- }, {
- token: "paren.lparen",
- regex: "[[({]"
- }, {
- token: "paren.rparen",
- regex: "[\\])}]"
- }, {
- token: "punctuation.operator",
- regex: /[,]/
- }, {
- token: "text",
- regex: "\\s+"
- }
- ],
- "string": [
- {
- token: "constant.language.escape",
- regex: /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
- }, {
- token: "string",
- regex: '"|$',
- next: "start"
- }, {
- defaultToken: "string"
- }
- ],
- "comment": [
- {
- token: "comment.end",
- regex: "\\*\\/",
- next: "start"
- }, {
- defaultToken: "comment"
- }
- ]
- };
-};
-oop.inherits(JsonHighlightRules, TextHighlightRules);
-exports.JsonHighlightRules = JsonHighlightRules;
-
-});
-
-ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
-var Range = require("../range").Range;
-var MatchingBraceOutdent = function () { };
-(function () {
- this.checkOutdent = function (line, input) {
- if (!/^\s+$/.test(line))
- return false;
- return /^\s*\}/.test(input);
- };
- this.autoOutdent = function (doc, row) {
- var line = doc.getLine(row);
- var match = line.match(/^(\s*\})/);
- if (!match)
- return 0;
- var column = match[1].length;
- var openBracePos = doc.findMatchingBracket({ row: row, column: column });
- if (!openBracePos || openBracePos.row == row)
- return 0;
- var indent = this.$getIndent(doc.getLine(openBracePos.row));
- doc.replace(new Range(row, 0, row, column - 1), indent);
- };
- this.$getIndent = function (line) {
- return line.match(/^\s*/)[0];
- };
-}).call(MatchingBraceOutdent.prototype);
-exports.MatchingBraceOutdent = MatchingBraceOutdent;
-
-});
-
-ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
-var oop = require("../../lib/oop");
-var Range = require("../../range").Range;
-var BaseFoldMode = require("./fold_mode").FoldMode;
-var FoldMode = exports.FoldMode = function (commentRegex) {
- if (commentRegex) {
- this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
- this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
- }
-};
-oop.inherits(FoldMode, BaseFoldMode);
-(function () {
- this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
- this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
- this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
- this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
- this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
- this._getFoldWidgetBase = this.getFoldWidget;
- this.getFoldWidget = function (session, foldStyle, row) {
- var line = session.getLine(row);
- if (this.singleLineBlockCommentRe.test(line)) {
- if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
- return "";
- }
- var fw = this._getFoldWidgetBase(session, foldStyle, row);
- if (!fw && this.startRegionRe.test(line))
- return "start"; // lineCommentRegionStart
- return fw;
- };
- this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
- var line = session.getLine(row);
- if (this.startRegionRe.test(line))
- return this.getCommentRegionBlock(session, line, row);
- var match = line.match(this.foldingStartMarker);
- if (match) {
- var i = match.index;
- if (match[1])
- return this.openingBracketBlock(session, match[1], row, i);
- var range = session.getCommentFoldRange(row, i + match[0].length, 1);
- if (range && !range.isMultiLine()) {
- if (forceMultiline) {
- range = this.getSectionRange(session, row);
- }
- else if (foldStyle != "all")
- range = null;
- }
- return range;
- }
- if (foldStyle === "markbegin")
- return;
- var match = line.match(this.foldingStopMarker);
- if (match) {
- var i = match.index + match[0].length;
- if (match[1])
- return this.closingBracketBlock(session, match[1], row, i);
- return session.getCommentFoldRange(row, i, -1);
- }
- };
- this.getSectionRange = function (session, row) {
- var line = session.getLine(row);
- var startIndent = line.search(/\S/);
- var startRow = row;
- var startColumn = line.length;
- row = row + 1;
- var endRow = row;
- var maxRow = session.getLength();
- while (++row < maxRow) {
- line = session.getLine(row);
- var indent = line.search(/\S/);
- if (indent === -1)
- continue;
- if (startIndent > indent)
- break;
- var subRange = this.getFoldWidgetRange(session, "all", row);
- if (subRange) {
- if (subRange.start.row <= startRow) {
- break;
- }
- else if (subRange.isMultiLine()) {
- row = subRange.end.row;
- }
- else if (startIndent == indent) {
- break;
- }
- }
- endRow = row;
- }
- return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
- };
- this.getCommentRegionBlock = function (session, line, row) {
- var startColumn = line.search(/\s*$/);
- var maxRow = session.getLength();
- var startRow = row;
- var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
- var depth = 1;
- while (++row < maxRow) {
- line = session.getLine(row);
- var m = re.exec(line);
- if (!m)
- continue;
- if (m[1])
- depth--;
- else
- depth++;
- if (!depth)
- break;
- }
- var endRow = row;
- if (endRow > startRow) {
- return new Range(startRow, startColumn, endRow, line.length);
- }
- };
-}).call(FoldMode.prototype);
-
-});
-
-ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var TextMode = require("./text").Mode;
-var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
-var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
-var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
-var CStyleFoldMode = require("./folding/cstyle").FoldMode;
-var WorkerClient = require("../worker/worker_client").WorkerClient;
-var Mode = function () {
- this.HighlightRules = HighlightRules;
- this.$outdent = new MatchingBraceOutdent();
- this.$behaviour = new CstyleBehaviour();
- this.foldingRules = new CStyleFoldMode();
-};
-oop.inherits(Mode, TextMode);
-(function () {
- this.lineCommentStart = "//";
- this.blockComment = { start: "/*", end: "*/" };
- this.getNextLineIndent = function (state, line, tab) {
- var indent = this.$getIndent(line);
- if (state == "start") {
- var match = line.match(/^.*[\{\(\[]\s*$/);
- if (match) {
- indent += tab;
- }
- }
- return indent;
- };
- this.checkOutdent = function (state, line, input) {
- return this.$outdent.checkOutdent(line, input);
- };
- this.autoOutdent = function (state, doc, row) {
- this.$outdent.autoOutdent(doc, row);
- };
- this.createWorker = function (session) {
- var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
- worker.attachToDocument(session.getDocument());
- worker.on("annotate", function (e) {
- session.setAnnotations(e.data);
- });
- worker.on("terminate", function () {
- session.clearAnnotations();
- });
- return worker;
- };
- this.$id = "ace/mode/json";
-}).call(Mode.prototype);
-exports.Mode = Mode;
-
-}); (function() {
- ace.require(["ace/mode/json"], function(m) {
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = m;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/ace/mode-xml.js b/GameDev/bin/Release/editor/ace/mode-xml.js
deleted file mode 100644
index e5521d3c..00000000
--- a/GameDev/bin/Release/editor/ace/mode-xml.js
+++ /dev/null
@@ -1,469 +0,0 @@
-ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-var XmlHighlightRules = function (normalize) {
- var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
- this.$rules = {
- start: [
- { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
- {
- token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
- regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
- },
- { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
- {
- token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
- regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
- },
- { include: "tag" },
- { token: "text.end-tag-open.xml", regex: "" },
- { token: "text.tag-open.xml", regex: "<" },
- { include: "reference" },
- { defaultToken: "text.xml" }
- ],
- processing_instruction: [{
- token: "entity.other.attribute-name.decl-attribute-name.xml",
- regex: tagRegex
- }, {
- token: "keyword.operator.decl-attribute-equals.xml",
- regex: "="
- }, {
- include: "whitespace"
- }, {
- include: "string"
- }, {
- token: "punctuation.xml-decl.xml",
- regex: "\\?>",
- next: "start"
- }],
- doctype: [
- { include: "whitespace" },
- { include: "string" },
- { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
- { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
- { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
- ],
- int_subset: [{
- token: "text.xml",
- regex: "\\s+"
- }, {
- token: "punctuation.int-subset.xml",
- regex: "]",
- next: "pop"
- }, {
- token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
- regex: "(<\\!)(" + tagRegex + ")",
- push: [{
- token: "text",
- regex: "\\s+"
- },
- {
- token: "punctuation.markup-decl.xml",
- regex: ">",
- next: "pop"
- },
- { include: "string" }]
- }],
- cdata: [
- { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
- { token: "text.xml", regex: "\\s+" },
- { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
- ],
- comment: [
- { token: "comment.end.xml", regex: "-->", next: "start" },
- { defaultToken: "comment.xml" }
- ],
- reference: [{
- token: "constant.language.escape.reference.xml",
- regex: "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
- }],
- attr_reference: [{
- token: "constant.language.escape.reference.attribute-value.xml",
- regex: "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
- }],
- tag: [{
- token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
- regex: "(?:(<)|())((?:" + tagRegex + ":)?" + tagRegex + ")",
- next: [
- { include: "attributes" },
- { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
- ]
- }],
- tag_whitespace: [
- { token: "text.tag-whitespace.xml", regex: "\\s+" }
- ],
- whitespace: [
- { token: "text.whitespace.xml", regex: "\\s+" }
- ],
- string: [{
- token: "string.xml",
- regex: "'",
- push: [
- { token: "string.xml", regex: "'", next: "pop" },
- { defaultToken: "string.xml" }
- ]
- }, {
- token: "string.xml",
- regex: '"',
- push: [
- { token: "string.xml", regex: '"', next: "pop" },
- { defaultToken: "string.xml" }
- ]
- }],
- attributes: [{
- token: "entity.other.attribute-name.xml",
- regex: tagRegex
- }, {
- token: "keyword.operator.attribute-equals.xml",
- regex: "="
- }, {
- include: "tag_whitespace"
- }, {
- include: "attribute_value"
- }],
- attribute_value: [{
- token: "string.attribute-value.xml",
- regex: "'",
- push: [
- { token: "string.attribute-value.xml", regex: "'", next: "pop" },
- { include: "attr_reference" },
- { defaultToken: "string.attribute-value.xml" }
- ]
- }, {
- token: "string.attribute-value.xml",
- regex: '"',
- push: [
- { token: "string.attribute-value.xml", regex: '"', next: "pop" },
- { include: "attr_reference" },
- { defaultToken: "string.attribute-value.xml" }
- ]
- }]
- };
- if (this.constructor === XmlHighlightRules)
- this.normalizeRules();
-};
-(function () {
- this.embedTagRules = function (HighlightRules, prefix, tag) {
- this.$rules.tag.unshift({
- token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
- regex: "(<)(" + tag + "(?=\\s|>|$))",
- next: [
- { include: "attributes" },
- { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
- ]
- });
- this.$rules[tag + "-end"] = [
- { include: "attributes" },
- { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
- onMatch: function (value, currentState, stack) {
- stack.splice(0);
- return this.token;
- } }
- ];
- this.embedRules(HighlightRules, prefix, [{
- token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
- regex: "()(" + tag + "(?=\\s|>|$))",
- next: tag + "-end"
- }, {
- token: "string.cdata.xml",
- regex: "<\\!\\[CDATA\\["
- }, {
- token: "string.cdata.xml",
- regex: "\\]\\]>"
- }]);
- };
-}).call(TextHighlightRules.prototype);
-oop.inherits(XmlHighlightRules, TextHighlightRules);
-exports.XmlHighlightRules = XmlHighlightRules;
-
-});
-
-ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module){"use strict";
-var oop = require("../../lib/oop");
-var Behaviour = require("../behaviour").Behaviour;
-var TokenIterator = require("../../token_iterator").TokenIterator;
-var lang = require("../../lib/lang");
-function is(token, type) {
- return token && token.type.lastIndexOf(type + ".xml") > -1;
-}
-var XmlBehaviour = function () {
- this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
- if (text == '"' || text == "'") {
- var quote = text;
- var selected = session.doc.getTextRange(editor.getSelectionRange());
- if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
- return {
- text: quote + selected + quote,
- selection: false
- };
- }
- var cursor = editor.getCursorPosition();
- var line = session.doc.getLine(cursor.row);
- var rightChar = line.substring(cursor.column, cursor.column + 1);
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
- var token = iterator.getCurrentToken();
- if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
- return {
- text: "",
- selection: [1, 1]
- };
- }
- if (!token)
- token = iterator.stepBackward();
- if (!token)
- return;
- while (is(token, "tag-whitespace") || is(token, "whitespace")) {
- token = iterator.stepBackward();
- }
- var rightSpace = !rightChar || rightChar.match(/\s/);
- if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
- return {
- text: quote + quote,
- selection: [1, 1]
- };
- }
- }
- });
- this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
- var selected = session.doc.getTextRange(range);
- if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
- var line = session.doc.getLine(range.start.row);
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
- if (rightChar == selected) {
- range.end.column++;
- return range;
- }
- }
- });
- this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
- if (text == '>') {
- var position = editor.getSelectionRange().start;
- var iterator = new TokenIterator(session, position.row, position.column);
- var token = iterator.getCurrentToken() || iterator.stepBackward();
- if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
- return;
- if (is(token, "reference.attribute-value"))
- return;
- if (is(token, "attribute-value")) {
- var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
- if (position.column < tokenEndColumn)
- return;
- if (position.column == tokenEndColumn) {
- var nextToken = iterator.stepForward();
- if (nextToken && is(nextToken, "attribute-value"))
- return;
- iterator.stepBackward();
- }
- }
- if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
- return;
- while (!is(token, "tag-name")) {
- token = iterator.stepBackward();
- if (token.value == "<") {
- token = iterator.stepForward();
- break;
- }
- }
- var tokenRow = iterator.getCurrentTokenRow();
- var tokenColumn = iterator.getCurrentTokenColumn();
- if (is(iterator.stepBackward(), "end-tag-open"))
- return;
- var element = token.value;
- if (tokenRow == position.row)
- element = element.substring(0, position.column - tokenColumn);
- if (this.voidElements.hasOwnProperty(element.toLowerCase()))
- return;
- return {
- text: ">" + "" + element + ">",
- selection: [1, 1]
- };
- }
- });
- this.add("autoindent", "insertion", function (state, action, editor, session, text) {
- if (text == "\n") {
- var cursor = editor.getCursorPosition();
- var line = session.getLine(cursor.row);
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
- var token = iterator.getCurrentToken();
- if (token && token.type.indexOf("tag-close") !== -1) {
- if (token.value == "/>")
- return;
- while (token && token.type.indexOf("tag-name") === -1) {
- token = iterator.stepBackward();
- }
- if (!token) {
- return;
- }
- var tag = token.value;
- var row = iterator.getCurrentTokenRow();
- token = iterator.stepBackward();
- if (!token || token.type.indexOf("end-tag") !== -1) {
- return;
- }
- if (this.voidElements && !this.voidElements[tag]) {
- var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
- var line = session.getLine(row);
- var nextIndent = this.$getIndent(line);
- var indent = nextIndent + session.getTabString();
- if (nextToken && nextToken.value === "") {
- return {
- text: "\n" + indent + "\n" + nextIndent,
- selection: [1, indent.length, 1, indent.length]
- };
- }
- else {
- return {
- text: "\n" + indent
- };
- }
- }
- }
- }
- });
-};
-oop.inherits(XmlBehaviour, Behaviour);
-exports.XmlBehaviour = XmlBehaviour;
-
-});
-
-ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
-var oop = require("../../lib/oop");
-var Range = require("../../range").Range;
-var BaseFoldMode = require("./fold_mode").FoldMode;
-var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
- BaseFoldMode.call(this);
- this.voidElements = voidElements || {};
- this.optionalEndTags = oop.mixin({}, this.voidElements);
- if (optionalEndTags)
- oop.mixin(this.optionalEndTags, optionalEndTags);
-};
-oop.inherits(FoldMode, BaseFoldMode);
-var Tag = function () {
- this.tagName = "";
- this.closing = false;
- this.selfClosing = false;
- this.start = { row: 0, column: 0 };
- this.end = { row: 0, column: 0 };
-};
-function is(token, type) {
- return token.type.lastIndexOf(type + ".xml") > -1;
-}
-(function () {
- this.getFoldWidget = function (session, foldStyle, row) {
- var tag = this._getFirstTagInLine(session, row);
- if (!tag)
- return this.getCommentFoldWidget(session, row);
- if (tag.closing || (!tag.tagName && tag.selfClosing))
- return foldStyle === "markbeginend" ? "end" : "";
- if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
- return "";
- if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
- return "";
- return "start";
- };
- this.getCommentFoldWidget = function (session, row) {
- if (/comment/.test(session.getState(row)) && /';
- break;
- }
- }
- return tag;
- }
- else if (is(token, "tag-close")) {
- tag.selfClosing = token.value == '/>';
- return tag;
- }
- tag.start.column += token.value.length;
- }
- return null;
- };
- this._findEndTagInLine = function (session, row, tagName, startColumn) {
- var tokens = session.getTokens(row);
- var column = 0;
- for (var i = 0; i < tokens.length; i++) {
- var token = tokens[i];
- column += token.value.length;
- if (column < startColumn)
- continue;
- if (is(token, "end-tag-open")) {
- token = tokens[i + 1];
- if (token && token.value == tagName)
- return true;
- }
- }
- return false;
- };
- this.getFoldWidgetRange = function (session, foldStyle, row) {
- var tags = session.getMatchingTags({ row: row, column: 0 });
- if (tags) {
- return new Range(tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column);
- }
- else {
- return this.getCommentFoldWidget(session, row)
- && session.getCommentFoldRange(row, session.getLine(row).length);
- }
- };
-}).call(FoldMode.prototype);
-
-});
-
-ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module){"use strict";
-var oop = require("../lib/oop");
-var lang = require("../lib/lang");
-var TextMode = require("./text").Mode;
-var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
-var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
-var XmlFoldMode = require("./folding/xml").FoldMode;
-var WorkerClient = require("../worker/worker_client").WorkerClient;
-var Mode = function () {
- this.HighlightRules = XmlHighlightRules;
- this.$behaviour = new XmlBehaviour();
- this.foldingRules = new XmlFoldMode();
-};
-oop.inherits(Mode, TextMode);
-(function () {
- this.voidElements = lang.arrayToMap([]);
- this.blockComment = { start: "" };
- this.createWorker = function (session) {
- var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
- worker.attachToDocument(session.getDocument());
- worker.on("error", function (e) {
- session.setAnnotations(e.data);
- });
- worker.on("terminate", function () {
- session.clearAnnotations();
- });
- return worker;
- };
- this.$id = "ace/mode/xml";
-}).call(Mode.prototype);
-exports.Mode = Mode;
-
-}); (function() {
- ace.require(["ace/mode/xml"], function(m) {
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = m;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/ace/theme-dawn.js b/GameDev/bin/Release/editor/ace/theme-dawn.js
deleted file mode 100644
index 923dad68..00000000
--- a/GameDev/bin/Release/editor/ace/theme-dawn.js
+++ /dev/null
@@ -1,115 +0,0 @@
-define("ace/theme/dawn",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
-
-exports.isDark = false;
-exports.cssClass = "ace-dawn";
-exports.cssText = ".ace-dawn .ace_gutter {\
-background: #ebebeb;\
-color: #333\
-}\
-.ace-dawn .ace_print-margin {\
-width: 1px;\
-background: #e8e8e8\
-}\
-.ace-dawn {\
-background-color: #F9F9F9;\
-color: #080808\
-}\
-.ace-dawn .ace_cursor {\
-color: #000000\
-}\
-.ace-dawn .ace_marker-layer .ace_selection {\
-background: rgba(39, 95, 255, 0.30)\
-}\
-.ace-dawn.ace_multiselect .ace_selection.ace_start {\
-box-shadow: 0 0 3px 0px #F9F9F9;\
-}\
-.ace-dawn .ace_marker-layer .ace_step {\
-background: rgb(255, 255, 0)\
-}\
-.ace-dawn .ace_marker-layer .ace_bracket {\
-margin: -1px 0 0 -1px;\
-border: 1px solid rgba(75, 75, 126, 0.50)\
-}\
-.ace-dawn .ace_marker-layer .ace_active-line {\
-background: rgba(36, 99, 180, 0.12)\
-}\
-.ace-dawn .ace_gutter-active-line {\
-background-color : #dcdcdc\
-}\
-.ace-dawn .ace_marker-layer .ace_selected-word {\
-border: 1px solid rgba(39, 95, 255, 0.30)\
-}\
-.ace-dawn .ace_invisible {\
-color: rgba(75, 75, 126, 0.50)\
-}\
-.ace-dawn .ace_keyword,\
-.ace-dawn .ace_meta {\
-color: #794938\
-}\
-.ace-dawn .ace_constant,\
-.ace-dawn .ace_constant.ace_character,\
-.ace-dawn .ace_constant.ace_character.ace_escape,\
-.ace-dawn .ace_constant.ace_other {\
-color: #811F24\
-}\
-.ace-dawn .ace_invalid.ace_illegal {\
-text-decoration: underline;\
-font-style: italic;\
-color: #F8F8F8;\
-background-color: #B52A1D\
-}\
-.ace-dawn .ace_invalid.ace_deprecated {\
-text-decoration: underline;\
-font-style: italic;\
-color: #B52A1D\
-}\
-.ace-dawn .ace_support {\
-color: #691C97\
-}\
-.ace-dawn .ace_support.ace_constant {\
-color: #B4371F\
-}\
-.ace-dawn .ace_fold {\
-background-color: #794938;\
-border-color: #080808\
-}\
-.ace-dawn .ace_list,\
-.ace-dawn .ace_markup.ace_list,\
-.ace-dawn .ace_support.ace_function {\
-color: #693A17\
-}\
-.ace-dawn .ace_storage {\
-font-style: italic;\
-color: #A71D5D\
-}\
-.ace-dawn .ace_string {\
-color: #0B6125\
-}\
-.ace-dawn .ace_string.ace_regexp {\
-color: #CF5628\
-}\
-.ace-dawn .ace_comment {\
-font-style: italic;\
-color: #5A525F\
-}\
-.ace-dawn .ace_heading,\
-.ace-dawn .ace_markup.ace_heading {\
-color: #19356D\
-}\
-.ace-dawn .ace_variable {\
-color: #234A97\
-}\
-.ace-dawn .ace_indent-guide {\
-background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYLh/5+x/AAizA4hxNNsZAAAAAElFTkSuQmCC) right repeat-y\
-}";
-
-var dom = require("../lib/dom");
-dom.importCssString(exports.cssText, exports.cssClass, false);
-}); (function() {
- window.require(["ace/theme/dawn"], function(m) {
- if (typeof module == "object" && typeof exports == "object" && module) {
- module.exports = m;
- }
- });
- })();
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/editor/js_editor.html b/GameDev/bin/Release/editor/js_editor.html
deleted file mode 100644
index be2fe67a..00000000
--- a/GameDev/bin/Release/editor/js_editor.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
- GameDev
-
-
-
-
-
-
-
-
-
-
diff --git a/GameDev/bin/Release/editor/json_editor.html b/GameDev/bin/Release/editor/json_editor.html
deleted file mode 100644
index 05b7088e..00000000
--- a/GameDev/bin/Release/editor/json_editor.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
- GameDev
-
-
-
-
-
-
-
-
-
-
diff --git a/GameDev/bin/Release/editor/xml_editor.html b/GameDev/bin/Release/editor/xml_editor.html
deleted file mode 100644
index f1b82a31..00000000
--- a/GameDev/bin/Release/editor/xml_editor.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
- GameDev
-
-
-
-
-
-
-
-
-
-
diff --git a/GameDev/bin/Release/help/Targets.jpg b/GameDev/bin/Release/help/Targets.jpg
deleted file mode 100644
index d2559ca2..00000000
Binary files a/GameDev/bin/Release/help/Targets.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/UIAndroid.png b/GameDev/bin/Release/help/UIAndroid.png
deleted file mode 100644
index c8938a51..00000000
Binary files a/GameDev/bin/Release/help/UIAndroid.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/UILayout.jpg b/GameDev/bin/Release/help/UILayout.jpg
deleted file mode 100644
index 8b46571f..00000000
Binary files a/GameDev/bin/Release/help/UILayout.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/UIWin.jpg b/GameDev/bin/Release/help/UIWin.jpg
deleted file mode 100644
index 2d74df79..00000000
Binary files a/GameDev/bin/Release/help/UIWin.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/ambient_light.jpg b/GameDev/bin/Release/help/ambient_light.jpg
deleted file mode 100644
index 8092b08d..00000000
Binary files a/GameDev/bin/Release/help/ambient_light.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/AVCPlayer.html b/GameDev/bin/Release/help/api/AVCPlayer.html
deleted file mode 100644
index 87346674..00000000
--- a/GameDev/bin/Release/help/api/AVCPlayer.html
+++ /dev/null
@@ -1,1319 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class AVCPlayer
-Play back a raw opus stream.
-Can be used as an image source.
-class AVCPlayer
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-AVCPlayer() |
-Creates an AVC-player. |
-
-
-Properties |
- |
-
-
-width |
-Width of the image source. |
-
-
-height |
-Height of the image source. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-addPacket() |
-Add an AVC packet to the play queue. |
-
-
-updateTexture() |
-Add an AVC packet to the play queue. |
-
-
-Constructors
-AVCPlayer()
-AVCPlayer
()
-Creates an AVC-player.
-Properties
-width
- .width
: Number
-Width of the image source.
-Read-only.
-height
- .height
: Number
-Height of the image source.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-addPacket()
-.addPacket
(data
: ArrayBuffer): undefined
-Add an AVC packet to the play queue.
-updateTexture()
-.updateTexture
(): undefined
-Attempt to read new frames and update the texture data.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/AVCRecorder.html b/GameDev/bin/Release/help/api/AVCRecorder.html
deleted file mode 100644
index 0767a0e3..00000000
--- a/GameDev/bin/Release/help/api/AVCRecorder.html
+++ /dev/null
@@ -1,1298 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class AVCRecorder
-Record from a video device and encode as a raw AVC stream.
-class AVCRecorder
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-AVCRecorder() |
-Creates an AVC-recorder. |
-
-
-Properties |
- |
-
-
-callback |
-Callback function for recieving AVC packets. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-AVCRecorder()
-AVCRecorder
(id_device
: Number)
-Creates an AVC-recorder.
-Parameters
-id_device
: index of the camera device.
-Properties
-callback
- .callback
: Function
- .callback
(data
: ArrayBuffer): undefined
-Callback function for recieving AVC packets.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/AmbientLight.html b/GameDev/bin/Release/help/api/AmbientLight.html
deleted file mode 100644
index 4785b737..00000000
--- a/GameDev/bin/Release/help/api/AmbientLight.html
+++ /dev/null
@@ -1,1314 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class AmbientLight
-This light globally illuminates all objects in the scene equally.
-This light cannot be used to cast shadows as it does not have a direction.
-class AmbientLight extends IndirectLight
-Inheritance IndirectLight --> AmbientLight
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-AmbientLight() |
-Creates a new AmbientLight. |
-
-
-Properties |
- |
-
-
-color |
-The color of the ambient light. |
-
-
-intensity |
-The intensity of the ambient light. |
-
-
-Methods |
- |
-
-
-getColor |
-Get the value of .color |
-
-
-setColor |
-Set the value of .color |
-
-
-Constructors
-AmbientLight()
-Creates a new AmbientLight.
-Properties
-color
-.color
: Object
-The color of the ambient light.
-Read-only. Use the method .setColor
to modify this property.
-intensity
-.intensity
: Number
-The intensity of the ambient light.
-Readable and writable.
-Methods
-getColor()
-.getColor
(color
: Vector3) : Vector3
-Copy the value of .color
into color
.
-setColor()
-.setColor
(color
: Vector3): undefined
-Set the value of .color
according to color
.
- .setColor
(r
: Number, g
: Number, b
: Number ): undefined
-Set the value of .color
according to the r
, g
, b
values.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Android.png b/GameDev/bin/Release/help/api/Android.png
deleted file mode 100644
index a135c162..00000000
Binary files a/GameDev/bin/Release/help/api/Android.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/AnimationMixer.html b/GameDev/bin/Release/help/api/AnimationMixer.html
deleted file mode 100644
index c7ba9c6a..00000000
--- a/GameDev/bin/Release/help/api/AnimationMixer.html
+++ /dev/null
@@ -1,1432 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class AnimationMixer
-Utility for linear blending of animation clips.
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-AnimationMixer() |
-Creates a new AnimationMixer. |
-
-
-Properties |
- |
-
-
-animations |
-list of current added animation clips |
-
-
-currentPlaying |
-list of current playing animation clips |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-getAnimation |
-Get an added animation clip by name. |
-
-
-getAnimations |
-Get all added animation clips. |
-
-
-addAnimation |
-Add an animation clip to the mixer. |
-
-
-addAnimations |
-Add multiple animation clips to the mixer. |
-
-
-startAnimation |
-Start an animation by name. |
-
-
-stopAnimation |
-Stop an animation by name. |
-
-
-setWeights |
-Set blending weigths for each animation currently being played. |
-
-
-getFrame |
-Get the mixed animation frame of current time point. |
-
-
-Constructors
-AnimationMixer()
- AnimationMixer
()
-Creates a new AnimationMixer.
-Properties
-animations()
-.animations
: Array
-Read-only property for displaying the info of added animation clips.
-.currentPlaying
: Array
-Read-only property for displaying the info of currently playing animation clips.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-getAnimation()
-.getAnimation
(name
: String): Object
-Get an added animation clip by name.
-The returned object has the following properties:
-.name
: String
-Name of the animation clip.
-.duration
: Number
-Duration of the animation clip in seconds.
-.morphs
: Array
-Optional. Morph tracks.
-.morphs[i].name
: String
-Name of the morphable mesh.
-.morphs[i].targets
: Number
-Number of morph targets of the morphable mesh.
-.morphs[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR" or "CUBICSPLINE"
-.morphs[i].times
: Float32Array
-Time stamp of each frame.
-.morphs[i].values
: Float32Array
-Weight values of each frame.
-.translations
: Array
-Optional. Translation tracks.
-.translations[i].name
: String
-Name of the targeted node.
-.translations[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR" or "CUBICSPLINE"
-.translations[i].times
: Float32Array
-Time stamp of each frame.
-.translations[i].values
: Float32Array
-Translation values of each frame.
-.rotations
: Array
-Optional. Rotation tracks.
-.rotations[i].name
: String
-Name of the targeted node.
-.rotations[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR"
-.rotations[i].times
: Float32Array
-Time stamp of each frame.
-.rotations[i].values
: Float32Array
-Rotation values of each frame.
-.scales
: Array
-Optional. Scale tracks.
-.scales[i].name
: String
-Name of the targeted node.
-.scales[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR" or "CUBICSPLINE"
-.scales[i].times
: Float32Array
-Time stamp of each frame.
-.scales[i].values
: Float32Array
-Scale values of each frame.
-getAnimations()
-.getAnimations
(): Array
-Get all added animation clips.
-Each element of the returned array has the same structure as the return value of .getAnimation()
.
-addAnimation()
-.addAnimation
(animation
: Object): undefined
-Add an animation clip to the mixer.
-The animation object should have the same structure as the return value of .getAnimation()
.
-addAnimations()
-.addAnimations
(animations
: Array): undefined
-Add multiple animation clips to the mixer.
-Each element of the array should have the same structure as the return value of .getAnimation()
.
-startAnimation()
-.startAnimation
(name
: String) : undefined
-Start an animation by name.
-stopAnimation()
-.stopAnimation
(name
: String) : undefined
-Stop an animation by name.
-setWeights()
-.setWeights
(weights
: Array) : undefined
-Set blending weigths for each animation currently being played.
-A weight of 0 will cause the corresponding animation clip being removed from the current playing list.
-getFrame()
-.getFrame
() : Object
-Get the mixed animation frame of current time point.
-The returned frame object has the following properties:
-frame.morphs
: Array
-Optional. Morph state for morphable meshes.
-frame.morphs[i].name
: String
-Name of a morphable mesh.
-frame.morphs[i].weights
: Array
-Weight for each morph target of the mesh.
-frame.translations
: Array
-Optional. Translation states for nodes.
-frame.translations[i].name
: String
-Name of the targeted node.
-frame.translations[i].translation
: Vector3
-Translation state of the node.
-frame.rotations
: Array
-Optional. Rotation states for nodes.
-frame.rotations[i].name
: String
-Name of the targeted node.
-frame.rotations[i].rotation
: Quaternion
-Rotation state of the node.
-frame.scales
: Array
-Optional. Scale states for nodes.
-frame.scales[i].name
: String
-Name of the targeted node.
-frame.translations[i].scale
: Vector3
-Scale state of the node.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Background.html b/GameDev/bin/Release/help/api/Background.html
deleted file mode 100644
index 756d72a0..00000000
--- a/GameDev/bin/Release/help/api/Background.html
+++ /dev/null
@@ -1,1271 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Background
-Abstract class for all backgrounds
-No contructor, never used directly.
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/BackgroundScene.html b/GameDev/bin/Release/help/api/BackgroundScene.html
deleted file mode 100644
index af468181..00000000
--- a/GameDev/bin/Release/help/api/BackgroundScene.html
+++ /dev/null
@@ -1,1303 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class BackgroundScene
-Use another scene as background.
-class BackgroundScene extends Background
-Inheritance Background --> BackgroundScene
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-BackgroundScene() |
-Creates a new BackgroundScene. |
-
-
-Properties |
- |
-
-
-scene |
-Reference to the scene. |
-
-
-near |
-near clipping distance for rendering the background |
-
-
-far |
-far clipping distance for rendering the background |
-
-
-Constructors
-BackgroundScene()
-BackgroundScene
(scene
: Scene, near: Number, far: Number)
-Creates a new BackgroundScene.
-Parameters
-scene
: reference to the scene used as background.
-near
: near clipping distance for rendering the background. Default value 10.0.
-far
: far clipping distance for rendering the background. Default value 10000.0.
-Properties
-scene
-.scene
: Scene
-Reference to the scene.
-Readable & writable.
-near
-.near
: Number
-Near clipping distance for rendering the background
-far
-.far
: Number
-Far clipping distance for rendering the background
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/BoundingVolumeHierarchy.html b/GameDev/bin/Release/help/api/BoundingVolumeHierarchy.html
deleted file mode 100644
index a7bea76e..00000000
--- a/GameDev/bin/Release/help/api/BoundingVolumeHierarchy.html
+++ /dev/null
@@ -1,1319 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class BoundingVolumeHierarchy
-Acceleration structure for ray-casting.
-class BoundingVolumeHierarchy
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-BoundingVolumeHierarchy() |
-Creates a new BoundingVolumeHierarchy. |
-
-
-Methods |
- |
-
-
-dispose |
-Dispose the unmanaged resource. |
-
-
-update |
-Update the BVH with a new model. |
-
-
-remove |
-Remove a model from the BVH. |
-
-
-intersect |
-Intersect the given ray with the acceleration structure. |
-
-
-Constructors
-BoundingVolumeHierarchy()
-BoundingVolumeHierarchy
(objects
: Array)
-Create a BoundingVolumeHierarchy from a list of Object3D objects.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-update()
-.update
(obj
: Object3D): undefined
-Update the BVH with a new model.
-remove()
-.remove
(obj
: Object3D): undefined
-Remove a model from the BVH.
-intersect()
- .intersect
(ray
: Object): Object
-Intersect the given ray with the acceleration structure.
-
-ray.origin
: Vector3
-Origin of the ray.
-ray.direction
: Vector3
-Direction of the ray.
-ray.near
: Number
-Optional. Nearest distance of search.
-ray.far
: Number
-Optional. Furthest distance of search.
-The returned object has the following properties:
-.name
: String
-Name of the first intersected object.
-.distance
: Number
-Distance of the first intersection point.
-At the event of missing intersection, it will return null;
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Camera.html b/GameDev/bin/Release/help/api/Camera.html
deleted file mode 100644
index 61ae038b..00000000
--- a/GameDev/bin/Release/help/api/Camera.html
+++ /dev/null
@@ -1,1329 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Camera
-Base class for cameras.
-class Camera extends Object3D
-Inheritance Object3D --> Camera
-
-Constructors
-Camera()
-Camera
()
-Creates a new Camera. Note that this class is not intended to be created directly.
-Properties
-See the base Object3D class for common properties.
-matrixWorldInverse
-.matrixWorldInverse
: Object
-This is the inverse of .matrixWorld
. .matrixWorld
contains the Matrix which has the world transform of the Camera.
-Read-only.
-projectionMatrix
-.projectionMatrix
: Object
-This is the matrix which contains the projection.
-Read-only.
-projectionMatrixInverse
-.projectionMatrixInverse
: Object
-The inverse of .projectionMatrix
.
-Read-only.
-Methods
-See the base Object3D class for common methods.
-getMatrixWorldInverse()
-.getMatrixWorldInverse
(matrix
: Matrix4) : Matrix4
-Copy the value of .matrixWorldInverse
into matrix
.
-getProjectionMatrix()
-.getProjectionMatrix
(matrix
: Matrix4) : Matrix4
-Copy the value of .projectionMatrix
into matrix
.
-getProjectionMatrixInverse()
-.getProjectionMatrixInverse
(matrix
: Matrix4) : Matrix4
-Copy the value of .projectionMatrixInverse
into matrix
.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/ColorBackground.html b/GameDev/bin/Release/help/api/ColorBackground.html
deleted file mode 100644
index 7b00b5ee..00000000
--- a/GameDev/bin/Release/help/api/ColorBackground.html
+++ /dev/null
@@ -1,1306 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class ColorBackground
-A background that has a monotone color.
-class ColorBackground extends Background
-Inheritance Background --> ColorBackground
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-ColorBackground() |
-Creates a new ColorBackground. |
-
-
-Properties |
- |
-
-
-color |
-Color of the background. |
-
-
-Methods |
- |
-
-
-getColor |
-Get the value of .color |
-
-
-setColor |
-Set the value of .color |
-
-
-Constructors
-ColorBackground()
-ColorBackground
()
-Creates a new ColorBackground.
-Properties
-color
-.color
: Object
-The color of the background.
-Read-only. Use the method .setColor
to modify this property.
-Methods
-getColor()
-.getColor
(color
: Vector3) : Vector3
-Copy the value of .color
into color
.
-setColor()
- .setColor
(color
: Vector3): undefined
- Set the value of .color
according to color
.
- .setColor
(r
: Number, g
: Number, b
: Number ): undefined
- Set the value of .color
according to the r
, g
, b
values.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/CubeBackground.html b/GameDev/bin/Release/help/api/CubeBackground.html
deleted file mode 100644
index 4ea1177a..00000000
--- a/GameDev/bin/Release/help/api/CubeBackground.html
+++ /dev/null
@@ -1,1284 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class CubeBackground
-A background using a CubeMap.
-class CubeBackground extends Background
-Inheritance Background --> CubeBackground
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-CubeBackground() |
-Creates a new CubeBackground. |
-
-
-Methods |
- |
-
-
-setCubemap |
-Set the cube-map data. |
-
-
-Constructors
-CubeBackground()
-CubeBackground
()
-Creates a new CubeBackground.
-Methods
-setCubemap()
-.setCubemap
(cubeMap
: CubeImage): undefined
-Set the cube-map data.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/CubeImage.html b/GameDev/bin/Release/help/api/CubeImage.html
deleted file mode 100644
index 8ccea216..00000000
--- a/GameDev/bin/Release/help/api/CubeImage.html
+++ /dev/null
@@ -1,1306 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class CubeImage
-Class that represents a cubemap image that resides in CPU memory.
-A CubeImage contains 6 images.
-Usually not created directly. Use ImageLoader class to create a cubemap image.
-class CubeImage
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-CubeImage() |
-Creates a cube image. |
-
-
-Properties |
- |
-
-
-width |
-Width of the image. |
-
-
-height |
-Height of the image. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-CubeImage()
-CubeImage
()
-Note that this constructor is not intended to be called directly.
-Properties
-width
- .width
: Number
-Width of the image.
-Read-only.
-height
- .height
: Number
-Height of the image.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/CubeRenderTarget.html b/GameDev/bin/Release/help/api/CubeRenderTarget.html
deleted file mode 100644
index 6dce3a04..00000000
--- a/GameDev/bin/Release/help/api/CubeRenderTarget.html
+++ /dev/null
@@ -1,1287 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class CubeRenderTarget
-A cubemap render target.
-Can be used in GLRenderer.renderCube().
-class CubeRenderTarget
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-CubeRenderTarget() |
-Creates a new CubeRenderTarget. |
-
-
-Methods |
- |
-
-
-dispose |
-Dispose the unmanaged resource. |
-
-
-Constructors
-CubeRenderTarget()
-CubeRenderTarget
(width
: Number, height
: Number)
-Create a new CubeRenderTarget.
-Parameters
-width
: width of the image data
-height
: height of the image data
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/DDSImage.html b/GameDev/bin/Release/help/api/DDSImage.html
deleted file mode 100644
index d50aeb28..00000000
--- a/GameDev/bin/Release/help/api/DDSImage.html
+++ /dev/null
@@ -1,1316 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class DDSImage
-Class that represents an image loaded from a DDS file that resides in CPU memory.
-Usually not created directly. Use DDSImageLoader class to create a dds-image.
-Note that the implementation is incomplete. Supported formats include:
-BGRA,
-BC1,
-BC2,
-BC3,
-BC4,
-BC5,
-BC6H,
-BC7,
-Faces and mipmaps are not implemented.
-Currently this class is mainly used as an option for loading lightmaps stored in BC6H.
-class DDSImage
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-DDSImage() |
-Creates a dds-image. |
-
-
-Properties |
- |
-
-
-width |
-Width of the dds-image. |
-
-
-height |
-Height of the dds-image. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-DDSImage()
-DDSImage
()
-Creates an empty dds-image.
-Properties
-width
- .width
: Number
-Width of the image.
-Read-only.
-height
- .height
: Number
-Height of the image.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/DDSImageLoader.html b/GameDev/bin/Release/help/api/DDSImageLoader.html
deleted file mode 100644
index eab987ca..00000000
--- a/GameDev/bin/Release/help/api/DDSImageLoader.html
+++ /dev/null
@@ -1,1290 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class DDSImageLoader
-Provides a few interfaces to load dds-images from local files or from memory.
-No constructor, exposed as a global object DDSImageLoader
.
-Note that the implementation is incomplete. Supported formats include:
-BGRA,
-BC1,
-BC2,
-BC3,
-BC4,
-BC5,
-BC6H,
-BC7,
-Faces and mipmaps are not implemented.
-Currently this class is mainly used as an option for loading lightmaps stored in BC6H.
-class DDSImageLoader
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-loadFile() |
-Load a dds-image from local file. |
-
-
-loadMemory() |
-Load a dds-image from a memory buffer. |
-
-
-Methods
-loadFile()
-.loadFile
(name
: String): DDSImage
-Load a dds-image from local file.
-loadMemory()
-.loadMemory
(buf
: ArrayBuffer): DDSImage
-Load a dds-image from a memory buffer.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/DirectionalLight.html b/GameDev/bin/Release/help/api/DirectionalLight.html
deleted file mode 100644
index 5484a82a..00000000
--- a/GameDev/bin/Release/help/api/DirectionalLight.html
+++ /dev/null
@@ -1,1347 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class DirectionalLight
-A light that gets emitted in a specific direction. This light will behave as though it is infinitely far away and the rays produced from it are all parallel. The common use case for this is to simulate daylight; the sun is far enough away that its position can be considered to be infinite, and all light rays coming from it are parallel.
-This light can cast shadows.
-class DirectionalLight extends Light
-Inheritance Light --> DirectionalLight
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-DirectionalLight() |
-Creates a new DirectionalLight. |
-
-
-Properties |
- |
-
-
-target |
-Target object |
-
-
-bias |
-bias for double-sided materials |
-
-
-forceCull |
-front-face cull even for double-sided materials |
-
-
-Methods |
- |
-
-
-setShadow |
-Set the basic shadow-map options. |
-
-
-setShadowProjection |
-Set the orthographic frustum parameters. |
-
-
-setShadowRadius |
-Set the soft-shadow radius. |
-
-
-getBoundingBox |
-Get the bounding box of a scene in the shadow coordinate. |
-
-
-Constructors
-DirectionalLight()
-Creates a new DirectionalLight.
-Properties
-See the base Light class for common properties.
-target
-.target
: Object3D
-The DirectionalLight points from its position to target.position. The default position of the target is (0, 0, 0).
-bias
-.bias
: Number
-Bias for double-sided materials.
-Readable & Writable. Default value is 0.001.
-forceCull
-.forceCull
: Boolean
-Whether apply front-face culling even for double-sided materials.
-Methods
-See the base Light class for common methods.
-setShadow
-.setShadow
(enable
: Boolean, width
: Number, height
: Number): undefined
-Set basic shadow-map options.
-Parameters
-enable
: If set to true light will cast dynamic shadows.
-width
: width of the shadow map.
-height
: height of the shadow map.
-setShadowProjection
-.setShadowProjection
(left
: Number, right
: Number, bottom
: Number, top
: Number, zNear
: Number, zFar
: Number): undefined
-Set the orthographic frustum parameters.
-Parameters
-left
: Frustum left plane.
-right
: Frustum right plane.
-top
: Frustum top plane.
-bottom
: Frustum bottom plane.
-near
: Frustum near plane.
-far
: Frustum far plane.
-setShadowRadius
-.setShadowRadius
(radius
: Number): undefined
-Set the soft-shadow radius at distance 1.0.
-radius
>0 would activate the PCSS rendering path.
-getBoundingBox
-.getBoundingBox
(scene
: Scene): Object
-Get the bounding box of a scene in the shadow coordinate.
-The returned object contains a 'minPos' property and a 'maxPos' property, each of which is a Vector3.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/EnvironmentMap.html b/GameDev/bin/Release/help/api/EnvironmentMap.html
deleted file mode 100644
index 43948ac2..00000000
--- a/GameDev/bin/Release/help/api/EnvironmentMap.html
+++ /dev/null
@@ -1,1283 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class EnvironmentMap
-class EnvironmentMap extends IndirectLight
-Inheritance IndirectLight --> EnvironmentMap
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-EnvironmentMap() |
-Creates a new EnvironmentMap. |
-
-
-Properties |
- |
-
-
-shCoefficients |
-Spherical harmonics basis |
-
-
-Constructors
-EnvironmentMap()
-EnvironmentMap
()
-Usually not created directly. Use EnvironmentMapCreator class to create an EnvironmentMap object.
-Properties
-shCoefficients
-.shCoefficients
: Array
-Spherical harmonics basis. An array of 9 elements, each of which is an array of 3 numbers.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/EnvironmentMapCreator.html b/GameDev/bin/Release/help/api/EnvironmentMapCreator.html
deleted file mode 100644
index e0ebc065..00000000
--- a/GameDev/bin/Release/help/api/EnvironmentMapCreator.html
+++ /dev/null
@@ -1,1295 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class EnvironmentMapCreator
-class EnvironmentMapCreator
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-EnvironmentMapCreator() |
-Creates a new EnvironmentMapCreator. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-create() |
-Create an EnvironmentMap object. |
-
-
-Constructors
-EnvironmentMapCreator()
-EnvironmentMapCreator
()
-Create an EnvironmentMapCreator object, which can be used to create EnvironmentMap objects.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-create()
-.create
(image
: CubeImage): EnvironmentMap
-Create an EnvironmentMap object using a cubemap image.
-.create
(image
: HDRCubeImage): EnvironmentMap
-Create an EnvironmentMap object using a HDR cubemap image.
- .create
(background
: CubeBackground): EnvironmentMap
-Create an EnvironmentMap object using a cubemap background.
-.create
(target
: CubeRenderTarget, irradiance_only = false
: Boolean): EnvironmentMap
-Create an EnvironmentMap object using a cubemap render target.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Features.html b/GameDev/bin/Release/help/api/Features.html
deleted file mode 100644
index 350d12c0..00000000
--- a/GameDev/bin/Release/help/api/Features.html
+++ /dev/null
@@ -1,1604 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Basic Routine
-import { OrbitControls } from "./controls/OrbitControls.js";
-import { view } from "./view.js";
-
-let renderer, scene, camera, controls;
-
-function init(width, height)
-{
- renderer = new GLRenderer();
- scene = new Scene();
-
- camera = new PerspectiveCamera(45.0, width / height, 0.1, 100.0);
- camera.setPosition(0.0, 0.0, 7.0);
-
- controls = new OrbitControls(camera, view);
- controls.enableDamping = true;
-
-}
-
-function dispose()
-{
- camera.dispose();
- scene.dispose();
- renderer.dispose();
-}
-
-function render(width, height, size_changed)
-{
- if (size_changed)
- {
- camera.aspect = width / height;
- camera.updateProjectionMatrix();
- }
-
- if (controls.hasOwnProperty('update'))
- {
- controls.update();
- }
- renderer.render(scene, camera);
-
-}
-
-setCallback('init', init);
-setCallback('dispose', dispose);
-setCallback('render', render);
-In the basic routine above, we register 3 callback functions for init
, dispose
, render
events. In addition, mouse events are recieved and dispatched by the imported view
object. The view
object serves as an event dispatcher. The OrbitControls object uses view
to listen to the mouse events.
-The basic routine contains a GLRenderer, a Scene, and a Camera. These are
-wrappers of engine objects. The classes are defined in native code.
-The each engine object has a dispose
method, which can be called explictly to release the underlying resources before garbage collection.
-The OrbitControls is an ordinary JS object. The class is defined in "./controls/OrbitControls.js". The code is directly ported from Three.js. There are other utilities from Three.js like Vector3, Matrix4, Quaternion, which we are going to use later.
-Currently, PerspectiveCamera is the only option for camera, but can be easily extended in the future.
-All scripts need to be pre-bundled. For exmaple:
-rollup game.js --file bundle.js
-To run a script, use GamePlayer to load the bundled script.
-Backgrounds
-The Scene class has a .background
property.
-A background is optional in a Three.V8 Scene. It is possible to integrate background/foreground layers from outside the engine.
-When user choose to use a Three.V8 background, now we have the following options:
-ColorBackground: Use a monotone color.
-CubeBackground: Use a cubemap.
-HemisphereBackground: Use a gradient change from sky-color to ground-color.
-BackgroundScene: Use another scene as background.
-ColorBackground:
-bg = new ColorBackground();
-bg.setColor(0.26225, 0.51492, 0.67244);
-scene.background = bg;
-HemisphereBackground:
-bg = new HemisphereBackground();
-bg.setSkyColor(0.318, 0.318, 0.318);
-bg.setGroundColor(0.01, 0.025, 0.025);
-scene.background = bg;
-CubeBackground:
-bg = new CubeBackground();
-let cube_img = imageLoader.loadCubeFromFile(
-"assets/textures/sky_cube_face0.jpg", "assets/textures/sky_cube_face1.jpg",
-"assets/textures/sky_cube_face2.jpg", "assets/textures/sky_cube_face3.jpg",
-"assets/textures/sky_cube_face4.jpg", "assets/textures/sky_cube_face5.jpg");
-bg.setCubemap(cube_img);
-cube_img.dispose();
-scene.background = bg;
-For CubeBackground, the cubemap image is loaded using the global object imageLoader.
-The effect when a HemisphereBackground is set-up:
-
-Models
-Like Three.js, Three.V8 also has a scene graph, with the Scene object as the root. In Three.V8, we have cameras, lights, and models. However, unlike in Three.js, the scene graph in Three.V8 doesn't get all the way down to meshes. Models, as high-level objects, can have internal structures, which are preserved when a specific type of model is loaded. We believe this is good for efficiency, but the downside is that user only has limited access to the internal structures.
-Currently, there are the following types of models:
-SimpleModel: A Model containing a single simple geometry.
-GLTFModel: A Model that has a GLTF style internal structure.
-SimpleModel:
-import { Vector3 } from "./math/Vector3.js";
-
-box = new SimpleModel();
-box.name = "box";
-box.createBox(2.0, 2.0, 2.0);
-box.translateX(-1.5);
-let axis = new Vector3(1.0, 1.0, 0.0);
-axis.normalize();
-box.rotateOnAxis(axis, 1.0);
-{
- let img = imageLoader.loadFile("assets/textures/uv-test-bw.png");
- box.setColorTexture(img);
- img.dispose();
-}
-scene.add(box);
-
-sphere = new SimpleModel();
-sphere.name = "sphere";
-sphere.createSphere(1.0);
-sphere.translateX(1.5);
-{
- let img = imageLoader.loadFile("assets/textures/uv-test-col.png");
- sphere.setColorTexture(img);
- img.dispose();
-}
-sphere.metalness = 0.5;
-sphere.roughness = 0.5;
-scene.add(sphere);
-
-ground = new SimpleModel();
-ground.createPlane(10.0, 10.0);
-ground.translateY(-1.7);
-ground.rotateX(-3.1416*0.5);
-scene.add(ground);
-For SimpleModel, first create by "new". Then, call one of the ".create" functions to create geometry. For material, you can set base color by calling .setColor, or .setColorTexture to set a base color map. The image is loaded using the global object imageLoader.
-GLTFModel:
-model = gltfLoader.loadModelFromFile("assets/models/RZYAS.glb");
-model.setPosition(0, -8, 0);
-scene.add(model);
-For GLTFModel, the global object gltfLoader should be used to create the model.
-The effect when a few simple models are added to the scene:
-
-Since that no lighting has been set, the models appear black.
-Indirect Lighting
-In an open scene, we can use a global indirect light source to create a natural looking. Therefore, we put the indirect lighting before the direct lighting. A global indirect light source can be set through scene.indirectLight
. In contrary to Three.js, in Three.v8, an IndirectLight is not an Object3D.
-Currently we have to following options for indirect light source.
-AmbientLight: corresponding to ColorBackground. Monotone ambient light.
-EnvironmentMap: corresponding to CubeBackground. Image based lighting.
-HemisphereLight: corresponding to HemisphereBackground. Gradient ambient light.
-ProbeGrid: an uniform grid of light-probes.
-LODProbeGrid: a mixed-resolution grid of light-probes.
-AmbientLight:
-envLight = new AmbientLight();
-envLight.setColor(0.0, 0.52, 1.0);
-scene.indirectLight = envLight;
-EnvironmentMap:
-let cube_img = imageLoader.loadCubeFromFile(
-"assets/textures/sky_cube_face0.jpg", "assets/textures/sky_cube_face1.jpg",
-"assets/textures/sky_cube_face2.jpg", "assets/textures/sky_cube_face3.jpg",
-"assets/textures/sky_cube_face4.jpg", "assets/textures/sky_cube_face5.jpg");
-
-let envMapCreator = new EnvironmentMapCreator();
-envLight = envMapCreator.create(cube_img);
-scene.indirectLight = envLight;
-envMapCreator.dispose();
-cube_img.dispose();
-You can use the same CubeImage for both the background and the indirect light of the scene, before disposing it.
-HemisphereLight:
-envLight = new HemisphereLight();
-envLight.setSkyColor(0.318, 0.318, 0.318);
-envLight.setGroundColor(0.01, 0.025, 0.025);
-scene.indirectLight = envLight;
-The effect after setting a HemisphereLight:
-
-Direct Lighting
-Direct light sources are explict light emitting 3d objects placed into the scene.
-Currently we have to following options for direct light source.
-DirectionalLight: A light that gets emitted in a specific direction. This light will behave as though it is infinitely far away and the rays produced from it are all parallel.
-DirectionalLight:
-directional_light = new DirectionalLight();
-directional_light.intensity = 4.0;
-directional_light.setPosition(5.0, 10.0, 5.0);
-directional_light.setShadow(true, 4096, 4096);
-directional_light.setShadowProjection(-10.0, 10.0, -10.0, 10.0, 0.0, 50.0);
-scene.add(directional_light);
-The DirectionalLight points from its position to target.position. The default position of the target is (0, 0, 0). Shadow is optional. When it is enabled. The projection parameters needs to be carefully specified as the shadow-map covers only a limited area.
-The effect after adding a DirectionalLight, without shadow:
-
-The effect after enabling shadow:
-
-Animation
-Animation features are enabled on a per model basis.
-Currently, only GLTFModel has the animation features.
-Animation Clip Management
-Animation clips are owned by each model. When a model is loaded, the animations clips are also loaded if they are present
-GLTFModel.addAnimation
and GLTFModel.addAnimations
: add more animation clips to a model. These animation clips might be loaded separately.
-Animation Control
-First, a static pose can be specified without involving any animation clip.
-GLTFModel.setAnimationFrame
: specify the state of each movable parts.
-Second, the play/stop state of each animation clip can be controlled separately.
-GLTFModel.playAnimation
: start playing an animation clip.
-GLTFModel.stopAnimation
: stop playing an animation clip.
-In order to have the animation clip being played to take effect, call GLTFModel.updateAnimation
from the render
callback function.
-The following code loads the Parrot model and starts the animation that comes with the model:
-model = gltfLoader.loadModelFromFile("assets/models/Parrot.glb");
-model.playAnimation("KeyAction");
-
-Ray Casting
-Accelerated ray-casting is most handy for basic physical simulation such as collision detection. Three.V8 provides a BoundingVolumeHierarchy helper class to accelerate ray-geometry intersection calculation, which is powered by the bvh library.
-The constructor creates a bvh acceleration structure from a list of 3d objects.
-The .intersect method intersects the accleration structure with a given ray. Both input and output are expressed using ordinary JS objects.
-Network Sub-system
-To provide a usable app framework, networking functionality is necessary.
-Currently, Three.V8 only support basic HTTP-Get requests.
-The global object http provides 2 methods:
-
-get()
: for synchronized HTTP-Get.
-getAsync()
: for asynchronized HTTP-Get.
-
-Both get
methods supports binary and text(utf-8 encoded) modes.
-getAsync()
uses callback. To convert it into an actual async function, use the following code-snippet:
-function httpGetAsync(url, is_text)
-{
- return new Promise((resolve, reject) => {
- http.getAsync(url, is_text, (suc, data)=>
- {
- resolve(data);
- });
- });
-}
-The returned ArrayBuffer
can then be used with ImageLoader
or GLTFLoader
.
-GUI Sub-system
-Again, to provide a usable app framework, GUI functionality is necessary.
-Currently, Three.V8 provides a minimalism GUI sub-system which is embedded into the 3D rendering flow.
-The system is incomplete. It doesn't include any layout calculation. The position and size of each ui element need to be explicitly specified by user. The up-side of this is that the ui elements are very accurately positioned, and behaves consistently across different devices.
-Structure
-
-Each script context has a single UIManager
object. The UIManager
manages one or more UIArea
objects, each contains multiple UIElement
objects.
-Each UIArea
maintains a framebuffer where the ui-elements are rendered.
-The UIManager
processes all the Mouse/Touch/Keyboard inputs by traversing each UIArea
and UIElement
.
-While all ui-elements are directly owned by an UIArea
, they can be geometrically nested.
-The geometry relationship can be specified using UIElement.block
. The block
property specifies the geometry parent of an element.
-In the hierachy of UIElement
classes:
-
-only those derived from UIBlock
can be used as UIElement.block
, which means the other ui-elements can only be the leaf elements.
-Example
-
-function setupUI()
-{
- if (!gamePlayer.hasFont("default"))
- {
- gamePlayer.createFontFromFile("default", "assets/fonts/NotoSansSC-Bold.otf");
- }
-
- ui_area = new UIArea();
- ui_area.setOrigin(15.0, 30.0);
- ui_area.setSize(320.0, 480.0);
- UIManager.add(ui_area);
-
- panel2 = new UIPanel();
- panel2.setOrigin(0.0, 0.0);
- panel2.setSize(300.0, 200.0);
- ui_area.add(panel2);
-
- {
- text_msg = new UIText();
- text_msg.text = "Accurate GUI Layout";
- text_msg.block = panel2;
- text_msg.setStyle({ "alignmentVertical": 0});
- text_msg.setOrigin(0.0, 30.0);
- ui_area.add(text_msg);
-
- edit = new UILineEdit();
- edit.setOrigin(50.0, 60.0);
- edit.block = panel2;
- edit.text = "你好ABC,Can you see me?";
- ui_area.add(edit);
-
- btn = new UIButton();
- btn.setOrigin(50.0, 120.0);
- btn.setSize(90.0, 40.0);
- btn.block = panel2;
- btn.onClick = ClearUI;
- ui_area.add(btn);
- {
-
- img = imageLoader.loadFile("assets/textures/ok.png");
- btn_img = new UIImage();
- btn_img.setImage(img);
- btn_img.block = btn;
- btn_img.setSize(30,30);
- ui_area.add(btn_img);
-
- btn_text = new UIText();
- btn_text.text = "OK";
- btn_text.block = btn;
- btn_text.setStyle({ "alignmentHorizontal": 0 });
- btn_text.setOrigin(40.0, 0.0);
- btn.onLongPress = () =>
- {
- print("Long Press");
- }
- ui_area.add(btn_text);
- }
-
- btn2 = new UIButton();
- btn2.setOrigin(150.0, 120.0);
- btn2.setSize(110.0, 40.0);
- btn2.block = panel2;
- btn2.onClick = ClearUI;
- ui_area.add(btn2);
- {
- img2 = imageLoader.loadFile("assets/textures/cancel.png");
- btn_img2 = new UIImage();
- btn_img2.setImage(img2);
- btn_img2.block = btn2;
- btn_img2.setSize(30,30);
- ui_area.add(btn_img2);
-
- btn_text2 = new UIText();
- btn_text2.text = "Cancel";
- btn_text2.block = btn2;
- btn_text2.setStyle({ "alignmentHorizontal": 0 });
- btn_text2.setOrigin(40.0, 0.0);
- ui_area.add(btn_text2);
- }
- }
-
- sview = new UIScrollViewer();
- sview.setOrigin(0.0, 220.0);
- sview.setSize(280.0, 240.0);
- ui_area.add(sview);
- {
- picture = new UIImage();
- picture.block = sview;
- {
- img3 = imageLoader.loadFile("assets/textures/uv-test-col.png");
- picture.setImage(img3);
- picture.setSize(180,180);
- }
- ui_area.add(picture);
- sview.setContentSize(200,400);
-
- btn3 = new UIButton();
- btn3.block = sview;
- btn3.setOrigin(20, 200);
- btn3.setSize(100.0, 40.0);
- ui_area.add(btn3);
- {
- btn_text3 = new UIText();
- btn_text3.text = "Test1";
- btn_text3.block = btn3;
- ui_area.add(btn_text3);
- }
-
- btn4 = new UIButton();
- btn4.block = sview;
- btn4.setOrigin(20, 250);
- btn4.setSize(100.0, 40.0);
- ui_area.add(btn4);
- {
- btn_text4 = new UIText();
- btn_text4.text = "Test2";
- btn_text4.block = btn4;
- ui_area.add(btn_text4);
- }
- }
-}
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/FileLoader.html b/GameDev/bin/Release/help/api/FileLoader.html
deleted file mode 100644
index ee1d07e0..00000000
--- a/GameDev/bin/Release/help/api/FileLoader.html
+++ /dev/null
@@ -1,1278 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class FileLoader
-Provides a few interfaces to loading local files into memory.
-No constructor, exposed as a global object fileLoader
.
-
-Methods
-loadBinaryFile()
-.loadBinaryFile
(name
: String): ArrayBuffer
-Load a binary file into memory.
-loadTextFile()
-.loadTextFile
(name
: String): String
-Load a text file (utf8 encoding assumed) into memory.
-
-
-
diff --git a/GameDev/bin/Release/help/api/Fog.html b/GameDev/bin/Release/help/api/Fog.html
deleted file mode 100644
index e05a88de..00000000
--- a/GameDev/bin/Release/help/api/Fog.html
+++ /dev/null
@@ -1,1343 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Fog
-Class that represents the particle substance in the air.
-Setting a fog object to a scene would trigger a ray-marching calculation when some kind of light source is present.
-class Fog
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-Fog() |
-Creates a Fog object. |
-
-
-Properties |
- |
-
-
-color |
-The color of the Fog. |
-
-
-density |
-The density of the Fog. |
-
-
-maxNumSteps |
-Maximum number of steps for each ray-marching. |
-
-
-minStep |
-Minimal distance to march for each ray-marching step. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-getColor |
-Get the value of .color |
-
-
-setColor |
-Set the value of .color |
-
-
-Constructors
-Fog()
-Fog
()
-Creates a Fog object.
-Properties
-color
-.color
: Object
-The color of the fog.
-Read-only. Use the method .setColor
to modify this property.
-density
-.density
: Number
-Density of the fog, which is the opacity of thickness 1 of the fog.
-Valid range: 0.0 ~ 1.0
-Defalut value: 0.1
-Readable and writable.
-maxNumSteps
-.maxNumSteps
: Number
-Maximum number of steps for each ray-marching.
-Valid range: > 0
-Default value: 50
-Readable and writable.
-minStep
-.minStep
: Number
-Minimal distance to march for each ray-marching step.
-Valid range: > 0.0
-Default value: 0.15
-Readable and writable.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-getColor()
-.getColor
(color
: Vector3) : Vector3
-Copy the value of .color
into color
.
-setColor()
- .setColor
(color
: Vector3): undefined
- Set the value of .color
according to color
.
- .setColor
(r
: Number, g
: Number, b
: Number ): undefined
- Set the value of .color
according to the r
, g
, b
values.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/GLRenderTarget.html b/GameDev/bin/Release/help/api/GLRenderTarget.html
deleted file mode 100644
index 2e095bac..00000000
--- a/GameDev/bin/Release/help/api/GLRenderTarget.html
+++ /dev/null
@@ -1,1302 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class GLRenderTarget
-An off-screen render target.
-Can be used as an extra parameter to GLRenderer.render().
-class GLRenderTarget
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-GLRenderTarget() |
-Creates a new GLRenderTarget. |
-
-
-Methods |
- |
-
-
-dispose |
-Dispose the unmanaged resource. |
-
-
-getImage |
-Get the rendering result as an Image |
-
-
-setSize |
-Update the size of the render target. |
-
-
-Constructors
-GLRenderTarget()
-GLRenderTarget
(width
: Number, height
: Number, msaa
= true: Boolean)
-Create a new GLRenderTarget.
-Parameters
-width
: width of the image data
-height
: height of the image data
-msaa
: should MSAA be used
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-getImage()
-.getImage
(): Image
-Returns the rendering result as an Image object.
-setSize()
-.setSize
(width
: Number, height
: Number): undefined
-Update the size of the render target.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/GLRenderer.html b/GameDev/bin/Release/help/api/GLRenderer.html
deleted file mode 100644
index 655b5d65..00000000
--- a/GameDev/bin/Release/help/api/GLRenderer.html
+++ /dev/null
@@ -1,1323 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class GLRenderer
-The OpenGL renderer displays your beautifully crafted scenes using OpenGL.
-class GLRenderer
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-GLRenderer() |
-Creates a new GLRenderer. |
-
-
-Properties |
- |
-
-
-useSSAO |
-Whether enable SSAO. |
-
-
-Methods |
- |
-
-
-dispose |
-Dispose the unmanaged resource. |
-
-
-render |
-Renders a scene. |
-
-
-renderCube |
-Renders a scene to a cubemap. |
-
-
-renderTexture |
-Render a 2d media to screen. |
-
-
-Constructors
-GLRenderer()
-GLRenderer
()
-Create a GLRenderer.
-Properties
-useSSAO
-.useSSAO
: Boolean
-Whether enable SSAO.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-render()
-.render
(scene
: Scene, camera
: Camera): undefined
-Renders scene
using camera
to the main view of the game-player.
-Should be called from the render()
callback function.
-.render
(scene
: Scene, camera
: Camera, ui3dviewer
: UI3DViewer): undefined
-Renders scene
using camera
to ui3dviewer
.
-Should be called from the onRender()
callback function of the ui3dviewer
.
-.render
(scene
: Scene, camera
: Camera, target
: GLRenderTarget): undefined
-Renders scene
using camera
to target
.
-renderCube()
-.renderCube
(scene
: Scene, target
: CubeRenderTarget, position
: Object, near
=0.1: Number, far
=100.0: Number): undefined
-Renders scene
to a cubemap target
centered at position
.
-renderTexture()
-.renderTexure
(img
: GLRenderTarget/MMCamera/MMLazyVideo/MMVideo/AVCPlayer, x
:Number, y
:Number, width
:Number, height
:Number, alpha = 1.0
:Number, target=undefined
: UI3DViewer/GLRenderTarget): undefined
-Render a 2D media to screen.
-When target
is not specified, the media is rendered to the main view of the game-player by default.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/GLTFLoader.html b/GameDev/bin/Release/help/api/GLTFLoader.html
deleted file mode 100644
index 9a3cb06b..00000000
--- a/GameDev/bin/Release/help/api/GLTFLoader.html
+++ /dev/null
@@ -1,1295 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class GLTFLoader
-Provides a few interfaces to load GLTF models from local files or from memory.
-No constructor, exposed as a global object gltfLoader
.
-class GLTFLoader
-
-Methods
-loadModelFromFile()
-.loadModelFromFile
(name
: String): GLTFModel
-Load a GLTF model from a local GLTF file.
-loadAnimationsFromFile()
-.loadAnimationsFromFile
(name
: String): Object
-Load only animation data from a local GLTF file.
-The returned object has the same structure as the return value of GLTFModel.getAnimation
.
-loadModelFromMemory()
-.loadModelFromMemory
(buf
: ArrayBuffer): GLTFModel
-Load a GLTF model from a memory buffer.
-loadAnimationsFromMemory()
-.loadAnimationsFromMemory
(buf
: ArrayBuffer): Object
-Load only animation data from a memory buffer.
-The returned object has the same structure as the return value of GLTFModel.getAnimation
.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/GLTFModel.html b/GameDev/bin/Release/help/api/GLTFModel.html
deleted file mode 100644
index 4c317010..00000000
--- a/GameDev/bin/Release/help/api/GLTFModel.html
+++ /dev/null
@@ -1,1472 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class GLTFModel
-A Model that has a GLTF style internal structure.
-class GLTFModel extends Object3D
-Inheritance Object3D --> GLTFModel
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-GLTFModel() |
-Creates a new GLTFModel. |
-
-
-Properties |
- |
-
-
-minPos |
-Bounding box min-position. |
-
-
-maxPos |
-Bounding box max-position. |
-
-
-meshes |
-Info of internal meshes. |
-
-
-animations |
-Info of internal animation clips. |
-
-
-Methods |
- |
-
-
-setTexture |
-Replace a texture using texture name. |
-
-
-batchPrimitives |
-Batch together primitives of the same materials. |
-
-
-setAnimationFrame |
-Assign the current stage of movable parts. |
-
-
-getAnimation |
-Get a loaded animation clip by name. |
-
-
-getAnimations |
-Get all loaded animation clips. |
-
-
-addAnimation |
-Add an animation clip to the model. |
-
-
-addAnimations |
-Add multiple animation clips to the model. |
-
-
-playAnimation |
-Play the animation clip of the given name. |
-
-
-stopAnimation |
-Stop the animation clip of the given name. |
-
-
-updateAnimation |
-Update the movable parts according to the current frame. |
-
-
-setLightmap |
-Set a lightmap image for the model. |
-
-
-Constructors
-GLTFModel()
- GLTFModel
()
-Creates a new GLTFModel. Usually not created directly. Use GLTFLoader class to create an GLTFModel.
-Properties
-See the base Object3D class for common properties.
-minPos
-.minPos
: Object
-Read-only property for bounding box min-position.
-maxPos
-.maxPos
: Object
-Read-only property for bounding box max-position.
-meshes
-.meshes
: Object
-Read-only property for displaying the info of internal meshes.
-animations
-.animations
: Array
-Read-only property for displaying the info of internal animation clips.
-Methods
-See the base Object3D class for common methods.
-setTexture()
-.setTexture
(name
: String, image
: Image): undefined
-Replace the texture of name
with image
.
-.setTexture
(name
: String, target
: GLRenderTarget): undefined
-Use the rendering result of target
to replace the texture of name
.
-.setTexture
(name
: String, mmcamera
: MMCamera): undefined
-Usa a web-camera image source mmcamera
to replace the texture of name
.
-.setTexture
(name
: String, mmlazyvideo
: MMLazyVideo): undefined
-Usa a video-file image source mmlazyvideo
to replace the texture of name
.
-.setTexture
(name
: String, mmvideo
: MMVideo): undefined
-Usa a video-file player mmvideo
to replace the texture of name
.
-batchPrimitives()
-.batchPrimitives
(): undefined
-Batch together primitives of the same materials.
-setAnimationFrame()
-.setAnimationFrame
(frame
: Object): undefined
-Assign the current stage of movable parts using a JS object.
-The frame
object should have the following properties:
-frame.morphs
: Array
-Optional. Morph state for morphable meshes.
-frame.morphs[i].name
: String
-Name of a morphable mesh.
-frame.morphs[i].weights
: Array
-Weight for each morph target of the mesh.
-frame.translations
: Array
-Optional. Translation states for nodes.
-frame.translations[i].name
: String
-Name of the targeted node.
-frame.translations[i].translation
: Vector3
-Translation state of the node.
-frame.rotations
: Array
-Optional. Rotation states for nodes.
-frame.rotations[i].name
: String
-Name of the targeted node.
-frame.rotations[i].rotation
: Quaternion
-Rotation state of the node.
-frame.scales
: Array
-Optional. Scale states for nodes.
-frame.scales[i].name
: String
-Name of the targeted node.
-frame.translations[i].scale
: Vector3
-Scale state of the node.
-getAnimation()
-.getAnimation
(name
: String): Object
-Get a loaded animation clip by name.
-The returned object has the following properties:
-.name
: String
-Name of the animation clip.
-.duration
: Number
-Duration of the animation clip in seconds.
-.morphs
: Array
-Optional. Morph tracks.
-.morphs[i].name
: String
-Name of the morphable mesh.
-.morphs[i].targets
: Number
-Number of morph targets of the morphable mesh.
-.morphs[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR" or "CUBICSPLINE"
-.morphs[i].times
: Float32Array
-Time stamp of each frame.
-.morphs[i].values
: Float32Array
-Weight values of each frame.
-.translations
: Array
-Optional. Translation tracks.
-.translations[i].name
: String
-Name of the targeted node.
-.translations[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR" or "CUBICSPLINE"
-.translations[i].times
: Float32Array
-Time stamp of each frame.
-.translations[i].values
: Float32Array
-Translation values of each frame.
-.rotations
: Array
-Optional. Rotation tracks.
-.rotations[i].name
: String
-Name of the targeted node.
-.rotations[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR"
-.rotations[i].times
: Float32Array
-Time stamp of each frame.
-.rotations[i].values
: Float32Array
-Rotation values of each frame.
-.scales
: Array
-Optional. Scale tracks.
-.scales[i].name
: String
-Name of the targeted node.
-.scales[i].interpolation
: String
-Interpolation method: "STEP", "LINEAR" or "CUBICSPLINE"
-.scales[i].times
: Float32Array
-Time stamp of each frame.
-.scales[i].values
: Float32Array
-Scale values of each frame.
-getAnimations()
-.getAnimations
(): Array
-Get all loaded animation clips.
-Each element of the returned array has the same structure as the return value of .getAnimation()
.
-addAnimation()
-.addAnimation
(animation
: Object): undefined
-Add an animation clip to the model.
-The animation object should have the same structure as the return value of .getAnimation()
.
-addAnimations()
-.addAnimations
(animations
: Array): undefined
-Add multiple animation clips to the model.
-Each element of the array should have the same structure as the return value of .getAnimation()
.
-playAnimation()
-.playAnimation
(name
: String): undefined
-Play the animation clip of the given name.
-stopAnimation()
-.stopAnimation
(name
: String): undefined
-Stop the animation clip of the given name.
-updateAnimation()
-.updateAnimation
(): undefined
-Update the movable parts according to the current frame. This function should be called from the render
callback function.
-setLightmap()
-.setLightmap
(img
: HDRImage): undefined
-Set a lightmap image for the model.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/GUI_Demo.png b/GameDev/bin/Release/help/api/GUI_Demo.png
deleted file mode 100644
index c4d9fc99..00000000
Binary files a/GameDev/bin/Release/help/api/GUI_Demo.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/GamePlayer.html b/GameDev/bin/Release/help/api/GamePlayer.html
deleted file mode 100644
index d92b10de..00000000
--- a/GameDev/bin/Release/help/api/GamePlayer.html
+++ /dev/null
@@ -1,1334 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class GamePlayer
-Provides a few interfaces to access the host GamePlayer object.
-No constructor, exposed as a global object gamePlayer
.
-class GamePlayer
-
-
-
-Name |
-Description |
-
-
-
-Properties |
- |
-
-
-width |
-Current video width |
-
-
-height |
-Current video height |
-
-
-picking |
-Whether picking is enabled |
-
-
-Methods |
- |
-
-
-message() |
-Send a general message to the game player. |
-
-
-hasFont() |
-Check if the font of name has been loaded. |
-
-
-createFontFromFile() |
-Load font from local file. |
-
-
-createFontFromMemory() |
-Load font from a memory buffer. |
-
-
-pickObject() |
-Pick the object visible at screen location x,y. |
-
-
-Properties
-width
-.width
: Number
-Read-only value of current video width.
-height
-.height
: Number
-Read-only value of current video height.
-picking
-.picking
: Boolean
-Whether picking is enabled.
-Methods
-message()
-.message
(name
: String, msg
: String) : String
-Send a general message to the game player.
-Pointer capture/release messages are sent through this interface, using names "setPointerCapture" and "releasePointerCapture".
-hasFont()
-.hasFont
(name
: String) : Boolean
-Check if the font of name
has been loaded.
-createFontFromFile()
-.createFontFromFile
(name
: String, filename
: String): undefined
-Load font from local file.
-Parameters
-name
: name of the font being loaded.
-filename
: file name of the TrueType font
-createFontFromMemory()
-.createFontFromMemory
(name
: String, data
: ArrayBuffer): undefined
-Load font from a memory buffer.
-Parameters
-name
: name of the font being loaded.
-data
: memory buffer containing the binary data of the TrueType font.
-pickObject()
-.pickObject
(x
:Number, y
:Number): Object
-Pick the object visible at screen location x,y.
-The returned object contains a "name" property.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/HDRCubeImage.html b/GameDev/bin/Release/help/api/HDRCubeImage.html
deleted file mode 100644
index d4d50e66..00000000
--- a/GameDev/bin/Release/help/api/HDRCubeImage.html
+++ /dev/null
@@ -1,1306 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class HDRCubeImage
-Class that represents a HDR cubemap image that resides in CPU memory.
-A HDRCubeImage contains 6 images.
-Usually not created directly. Use HDRImageLoader class to create a HDR cubemap image.
-class HDRCubeImage
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-HDRCubeImage() |
-Creates a HDR cube image. |
-
-
-Properties |
- |
-
-
-width |
-Width of the image. |
-
-
-height |
-Height of the image. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-HDRCubeImage()
-HDRCubeImage
()
-Note that this constructor is not intended to be called directly.
-Properties
-width
- .width
: Number
-Width of the image.
-Read-only.
-height
- .height
: Number
-Height of the image.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/HDRImage.html b/GameDev/bin/Release/help/api/HDRImage.html
deleted file mode 100644
index a2b7fcad..00000000
--- a/GameDev/bin/Release/help/api/HDRImage.html
+++ /dev/null
@@ -1,1310 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class HDRImage
-Class that represents a HDR image that resides in CPU memory.
-Usually not created directly. Use HDRImageLoader class to create an HDR image.
-class HDRImage
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-HDRImage() |
-Creates a HDR image. |
-
-
-Properties |
- |
-
-
-width |
-Width of the image. |
-
-
-height |
-Height of the image. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-HDRImage()
-HDRImage
()
-Creates an empty HDR image.
-HDRImage
(width
: Number, height
: Number)
-Create an HDR image of specified size.
-Parameters
-width
: width of image
-height
: height of image
-Properties
-width
- .width
: Number
-Width of the image.
-Read-only.
-height
- .height
: Number
-Height of the image.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/HDRImageLoader.html b/GameDev/bin/Release/help/api/HDRImageLoader.html
deleted file mode 100644
index 1307eec8..00000000
--- a/GameDev/bin/Release/help/api/HDRImageLoader.html
+++ /dev/null
@@ -1,1311 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class HDRImageLoader
-Provides a few interfaces to load HDR images from local files or from memory.
-No constructor, exposed as a global object HDRImageLoader
.
-class HDRImageLoader
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-loadFile() |
-Load a HDR image from local file. |
-
-
-loadMemory() |
-Load a HDR image from a memory buffer. |
-
-
-loadCubeFromFile() |
-Load 6 HDR images from local files to form a HDR cubemap image. |
-
-
-loadCubeFromMemory() |
-Load 6 HDR images from memory buffers to form a HDR cubemap image. |
-
-
-fromImages() |
-Load a HDR image from a series of LDR images. |
-
-
-fromRGBM() |
-Load a HDR image from a RGBM image(LDR). |
-
-
-Methods
-loadFile()
-.loadFile
(name
: String): HDRImage
-Load a HDR (RGBE) image from local file.
-loadMemory()
-.loadMemory
(buf
: ArrayBuffer): HDRImage
-Load a HDR (RGBE) image from a memory buffer.
-loadCubeFromFile()
-.loadCubeFromFile
(name0
: String, name1
: String, name2
: String, name3
: String, name4
: String, name5
: String) : HDRCubeImage
-Load 6 HDR (RGBE) images from local files to form a HDR cubemap image.
-loadCubeFromMemory()
-.loadCubeFromMemory
(buf0
: ArrayBuffer, buf1
: ArrayBuffer, buf2
: ArrayBuffer, buf3
: ArrayBuffer, buf4
: ArrayBuffer, buf5
: ArrayBuffer) : HDRCubeImage
-Load 6 HDR (RGBE) images from memory buffers to form a HDR cubemap image.
-fromImages()
-.fromImages
(lst_images
: Array, lst_ranges
: Array) : HDRImage
-Load a HDR image from a series of LDR images.
-This is a decoding method for a HDR image compressed using cascaded residual encoding.
-Parameters
-lst_images
: an array of Image objects.
-lst_ranges
: an array of objects containing a 'low' property and a 'high' property, each of which is a Vector3.
-fromRGBM()
-.fromRGBM
(img
: Image, rate
: Number)
-Load a HDR image from a RGBM image(LDR).
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/HemisphereBackground.html b/GameDev/bin/Release/help/api/HemisphereBackground.html
deleted file mode 100644
index 4df3e9a5..00000000
--- a/GameDev/bin/Release/help/api/HemisphereBackground.html
+++ /dev/null
@@ -1,1314 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class HemisphereBackground
-A background that has a sky color and a ground color.
-class HemisphereBackground extends Background
-Inheritance Background --> HemisphereBackground
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-HemisphereBackground() |
-Creates a new HemisphereBackground. |
-
-
-Properties |
- |
-
-
-setSkyColor |
-Sky color of the background. |
-
-
-groundColor |
-Ground color of the background. |
-
-
-Methods |
- |
-
-
-getSkyColor |
-Get the value of .skyColor |
-
-
-setSkyColor |
-Set the value of .skyColor |
-
-
-Constructors
-HemisphereBackground()
-HemisphereBackground
()
-Creates a new HemisphereBackground.
-Properties
-skyColor
-.skyColor
: Object
-The sky color of the background.
-Read-only. Use the method .setSkyColor
to modify this property.
-groundColor
-.groundColor
: Object
-The ground color of the background.
-Read-only. Use the method .setGroundColor
to modify this property.
-Methods
-getSkyColor()
-.getSkyColor
(color
: Vector3) : Vector3
-Copy the value of .skyColor
into color
.
-setSkyColor()
-.setSkyColor
(color
: Vector3): undefined
-Set the value of .skyColor
according to color
.
-.setSkyColor
(r
: Number, g
: Number, b
: Number ): undefined
-Set the value of .skyColor
according to the r
, g
, b
values.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/HemisphereLight.html b/GameDev/bin/Release/help/api/HemisphereLight.html
deleted file mode 100644
index da7f3125..00000000
--- a/GameDev/bin/Release/help/api/HemisphereLight.html
+++ /dev/null
@@ -1,1339 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class HemisphereLight
-A light source positioned directly above the scene, with color fading from the sky color to the ground color.
-This light cannot be used to cast shadows.
-class HemisphereLight extends IndirectLight
-Inheritance IndirectLight --> HemisphereLight
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-HemisphereLight() |
-Creates a new HemisphereLight. |
-
-
-Properties |
- |
-
-
-skyColor |
-The sky color of the hemisphere light. |
-
-
-groundColor |
-The ground color of the hemisphere light. |
-
-
-intensity |
-The intensity of the hemisphere light. |
-
-
-Methods |
- |
-
-
-getSkyColor |
-Get the value of .skyColor |
-
-
-setSkyColor |
-Set the value of .skyColor |
-
-
-getGroundColor |
-Get the value of .groundColor |
-
-
-setGroundColor |
-Set the value of .groundColor |
-
-
-Constructors
-HemisphereLight()
-HemisphereLight
()
-Creates a new HemisphereLight.
-Properties
-skyColor
-.skyColor
: Object
-The sky color of the hemisphere light.
-Read-only. Use the method .setSkyColor
to modify this property.
-groundColor
-.groundColor
: Object
-The ground color of the hemisphere light.
-Read-only. Use the method .setGroundColor
to modify this property.
-intensity
-.intensity
: Number
-The intensity of the hemisphere light.
-Readable and writable.
-Methods
-getSkyColor()
-.getSkyColor
(color
: Vector3) : Vector3
-Copy the value of .skyColor
into color
.
-setSkyColor()
-.setSkyColor
(color
: Vector3): undefined
-Set the value of .skyColor
according to color
.
-.setSkyColor
(r
: Number, g
: Number, b
: Number ): undefined
-Set the value of .skyColor
according to the r
, g
, b
values.
-getGroundColor()
-.getGroundColor
(color
: Vector3) : Vector3
-Copy the value of .groundColor
into color
.
-setGroundColor();
-.setGroundColor
(color
: Vector3): undefined
-Set the value of .groundColor
according to color
.
-.setGroundColor
(r
: Number, g
: Number, b
: Number ): undefined
-Set the value of .groundColor
according to the r
, g
, b
values.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/HttpClient.html b/GameDev/bin/Release/help/api/HttpClient.html
deleted file mode 100644
index d58f5af5..00000000
--- a/GameDev/bin/Release/help/api/HttpClient.html
+++ /dev/null
@@ -1,1284 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class HttpClient
-Provides a few interfaces to make HTTP requests.
-No constructor, exposed as a global object http
.
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-get |
-Makes a synchronized HTTP Get Request. |
-
-
-getAsync |
-Makes an asynchronized HTTP Get Request. |
-
-
-Methods
-get()
-.get
(url
: String, is_string = False
: Boolean): String/ArrayBuffer
-Makes a synchronized HTTP Get Request.
-Returns String when is_string == True
.
-Return ArrayBuffer when is_string == False
.
-getAsync()
-.getAsync
(url
:String, is_string = False
: Boolean, callback
: Function) : undefined
-Makes an asynchronized HTTP Get Request.
-When is_string == True
:
-callback
(result
: Boolean, text
: String): undefined
-When is_string == False
:
-callback
(result
: Boolean, data
: ArrayBuffer): undefined
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Image.html b/GameDev/bin/Release/help/api/Image.html
deleted file mode 100644
index 86b59c05..00000000
--- a/GameDev/bin/Release/help/api/Image.html
+++ /dev/null
@@ -1,1310 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Image
-Class that represents an image that resides in CPU memory.
-Usually not created directly. Use ImageLoader class to create an image.
-class Image
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-Image() |
-Creates an image. |
-
-
-Properties |
- |
-
-
-width |
-Width of the image. |
-
-
-height |
-Height of the image. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-Image()
-Image
()
-Creates an empty image.
-Image
(width
: Number, height
: Number)
-Create an image of specified size.
-Parameters
-width
: width of image
-height
: height of image
-Properties
-width
- .width
: Number
-Width of the image.
-Read-only.
-height
- .height
: Number
-Height of the image.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/ImageLoader.html b/GameDev/bin/Release/help/api/ImageLoader.html
deleted file mode 100644
index 55762fc6..00000000
--- a/GameDev/bin/Release/help/api/ImageLoader.html
+++ /dev/null
@@ -1,1293 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class ImageLoader
-Provides a few interfaces to load images from local files or from memory.
-No constructor, exposed as a global object imageLoader
.
-class ImageLoader
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-loadFile() |
-Load an image from local file. |
-
-
-loadMemory() |
-Load an image from a memory buffer. |
-
-
-loadCubeFromFile() |
-Load 6 images from local files to form a cubemap image. |
-
-
-loadCubeFromMemory() |
-Load 6 images from memory buffers to form a cubemap image. |
-
-
-Methods
-loadFile()
-.loadFile
(name
: String): Image
-Load an image from local file.
-loadMemory()
-.loadMemory
(buf
: ArrayBuffer): Image
-Load an image from a memory buffer.
-loadCubeFromFile()
-.loadCubeFromFile
(name0
: String, name1
: String, name2
: String, name3
: String, name4
: String, name5
: String) : CubeImage
-Load 6 images from local files to form a cubemap image.
-loadCubeFromMemory()
-.loadCubeFromMemory
(buf0
: ArrayBuffer, buf1
: ArrayBuffer, buf2
: ArrayBuffer, buf3
: ArrayBuffer, buf4
: ArrayBuffer, buf5
: ArrayBuffer) : CubeImage
-Load 6 images from memory buffers to form a cubemap image.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/IndirectLight.html b/GameDev/bin/Release/help/api/IndirectLight.html
deleted file mode 100644
index 01d03ddb..00000000
--- a/GameDev/bin/Release/help/api/IndirectLight.html
+++ /dev/null
@@ -1,1272 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class IndirectLight
-Abstract class for all indirect lights
-No contructor, never used directly.
-class IndirectLight
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-dispose |
-Dispose the unmanaged resource. |
-
-
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/LODProbeGrid.html b/GameDev/bin/Release/help/api/LODProbeGrid.html
deleted file mode 100644
index dfbed4e4..00000000
--- a/GameDev/bin/Release/help/api/LODProbeGrid.html
+++ /dev/null
@@ -1,1388 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class LODProbeGrid
-A mixed resolution grid of light-probes.
-class LODProbeGrid extends IndirectLight
-Inheritance IndirectLight --> LODProbeGrid
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-LODProbeGrid() |
-Creates a new LODProbeGrid. |
-
-
-Properties |
- |
-
-
-coverageMin |
-minimum position of the grid coverage |
-
-
-coverageMax |
-maximum position of the grid coverage |
-
-
-baseDivisions |
-number of divisions of the base-level of the grid |
-
-
-subDivisionLevel |
-number of sub-division levels |
-
-
-numberOfProbes |
-number of probes in the grid |
-
-
-normalBias |
-bias used for sampling visibility information |
-
-
-perPrimitive |
-whether using per-primitive interpolation for better performance |
-
-
-Methods |
- |
-
-
-getCoverageMin |
-Get the minimum position of the grid coverage |
-
-
-setCoverageMin |
-Set the minimum position of the grid coverage |
-
-
-getCoverageMax |
-Get the maximum position of the grid coverage |
-
-
-setCoverageMax |
-Set the maximum position of the grid coverage |
-
-
-getBaseDivisions |
-Get the number of divisions of the base-level of the grid |
-
-
-setBaseDivisions |
-Set the number of divisions of the base-level of the grid |
-
-
-toProbeGrid |
-Convert to uniform grid |
-
-
-Constructors
-LODProbeGrid()
- LODProbeGrid
()
-Creates a new LODProbeGrid.
-Properties
-coverageMin
-.coverageMin
: Object
-The minimum position of the grid coverage.
-Read-only. Use the method .setCoverageMin
to modify this property.
-coverageMax
-.coverageMax
: Object
-The maximum position of the grid coverage.
-Read-only. Use the method .setCoverageMax
to modify this property.
-baseDivisions
-.baseDivisions
: Object
-The number of divisions of the base-level of the grid.
-Read-only. Use the method .setBaseDivisions
to modify this property.
-subDivisionLevel
-.subDivisionLevel
: Number
-Number of sub-division levels.
-Readable and writable. Default value is 2.
-numberOfProbes
-.numberOfProbes
: Number
-Number of probes in the grid.
-ReadOnly.
-normalBias
-.normalBias
: Number
-The bias used for sampling visibility information.
-Readable and writable. Default value is 0.2.
-perPrimitive
-.perPrimitive
: Boolean
-Whether using per-primitive interpolation for better performance
-Readable and writable. Default value is false.
-Methods
-getCoverageMin()
-.getCoverageMin
(coverage_min
: Vector3) : Vector3
-Copy the value of .coverageMin
into coverage_min
.
-setCoverageMin()
-.setCoverageMin
(coverage_min
: Vector3): undefined
-Set the value of .coverageMin
according to coverage_min
.
-getCoverageMax()
-.getCoverageMax
(coverage_max
: Vector3) : Vector3
-Copy the value of .coverageMax
into coverage_max
.
-setCoverageMax()
-.setCoverageMax
(coverage_max
: Vector3): undefined
-Set the value of .coverageMax
according to coverage_max
.
-getBaseDivisions()
-.getBaseDivisions
(divisions
: Vector3) : Vector3
-Copy the value of .baseDivisions
into divisions
.
-setBaseDivisions()
-.setBaseDivisions
(divisions
: Vector3): undefined
-Set the value of .baseDivisions
according to divisions
.
-toProbeGrid()
-.toProbeGrid
(scene
: Scene) : ProbeGrid
-Convert the mixed resoluion grid of light probes to an uniform grid of light probes.
-Needs the scene
paramter for reconstructing missing visibility information.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/LODProbeGridLoader.html b/GameDev/bin/Release/help/api/LODProbeGridLoader.html
deleted file mode 100644
index 7f980bad..00000000
--- a/GameDev/bin/Release/help/api/LODProbeGridLoader.html
+++ /dev/null
@@ -1,1279 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class LODProbeGridLoader
-Provides a few interfaces to load a LODProbeGrid from local files or from memory.
-No constructor, exposed as a global object LODProbeGridLoader
.
-class LODProbeGridLoader
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-loadFile() |
-Load a lod-probe-grid from a local file. |
-
-
-loadMemory() |
-Load a lod-probe-grid from a memory buffer. |
-
-
-Methods
-loadFile()
-.loadFile
(name
: String): LODProbeGrid
-Load a lod-probe-grid from a local file.
-loadMemory()
-.loadMemory
(buf
: ArrayBuffer): LODProbeGrid
-Load a lod-probe-grid from a memory buffer.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Light.html b/GameDev/bin/Release/help/api/Light.html
deleted file mode 100644
index 865960cb..00000000
--- a/GameDev/bin/Release/help/api/Light.html
+++ /dev/null
@@ -1,1304 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Light
-Abstract class for all direct lights.
-No contructor, never used directly.
-class Light extends Object3D
-Inheritance Object3D --> Light
-
-
-
-Name |
-Description |
-
-
-
-Properties |
- |
-
-
-color |
-Color of the light object. |
-
-
-intensity |
-Intensity of the light object. |
-
-
-Methods |
- |
-
-
-getColor |
-Get the value of .color |
-
-
-setColor |
-Set the value of .color |
-
-
-Properties
-See the base Object3D class for common properties.
-color
-.color
: Object
-Color of the light object.
-Read-only. Use the method .setColor
to modify this property.
-intensity
-Intensity of the light object.
-Readable and writable.
-Methods
-See the base Object3D class for common methods.
-getColor()
-.getColor
(color
: Vector3) : Vector3
-Copy the value of .color
into color
.
-setColor()
-.setColor
(color
: Vector3): undefined
-Set the value of .color
according to color
.
-.setColor
(r
: Number, g
: Number, b
: Number ): undefined
-Set the value of .color
according to the r
, g
, b
values.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/MMAudio.html b/GameDev/bin/Release/help/api/MMAudio.html
deleted file mode 100644
index d579f4f4..00000000
--- a/GameDev/bin/Release/help/api/MMAudio.html
+++ /dev/null
@@ -1,1352 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class MMAudio
-Class that represents a background audio-file player.
-class MMAudio
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-MMAudio() |
-Creates a audio-file player. |
-
-
-Properties |
- |
-
-
-looping |
-Whether loop the media when EOF met. |
-
-
-isPlaying |
-Whether the media is currently being played. |
-
-
-duration |
-Duration of the media in seconds. |
-
-
-position |
-Playback position of the current media in seconds. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-play() |
-Start playback of the media. |
-
-
-pause() |
-Pause playback of the media. |
-
-
-setPosition() |
-Apply seeking. |
-
-
-setAudioDevice() |
-Change the audio-out device. |
-
-
-Constructors
-MMAudio()
-MMAudio
(filename
: String, idx_audio_dev
: Number, speed
: Number)
-Creates a audio-file player.
-Parameters
-filename
: url to local or http video source.
-idx_audio_dev
: index of the audio-out device.
-speed
: playback speed. Default 1.0.
-Properties
-looping
-.looping
: Boolean
-Whether loop the media when EOF met.
-Readable and writable.
-isPlaying
-.isPlaying
: Boolean
-Whether the media is currently being played.
-Read-only.
-duration
-.duration
: Number
-Duration of the media in seconds.
-Read-only.
-position
-.position
: Number
-Playback position of the current media in seconds.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-play()
-.play
(): undefined
-Start playback of the media.
-pause()
-.pause
(): undefined
-Pause playback of the media.
-setPosition()
-setPosition
(position
: Number): undefined
-Apply seeking, set the current position (in secs) to position
.
-setAudioDevice()
-.setAudioDevice
(idx_audio_dev
: Number): undefined
-Change the audio-out device.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/MMCamera.html b/GameDev/bin/Release/help/api/MMCamera.html
deleted file mode 100644
index 7f4b0fc8..00000000
--- a/GameDev/bin/Release/help/api/MMCamera.html
+++ /dev/null
@@ -1,1313 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class MMCamera
-Class that represents an image source from a web-camera.
-class MMCamera
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-MMCamera() |
-Creates a web-camera source. |
-
-
-Properties |
- |
-
-
-width |
-Width of the image source. |
-
-
-height |
-Height of the image source. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-updateTexture() |
-Attempt to read new frames and update the texture data. |
-
-
-Constructors
-MMCamera()
-MMCamera
(idx
: Number)
-Creates a web-camera source.
-Parameters
-idx
: index of the camera device.
-Properties
-width
- .width
: Number
-Width of the image source.
-Read-only.
-height
- .height
: Number
-Height of the image source.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-updateTexture()
-.updateTexture
(): undefined
-Attempt to read new frames and update the texture data.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/MMLazyVideo.html b/GameDev/bin/Release/help/api/MMLazyVideo.html
deleted file mode 100644
index 07b8bed2..00000000
--- a/GameDev/bin/Release/help/api/MMLazyVideo.html
+++ /dev/null
@@ -1,1366 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class MMLazyVideo
-Class that represents an image source from a video-file.
-class MMLazyVideo
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-MMLazyVideo() |
-Creates a video-file source. |
-
-
-Properties |
- |
-
-
-looping |
-Whether loop the media when EOF met. |
-
-
-width |
-Width of the image source. |
-
-
-height |
-Height of the image source. |
-
-
-isPlaying |
-Whether the media is currently being played. |
-
-
-duration |
-Duration of the media in seconds. |
-
-
-position |
-Playback position of the current media in seconds. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-updateTexture() |
-Attempt to read new frames and update the texture data. |
-
-
-play() |
-Start playback of the media. |
-
-
-pause() |
-Pause playback of the media. |
-
-
-setPosition() |
-Apply seeking. |
-
-
-Constructors
-MMLazyVideo()
-MMLazyVideo
(filename
: String, speed
: Number)
-Creates a video-file source.
-Parameters
-speed
: playback speed. Default 1.0.
-Properties
-looping
-.looping
: Boolean
-Whether loop the media when EOF met.
-Readable and writable.
-width
- .width
: Number
-Width of the image source.
-Read-only.
-height
- .height
: Number
-Height of the image source.
-Read-only.
-isPlaying
-.isPlaying
: Boolean
-Whether the media is currently being played.
-Read-only.
-duration
-.duration
: Number
-Duration of the media in seconds.
-Read-only.
-position
-.position
: Number
-Playback position of the current media in seconds.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-updateTexture()
-.updateTexture
(): undefined
-Attempt to read new frames and update the texture data.
-play()
-.play
(): undefined
-Start playback of the media.
-pause()
-.pause
(): undefined
-Pause playback of the media.
-setPosition()
-setPosition
(position
: Number): undefined
-Apply seeking, set the current position (in secs) to position
.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/MMVideo.html b/GameDev/bin/Release/help/api/MMVideo.html
deleted file mode 100644
index f66e04da..00000000
--- a/GameDev/bin/Release/help/api/MMVideo.html
+++ /dev/null
@@ -1,1377 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class MMVideo
-Class that represents a background video-file player.
-Can be used as an image source.
-class MMVideo
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-MMVideo() |
-Creates a video-file player. |
-
-
-Properties |
- |
-
-
-looping |
-Whether loop the media when EOF met. |
-
-
-width |
-Width of the image source. |
-
-
-height |
-Height of the image source. |
-
-
-isPlaying |
-Whether the media is currently being played. |
-
-
-duration |
-Duration of the media in seconds. |
-
-
-position |
-Playback position of the current media in seconds. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-updateTexture() |
-Attempt to read new frames and update the texture data. |
-
-
-play() |
-Start playback of the media. |
-
-
-pause() |
-Pause playback of the media. |
-
-
-setPosition() |
-Apply seeking. |
-
-
-setAudioDevice() |
-Change the audio-out device. |
-
-
-Constructors
-MMVideo()
-MMVideo
(filename
: String, playAudio
: Boolean, idx_audio_dev
: Number, speed
: Number)
-Creates a video-file player.
-Parameters
-filename
: url to local or http video source.
-playAudio
: whether to play audio. Default true.
-idx_audio_dev
: index of the audio-out device.
-speed
: playback speed. Default 1.0.
-Properties
-looping
-.looping
: Boolean
-Whether loop the media when EOF met.
-Readable and writable.
-width
- .width
: Number
-Width of the image source.
-Read-only.
-height
- .height
: Number
-Height of the image source.
-Read-only.
-isPlaying
-.isPlaying
: Boolean
-Whether the media is currently being played.
-Read-only.
-duration
-.duration
: Number
-Duration of the media in seconds.
-Read-only.
-position
-.position
: Number
-Playback position of the current media in seconds.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-updateTexture()
-.updateTexture
(): undefined
-Attempt to read new frames and update the texture data.
-play()
-.play
(): undefined
-Start playback of the media.
-pause()
-.pause
(): undefined
-Pause playback of the media.
-setPosition()
-setPosition
(position
: Number): undefined
-Apply seeking, set the current position (in secs) to position
.
-setAudioDevice()
-.setAudioDevice
(idx_audio_dev
: Number): undefined
-Change the audio-out device.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Object3D.html b/GameDev/bin/Release/help/api/Object3D.html
deleted file mode 100644
index 1cb1e9cc..00000000
--- a/GameDev/bin/Release/help/api/Object3D.html
+++ /dev/null
@@ -1,1729 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Object3D
-Base class of all 3D objects visible to user script.
-class Object3D
-
-Constructors
-Object3D()
-Object3D
()
-Can be created to group 3D objects together.
-Properties
-name
-.name
: String
-Readable and writable. Default is an empty string.
-isBuilding
-.isBuilding
: Boolean
-The engine uses a separate shadow-map for buildings which updates at a lower rate.
-isBuilding
marks whether the object is part of the buildings.
-Readable and writable. Default is false
.
-moved
-.moved
: Boolean
-The engine uses a separate shadow-map for buildings which updates at a lower rate.
-moved
marks whether the object has been moved since last time the shadow-map is updated.
-Readable and writable. Default is true
.
-parent
-.parent
: Object3D
-Object's parent in the scene graph.
-Readable and writable.
-children
-.children
: Array
-Array with object's children.
-Read-only. Use methods like add()
, remove()
to modify this property.
-up
-.up
: Object
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Read-only. Use method setUp()
to modify this property.
-Default is {x: 0, y: 1, z: 0}.
-position
-.position
: Object
-A Vector3 representing the object's local position
-Read-only. Use method setPosition()
to modify this property.
-Default is {x: 0, y: 0, z: 0}.
-rotation
-.rotation
: Object
-Object's local rotation, Euler angles in radians.
-Read-only. Use method setRotation()
to modify this property.
-quaternion
-.quaternion
: Object
-Object's local rotation as a Quaternion.
-Read-only. Use method setQuaternion()
to modify this property.
-scale
-.scale
: Object
-The object's local scale.
-Default is {x: 1, y: 1, z: 1}.
-Read-only. Use method setScale()
to modify this property.
-matrix
-.matrix
: Object
-The local transform matrix.
-Read-only.
-matrixWorld
-.matrixWorld
: Object
-The global transform of the object. If the Object3D has no parent, then it's identical to the local transform .matrix.
-Read-only.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-getUp()
-.getUp
(vector
: Vector3): Vector3
-Copy the value of .up
into vector
.
-setUp()
-.setUp
(vector
: Vector3): undefined
-Set the value of .up
according to vector
.
-.setUp
(x
: Number, y
: Number, z
: Number ): undefined
-Set the value of .up
according to the x, y, z coordinates.
-getPosition()
-.getPosition
(vector
: Vector3): Vector3
-Copy the value of .position
into vector
.
-setPosition()
-.setPosition
(vector
: Vector3): undefined
-Set the value of .position
according to vector
.
-.setPosition
(x
: Number, y
: Number, z
: Number ): undefined
-Set the value of .position
according to the x, y, z coordinates.
-getRotation()
-.getRotation
(vector
: Vector3): Vector3
-Copy the value of .rotation
into vector
.
-setRotation()
-.setRotation
(vector
: Vector3): undefined
-Set the value of .rotation
according to vector
.
-.setRotation
(x
: Number, y
: Number, z
: Number ): undefined
-Set the value of .rotation
according to the x, y, z coordinates.
-getQuaternion()
-.getQuaternion
(quaternion
: Quaternion): Quaternion
-Copy the value of .quaternion
into quaternion
.
-setQuaternion()
-.setQuaternion
(quaternion
: Quaternion): undefined
-Set the value of.quaternion
according to quaternion
.
-.setQuaternion
(x
: Number, y
: Number, z
: Number, w
: Number ): undefined
-Set the value of .quaternion
according to the x, y, z, w coordinates.
-getScale()
-.getScale
(vector
: Vector3): Vector3
-Copy the value of .scale
into vector
.
-setScale()
-.setScale
(vector
: Vector3): undefined
-Set the value of .scale
according to vector
.
-.setScale
(x
: Number, y
: Number, z
: Number ): undefined
-Set the value of .scale
according to the x, y, z coordinates.
-getMatrix()
-.getMatrix
(matrix
: Matrix4): Matrix4
-Copy the value of .matrix
into matrix
.
-getMatrixWorld()
-.getMatrixWorld
(matrix
: Matrix4): Matrix4
-Copy the value of .matrixWorld
into matrix
.
-updateMatrix()
-.updateMatrix
(): undefined
-Updates the local transform.
-updateMatrixWorld()
-.updateMatrixWorld
(force
: Boolean): undefined
-Updates the global transform of the object and its descendants.
-updateWorldMatrix()
-.updateWorldMatrix
(updateParents
: Boolean, updateChildren
: Boolean): undefined
-Updates the global transform of the object and its descendants.
-Parameters
-updateParents
: recursively updates global transform of ancestors.
-updateChildren
: recursively updates global transform of descendants.
-applyMatrix4()
-.applyMatrix4
(matrix
: Matrix4): this
-Applies the matrix transform to the object and updates the object's position, rotation and scale.
-applyQuaternion()
-.applyQuaternion
(quaternion
: Quaternion): this
-Applies the rotation represented by the quaternion to the object.
-setRotationFromAxisAngle()
-.setRotationFromAxisAngle
(axis
: Vector3, angle
: Number ): undefined
-Set the rotation from axis and angle.
-Parameters
-axis
: A normalized vector in object space.
-angle
: angle in radians
-setRotationFromMatrix()
-.setRotationFromMatrix
(m
: Matrix4): undefined
-Set the rotation from rotation matrix.
-Parameters
-m
: rotate the quaternion by the rotation component of the matrix.
-Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
-rotateOnAxis()
-.rotateOnAxis
(axis
: Vector3, angle
: Number ) : this
-Rotate an object along an axis in object space. The axis is assumed to be normalized.
-Parameters
-axis
: A normalized vector in object space.
-angle
: The angle in radians.
-rotateOnWorldAxis()
-.rotateOnWorldAxis
(axis
: Vector3, angle
: Number ) : this
-Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.
-Parameters
-axis
: A normalized vector in object space.
-angle
: The angle in radians.
-rotateX()
-.rotateX
(rad
: Number ) : this
-Rotates the object around x axis in local space.
-Parameters
-rad
: the angle to rotate in radians.
-rotateY()
-.rotateY
(rad
: Number ) : this
-Rotates the object around y axis in local space.
-Parameters
-rad
: the angle to rotate in radians.
-rotateZ()
-.rotateZ
(rad
: Number ) : this
-Rotates the object around z axis in local space.
-Parameters
-rad
: the angle to rotate in radians.
-translateOnAxis()
-.translateOnAxis
axis
: Vector3, distance
: Number ) : this
-Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
-Parameters
-axis
: A normalized vector in object space.
-distance
: The distance to translate.
-translateX()
-.translateX
(distance
: Number ) : this
-Translates object along x axis in object space by distance units.
-translateY()
-.translateY
(distance
: Number ) : this
-Translates object along y axis in object space by distance units.
-translateZ()
-.translateZ
(distance
: Number ) : this
-Translates object along z axis in object space by distance units.
-localToWorld()
-.localToWorld
(vector
: Vector3 ) : Vector3
-Converts the vector from this object's local space to world space.
-Parameters
-vector
: A vector representing a position in this object's local space.
-worldToLocal()
-.worldToLocal
(vector
: Vector3 ) : Vector3
-Converts the vector from world space to this object's local space.
-Parameters
-vector
: A vector representing a position in world space.
-getWorldPosition
-.getWorldPosition
(target
: Vector3 ) : Vector3
-Returns a vector representing the position of the object in world space.
-Parameters
-target
: the result will be copied into this Vector3.
-getWorldQuaternion()
-.getWorldQuaternion
(target
: Quaternion ) : Quaternion
-Returns a quaternion representing the rotation of the object in world space.
-Parameters
-target
: the result will be copied into this Quaternion.
-getWorldScale()
-.getWorldScale
(target
: Vector3 ) : Vector3
-Returns a vector of the scaling factors applied to the object for each axis in world space.
-Parameters
-target
: the result will be copied into this Vector3.
-getWorldDirection()
- .getWorldDirection
(target
: Vector3 ) : Vector3
- Returns a vector representing the direction of object's positive z-axis in world space.
-Parameters
- target
: the result will be copied into this Vector3.
-lookAt()
-Rotates the object to face a point in world space.
-This method does not support objects having non-uniformly-scaled parent(s).
-.lookAt
(vector
: Vector3 ) : undefined
-World space position as a Vector3.
-.lookAt
(x
: Number, y
: Number, z
: Number ) : undefined
-World space position as x
, y
and z
components.
-add()
-.add
(object
: Object3D) : this
-Adds an object as child of this object. Any current parent on the object passed in here will be removed, since an object can have at most one parent.
-remove()
-.remove
(object
: Object3D) : this
-Removes an object as child of this object.
-removeFromParent()
-.removeFromParent
() : this
-Removes this object from its current parent.
-clear()
-.clear
() : this
-Removes all child objects.
-getObjectByName()
-.getObjectByName
(name
: String ) : Object3D
-Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-Note that for most objects the name is an empty string by default. You will have to set it manually to make use of this method.
-Parameters
-name
: String to match to the children's Object3D.name property.
-traverse()
-.traverse
(callback
: Function ) : undefined
-Executes the callback on this object and all descendants.
-Note: Modifying the scene graph inside the callback is discouraged.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/OpusPlayer.html b/GameDev/bin/Release/help/api/OpusPlayer.html
deleted file mode 100644
index 99a36abe..00000000
--- a/GameDev/bin/Release/help/api/OpusPlayer.html
+++ /dev/null
@@ -1,1292 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class OpusPlayer
-Play back a raw opus stream.
-class OpusPlayer
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-OpusPlayer() |
-Creates an opus-player. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-addPacket() |
-Add an opus packet to the play queue. |
-
-
-Constructors
-OpusRecorder()
-OpusPlayer
(id_device
: Number)
-Creates an opus-player.
-Parameters
-id_device
: index of the audio output device
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-addPacket()
-.addPacket
(data
: ArrayBuffer): undefined
-Add an opus packet to the play queue.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/OpusRecorder.html b/GameDev/bin/Release/help/api/OpusRecorder.html
deleted file mode 100644
index 48b39ecc..00000000
--- a/GameDev/bin/Release/help/api/OpusRecorder.html
+++ /dev/null
@@ -1,1298 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class OpusRecorder
-Record from an audio device and encode as a raw opus stream.
-class OpusRecorder
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-OpusRecorder() |
-Creates an opus-recorder. |
-
-
-Properties |
- |
-
-
-callback |
-Callback function for recieving opus packets. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-Constructors
-OpusRecorder()
-OpusRecorder
(id_device
: Number)
-Creates an opus-recorder.
-Parameters
-id_device
: index of the audio input device
-Properties
-callback
- .callback
: Function
- .callback
(data
: ArrayBuffer): undefined
-Callback function for recieving opus packets.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Parrot.png b/GameDev/bin/Release/help/api/Parrot.png
deleted file mode 100644
index e57494be..00000000
Binary files a/GameDev/bin/Release/help/api/Parrot.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/PerspectiveCamera.html b/GameDev/bin/Release/help/api/PerspectiveCamera.html
deleted file mode 100644
index 046e111d..00000000
--- a/GameDev/bin/Release/help/api/PerspectiveCamera.html
+++ /dev/null
@@ -1,1338 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class PerspectiveCamera
-class PerspectiveCamera extends Camera
-Inheritance Object3D --> Camera --> PerspectiveCamera
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-PerspectiveCamera() |
-Creates a perspective Camera. |
-
-
-Properties |
- |
-
-
-isPerspectiveCamera |
-Checks if the object is PerspectiveCamera |
-
-
-fov |
-Camera frustum vertical field of view |
-
-
-aspect |
-Camera frustum aspect ratio |
-
-
-near |
-Camera frustum near plane |
-
-
-far |
-Camera frustum far plane |
-
-
-Methods |
- |
-
-
-updateProjectionMatrix |
-Updates the camera projection matrix. |
-
-
-Constructors
-PerspectiveCamera()
-PerspectiveCamera
(fov
: Number, aspect
: Number, near
: Number, far
: Number)
-Creates a perspective camera.
-Parameters
-fov
: Camera frustum vertical field of view.
-aspect
: Camera frustum aspect ratio.
-near
: Camera frustum near plane.
-far
: Camera frustum far plane.
-Together these define the camera's viewing frustum.
-Properties
-See the base Camera class for common properties.
-Note that after making changes to most of these properties you will have to call .updateProjectionMatrix
for the changes to take effect.
-isPerspectiveCamera
-.isPerspectiveCamera
: Boolean
-Read-only flag to check if a given object is of type PerspectiveCamera.
-fov
-.fov
: Number
-Camera frustum vertical field of view, from bottom to top of view, in degrees. Default is 50.
-Readable and writable.
-aspect
-.aspect
: Number
-Camera frustum aspect ratio, usually the canvas width / canvas height. Default is 1 (square canvas).
-Readable and writable.
-near
-.near
: Number
-Camera frustum near plane. Default is 0.1.
-The valid range is greater than 0 and less than the current value of the far plane.
-Readable and writable.
-far
-.far
: Numbers
-Camera frustum far plane. Default is 200.
-Must be greater than the current value of near plane.
-Readable and writable.
-Methods
-See the base Camera class for common methods.
-updateProjectionMatrix()
-.updateProjectionMatrix
(): undefined
-Updates the camera projection matrix. Must be called after any change of parameters.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/ProbeGrid.html b/GameDev/bin/Release/help/api/ProbeGrid.html
deleted file mode 100644
index 38813326..00000000
--- a/GameDev/bin/Release/help/api/ProbeGrid.html
+++ /dev/null
@@ -1,1723 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- For a quick walkthrough of what can be done in a Three.V8 user script, see Features.
-For details of the APIs that enable the features, see below.
-Three.V8 User Script APIs
-The user script APIs consist of
-
-- Engine Classes: have properties and methods to communicate with engine objects.
-- Global Functions: can be called directly from user script.
-- Global Objects: are special engine objects which are preexisting in the context rather than created by the user script.
-- Callback Functions: are used by user script to recieve the event calls from the host program.
-
-Engine Classes (3D)
-
-
-
-Class Name |
-Description |
-
-
-
-Image |
-Represents an image that resides in CPU memory. |
-
-
-CubeImage |
-Represents a cubemap image that resides in CPU memory. |
-
-
-DDSImage |
-Represents a dds-image that resides in CPU memory. |
-
-
-HDRImage |
-Represents a HDR image that resides in CPU memory. |
-
-
-HDRCubeImage |
-Represents a HDR cubemap image that resides in CPU memory. |
-
-
-Object3D |
-Base class of all 3D objects visible to user script. |
-
-
-Camera |
-Base class for cameras. |
-
-
-PerspectiveCamera |
-Perspective camera |
-
-
-Backround |
-Abstract class for all backgrounds |
-
-
-ColorBackground |
-A background that has a monotone color. |
-
-
-CubeBackground |
-A background using a CubeMap. |
-
-
-HemisphereBackground |
-A background that has a sky color and a ground color. |
-
-
-BackgroundScene |
-Use another scene as background. |
-
-
-Light |
-Abstract class for all direct lights. |
-
-
-DirectionalLight |
-A light that gets emitted in a specific direction. |
-
-
-IndirectLight |
-Abstract class for all indirect lights |
-
-
-EnvironmentMap |
-Image based indirect light |
-
-
-EnvironmentMapCreator |
-Cube-map filter that generates environmaps |
-
-
-AmbientLight |
-Uniform indirect light |
-
-
-HemisphereLight |
-Gradient indirect light |
-
-
-ProbeGrid |
-An uniform grid of light-probes |
-
-
-SimpleModel |
-A Model containing a single simple geometry |
-
-
-GLTFModel |
-A Model that has a GLTF style internal structure. |
-
-
-Scene |
-3D Object collection for rendering |
-
-
-Fog |
-Represents the particle substance in the air |
-
-
-GLRenderer |
-Manages rendering routines, including shaders |
-
-
-GLRenderTarget |
-An off-screen render target. |
-
-
-CubeRenderTarget |
-A cubemap render target. |
-
-
-BoundingVolumeHierarchy |
-Acceleration structure for ray-casting. |
-
-
-GamePlayer |
-Wrapper for the host GamePlayer object. |
-
-
-FileLoader |
-Provides a few interfaces to loading local files. |
-
-
-ImageLoader |
-Provides a few interfaces to load images. |
-
-
-DDSImageLoader |
-Provides a few interfaces to load dds-images. |
-
-
-HDRImageLoader |
-Provides a few interfaces to load HDR images. |
-
-
-GLTFLoader |
-Provides a few interfaces to load GLTF models. |
-
-
-ImageSaver |
-Provides a few interfaces to save images. (PC only) |
-
-
-Engine Classes (Network)
-
-
-
-Class Name |
-Description |
-
-
-
-HttpClient |
-Provides a few interfaces to make HTTP requests. |
-
-
-Engine Classes (GUI)
-
-
-
-Class Name |
-Description |
-
-
-
-UIManager |
-Manages UIArea objects. |
-
-
-UIArea |
-Manages UIElement objects and UI3DViewer objects. |
-
-
-UIElement |
-Abstract base class of all ui-elements. |
-
-
-UIBlock |
-Base class for all ui-elements containing other ui-elements. |
-
-
-UIPanel |
-A visible ui-block. |
-
-
-UIButton |
-A clickable ui-block. |
-
-
-UIScrollViewer |
-A scrollable ui-block. |
-
-
-UIImage |
-Image element in a UI. |
-
-
-UIText |
-Non-editable text element in a UI. |
-
-
-UITextBlock |
-Non-editable multi-lined text element in a UI. |
-
-
-UILineEdit |
-Editable text box in a UI. |
-
-
-UI3DViewer |
-Object for embedding a 3D view in a UI. |
-
-
-
-
-
-
-Class Name |
-Description |
-
-
-
-MMCamera |
-Represents an image source from a web-camera. |
-
-
-MMLazyVideo |
-Represents an image source from a video-file. |
-
-
-MMVideo |
-Represents a background video-file player. |
-
-
-MMAudio |
-Represents a background audio-file player. |
-
-
-Global Functions
-These are functions that can be called directly in user script.
-
-print()
-print
(text1
: String, text2
: String, ...): undefined
-Print strings to stdout
separated by spaces. Objects are not stringified automatically. To do that you need JSON.stringify()
.
-setCallback()
-setCallback
(name
: String, callback
: Function): undefined
-Register a callback function.
-Parameters
-name
: one of the names listed in Callback Functions.
-callback
: function accessable from script, or lambda.
-now()
-now
(): Number
-Current time in milliseconds.
-getGLError()
-getGLError
(): Number
-Get the last OpenGL error code for debugging.
-getListOfCameras()
-getListOfCameras
(): Array
-Get a list of camera device names.
-getListOfAudioPlaybackDevices()
-getListOfAudioPlaybackDevices
(): Array
-Get a list of audio playback device names.
-Global Objects
-These are engine class singletons that can be used directly in user script.
-
-Callback Functions
-User scripts are event driven programs. Callback functions need to be registered in the global scope by calling setCallback.
-The host program calls these functions at specific events according to their names.
-The following callback functions are called by the default "GamePlayer".
-Mouse callbacks are specific to desktop while touch callbacks are specific to mobile devices.
-
-
-
-Callback name |
-Description |
-
-
-
-init() |
-Called immediately after loading the script. |
-
-
-dispose() |
-Called before unloading the script. |
-
-
-render() |
-Called when rendering a video frame. |
-
-
-OnMouseDown() |
-Called when mouse button is pressed down. |
-
-
-OnMouseUp() |
-Called when mouse button is up. |
-
-
-OnMouseMove() |
-Called when mouse pointer is moved. |
-
-
-OnMouseWheel() |
-Called when mouse wheel is moved. |
-
-
-OnTouchDown() |
-Called when user touches screen. |
-
-
-OnTouchUp() |
-Called when user stops touching screen. |
-
-
-OnTouchMove() |
-Called when user moves on touch screen. |
-
-
-init()
-init
(width
: Number, height
: Number): undefined
-Called immediately after loading the script.
-Parameters
-width
: width of the container window.
-height
: height of the container window.
-dispose()
-dispose
(): undefined
-Called before unloading the script.
-render()
-render
(width
: Number, height
: Number, sizeChanged
: Boolean): undefined
-Called when rendering a video frame.
-Parameters
-width
: width of the container window.
-height
: height of the container window.
-sizeChanged
: if size of windows has changed.
-OnMouseDown()
-OnMouseDown
(e
: Object): undefined
-Called when mouse button is pressed down.
-Parameters
-e
: has the following properties:
-e.x
: Number
-x coordinate of mouse pointer
-e.y
: Number
-y coordinate of mouse pointer
-e.delta
: Number
-wheel delta
-e.button
: Number
-0 = Left Button
-1 = Middle Button
-2 = Right Button
-3 = XButton1
-4 = XButton2
-OnMouseUp()
-OnMouseUp
(e
: Object): undefined
-Called when mouse button is up.
-The parameter e
has the same structure as in OnMouseDown()
-OnMouseMove()
-OnMouseMove
(e
: Object): undefined
-Called when mouse pointer is moved.
-The parameter e
has the same structure as in OnMouseDown()
-OnMouseWheel()
-OnMouseWheel
(e
: Object): undefined
-Called when mouse wheel is moved.
-The parameter e
has the same structure as in OnMouseDown()
-OnTouchDown()
-OnTouchDown
(e
: Object): undefined
-Called when user touches screen.
-Parameters
-e
: has the following properties:
-pointerId
: Number
-Identifier for distinguishing multiple touch points.
-x
: number
-x coordinate of touch point.
-y
: number
-y coordinate of touch point.
-OnTouchUp()
-OnTouchUp
(e
: Object): undefined
-Called when user stops touching screen.
-The parameter e
has the same structure as in OnTouchDown()
-OnTouchMove()
-OnTouchMove
(e
: Object): undefined
-Called when user moves on touch screen.
-The parameter e
has the same structure as in OnTouchDown()
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/ProbeGridLoader.html b/GameDev/bin/Release/help/api/ProbeGridLoader.html
deleted file mode 100644
index 43b180c1..00000000
--- a/GameDev/bin/Release/help/api/ProbeGridLoader.html
+++ /dev/null
@@ -1,1279 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class ProbeGridLoader
-Provides a few interfaces to load a ProbeGrid from local files or from memory.
-No constructor, exposed as a global object probeGridLoader
.
-class ProbeGridLoader
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-loadFile() |
-Load a probe-grid from a local file. |
-
-
-loadMemory() |
-Load a probe-grid from a memory buffer. |
-
-
-Methods
-loadFile()
-.loadFile
(name
: String): ProbeGrid
-Load a probe-grid from a local file.
-loadMemory()
-.loadMemory
(buf
: ArrayBuffer): ProbeGrid
-Load a probe-grid from a memory buffer.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Scene.html b/GameDev/bin/Release/help/api/Scene.html
deleted file mode 100644
index 0bbc38fc..00000000
--- a/GameDev/bin/Release/help/api/Scene.html
+++ /dev/null
@@ -1,1316 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Scene
-Scenes allow you to set up what and where is to be rendered by Three.V8. This is where you place objects, lights and cameras.
-class Scene extends Object3D
-Inheritance Object3D --> Scene
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-Scene() |
-Creates a new Scene. |
-
-
-Properties |
- |
-
-
-background |
-Object used as background |
-
-
-indirectLight |
-Object used as the indirect light-source. |
-
-
-fog |
-Object representing the particle substance in the air. |
-
-
-Methods |
- |
-
-
-getBoundingBox |
-Get the bounding-box of the whole scene |
-
-
-Constructors
-Scene()
-Scene
()
-Create a new scene object.
-Properties
-See the base Object3D class for common properties.
-background
-.background
: Background
-Object used as background.
-Readable and writable.
-indirectLight
-.indirectLight
: IndirectLight
-Object used as the indirect light-source.
-Readable and writable.
-fog
-.fog
: Fog
-Object representing the particle substance in the air.
-Readable and writable.
-Methods
-See the base Object3D class for common methods.
-getBoundingBox()
-.getBoundingBox
() : Object
-Get the bounding-box of the whole scene.
-The returned object contains a 'minPos' property and a 'maxPos' property, each of which is a Vector3.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/SimpleModel.html b/GameDev/bin/Release/help/api/SimpleModel.html
deleted file mode 100644
index 83b7d3ef..00000000
--- a/GameDev/bin/Release/help/api/SimpleModel.html
+++ /dev/null
@@ -1,1370 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class SimpleModel
-A Model containing a single simple geometry.
-class SimpleModel extends Object3D
-Inheritance Object3D --> SimpleModel
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-SimpleModel() |
-Creates a new SimpleModel. |
-
-
-Properties |
- |
-
-
-color |
-Base-color of the material of the model. |
-
-
-metalness |
-Metalness factor of the material of the model. |
-
-
-roughness |
-Roughness factor of the material of the model. |
-
-
-Methods |
- |
-
-
-createBox |
-Create a Box shaped geometry for the model. |
-
-
-createSphere |
-Create a Sphere shaped geometry for the model. |
-
-
-createPlane |
-Create a Plane shaped geometry for the model. |
-
-
-getColor |
-Get the value of .color . |
-
-
-setColor |
-Set the value of .color . |
-
-
-setColorTexture |
-Set a texture image as the base color map of the model. |
-
-
-Constructors
-SimpleModel()
-Creates a new SimpleModel.
-Properties
-See the base Object3D class for common properties.
-color
-.color
: Object
-Base-color of the material of the model.
-Read-only. Use the method .setColor
to modify this property.
-
-.metalness
: Number
-Metalness factor of the material of the model.
-Readable and writable.
-roughness
-.roughness
: Number
-Roughness factor of the material of the model.
-Readable and writable.
-Methods
-See the base Object3D class for common methods.
-createBox()
-.createBox
(width
: Number, height
: Number, depth
: Number): undefined
-Create a Box shaped geometry for the model.
-Parameters
-width
: width of the Box
-height
: height of the Box
-depth
: depth of the Box
-createSphere()
-.createSphere
(radius
: Number, widthSegments
: Number, heightSegments
: Number): undefined
-Create a Sphere shaped geometry for the model.
-Parameters
-radius
: radius of the Sphere
-widthSegments
: number of width segments of the triangulated Sphere.
-heightSegments
: number of height segments of the triangulated Sphere.
-createPlane()
-.createPlane
(width
: Number, height
: Number): undefined
-Create a Plane shaped geometry for the model.
-Parameters
-width
: width of the Plane
-height
: height of the Plane
-getColor()
-.getColor
(color
: Vector3) : Vector3
-Copy the value of .color
into color
.
-setColor()
-.setColor
(color
: Vector3): undefined
-Set the value of .color
according to color
.
-.setColor
(r
: Number, g
: Number, b
: Number ): undefined
-set the value of .color
according to the r
, g
, b
values.
-setColorTexture()
-.setColorTexture
(image
: Image): undefined
-Set a texture image as the base color map of the model.
-.setColorTexture
(target
: GLRenderTarget): undefined
-Use a rendering result as the base color map of the model.
-.setColorTexture
(mmcamera
: MMCamera): undefined
-Usa a web-camera image source as the base color map of the model.
-.setColorTexture
(mmlazyvideo
: MMLazyVideo): undefined
-Usa a video-file image source as the base color map of the model.
-.setColorTexture
(mmvideo
: MMVideo): undefined
-Usa a video-file player as the base color map of the model.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/Text.html b/GameDev/bin/Release/help/api/Text.html
deleted file mode 100644
index 32645bdc..00000000
--- a/GameDev/bin/Release/help/api/Text.html
+++ /dev/null
@@ -1,1279 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class Text
-Provides a few interfaces for text conversion.
-No constructor, exposed as a global object text
.
-class Text
-
-
-
-Name |
-Description |
-
-
-
-Methods |
- |
-
-
-toUTF8Buffer() |
-Convert string to ArrayBuffer of utf8 code. |
-
-
-fromUTF8Buffer() |
-Convert ArrayBuffer of utf8 code to string. |
-
-
-Methods
-toUTF8Buffer()
-.toUTF8Buffer
(text
: String): ArrayBuffer
-Convert string to ArrayBuffer of utf8 code.
-fromUTF8Buffer()
-.fromUTF8Buffer
(buf
: ArrayBuffer): String
-Convert ArrayBuffer of utf8 code to string.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UI3DViewer.html b/GameDev/bin/Release/help/api/UI3DViewer.html
deleted file mode 100644
index 0e0282e7..00000000
--- a/GameDev/bin/Release/help/api/UI3DViewer.html
+++ /dev/null
@@ -1,1430 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UI3DViewer
-Object for embedding a 3D view in a UI.
-class UI3DViewer
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UI3DViewer() |
-Creates a new UI3DViewer. |
-
-
-Properties |
- |
-
-
-block |
-The block element to which this ui-3dviewer belongs. |
-
-
-origin |
-A Vector2 representing the ui-3dviewer's position. |
-
-
-size |
-A Vector2 representing the ui-3dviewer's size. |
-
-
-onRender |
-Callback function triggered by UIManager during UI rendering. |
-
-
-onMouseDown |
-Callback function passed by UIManager during UI input handling. |
-
-
-onMouseUp |
-Callback function passed by UIManager during UI input handling. |
-
-
-onMouseMove |
-Callback function passed by UIManager during UI input handling. |
-
-
-onMouseWheel |
-Callback function passed by UIManager during UI input handling. |
-
-
-onTouchDown |
-Callback function passed by UIManager during UI input handling. |
-
-
-onTouchUp |
-Callback function passed by UIManager during UI input handling. |
-
-
-onTouchMove |
-Callback function passed by UIManager during UI input handling. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-getOrigin() |
-Get the value of .origin |
-
-
-setOrigin() |
-Set the value of .origin |
-
-
-getSize() |
-Get the value of .size |
-
-
-setSize() |
-Set the value of .size |
-
-
-Constructors
-UI3DViewer()
-UI3DViewer
()
-Creates a new UI3DViewer.
-Properties
-block
-.block
: UIBlock
-The block element to which this ui-3dviewer belongs.
-When there is a valid block element, this ui-3dviewer is translated and clipped according the its block element.
-Readable and writable.
-Default is null.
-origin
-.origin
: Object
-A Vector2 representing the ui-3dviewer's position.
-Read-only. Use method setOrigin()
to modify this property.
-Default is {x: 0, y: 0}.
-onRender
-.onRender
: Function
-Callback function triggered by UIManager during UI rendering.
-Signature: onRender
(width
: Number, height
: Number, size_changed
: Boolean):undefined
-Readable and writable.
-Default is null.
-onMouseDown
-.onMouseDown
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onMouseDown
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnMouseDown()
-Readable and writable.
-Default is null.
-onMouseUp
-.onMouseUp
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onMouseUp
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnMouseDown()
-Readable and writable.
-Default is null.
-onMouseMove
-.onMouseMove
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onMouseMove
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnMouseDown()
-Readable and writable.
-Default is null.
-onMouseWheel
-.onMouseWheel
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onMouseWheel
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnMouseDown()
-Readable and writable.
-Default is null.
-onTouchDown
-.onTouchDown
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onTouchDown
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnTouchDown()
-Readable and writable.
-Default is null.
-onTouchUp
-.onTouchUp
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onTouchUp
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnTouchDown()
-Readable and writable.
-Default is null.
-onTouchMove
-.onTouchMove
: Function
-Callback function passed by UIManager during UI input handling.
-Signature: onTouchMove
(e
: Object): undefined
-The parameter e
has the same structure as in the global callback OnTouchDown()
-Readable and writable.
-Default is null.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-getOrigin()
-.getOrigin
(vector
: Vector2): Vector2
-Copy the value of .origin
into vector
.
-setOrigin()
-.setOrigin
(vector
: Vector2): undefined
-Set the value of .origin
according to vector
.
-.setOrigin
(x
: Number, y
: Number ): undefined
-Set the value of .origin
according to the x, y coordinates.
-getSize()
-.getSize
(vector
: Vector2): Vector2
-Copy the value of .size
into vector
.
-setSize()
-.setSize
(vector
: Vector2): undefined
-Set the value of .size
according to vector
.
-.setSize
(x
: Number, y
: Number ): undefined
-Set the value of .size
according to the x, y coordinates.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIArea.html b/GameDev/bin/Release/help/api/UIArea.html
deleted file mode 100644
index 2a25a823..00000000
--- a/GameDev/bin/Release/help/api/UIArea.html
+++ /dev/null
@@ -1,1409 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIArea
-Manages UIElement objects and UI3DViewer objects.
-Provides a framebuffer for rendering ui-elements. Also keeps a scaling record.
-UIElement objects are rendered first, then UI3DViewer objects are rendered above all ui-elements at a higher-frequency.
-class UIArea
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UIArea() |
-Creates an UIArea. |
-
-
-Properties |
- |
-
-
-elements |
-Array of UIElement objects managed by this ui-area. |
-
-
-viewers |
-Array of UI3DViewer objects managed by this ui-area. |
-
-
-origin |
-A Vector2 representing the ui-area's position. |
-
-
-size |
-A Vector2 representing the ui-area's size. |
-
-
-scale |
-Scale factor of the ui-area. |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-add() |
-Adds an ui-element to this ui-area. |
-
-
-remove() |
-Removes an ui-element from this ui-area. |
-
-
-clear() |
-Removes all ui-elements from this ui-area. |
-
-
-addViewer() |
-Adds an ui-3dviewer to this ui-area. |
-
-
-removeViewer() |
-Removes an ui-3dviewer from this ui-area. |
-
-
-clearViewer() |
-Removes all ui-3dviewers from this ui-area. |
-
-
-getOrigin() |
-Get the value of .origin |
-
-
-setOrigin() |
-Set the value of .origin |
-
-
-getSize() |
-Get the value of .size |
-
-
-setSize() |
-Set the value of .size |
-
-
-Constructors
-UIArea()
-UIArea
()
-Creates an UIArea.
-Properties
-elements
-.elements
: Array
-Array of UIElement objects managed by the ui-area.
-Read-only.
-viewers
-.viewers
: Array
-Array of UI3DViewer objects managed by the ui-area.
-Read-only.
-origin
-.origin
: Object
-A Vector2 representing the ui-area's position.
-Scaled by .scale
.
-Read-only. Use method setOrigin()
to modify this property.
-Default is {x: 0, y: 0}.
-size
-.size
: Object
-A Vector2 representing the ui-area's size.
-Scaled by .scale
.
-Read-only. Use method setSize()
to modify this property.
-Default is {x: 0, y: 0}.
-scale
-.scale
: Number
-Scale factor of the ui-area.
-Readable and writable.
-Default is 1.0.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-add()
-.add
(elem
: UIElement): this
-Adds an ui-element to this ui-area.
-remove()
-.remove
(elem
: UIElement): this
-Removes an ui-element from the ui-area.
-clear()
-.clear
(): this
-Removes all ui-elements from the ui-area.
-addViewer()
-.addViewer
(viewer
: UI3DViewer): this
-Adds an ui-3dviewer to this ui-area.
-removeViewer()
-.removeViewer
(viewer
: UI3DViewer): this
-Removes an ui-3dviewer from the ui-area.
-clearViewer()
-.clearViewer
(): this
-Removes all ui-3dviewers from the ui-area.
-getOrigin()
-.getOrigin
(vector
: Vector2): Vector2
-Copy the value of .origin
into vector
.
-setOrigin()
-.setOrigin
(vector
: Vector2): undefined
-Set the value of .origin
according to vector
.
-.setOrigin
(x
: Number, y
: Number ): undefined
-Set the value of .origin
according to the x, y coordinates.
-getSize()
-.getSize
(vector
: Vector2): Vector2
-Copy the value of .size
into vector
.
-setSize()
-.setSize
(vector
: Vector2): undefined
-Set the value of .size
according to vector
.
-.setSize
(x
: Number, y
: Number ): undefined
-Set the value of .size
according to the x, y coordinates.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIBlock.html b/GameDev/bin/Release/help/api/UIBlock.html
deleted file mode 100644
index 9ba95f1b..00000000
--- a/GameDev/bin/Release/help/api/UIBlock.html
+++ /dev/null
@@ -1,1319 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIBlock
-Base class for all ui-elements containing other ui-elements.
-class UIBlock extends UIElement
-Inheritance UIElement --> UIBlock
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UIBlock() |
-Creates a new UIBlock. |
-
-
-Properties |
- |
-
-
-size |
-A Vector2 representing the ui-block's size. |
-
-
-scissorEnabled |
-Indicating whether the containing ui-elements are clipped . |
-
-
-Methods |
- |
-
-
-getSize() |
-Get the value of .size |
-
-
-setSize() |
-Set the value of .size |
-
-
-Constructors
-UIBlock()
-UIBlock
()
-Creates a new UIBlock.
-A UIBlock is not rendered by default. It only applies transformations and clipping to the ui-elements it contains.
-Properties
-See the base UIElement class for common properties.
-size
-.size
: Object
-A Vector2 representing the ui-block's size.
-Read-only. Use method setSize()
to modify this property.
-Default is {x: 100, y: 40}.
-scissorEnabled
-.scissorEnabled
: Boolean
-Indicating whether the containing ui-elements are clipped by this ui-block.
-Readable and writable.
-Dafault is true.
-Methods
-See the base UIElement class for common methods.
-getSize()
-.getSize
(vector
: Vector2): Vector2
-Copy the value of .size
into vector
.
-setSize()
-.setSize
(vector
: Vector2): undefined
-Set the value of .size
according to vector
.
-.setSize
(x
: Number, y
: Number ): undefined
-Set the value of .size
according to the x, y coordinates.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIButton.html b/GameDev/bin/Release/help/api/UIButton.html
deleted file mode 100644
index bd21a216..00000000
--- a/GameDev/bin/Release/help/api/UIButton.html
+++ /dev/null
@@ -1,1320 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-
-A clickable ui-block
-class UIButton extends UIBlock
-Inheritance UIElement --> UIBlock --> UIButton
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UIButton() |
-Creates a new UIButton. |
-
-
-Properties |
- |
-
-
-onClick |
-Callback function triggered when the button is clicked. |
-
-
-onLongPress |
-Callback function triggered when the button is long-pressed. |
-
-
-Methods |
- |
-
-
-setStyle() |
-Set the displaying style of the ui-button. |
-
-
-Constructors
-
-UIButton
()
-Creates a new UIButton.
-Properties
-See the base UIBlock class for common properties.
-onClick
-.onClick
: Function
-Callback function triggered when the button is clicked.
-Signature: onClick
():undefined
-Readable and writable.
-Default is null.
-onLongPress
-.onLongPress
: Function
-Callback function triggered when the button is long-pressed.
-Signature: onLongPress
():undefined
-Readable and writable.
-Default is null.
-Methods
-See the base UIBlock class for common methods.
-setStyle()
-.setStyle
(style
: Object): undefined
-Set the displaying style of the ui-button.
-style
may have the following properties:
-style.cornerRadius
: Number
-Corner radius of the rounded rectangle.
-style.strokeWidth
: Number
-Line-width of the stroke.
-style.colorBg
: String
-Background color of the panel.
-style.colorStroke
: String
-Stroke color of the panel.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIDraggable.html b/GameDev/bin/Release/help/api/UIDraggable.html
deleted file mode 100644
index 3b4c378b..00000000
--- a/GameDev/bin/Release/help/api/UIDraggable.html
+++ /dev/null
@@ -1,1385 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIDraggable
-A draggable ui-panel.
-class UIDraggable extends UIPanel
-Inheritance UIElement --> UIBlock --> UIPanel --> UIDraggable
-
-Constructors
-UIDraggable()
-UIDraggable
()
-Creates a new UIDraggable.
-Properties
-See the base UIPanel class for common properties.
-draggableHorizontal
-.draggableHorizontal
: Boolean
-Indicating if the panel is draggable in horizontal direction
-Readable and writable.
-Dafault is true.
-draggableVertical
-.draggableVertical
: Boolean
-Indicating if the panel is draggable in vertical direction.
-Readable and writable.
-Dafault is false.
-originMin
-.originMin
: Object
-A Vector2 representing the minimum position for origin.
-Read-only. Use method setOriginMin()
to modify this property.
-Default is {x: 0, y: 0}.
-originMax
-.originMax
: Object
-A Vector2 representing the maximum position for origin.
-Read-only. Use method setOriginMax()
to modify this property.
-Default is {x: 0, y: 0}.
-value
-.value
: Object
-A Vector2 representing the value corresponding to current position.
-Read-only. Use method setValue()
to modify this property.
-Default is {x: 0, y: 0}.
-onDrag
- .onDrag
: Function
- .onDrag
(x
: Number, y
: Number): undefined
-Callback functions called when the element is dragged.
-Methods
-See the base UIPanel class for common methods.
-getOriginMin()
-.getOriginMin
(vector
: Vector2): Vector2
-Copy the value of .originMin
into vector
.
-setOriginMin()
-.setOriginMin
(vector
: Vector2): undefined
-Set the value of .originMin
according to vector
.
-.setOriginMin
(x
: Number, y
: Number ): undefined
-Set the value of .originMin
according to the x, y coordinates.
-getOriginMax()
-.getOriginMax
(vector
: Vector2): Vector2
-Copy the value of .originMax
into vector
.
-setOriginMax()
-.setOriginMax
(vector
: Vector2): undefined
-Set the value of .originMax
according to vector
.
-.setOriginMax
(x
: Number, y
: Number ): undefined
-Set the value of .originMax
according to the x, y coordinates.
-getValue()
-.getValue
(vector
: Vector2): Vector2
-Copy the value of .value
into vector
.
-setValue()
-.setValue
(vector
: Vector2): undefined
-Set the value of .value
according to vector
.
-.setValue
(x
: Number, y
: Number ): undefined
-Set the value of .value
according to the x, y coordinates.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIElement.html b/GameDev/bin/Release/help/api/UIElement.html
deleted file mode 100644
index 2d1f928e..00000000
--- a/GameDev/bin/Release/help/api/UIElement.html
+++ /dev/null
@@ -1,1336 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIElement
-Abstract base class of all ui-elements.
-No contructor, never used directly.
-class UIElement
-
-
-
-Name |
-Description |
-
-
-
-Properties |
- |
-
-
-block |
-The block element to which this ui-element belongs. |
-
-
-origin |
-A Vector2 representing the ui-element's position. |
-
-
-onPointerDown |
-Callback functions called when pointer is down on the element |
-
-
-onPointerUp |
-Callback functions called when pointer is up on the element |
-
-
-onPointerMove |
-Callback functions called when pointer is moved on the element |
-
-
-Methods |
- |
-
-
-dispose() |
-Dispose the unmanaged resource. |
-
-
-getOrigin() |
-Get the value of .origin |
-
-
-setOrigin() |
-Set the value of .origin |
-
-
-Properties
-block
-.block
: UIBlock
-The block element to which this ui-element belongs.
-When there is a valid block element, this element is translated and clipped according the its block element.
-Readable and writable.
-Default is null.
-origin
-.origin
: Object
-A Vector2 representing the ui-element's position.
-Read-only. Use method setOrigin()
to modify this property.
-Default is {x: 0, y: 0}.
-onPointerDown
- .onPointerDown
: Function
- .onPointerDown
(x
: Number, y
: Number): undefined
-Callback functions called when pointer is down on the element.
-onPointerUp
- .onPointerUp
: Function
- .onPointerUp
(x
: Number, y
: Number): undefined
-Callback functions called when pointer is up on the element.
-onPointerMove
- .onPointerMove
: Function
- .onPointerMove
(x
: Number, y
: Number): undefined
-Callback functions called when pointer is moved on the element.
-Methods
-dispose()
-.dispose
(): undefined
-Dispose the unmanaged resource.
-getOrigin()
-.getOrigin
(vector
: Vector2): Vector2
-Copy the value of .origin
into vector
.
-setOrigin()
-.setOrigin
(vector
: Vector2): undefined
-Set the value of .origin
according to vector
.
-.setOrigin
(x
: Number, y
: Number ): undefined
-Set the value of .origin
according to the x, y coordinates.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIElement.png b/GameDev/bin/Release/help/api/UIElement.png
deleted file mode 100644
index 75c35865..00000000
Binary files a/GameDev/bin/Release/help/api/UIElement.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/UIImage.html b/GameDev/bin/Release/help/api/UIImage.html
deleted file mode 100644
index 77862f1a..00000000
--- a/GameDev/bin/Release/help/api/UIImage.html
+++ /dev/null
@@ -1,1317 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIImage
-Image element in a UI.
-class UIImage extends UIElement
-Inheritance UIElement --> UIImage
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UIImage() |
-Creates a new UIImage. |
-
-
-Properties |
- |
-
-
-size |
-A Vector2 representing the ui-image's size. |
-
-
-Methods |
- |
-
-
-getSize() |
-Get the value of .size |
-
-
-setSize() |
-Set the value of .size |
-
-
-setImage() |
-Set the content of the ui-image. |
-
-
-Constructors
-UIImage()
-UIImage
()
-Creates a new UIImage.
-Properties
-See the base UIElement class for common properties.
-size
-.size
: Object
-A Vector2 representing the ui-image's size.
-Read-only. Use method setSize()
to modify this property.
-Default is {x: 100, y: 100}.
-Methods
-See the base UIElement class for common methods.
-getSize()
-.getSize
(vector
: Vector2): Vector2
-Copy the value of .size
into vector
.
-setSize()
-.setSize
(vector
: Vector2): undefined
-Set the value of .size
according to vector
.
-.setSize
(x
: Number, y
: Number ): undefined
-Set the value of .size
according to the x, y coordinates.
-setImage()
-.setImage
(image
: Image): undefined
-Set the content of the ui-image using a Image object.
-.size
will be set according to the image contetnt.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UILineEdit.html b/GameDev/bin/Release/help/api/UILineEdit.html
deleted file mode 100644
index cf98bde9..00000000
--- a/GameDev/bin/Release/help/api/UILineEdit.html
+++ /dev/null
@@ -1,1334 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UILineEdit
-Editable text box in a UI.
-class UILineEdit extends UIElement
-Inheritance UIElement --> UILineEdit
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UILineEdit() |
-Creates a new UILineEdit. |
-
-
-Properties |
- |
-
-
-size |
-A Vector2 representing the ui-lineedit's size. |
-
-
-text |
-Current text content. |
-
-
-Methods |
- |
-
-
-getSize() |
-Get the value of .size |
-
-
-setSize() |
-Set the value of .size |
-
-
-setStyle() |
-Set the displaying style of the ui-text. |
-
-
-Constructors
-UILineEdit()
-UILineEdit
()
-Creates a new UILineEdit.
-Properties
-See the base UIElement class for common properties.
-size
-.size
: Object
-A Vector2 representing the ui-lineedit's size.
-Read-only. Use method setSize()
to modify this property.
-Default is {x: 100, y: 40}.
-text
-.text
: String
-Current text content.
-Readable and writable.
-Default is "".
-Methods
-See the base UIElement class for common methods.
-getSize()
-.getSize
(vector
: Vector2): Vector2
-Copy the value of .size
into vector
.
-setSize()
-.setSize
(vector
: Vector2): undefined
-Set the value of .size
according to vector
.
-.setSize
(x
: Number, y
: Number ): undefined
-Set the value of .size
according to the x, y coordinates.
-setStyle()
-.setStyle
(style
: Object): undefined
-Set the displaying style of the ui-text.
-style
may have the following properties:
-style.fontSize
: Number
-Font size.
-style.fontFace
: String
-Name of TypeTrue font face.
-style.colorBg
: String
-Background color.
-style.colorFg
: String
-Text color.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIManager.html b/GameDev/bin/Release/help/api/UIManager.html
deleted file mode 100644
index 0c3f1812..00000000
--- a/GameDev/bin/Release/help/api/UIManager.html
+++ /dev/null
@@ -1,1299 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIManager
-Manages UIArea objects.
-Handles UI related Mouse/Touch/Keyboard inputs.
-No constructor, exposed as a global object UIManager
.
-
-
-
-Name |
-Description |
-
-
-
-Properties |
- |
-
-
-areas |
-Array of UIArea objects managed by the ui-manager. |
-
-
-Methods |
- |
-
-
-add() |
-Adds an ui-area to the ui-manager. |
-
-
-remove() |
-Removes an ui-area from the ui-manager. |
-
-
-clear() |
-Removes all ui-areas from the ui-manager. |
-
-
-Properties
-areas
-.areas
: Array
-Array of UIArea objects managed by the ui-manager.
-Read-only.
-Methods
-add()
-.add
(area
: UIArea): this
-Adds an ui-area to the ui-manager.
-remove()
-.remove
(area
: UIArea): this
-Removes an ui-area from the ui-manager.
-clear()
-.clear
(): this
-Removes all ui-areas from the ui-manager.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIManager.png b/GameDev/bin/Release/help/api/UIManager.png
deleted file mode 100644
index fba08ab1..00000000
Binary files a/GameDev/bin/Release/help/api/UIManager.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/UIPanel.html b/GameDev/bin/Release/help/api/UIPanel.html
deleted file mode 100644
index 27b1b3f5..00000000
--- a/GameDev/bin/Release/help/api/UIPanel.html
+++ /dev/null
@@ -1,1296 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIPanel
-A visible ui-block.
-class UIPanel extends UIBlock
-Inheritance UIElement --> UIBlock --> UIPanel
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UIPanel() |
-Creates a new UIPanel. |
-
-
-Methods |
- |
-
-
-setStyle() |
-Set the displaying style of the ui-panel. |
-
-
-Constructors
-UIPanel()
-UIPanel
()
-Creates a new UIPanel.
-Properties
-See the base UIBlock class for common properties.
-Methods
-See the base UIBlock class for common methods.
-setStyle()
-.setStyle
(style
: Object): undefined
-Set the displaying style of the ui-panel.
-style
may have the following properties:
-style.cornerRadius
: Number
-Corner radius of the rounded rectangle.
-style.strokeWidth
: Number
-Line-width of the stroke.
-style.colorBg
: String
-Background color of the panel.
-style.colorStroke
: String
-Stroke color of the panel.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIScrollViewer.html b/GameDev/bin/Release/help/api/UIScrollViewer.html
deleted file mode 100644
index 3f2c5fc4..00000000
--- a/GameDev/bin/Release/help/api/UIScrollViewer.html
+++ /dev/null
@@ -1,1368 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-
-A scrollable ui-block.
-class UIScrollViewer extends UIBlock
-Inheritance UIElement --> UIBlock --> UIScrollViewer
-
-Constructors
-
-UIScrollViewer
()
-Creates a new UIScrollViewer.
-Properties
-See the base UIBlock class for common properties.
-
-.scrollableVertical
: Boolean
-Indicates whether the ui-scrollviewer is vertical-scrollable.
-Readble and writable.
-Default is true.
-
-.scrollableHorizontal
: Boolean
-Indicates whether the ui-scrollviewer is horizontal-scrollable.
-Readble and writable.
-Default is false.
-
-.scrollPosition
: Object
-A Vector2 representing the ui-scrollviewer's current scroll position.
-Read-only. Use method setScrollPosition()
to modify this property.
-Default is {x: 0, y: 0}.
-contentSize
-.contentSize
: Object
-A Vector2 representing the ui-scrollviewer's content size.
-Read-only. Use method setContentSize()
to modify this property.
-Default is {x: 100, y: 100}.
-Methods
-See the base UIBlock class for common methods.
-setStyle()
-.setStyle
(style
: Object): undefined
-Set the displaying style of the ui-panel.
-style
may have the following properties:
-style.cornerRadius
: Number
-Corner radius of the rounded rectangle.
-style.strokeWidth
: Number
-Line-width of the stroke.
-style.colorBg
: String
-Background color of the panel.
-style.colorStroke
: String
-Stroke color of the panel.
-
-.getScrollPosition
(vector
: Vector2): Vector2
-Copy the value of .scrollPosition
into vector
.
-
-.setScrollPosition
(vector
: Vector2): undefined
-Set the value of .scrollPosition
according to vector
.
-.setScrollPosition
(x
: Number, y
: Number): undefined
-Set the value of .scrollPosition
according to the x, y coordinates.
-getContentSize()
-.getContentSize
(vector
: Vector2): Vector2
-Copy the value of .contentSize
into vector
.
-setContentSize()
-.setContentSize
(vector
: Vector2): undefined
-Set the value of .contentSize
according to vector
.
-.setContentSize
(x
: Number, y
: Number): undefined
-Set the value of .contentSize
according to the x, y coordinates.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UIText.html b/GameDev/bin/Release/help/api/UIText.html
deleted file mode 100644
index c4a03ee7..00000000
--- a/GameDev/bin/Release/help/api/UIText.html
+++ /dev/null
@@ -1,1317 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UIText
-Non-editable text element in a UI.
-class UIText extends UIElement
-Inheritance UIElement --> UIText
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UIText() |
-Creates a new UIText. |
-
-
-Properties |
- |
-
-
-text |
-Text content. |
-
-
-Methods |
- |
-
-
-setStyle() |
-Set the displaying style of the ui-text. |
-
-
-Constructors
-UIText()
-UIText
()
-Creates a new UIText.
-Properties
-See the base UIElement class for common properties.
-text
-.text
: String
-Text content.
-Readable and writable.
-Default is "".
-Methods
-setStyle()
-.setStyle
(style
: Object): undefined
-Set the displaying style of the ui-text.
-style
may have the following properties:
-style.fontSize
: Number
-Font size.
-style.fontFace
: String
-Name of TypeTrue font face.
-style.alignmentHorizontal
: Number
-Horizontal alignment mode.
-1: left
-2: center
-3: right
-style.alignmentVertical
: Number
-Vertial alignment mode.
-1: top
-2: center
-3: bottom
-4: baseline
-style.colorFg
: String
-Text color.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/UITextBlock.html b/GameDev/bin/Release/help/api/UITextBlock.html
deleted file mode 100644
index 54f10a7a..00000000
--- a/GameDev/bin/Release/help/api/UITextBlock.html
+++ /dev/null
@@ -1,1321 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <--Home
-class UITextBlock
-Non-editable, mutli-lined text element in a UI.
-class UITextBlock extends UIElement
-Inheritance UIElement --> UITextBlock
-
-
-
-Name |
-Description |
-
-
-
-Constructors |
- |
-
-
-UITextBlock() |
-Creates a new UITextBlock. |
-
-
-Properties |
- |
-
-
-text |
-Text content. |
-
-
-Methods |
- |
-
-
-setStyle() |
-Set the displaying style of the ui-text. |
-
-
-Constructors
-UITextBlock()
-UITextBlock
()
-Creates a new UITextBlock.
-Properties
-See the base UIElement class for common properties.
-text
-.text
: String
-Text content.
-Readable and writable.
-Default is "".
-Methods
-setStyle()
-.setStyle
(style
: Object): undefined
-Set the displaying style of the ui-text.
-style
may have the following properties:
-style.lineWidth
: Number
-Number of characters each line.
-style.lineHeight
: Number
-Height of each line.
-style.fontSize
: Number
-Font size.
-style.fontFace
: String
-Name of TypeTrue font face.
-style.alignmentHorizontal
: Number
-Horizontal alignment mode.
-1: left
-2: center
-3: right
-style.alignmentVertical
: Number
-Vertial alignment mode.
-1: top
-2: center
-3: bottom
-4: baseline
-style.colorFg
: String
-Text color.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/background.png b/GameDev/bin/Release/help/api/background.png
deleted file mode 100644
index 1cee13ec..00000000
Binary files a/GameDev/bin/Release/help/api/background.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/index.html b/GameDev/bin/Release/help/api/index.html
deleted file mode 100644
index aa50fe60..00000000
--- a/GameDev/bin/Release/help/api/index.html
+++ /dev/null
@@ -1,1771 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- For a quick walkthrough of what can be done in a Three.V8 user script, see Features.
-For details of the APIs that enable the features, see below.
-Three.V8 User Script APIs
-The user script APIs consist of
-
-- Engine Classes: have properties and methods to communicate with engine objects.
-- Global Functions: can be called directly from user script.
-- Global Objects: are special engine objects which are preexisting in the context rather than created by the user script.
-- Callback Functions: are used by user script to recieve the event calls from the host program.
-
-Engine Classes (3D)
-
-
-
-Class Name |
-Description |
-
-
-
-Image |
-Represents an image that resides in CPU memory. |
-
-
-CubeImage |
-Represents a cubemap image that resides in CPU memory. |
-
-
-DDSImage |
-Represents a dds-image that resides in CPU memory. |
-
-
-HDRImage |
-Represents a HDR image that resides in CPU memory. |
-
-
-HDRCubeImage |
-Represents a HDR cubemap image that resides in CPU memory. |
-
-
-Object3D |
-Base class of all 3D objects visible to user script. |
-
-
-Camera |
-Base class for cameras. |
-
-
-PerspectiveCamera |
-Perspective camera |
-
-
-Backround |
-Abstract class for all backgrounds |
-
-
-ColorBackground |
-A background that has a monotone color. |
-
-
-CubeBackground |
-A background using a CubeMap. |
-
-
-HemisphereBackground |
-A background that has a sky color and a ground color. |
-
-
-BackgroundScene |
-Use another scene as background. |
-
-
-Light |
-Abstract class for all direct lights. |
-
-
-DirectionalLight |
-A light that gets emitted in a specific direction. |
-
-
-IndirectLight |
-Abstract class for all indirect lights |
-
-
-EnvironmentMap |
-Image based indirect light |
-
-
-EnvironmentMapCreator |
-Cube-map filter that generates environmaps |
-
-
-AmbientLight |
-Uniform indirect light |
-
-
-HemisphereLight |
-Gradient indirect light |
-
-
-ProbeGrid |
-An uniform grid of light-probes |
-
-
-LODProbeGrid |
-A mixed resolution grid of light-probes |
-
-
-SimpleModel |
-A Model containing a single simple geometry |
-
-
-GLTFModel |
-A Model that has a GLTF style internal structure. |
-
-
-AnimationMixer |
-Utility for linear blending of animation clips. |
-
-
-Scene |
-3D Object collection for rendering |
-
-
-Fog |
-Represents the particle substance in the air |
-
-
-GLRenderer |
-Manages rendering routines, including shaders |
-
-
-GLRenderTarget |
-An off-screen render target. |
-
-
-CubeRenderTarget |
-A cubemap render target. |
-
-
-BoundingVolumeHierarchy |
-Acceleration structure for ray-casting. |
-
-
-GamePlayer |
-Wrapper for the host GamePlayer object. |
-
-
-FileLoader |
-Provides a few interfaces to loading local files. |
-
-
-ImageLoader |
-Provides a few interfaces to load images. |
-
-
-DDSImageLoader |
-Provides a few interfaces to load dds-images. |
-
-
-HDRImageLoader |
-Provides a few interfaces to load HDR images. |
-
-
-GLTFLoader |
-Provides a few interfaces to load GLTF models. |
-
-
-ProbeGridLoader |
-Provides a few interfaces to load probe-grids. |
-
-
-LODProbeGridLoader |
-Provides a few interfaces to load lod-probe-grids. |
-
-
-Text |
-Provides a few interfaces for text conversion. |
-
-
-Engine Classes (Network)
-
-
-
-Class Name |
-Description |
-
-
-
-HttpClient |
-Provides a few interfaces to make HTTP requests. |
-
-
-WSClient |
-Maintains a websocket connection at the client side. |
-
-
-Engine Classes (GUI)
-
-
-
-Class Name |
-Description |
-
-
-
-UIManager |
-Manages UIArea objects. |
-
-
-UIArea |
-Manages UIElement objects and UI3DViewer objects. |
-
-
-UIElement |
-Abstract base class of all ui-elements. |
-
-
-UIBlock |
-Base class for all ui-elements containing other ui-elements. |
-
-
-UIPanel |
-A visible ui-block. |
-
-
-UIButton |
-A clickable ui-block. |
-
-
-UIScrollViewer |
-A scrollable ui-block. |
-
-
-UIImage |
-Image element in a UI. |
-
-
-UIText |
-Non-editable text element in a UI. |
-
-
-UITextBlock |
-Non-editable multi-lined text element in a UI. |
-
-
-UILineEdit |
-Editable text box in a UI. |
-
-
-UI3DViewer |
-Object for embedding a 3D view in a UI. |
-
-
-UIDraggable |
-A draggable ui-panel. |
-
-
-
-
-
-
-Class Name |
-Description |
-
-
-
-MMCamera |
-Represents an image source from a web-camera. |
-
-
-MMLazyVideo |
-Represents an image source from a video-file. |
-
-
-MMVideo |
-Represents a background video-file player. |
-
-
-MMAudio |
-Represents a background audio-file player. |
-
-
-OpusRecorder |
-Record from an audio device and encode as a raw opus stream. |
-
-
-OpusPlayer |
-Play back a raw opus stream. |
-
-
-AVCRecorder |
-Record from a video device and encode as a raw AVC stream. |
-
-
-AVCPlayer |
-Play back a raw AVC stream. |
-
-
-Global Functions
-These are functions that can be called directly in user script.
-
-print()
-print
(text1
: String, text2
: String, ...): undefined
-Print strings to stdout
separated by spaces. Objects are not stringified automatically. To do that you need JSON.stringify()
.
-setCallback()
-setCallback
(name
: String, callback
: Function): undefined
-Register a callback function.
-Parameters
-name
: one of the names listed in Callback Functions.
-callback
: function accessable from script, or lambda.
-now()
-now
(): Number
-Current time in milliseconds.
-getGLError()
-getGLError
(): Number
-Get the last OpenGL error code for debugging.
-getListOfCameras()
-getListOfCameras
(): Array
-Get a list of camera device names.
-getListOfAudioPlaybackDevices()
-getListOfAudioPlaybackDevices
(): Array
-Get a list of audio playback device names.
-Global Objects
-These are engine class singletons that can be used directly in user script.
-
-Callback Functions
-User scripts are event driven programs. Callback functions need to be registered in the global scope by calling setCallback.
-The host program calls these functions at specific events according to their names.
-The following callback functions are called by the default "GamePlayer".
-Mouse callbacks are specific to desktop while touch callbacks are specific to mobile devices.
-
-
-
-Callback name |
-Description |
-
-
-
-init() |
-Called immediately after loading the script. |
-
-
-dispose() |
-Called before unloading the script. |
-
-
-render() |
-Called when rendering a video frame. |
-
-
-OnMouseDown() |
-Called when mouse button is pressed down. |
-
-
-OnMouseUp() |
-Called when mouse button is up. |
-
-
-OnMouseMove() |
-Called when mouse pointer is moved. |
-
-
-OnMouseWheel() |
-Called when mouse wheel is moved. |
-
-
-OnTouchDown() |
-Called when user touches screen. |
-
-
-OnTouchUp() |
-Called when user stops touching screen. |
-
-
-OnTouchMove() |
-Called when user moves on touch screen. |
-
-
-init()
-init
(width
: Number, height
: Number): undefined
-Called immediately after loading the script.
-Parameters
-width
: width of the container window.
-height
: height of the container window.
-dispose()
-dispose
(): undefined
-Called before unloading the script.
-render()
-render
(width
: Number, height
: Number, sizeChanged
: Boolean): undefined
-Called when rendering a video frame.
-Parameters
-width
: width of the container window.
-height
: height of the container window.
-sizeChanged
: if size of windows has changed.
-OnMouseDown()
-OnMouseDown
(e
: Object): undefined
-Called when mouse button is pressed down.
-Parameters
-e
: has the following properties:
-e.x
: Number
-x coordinate of mouse pointer
-e.y
: Number
-y coordinate of mouse pointer
-e.delta
: Number
-wheel delta
-e.button
: Number
-0 = Left Button
-1 = Middle Button
-2 = Right Button
-3 = XButton1
-4 = XButton2
-OnMouseUp()
-OnMouseUp
(e
: Object): undefined
-Called when mouse button is up.
-The parameter e
has the same structure as in OnMouseDown()
-OnMouseMove()
-OnMouseMove
(e
: Object): undefined
-Called when mouse pointer is moved.
-The parameter e
has the same structure as in OnMouseDown()
-OnMouseWheel()
-OnMouseWheel
(e
: Object): undefined
-Called when mouse wheel is moved.
-The parameter e
has the same structure as in OnMouseDown()
-OnTouchDown()
-OnTouchDown
(e
: Object): undefined
-Called when user touches screen.
-Parameters
-e
: has the following properties:
-pointerId
: Number
-Identifier for distinguishing multiple touch points.
-x
: number
-x coordinate of touch point.
-y
: number
-y coordinate of touch point.
-OnTouchUp()
-OnTouchUp
(e
: Object): undefined
-Called when user stops touching screen.
-The parameter e
has the same structure as in OnTouchDown()
-OnTouchMove()
-OnTouchMove
(e
: Object): undefined
-Called when user moves on touch screen.
-The parameter e
has the same structure as in OnTouchDown()
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/api/indirect_light.png b/GameDev/bin/Release/help/api/indirect_light.png
deleted file mode 100644
index 2a6c56ec..00000000
Binary files a/GameDev/bin/Release/help/api/indirect_light.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/models.png b/GameDev/bin/Release/help/api/models.png
deleted file mode 100644
index 2a4ea19f..00000000
Binary files a/GameDev/bin/Release/help/api/models.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/noshadow.png b/GameDev/bin/Release/help/api/noshadow.png
deleted file mode 100644
index 74365608..00000000
Binary files a/GameDev/bin/Release/help/api/noshadow.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/api/screenshot.png b/GameDev/bin/Release/help/api/screenshot.png
deleted file mode 100644
index 5efa71fa..00000000
Binary files a/GameDev/bin/Release/help/api/screenshot.png and /dev/null differ
diff --git a/GameDev/bin/Release/help/background_scene.jpg b/GameDev/bin/Release/help/background_scene.jpg
deleted file mode 100644
index a9b59481..00000000
Binary files a/GameDev/bin/Release/help/background_scene.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/background_scene1.jpg b/GameDev/bin/Release/help/background_scene1.jpg
deleted file mode 100644
index ae1114cc..00000000
Binary files a/GameDev/bin/Release/help/background_scene1.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/box.jpg b/GameDev/bin/Release/help/box.jpg
deleted file mode 100644
index 8f951a4d..00000000
Binary files a/GameDev/bin/Release/help/box.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/cube_sky.jpg b/GameDev/bin/Release/help/cube_sky.jpg
deleted file mode 100644
index 10e99be0..00000000
Binary files a/GameDev/bin/Release/help/cube_sky.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/directional_light.jpg b/GameDev/bin/Release/help/directional_light.jpg
deleted file mode 100644
index edceb51b..00000000
Binary files a/GameDev/bin/Release/help/directional_light.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/directional_light2.jpg b/GameDev/bin/Release/help/directional_light2.jpg
deleted file mode 100644
index 49df66fb..00000000
Binary files a/GameDev/bin/Release/help/directional_light2.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/env_lights.jpg b/GameDev/bin/Release/help/env_lights.jpg
deleted file mode 100644
index dfe0d5e3..00000000
Binary files a/GameDev/bin/Release/help/env_lights.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/env_map.jpg b/GameDev/bin/Release/help/env_map.jpg
deleted file mode 100644
index ff96816a..00000000
Binary files a/GameDev/bin/Release/help/env_map.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/gameplayer.jpg b/GameDev/bin/Release/help/gameplayer.jpg
deleted file mode 100644
index b9d8be58..00000000
Binary files a/GameDev/bin/Release/help/gameplayer.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/group.jpg b/GameDev/bin/Release/help/group.jpg
deleted file mode 100644
index 0641b889..00000000
Binary files a/GameDev/bin/Release/help/group.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/hemisphere_light.jpg b/GameDev/bin/Release/help/hemisphere_light.jpg
deleted file mode 100644
index 5ed05303..00000000
Binary files a/GameDev/bin/Release/help/hemisphere_light.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/hemisphere_sky.jpg b/GameDev/bin/Release/help/hemisphere_sky.jpg
deleted file mode 100644
index 20b698e8..00000000
Binary files a/GameDev/bin/Release/help/hemisphere_sky.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/index.html b/GameDev/bin/Release/help/index.html
deleted file mode 100644
index b26d61b3..00000000
--- a/GameDev/bin/Release/help/index.html
+++ /dev/null
@@ -1,1314 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GameDev
-GameDev is an IDE for Three.V8, the JavaScript based 3D application engine.
-
-See Scene Editor for details of the XML based scene-editor.
-See Tutorial for a walk-through of creation of different type of Apps.
-See Three.V8 User Script APIs for the detail of the APIs.
-The Engine
-Three.V8 is a cross-platform 3D application engine.
-Developer can use the engine to develop their own cross-platform 3D applications in JavaScript.
-Apps developed using Three.V8 can run in all supported platforms using the engine for the specific platform.
-Three.V8 exposes its own set of engine APIs which can be called by the apps to implement their required functionalities.
-There is a separate documentation about the detail of the APIs.
-The design of the engine is similar to other script-based game engines.
-However, as an application engine, Three.V8 also provides basic APIs for networking, multimedia and GUI apart from its 3D functionalities.
-The GUI system is based on the built-in graphics library of the engine so that the appearance of the GUI is highly consistent across different platforms.
-
-GUI appearance in Windows
-
-GUI appearance in Android
-Structure of an App
-An app developed using Three.V8 is consisted of a code part and a data part.
-The code part can be consisted of multiple JavaScript file during development.
-However, all the code need to be bundled togather using Rollup.js or other bundlers
-before it can be run with the engine. The bundling procedural is automated by the IDE.
-The data part is consisted of multiple data files of arbitary formats. They should either be deployed together
-with the bundled code inside the final App or placed at a remote server to be downloaded at run-time.
-Those deployed inside the App can be referenced using paths relative to the bundled code.
-The IDE
-
-The GUI of the IDE is consisted of ① Menu bar ② Side bar ③ Editor area and ④ Log area.
-External Dependencies
-
-- Code editors are based on Microsoft WebView2. Make sure to get the runtime installed before starting the IDE.
-- Bundling is performed using Rollup.js. Make sure to install the npm package (globally) before trying to run any target.
-
-
-Use File-New-Project to create a new project. A project is a directory containing a "project.json" file. "project.json" marks the directory as a GameDev project, and maintains a list of bundle targets.
-Use File-New-File to add files to the project directory. You can also right-click a directory item in the side-bar to create files at a specified position.
-The editors does not reload automatically when a file is modified outside of the IDE. You can manually refresh using File-Reopen or by pressing F5.
-Side Bar
-The "Files" tab provides a tree-view of the project directory. Use the context menus to create, open or delete files.
-The "Targets" tab provides a list-view of the managed bundle targets.
-
-Use buttons at ① to add/remove bundle targets or open the "Edit Target" window ③.
-Right click the Target item at ② for context menu, where you get options to run the target or create a shortcut of the App on the desktop. To run the target, you can also just double click the item. A bundling process will be triggered by calling the external "rollup" tool if a JavaScript file is modified. A separate process will be started by launching GamePlayer.exe with the path of the bundled JavaScript file. Note the bundled JavaScript files are hidden in the "Files" tab, because you should never edit these files manually.
-Editors
-GameDev provides editors for file formats most commonly used in a Three.V8 project, which are JavaScript, XML and JSON.
-In this IDE, we use specifically structured XML files to represent 3D Scenes and a dedicated scene editor is provided.
-Logs
-Currently the "Console" tab of the log areas mainly shows outputs from the bundling process and the scene editor.
-Since that a running Target has its own process (GamePlayer.exe), their outputs can be seen in their own consoles.
-
-The console of GamePlayer.exe is hidden by default, and can be shown by dragging.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/model.jpg b/GameDev/bin/Release/help/model.jpg
deleted file mode 100644
index cfe20c39..00000000
Binary files a/GameDev/bin/Release/help/model.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/plane.jpg b/GameDev/bin/Release/help/plane.jpg
deleted file mode 100644
index 294b5765..00000000
Binary files a/GameDev/bin/Release/help/plane.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/proxy.jpg b/GameDev/bin/Release/help/proxy.jpg
deleted file mode 100644
index 0228af7d..00000000
Binary files a/GameDev/bin/Release/help/proxy.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/scene_editor.html b/GameDev/bin/Release/help/scene_editor.html
deleted file mode 100644
index a609dde0..00000000
--- a/GameDev/bin/Release/help/scene_editor.html
+++ /dev/null
@@ -1,1340 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Scene Editor
-
-
-Three.V8 does not specify how a scene is represented in external storage, which can be decided by each App (user script). However, the IDE has a built-in support for a specific XML format and provides a visualized interface to edit the scene, which is being described here. To support this XML format in your app, you can start with the "project_template" provided with GameDev.
-The visualized scene editor is opened when you open a XML file in the IDE.
-On the left side of the editor, you will see the scene preview ①. On the right side, the "Code" tab is activated by default, where you can edit the XML code directly. However, the "Scene" tab is of more interest, where you can tweak the content of the XML file by controls. The changes are synchronized between the tabs.
-On the "Scene" tab, you can find the "Scene Graph" group ② where you can select the items currently present in the scene. To select an item, you can either click it in the tree-view or click the "Picking" button then pick it inside the left view. Once an item is selected, you can edit the properties of the item on the right side ④.
-Using the tool buttons in the "Create..." group ③, you can add new items into the scene.
-
-Basically, you first select an existing item as the parent item, then click a tool button to create an item. There are 2 kinds of items you can create this way, scene-items and 3D-items. Scene items are unique to a scene and the parent item must be "scene". 3D Items can be placed either under "scene" or under an existing 3D Item.
-Fog Item
-The fog item describes particle scattering material in the air across the scene. It can be used to obscure the objects at a far distance, and is all essential for generating the Tyndall effect. The Fog Item has 2 properties, density and color. The bigger the density is, the faster the light attenuates.
-Sky Item
-The sky item describes the background of the scene, which is shown when no there are no 3D objects. There are 4 types of skys you can select from the dropbox.
-
-
-Select uniform if you want a uniform color as the background.
-
-The color will be the same no matter which direction you look at.
-Hemisphere
-The background has a gradual change of color from sky to ground.
-
-Cube
-The background is defined by a cube-map consisting of 6 images.
-
-The 6 images must be in the same directory. You can specify the file name of each of the images, or you can click "Browse" to select all 6 images.
-Scene
-The background of current scene is defined using another scene.
-
-For each frame, the background scene is rendered first using a camera located at the same position as the camera used for rendering the current scene, but with relatively large clipping plane values, which means that the objects in the background scene should be located much further away than objects in the current scene. Then the current scene is rendered on top of it.
-
-Environment Light Item
-The environment light item describes how objects in the scene should be lighted not by a direct light source but by random reflections from the scene its self. There are 3 types of environment lights you can select from the dropbox.
-
-
-Light recieved from every direction of the scene is the same.
-
-Hemisphere
-There is a gradual change of light from sky to ground.
-
-Cube
-The enviroment light is defined by a cube-map consisting of 6 images.
-
-The 6 images must be in the same directory. You can specify the file name of each of the images, or you can click "Browse" to select all 6 images.
-This kind of environment light can also be generated by an iterative process using a probe into the scene.
-
-A proxy cube is created alongside with the environment light indicating where the probe is located. The position of the probe can be adjusted using the "Probe Position" tuners. When you have decided where to place the probe, click "Generate Images" and the cube-map will be generated in a few iterations.
-Group Item
-A group item is a 3D object you can put into scene-graph as a common parent of several child objects. The group object itself does not contain any geometry, so only its transformations are taking effect.
-
-These transformation properties are common to all 3D objects, you can also find them when another 3D object is selected.
-Plane/Box/Sphere Items
-These are simple geometry objects.
-
-
-
-There property pages share many in common.
-For each of them, the geometry options come first, followed by the transformation properties, then material properties(Color/Texture/Metalness/Roughness).
-Check the "is building" option if the object is part of building and should be hit-tested at run time.
-Model Item
-A model item is defined by a model file. It also has an "is building" option, check it when the model defines part of the building.
-
-Directional Light Item
-A directional light is a light source located far away from the scene, such as the sunlight.
-
-The "Position" property of the light source defines the origin coordinate of the light.
-"Target", when it is set, defines which object the light goes towards. It must be the name of an 3D object within the scene.
-When "Cast Shadow" is not checked. The light comes from infinitely far away from the direction of normalize(light.position - Target.position).
-When "Cast Shadow" is checked, a shadow will be used, which covers the areas defined by the Left/Right/Bottom/Top/Near/Far properties.
-
-The shadow-map covered area is visualized by the wires.
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/scene_editor.jpg b/GameDev/bin/Release/help/scene_editor.jpg
deleted file mode 100644
index fbbcc742..00000000
Binary files a/GameDev/bin/Release/help/scene_editor.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/sky_types.jpg b/GameDev/bin/Release/help/sky_types.jpg
deleted file mode 100644
index 9903c53a..00000000
Binary files a/GameDev/bin/Release/help/sky_types.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/sphere.jpg b/GameDev/bin/Release/help/sphere.jpg
deleted file mode 100644
index 2a589587..00000000
Binary files a/GameDev/bin/Release/help/sphere.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/tools.jpg b/GameDev/bin/Release/help/tools.jpg
deleted file mode 100644
index 1646562a..00000000
Binary files a/GameDev/bin/Release/help/tools.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/help/tutorials.html b/GameDev/bin/Release/help/tutorials.html
deleted file mode 100644
index 49c19604..00000000
--- a/GameDev/bin/Release/help/tutorials.html
+++ /dev/null
@@ -1,1248 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Tutorial
-
-
-
\ No newline at end of file
diff --git a/GameDev/bin/Release/help/uniform_sky.jpg b/GameDev/bin/Release/help/uniform_sky.jpg
deleted file mode 100644
index 1779664f..00000000
Binary files a/GameDev/bin/Release/help/uniform_sky.jpg and /dev/null differ
diff --git a/GameDev/bin/Release/icudtl.dat b/GameDev/bin/Release/icudtl.dat
deleted file mode 100644
index 0e35d1da..00000000
Binary files a/GameDev/bin/Release/icudtl.dat and /dev/null differ
diff --git a/GameDev/bin/Release/icui18n.dll b/GameDev/bin/Release/icui18n.dll
deleted file mode 100644
index ea9a114b..00000000
Binary files a/GameDev/bin/Release/icui18n.dll and /dev/null differ
diff --git a/GameDev/bin/Release/icuuc.dll b/GameDev/bin/Release/icuuc.dll
deleted file mode 100644
index 6be4c8f0..00000000
Binary files a/GameDev/bin/Release/icuuc.dll and /dev/null differ
diff --git a/GameDev/bin/Release/postproc-55.dll b/GameDev/bin/Release/postproc-55.dll
deleted file mode 100644
index e51df89e..00000000
Binary files a/GameDev/bin/Release/postproc-55.dll and /dev/null differ
diff --git a/GameDev/bin/Release/project_template/controls/EventDispatcher.js b/GameDev/bin/Release/project_template/controls/EventDispatcher.js
deleted file mode 100644
index 0a40a60e..00000000
--- a/GameDev/bin/Release/project_template/controls/EventDispatcher.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * https://github.com/mrdoob/eventdispatcher.js/
- */
-
-class EventDispatcher {
-
- addEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) this._listeners = {};
-
- const listeners = this._listeners;
-
- if ( listeners[ type ] === undefined ) {
-
- listeners[ type ] = [];
-
- }
-
- if ( listeners[ type ].indexOf( listener ) === - 1 ) {
-
- listeners[ type ].push( listener );
-
- }
-
- }
-
- hasEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) return false;
-
- const listeners = this._listeners;
-
- return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
-
- }
-
- removeEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) return;
-
- const listeners = this._listeners;
- const listenerArray = listeners[ type ];
-
- if ( listenerArray !== undefined ) {
-
- const index = listenerArray.indexOf( listener );
-
- if ( index !== - 1 ) {
-
- listenerArray.splice( index, 1 );
-
- }
-
- }
-
- }
-
- dispatchEvent( event ) {
- if ( this._listeners === undefined ) return;
-
- const listeners = this._listeners;
- const listenerArray = listeners[event.type];
-
- if ( listenerArray !== undefined ) {
-
- event.target = this;
-
- // Make a copy, in case listeners are removed while iterating.
- const array = listenerArray.slice( 0 );
-
- for ( let i = 0, l = array.length; i < l; i ++ ) {
-
- array[ i ].call( this, event );
-
- }
-
- event.target = null;
-
- }
-
- }
-
-}
-
-
-export { EventDispatcher };
diff --git a/GameDev/bin/Release/project_template/controls/OrbitControls.js b/GameDev/bin/Release/project_template/controls/OrbitControls.js
deleted file mode 100644
index 74a34db6..00000000
--- a/GameDev/bin/Release/project_template/controls/OrbitControls.js
+++ /dev/null
@@ -1,1261 +0,0 @@
-import { EventDispatcher } from "./EventDispatcher.js";
-import { MOUSE, TOUCH } from "./constants.js";
-import { Quaternion } from "../math/Quaternion.js";
-import { Spherical } from "../math/Spherical.js";
-import { Vector2 } from "../math/Vector2.js";
-import { Vector3 } from "../math/Vector3.js";
-import { Matrix4 } from "../math/Matrix4.js";
-
-
-// This set of controls performs orbiting, dollying (zooming), and panning.
-// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
-//
-// Orbit - left mouse / touch: one-finger move
-// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
-
-const _changeEvent = { type: 'change' };
-const _startEvent = { type: 'start' };
-const _endEvent = { type: 'end' };
-
-class OrbitControls extends EventDispatcher {
-
- constructor( object, domElement ) {
-
- super();
-
- if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' );
-
- this.object = object;
- this.domElement = domElement;
-
- // Set to false to disable this control
- this.enabled = true;
-
- // "target" sets the location of focus, where the object orbits around
- this.target = new Vector3();
-
- // How far you can dolly in and out ( PerspectiveCamera only )
- this.minDistance = 0;
- this.maxDistance = Infinity;
-
- // How far you can zoom in and out ( OrthographicCamera only )
- this.minZoom = 0;
- this.maxZoom = Infinity;
-
- // How far you can orbit vertically, upper and lower limits.
- // Range is 0 to Math.PI radians.
- this.minPolarAngle = 0; // radians
- this.maxPolarAngle = Math.PI; // radians
-
- // How far you can orbit horizontally, upper and lower limits.
- // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
- this.minAzimuthAngle = - Infinity; // radians
- this.maxAzimuthAngle = Infinity; // radians
-
- // Set to true to enable damping (inertia)
- // If damping is enabled, you must call controls.update() in your animation loop
- this.enableDamping = false;
- this.dampingFactor = 0.05;
-
- // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
- // Set to false to disable zooming
- this.enableZoom = true;
- this.zoomSpeed = 1.0;
-
- // Set to false to disable rotating
- this.enableRotate = true;
- this.rotateSpeed = 1.0;
-
- // Set to false to disable panning
- this.enablePan = true;
- this.panSpeed = 1.0;
- this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
- this.keyPanSpeed = 7.0; // pixels moved per arrow key push
-
- // Set to true to automatically rotate around the target
- // If auto-rotate is enabled, you must call controls.update() in your animation loop
- this.autoRotate = false;
- this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60
-
- // The four arrow keys
- this.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' };
-
- // Mouse buttons
- this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };
-
- // Touch fingers
- this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };
-
- // for reset
- this.target0 = this.target.clone();
- this.position0 = this.object.getPosition(new Vector3());
-
- // this.zoom0 = this.object.zoom;
- this.zoom0 = 1.0;
-
- // the target DOM element for key events
- this._domElementKeyEvents = null;
-
- //
- // public methods
- //
-
- this.getPolarAngle = function () {
-
- return spherical.phi;
-
- };
-
- this.getAzimuthalAngle = function () {
-
- return spherical.theta;
-
- };
-
- this.getDistance = function () {
- let position = this.object.getPosition(new Vector3());
- return position.distanceTo( this.target );
-
- };
-
- this.listenToKeyEvents = function ( domElement ) {
-
- domElement.addEventListener( 'keydown', onKeyDown );
- this._domElementKeyEvents = domElement;
-
- };
-
- this.saveState = function () {
-
- scope.target0.copy(scope.target);
- this.object.getPosition(scope.position0);
-
- // scope.zoom0 = scope.object.zoom;
- scope.zoom0 = 1.0;
-
- };
-
- this.reset = function () {
-
- scope.target.copy(scope.target0);
-
- this.object.getPosition(scope.position0);
-
- // scope.object.zoom = scope.zoom0;
-
- scope.object.updateProjectionMatrix();
- scope.dispatchEvent( _changeEvent );
-
- scope.update();
-
- state = STATE.NONE;
-
- };
-
- // this method is exposed, but perhaps it would be better if we can make it private...
- this.update = function () {
-
- const offset = new Vector3();
-
- // so camera.up is the orbit axis
- let camera_up = object.getUp(new Vector3());
- const quat = new Quaternion().setFromUnitVectors(camera_up, new Vector3(0, 1, 0));
- const quatInverse = quat.clone().invert();
-
- const lastPosition = new Vector3();
- const lastQuaternion = new Quaternion();
-
- const twoPI = 2 * Math.PI;
-
- return function update() {
-
- const position = scope.object.getPosition(new Vector3());
-
- offset.copy( position ).sub( scope.target );
-
- // rotate offset to "y-axis-is-up" space
- offset.applyQuaternion( quat );
-
- // angle from z-axis around y-axis
- spherical.setFromVector3( offset );
-
- if ( scope.autoRotate && state === STATE.NONE ) {
-
- rotateLeft( getAutoRotationAngle() );
-
- }
-
- if ( scope.enableDamping ) {
-
- spherical.theta += sphericalDelta.theta * scope.dampingFactor;
- spherical.phi += sphericalDelta.phi * scope.dampingFactor;
-
- } else {
-
- spherical.theta += sphericalDelta.theta;
- spherical.phi += sphericalDelta.phi;
-
- }
-
- // restrict theta to be between desired limits
-
- let min = scope.minAzimuthAngle;
- let max = scope.maxAzimuthAngle;
-
- if ( isFinite( min ) && isFinite( max ) ) {
-
- if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI;
-
- if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI;
-
- if ( min <= max ) {
-
- spherical.theta = Math.max( min, Math.min( max, spherical.theta ) );
-
- } else {
-
- spherical.theta = ( spherical.theta > ( min + max ) / 2 ) ?
- Math.max( min, spherical.theta ) :
- Math.min( max, spherical.theta );
-
- }
-
- }
-
- // restrict phi to be between desired limits
- spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
-
- spherical.makeSafe();
-
-
- spherical.radius *= scale;
-
- // restrict radius to be between desired limits
- spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
-
- // move target to panned location
-
- if ( scope.enableDamping === true ) {
-
- scope.target.addScaledVector( panOffset, scope.dampingFactor );
-
- } else {
-
- scope.target.add( panOffset );
-
- }
-
- offset.setFromSpherical( spherical );
-
- // rotate offset back to "camera-up-vector-is-up" space
- offset.applyQuaternion( quatInverse );
-
- position.copy(scope.target).add(offset);
- scope.object.setPosition(position)
-
- scope.object.lookAt( scope.target );
-
- if ( scope.enableDamping === true ) {
-
- sphericalDelta.theta *= ( 1 - scope.dampingFactor );
- sphericalDelta.phi *= ( 1 - scope.dampingFactor );
-
- panOffset.multiplyScalar( 1 - scope.dampingFactor );
-
- } else {
-
- sphericalDelta.set( 0, 0, 0 );
-
- panOffset.set( 0, 0, 0 );
-
- }
-
- 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
-
- const quaternion = scope.object.getQuaternion(new Quaternion());
-
- if ( zoomChanged ||
- lastPosition.distanceToSquared(position) > EPS ||
- 8 * (1 - lastQuaternion.dot(quaternion) ) > EPS ) {
-
- scope.dispatchEvent( _changeEvent );
-
- lastPosition.copy(position );
- lastQuaternion.copy(quaternion);
- zoomChanged = false;
-
- return true;
-
- }
-
- return false;
-
- };
-
- }();
-
- this.dispose = function () {
-
- scope.domElement.removeEventListener( 'contextmenu', onContextMenu );
-
- scope.domElement.removeEventListener( 'pointerdown', onPointerDown );
- scope.domElement.removeEventListener( 'pointercancel', onPointerCancel );
- scope.domElement.removeEventListener( 'wheel', onMouseWheel );
-
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
-
-
- if ( scope._domElementKeyEvents !== null ) {
-
- scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );
-
- }
-
- //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
-
- };
-
- //
- // internals
- //
-
- const scope = this;
-
- const STATE = {
- NONE: - 1,
- ROTATE: 0,
- DOLLY: 1,
- PAN: 2,
- TOUCH_ROTATE: 3,
- TOUCH_PAN: 4,
- TOUCH_DOLLY_PAN: 5,
- TOUCH_DOLLY_ROTATE: 6
- };
-
- let state = STATE.NONE;
-
- const EPS = 0.000001;
-
- // current position in spherical coordinates
- const spherical = new Spherical();
- const sphericalDelta = new Spherical();
-
- let scale = 1;
- const panOffset = new Vector3();
- let zoomChanged = false;
-
- const rotateStart = new Vector2();
- const rotateEnd = new Vector2();
- const rotateDelta = new Vector2();
-
- const panStart = new Vector2();
- const panEnd = new Vector2();
- const panDelta = new Vector2();
-
- const dollyStart = new Vector2();
- const dollyEnd = new Vector2();
- const dollyDelta = new Vector2();
-
- const pointers = [];
- const pointerPositions = {};
-
- function getAutoRotationAngle() {
-
- return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
-
- }
-
- function getZoomScale() {
-
- return Math.pow( 0.95, scope.zoomSpeed );
-
- }
-
- function rotateLeft( angle ) {
-
- sphericalDelta.theta -= angle;
-
- }
-
- function rotateUp( angle ) {
-
- sphericalDelta.phi -= angle;
-
- }
-
- const panLeft = function () {
-
- const v = new Vector3();
-
- return function panLeft( distance, objectMatrix ) {
-
- v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
- v.multiplyScalar( - distance );
-
- panOffset.add( v );
-
- };
-
- }();
-
- const panUp = function () {
-
- const v = new Vector3();
-
- return function panUp( distance, objectMatrix ) {
-
- if ( scope.screenSpacePanning === true ) {
-
- v.setFromMatrixColumn( objectMatrix, 1 );
-
- } else {
- let up = scope.object.getUp(new Vector3());
- v.setFromMatrixColumn( objectMatrix, 0 );
- v.crossVectors(up, v );
-
- }
-
- v.multiplyScalar( distance );
-
- panOffset.add( v );
-
- };
-
- }();
-
- // deltaX and deltaY are in pixels; right and down are positive
- const pan = function () {
-
- const offset = new Vector3();
-
- return function pan( deltaX, deltaY ) {
-
- const element = scope.domElement;
-
- if ( scope.object.isPerspectiveCamera ) {
-
- // perspective
- const position = scope.object.getPosition(new Vector3());
- offset.copy( position ).sub( scope.target );
- let targetDistance = offset.length();
-
- // half of the fov is center to top of screen
- targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
-
- const matrix = scope.object.getMatrix(new Matrix4());
- // we use only clientHeight here so aspect ratio does not distort speed
- panLeft(2 * deltaX * targetDistance / element.clientHeight, matrix );
- panUp(2 * deltaY * targetDistance / element.clientHeight, matrix );
-
- } else if (scope.object.isOrthographicCamera) {
-
- const matrix = scope.object.getMatrix(new Matrix4());
- // orthographic
- panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, matrix );
- panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, matrix );
-
- } else {
-
- // camera neither orthographic nor perspective
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
- scope.enablePan = false;
-
- }
-
- };
-
- }();
-
- function dollyOut( dollyScale ) {
-
- if ( scope.object.isPerspectiveCamera ) {
-
- scale /= dollyScale;
-
- } else if ( scope.object.isOrthographicCamera ) {
-
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
- scope.object.updateProjectionMatrix();
- zoomChanged = true;
-
- } else {
-
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
- scope.enableZoom = false;
-
- }
-
- }
-
- function dollyIn( dollyScale ) {
-
- if ( scope.object.isPerspectiveCamera ) {
-
- scale *= dollyScale;
-
- } else if ( scope.object.isOrthographicCamera ) {
-
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
- scope.object.updateProjectionMatrix();
- zoomChanged = true;
-
- } else {
-
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
- scope.enableZoom = false;
-
- }
-
- }
-
- //
- // event callbacks - update the object state
- //
-
- function handleMouseDownRotate( event ) {
-
- rotateStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseDownDolly( event ) {
-
- dollyStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseDownPan( event ) {
-
- panStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseMoveRotate( event ) {
-
- rotateEnd.set( event.clientX, event.clientY );
-
- rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
-
- const element = scope.domElement;
-
- rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
-
- rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
-
- rotateStart.copy( rotateEnd );
-
- scope.update();
-
- }
-
- function handleMouseMoveDolly( event ) {
-
- dollyEnd.set( event.clientX, event.clientY );
-
- dollyDelta.subVectors( dollyEnd, dollyStart );
-
- if ( dollyDelta.y > 0 ) {
-
- dollyOut( getZoomScale() );
-
- } else if ( dollyDelta.y < 0 ) {
-
- dollyIn( getZoomScale() );
-
- }
-
- dollyStart.copy( dollyEnd );
-
- scope.update();
-
- }
-
- function handleMouseMovePan( event ) {
-
- panEnd.set( event.clientX, event.clientY );
-
- panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
-
- pan( panDelta.x, panDelta.y );
-
- panStart.copy( panEnd );
-
- scope.update();
-
- }
-
- function handleMouseWheel( event ) {
-
- if ( event.deltaY < 0 ) {
-
- dollyIn( getZoomScale() );
-
- } else if ( event.deltaY > 0 ) {
-
- dollyOut( getZoomScale() );
-
- }
-
- scope.update();
-
- }
-
- function handleKeyDown( event ) {
-
- let needsUpdate = false;
-
- switch ( event.code ) {
-
- case scope.keys.UP:
- pan( 0, scope.keyPanSpeed );
- needsUpdate = true;
- break;
-
- case scope.keys.BOTTOM:
- pan( 0, - scope.keyPanSpeed );
- needsUpdate = true;
- break;
-
- case scope.keys.LEFT:
- pan( scope.keyPanSpeed, 0 );
- needsUpdate = true;
- break;
-
- case scope.keys.RIGHT:
- pan( - scope.keyPanSpeed, 0 );
- needsUpdate = true;
- break;
-
- }
-
- if ( needsUpdate ) {
-
- // prevent the browser from scrolling on cursor keys
- // event.preventDefault();
-
- scope.update();
-
- }
-
-
- }
-
- function handleTouchStartRotate() {
-
- if ( pointers.length === 1 ) {
-
- rotateStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
-
- } else {
-
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
-
- rotateStart.set( x, y );
-
- }
-
- }
-
- function handleTouchStartPan() {
-
- if ( pointers.length === 1 ) {
-
- panStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
-
- } else {
-
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
-
- panStart.set( x, y );
-
- }
-
- }
-
- function handleTouchStartDolly() {
-
- const dx = pointers[ 0 ].pageX - pointers[ 1 ].pageX;
- const dy = pointers[ 0 ].pageY - pointers[ 1 ].pageY;
-
- const distance = Math.sqrt( dx * dx + dy * dy );
-
- dollyStart.set( 0, distance );
-
- }
-
- function handleTouchStartDollyPan() {
-
- if ( scope.enableZoom ) handleTouchStartDolly();
-
- if ( scope.enablePan ) handleTouchStartPan();
-
- }
-
- function handleTouchStartDollyRotate() {
-
- if ( scope.enableZoom ) handleTouchStartDolly();
-
- if ( scope.enableRotate ) handleTouchStartRotate();
-
- }
-
- function handleTouchMoveRotate( event ) {
-
- if ( pointers.length == 1 ) {
-
- rotateEnd.set( event.pageX, event.pageY );
-
- } else {
-
- const position = getSecondPointerPosition( event );
-
- const x = 0.5 * ( event.pageX + position.x );
- const y = 0.5 * ( event.pageY + position.y );
-
- rotateEnd.set( x, y );
-
- }
-
- rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
-
- const element = scope.domElement;
-
- rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
-
- rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
-
- rotateStart.copy( rotateEnd );
-
- }
-
- function handleTouchMovePan( event ) {
-
- if ( pointers.length === 1 ) {
-
- panEnd.set( event.pageX, event.pageY );
-
- } else {
-
- const position = getSecondPointerPosition( event );
-
- const x = 0.5 * ( event.pageX + position.x );
- const y = 0.5 * ( event.pageY + position.y );
-
- panEnd.set( x, y );
-
- }
-
- panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
-
- pan( panDelta.x, panDelta.y );
-
- panStart.copy( panEnd );
-
- }
-
- function handleTouchMoveDolly( event ) {
-
- const position = getSecondPointerPosition( event );
-
- const dx = event.pageX - position.x;
- const dy = event.pageY - position.y;
-
- const distance = Math.sqrt( dx * dx + dy * dy );
-
- dollyEnd.set( 0, distance );
-
- dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );
-
- dollyOut( dollyDelta.y );
-
- dollyStart.copy( dollyEnd );
-
- }
-
- function handleTouchMoveDollyPan( event ) {
-
- if ( scope.enableZoom ) handleTouchMoveDolly( event );
-
- if ( scope.enablePan ) handleTouchMovePan( event );
-
- }
-
- function handleTouchMoveDollyRotate( event ) {
-
- if ( scope.enableZoom ) handleTouchMoveDolly( event );
-
- if ( scope.enableRotate ) handleTouchMoveRotate( event );
-
- }
-
- //
- // event handlers - FSM: listen for events and reset state
- //
-
- function onPointerDown( event ) {
-
- if ( scope.enabled === false ) return;
-
- if ( pointers.length === 0 ) {
-
- scope.domElement.setPointerCapture();
-
- scope.domElement.addEventListener( 'pointermove', onPointerMove );
- scope.domElement.addEventListener( 'pointerup', onPointerUp );
-
- }
-
- //
-
- addPointer( event );
-
- if ( event.pointerType === 'touch' ) {
-
- onTouchStart( event );
-
- } else {
-
- onMouseDown( event );
-
- }
-
- }
-
- function onPointerMove( event ) {
-
- if ( scope.enabled === false ) return;
-
- if ( event.pointerType === 'touch' ) {
-
- onTouchMove( event );
-
- } else {
-
- onMouseMove( event );
-
- }
-
- }
-
- function onPointerUp( event ) {
-
- removePointer( event );
-
- if ( pointers.length === 0 ) {
-
- scope.domElement.releasePointerCapture();
-
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
-
- }
-
- scope.dispatchEvent( _endEvent );
-
- state = STATE.NONE;
-
- }
-
- function onPointerCancel( event ) {
-
- removePointer( event );
-
- }
-
- function onMouseDown( event ) {
-
- let mouseAction;
-
- switch ( event.button ) {
-
- case 0:
-
- mouseAction = scope.mouseButtons.LEFT;
- break;
-
- case 1:
-
- mouseAction = scope.mouseButtons.MIDDLE;
- break;
-
- case 2:
-
- mouseAction = scope.mouseButtons.RIGHT;
- break;
-
- default:
-
- mouseAction = - 1;
-
- }
-
- switch ( mouseAction ) {
-
- case MOUSE.DOLLY:
-
- if ( scope.enableZoom === false ) return;
-
- handleMouseDownDolly( event );
-
- state = STATE.DOLLY;
-
- break;
-
- case MOUSE.ROTATE:
-
- if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
-
- if ( scope.enablePan === false ) return;
-
- handleMouseDownPan( event );
-
- state = STATE.PAN;
-
- } else {
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseDownRotate( event );
-
- state = STATE.ROTATE;
-
- }
-
- break;
-
- case MOUSE.PAN:
-
- if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseDownRotate( event );
-
- state = STATE.ROTATE;
-
- } else {
-
- if ( scope.enablePan === false ) return;
-
- handleMouseDownPan( event );
-
- state = STATE.PAN;
-
- }
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- if ( state !== STATE.NONE ) {
-
- scope.dispatchEvent( _startEvent );
-
- }
-
- }
-
- function onMouseMove( event ) {
-
- if ( scope.enabled === false ) return;
-
- switch ( state ) {
-
- case STATE.ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseMoveRotate( event );
-
- break;
-
- case STATE.DOLLY:
-
- if ( scope.enableZoom === false ) return;
-
- handleMouseMoveDolly( event );
-
- break;
-
- case STATE.PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleMouseMovePan( event );
-
- break;
-
- }
-
- }
-
- function onMouseWheel( event ) {
-
- if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
-
- // event.preventDefault();
-
- scope.dispatchEvent( _startEvent );
-
- handleMouseWheel( event );
-
- scope.dispatchEvent( _endEvent );
-
- }
-
- function onKeyDown( event ) {
-
- if ( scope.enabled === false || scope.enablePan === false ) return;
-
- handleKeyDown( event );
-
- }
-
- function onTouchStart( event ) {
-
- trackPointer( event );
-
- switch ( pointers.length ) {
-
- case 1:
-
- switch ( scope.touches.ONE ) {
-
- case TOUCH.ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleTouchStartRotate();
-
- state = STATE.TOUCH_ROTATE;
-
- break;
-
- case TOUCH.PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleTouchStartPan();
-
- state = STATE.TOUCH_PAN;
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- break;
-
- case 2:
-
- switch ( scope.touches.TWO ) {
-
- case TOUCH.DOLLY_PAN:
-
- if ( scope.enableZoom === false && scope.enablePan === false ) return;
-
- handleTouchStartDollyPan();
-
- state = STATE.TOUCH_DOLLY_PAN;
-
- break;
-
- case TOUCH.DOLLY_ROTATE:
-
- if ( scope.enableZoom === false && scope.enableRotate === false ) return;
-
- handleTouchStartDollyRotate();
-
- state = STATE.TOUCH_DOLLY_ROTATE;
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- if ( state !== STATE.NONE ) {
-
- scope.dispatchEvent( _startEvent );
-
- }
-
- }
-
- function onTouchMove( event ) {
-
- trackPointer( event );
-
- switch ( state ) {
-
- case STATE.TOUCH_ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleTouchMoveRotate( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleTouchMovePan( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_DOLLY_PAN:
-
- if ( scope.enableZoom === false && scope.enablePan === false ) return;
-
- handleTouchMoveDollyPan( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_DOLLY_ROTATE:
-
- if ( scope.enableZoom === false && scope.enableRotate === false ) return;
-
- handleTouchMoveDollyRotate( event );
-
- scope.update();
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- }
-
- function onContextMenu( event ) {
-
- if ( scope.enabled === false ) return;
-
- // event.preventDefault();
-
- }
-
- function addPointer( event ) {
-
- pointers.push( event );
-
- }
-
- function removePointer( event ) {
-
- delete pointerPositions[ event.pointerId ];
-
- for ( let i = 0; i < pointers.length; i ++ ) {
-
- if ( pointers[ i ].pointerId == event.pointerId ) {
-
- pointers.splice( i, 1 );
- return;
-
- }
-
- }
-
- }
-
- function trackPointer( event ) {
-
- let position = pointerPositions[ event.pointerId ];
-
- if ( position === undefined ) {
-
- position = new Vector2();
- pointerPositions[ event.pointerId ] = position;
-
- }
-
- position.set( event.pageX, event.pageY );
-
- }
-
- function getSecondPointerPosition( event ) {
-
- const pointer = ( event.pointerId === pointers[ 0 ].pointerId ) ? pointers[ 1 ] : pointers[ 0 ];
-
- return pointerPositions[ pointer.pointerId ];
-
- }
-
- //
-
- scope.domElement.addEventListener( 'contextmenu', onContextMenu );
-
- scope.domElement.addEventListener( 'pointerdown', onPointerDown );
- scope.domElement.addEventListener( 'pointercancel', onPointerCancel );
- scope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } );
-
- // force an update at start
-
- this.update();
-
- }
-
-}
-
-
-// This set of controls performs orbiting, dollying (zooming), and panning.
-// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
-// This is very similar to OrbitControls, another set of touch behavior
-//
-// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
-// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-// Pan - left mouse, or arrow keys / touch: one-finger move
-
-class MapControls extends OrbitControls {
-
- constructor( object, domElement ) {
-
- super( object, domElement );
-
- this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up
-
- this.mouseButtons.LEFT = MOUSE.PAN;
- this.mouseButtons.RIGHT = MOUSE.ROTATE;
-
- this.touches.ONE = TOUCH.PAN;
- this.touches.TWO = TOUCH.DOLLY_ROTATE;
-
- }
-
-}
-
-export { OrbitControls, MapControls };
diff --git a/GameDev/bin/Release/project_template/controls/constants.js b/GameDev/bin/Release/project_template/controls/constants.js
deleted file mode 100644
index ef811450..00000000
--- a/GameDev/bin/Release/project_template/controls/constants.js
+++ /dev/null
@@ -1,2 +0,0 @@
-export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
-export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
diff --git a/GameDev/bin/Release/project_template/document.js b/GameDev/bin/Release/project_template/document.js
deleted file mode 100644
index 1cc002dc..00000000
--- a/GameDev/bin/Release/project_template/document.js
+++ /dev/null
@@ -1,1719 +0,0 @@
-import { OrbitControls } from "./controls/OrbitControls.js";
-import { Vector3 } from "./math/Vector3.js";
-import { view, UIViewDispatcher } from "./view.js";
-
-import * as txml from "./txml.js";
-
-function string_to_boolean(string) {
- switch (string.toLowerCase().trim()) {
- case "true":
- case "yes":
- case "1":
- return true;
-
- case "false":
- case "no":
- case "0":
- case null:
- return false;
-
- default:
- return Boolean(string);
- }
-}
-
-
-class JoyStick
-{
- constructor(options)
- {
- let width = options.width;
- let height = options.height;
- this.center_x = width * 0.5;
- this.center_y = height - 75.0;
-
- this.ui_area = new UIArea();
- this.ui_area.setOrigin(this.center_x-60.0, this.center_y - 60.0);
- this.ui_area.setSize(120.0, 120.0);
- UIManager.add(this.ui_area);
-
- this.circle = new UIPanel();
- this.circle.setOrigin(20.0, 20.0);
- this.circle.setSize(80.0, 80.0);
- this.circle.setStyle({cornerRadius:40.0, colorBg: "#7E7E7E7E"});
- this.ui_area.add(this.circle);
-
- this.thumb = new UIPanel();
- this.thumb.setOrigin(40.0, 40.0);
- this.thumb.setSize(40.0, 40.0);
- this.thumb.setStyle({cornerRadius:20.0, colorBg: "#FFFFFFFF", shadowOffset:0.0});
- this.ui_area.add(this.thumb);
-
- this.maxRadius = options.maxRadius || 40;
- this.maxRadiusSquared = this.maxRadius * this.maxRadius;
- this.onMove = options.onMove;
-
- const move = (x, y)=>
- {
- let delta_x = x - this.offset.x;
- let delta_y = y - this.offset.y;
-
- const run_status = Math.abs(delta_x) - 50 >= 0 || Math.abs(delta_y) - 50 >= 0;
- const sqMag = delta_x * delta_x + delta_y * delta_y;
- if (sqMag > this.maxRadiusSquared) {
- const magnitude = Math.sqrt(sqMag);
- delta_x /= magnitude;
- delta_y /= magnitude;
- delta_x *= this.maxRadius;
- delta_y *= this.maxRadius;
- }
-
- this.thumb.setOrigin(40.0 + delta_x, 40.0 + delta_y);
-
- const forward = -delta_y / this.maxRadius;
- const turn = delta_x / this.maxRadius;
-
- if (this.onMove != undefined) this.onMove(forward, turn, run_status);
- }
-
- const up = (x, y) =>
- {
- this.thumb.onPointerMove = null;
- this.thumb.onPointerUp = null;
- this.thumb.setOrigin(40.0, 40.0);
- if (this.onMove != undefined) this.onMove(0,0,false);
- gamePlayer.message("releasePointerCapture", "");
- }
-
- const tap = (x, y) =>
- {
- this.offset = { x, y };
- this.thumb.onPointerMove = move;
- this.thumb.onPointerUp = up;
- gamePlayer.message("setPointerCapture", "");
- };
-
- this.thumb.onPointerDown = tap;
-
-
- }
-
- onResize(width, height)
- {
- let center_x = width * 0.5;
- let center_y = height - 75.0;
- if (center_x!=this.center_x || center_y!= this.center_y)
- {
- this.center_x = center_x;
- this.center_y = center_y;
- this.ui_area.setOrigin(this.center_x-60.0, this.center_y - 60.0);
- }
- }
-
-
-}
-
-class AnimCrossFader
-{
- constructor(fade_time)
- {
- this.mixer = new AnimationMixer();
- this.fade_time = fade_time || 0.5;
- }
-
- add_clips(clips)
- {
- this.mixer.addAnimations(clips);
- }
-
- set_current(clip_name)
- {
- this.start_time = now();
- this.mixer.startAnimation(clip_name);
- }
-
- update_weights(weight_cur)
- {
- let lst_active = this.mixer.currentPlaying;
- let weight_last = lst_active[lst_active.length - 1].weight;
- let k = (1.0 - weight_cur)/(1.0-weight_last);
- let weights = [];
- for (let i=0; i< lst_active.length-1; i++)
- {
- let w = lst_active[i].weight * k;
- weights.push(w);
- }
- weights.push(weight_cur);
- this.mixer.setWeights(weights);
- }
-
- get_frame()
- {
- let lst_active = this.mixer.currentPlaying;
- if (lst_active.length<1) return;
- if (lst_active.length>1)
- {
- let cur_time = now();
- let delta = cur_time - this.start_time;
- let weight = 1.0;
- if (delta0)
- {
- let i = getRandomInt(this.update_queue.length);
- let idx = this.update_queue[i];
- this.update_queue.splice(i,1);
- this.update_set.delete(idx);
-
- let x = idx;
- let y = x / divisions.x;
- let z = y / divisions.y;
- y = y % divisions.y;
- x = x % divisions.x;
- let v_idx = new Vector3(x,y,z);
-
- renderer.updateProbe(this.doc.scene, this.cube_target, this.probe_grid, v_idx, 0.1, 100.0, 0.2);
- }
- }
-
-}
-
-
-// Tags
-const create_default_controls = (doc)=>{
- if (doc.controls)
- doc.controls.dispose();
- doc.controls = new OrbitControls(doc.camera, doc.view);
- doc.controls.enableDamping = true;
- doc.controls.target.set(0, 1.5, 0);
-}
-
-
-const create_default_sky = (doc)=>{
- let bg = new HemisphereBackground();
- bg.setSkyColor(0.318, 0.318, 0.318);
- bg.setGroundColor(0.01, 0.025, 0.025);
- doc.scene.background = bg;
-}
-
-const create_default_env_light = (doc) =>{
- let envLight = new HemisphereLight();
- envLight.setSkyColor(0.318, 0.318, 0.318);
- envLight.setGroundColor(0.01, 0.025, 0.025);
- doc.scene.indirectLight = envLight;
-}
-
-
-const scene = {
- reset: (doc) => {
- doc.scene = new Scene();
- },
- create: async (doc, props, mode, parent) => {
- doc.scene = new Scene();
- create_default_sky(doc);
- create_default_env_light(doc);
- return doc.scene;
- }
-}
-
-
-const camera = {
- reset: (doc) => {
- doc.camera = new PerspectiveCamera(45, doc.width / doc.height, 0.1, 100);
- doc.camera.setPosition(0, 1.5, 5.0);
- },
-
- create: async (doc, props, mode, parent) => {
- let fov = 50.0;
- let near = 0.1;
- let far = 200.0;
- if (props.hasOwnProperty("fov"))
- {
- fov = parseFloat(props.fov);
- }
- if (props.hasOwnProperty("near"))
- {
- near = parseFloat(props.near);
- }
- if (props.hasOwnProperty("far"))
- {
- far = parseFloat(props.far);
- }
- doc.camera = new PerspectiveCamera(fov, doc.width / doc.height, near, far);
- create_default_controls(doc);
- return doc.camera;
- }
-}
-
-const control = {
- reset: (doc) => {
- create_default_controls(doc);
- },
- create: async (doc, props, mode, parent) =>{
- let type = 'orbit';
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == 'orbit')
- {
- let from_x = 0.0;
- let from_y = 1.5;
- let from_z = 5.0;
- if (props.hasOwnProperty("look_from"))
- {
- let look_from = props.look_from.split(',');
- from_x = parseFloat(look_from[0]);
- from_y = parseFloat(look_from[1]);
- from_z = parseFloat(look_from[2]);
- }
-
- let to_x = 0.0;
- let to_y = 1.5;
- let to_z = 0.0;
- if (props.hasOwnProperty("look_at"))
- {
- let look_at = props.look_at.split(',');
- to_x = parseFloat(look_at[0]);
- to_y = parseFloat(look_at[1]);
- to_z = parseFloat(look_at[2]);
- }
-
- doc.camera.setPosition(from_x, from_y, from_z);
- if (doc.controls != null)
- doc.controls.dispose();
- doc.controls = new OrbitControls(doc.camera, doc.view);
- doc.controls.enableDamping = true;
- doc.controls.target.set(to_x, to_y, to_z);
- }
- }
-}
-
-const fog = {
- create: async (doc, props, mode, parent) =>{
- doc.scene.fog = new Fog();
- if (props.hasOwnProperty("density"))
- {
- doc.scene.fog.density = parseFloat(props.density);
- }
- return doc.scene.fog;
- }
-}
-
-const sky = {
- reset: (doc) => {
- create_default_sky(doc);
- },
- create: async (doc, props, mode, parent) => {
- let type = "hemisphere"
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- let bg = new ColorBackground();
- let envLight = null;
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setColor(r,g,b);
- }
- doc.scene.background = bg;
- }
- else if (type == "hemisphere")
- {
- let bg = new HemisphereBackground();
-
- if (props.hasOwnProperty('skyColor'))
- {
- const color = props.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setSkyColor(r,g,b);
- }
-
- if (props.hasOwnProperty('groundColor'))
- {
- const color = props.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setGroundColor(r,g,b);
- }
- doc.scene.background = bg;
-
- }
- else if (type == "cube")
- {
- let bg = new CubeBackground();
-
- let url = "assets/textures";
- let posx = "face0.jpg";
- let negx = "face1.jpg";
- let posy = "face2.jpg";
- let negy = "face3.jpg";
- let posz = "face4.jpg";
- let negz = "face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (cube_img!=null)
- {
- bg.setCubemap(cube_img);
- }
- doc.scene.background = bg;
- }
- else if (type == "scene")
- {
- let path_scene = "terrain.xml";
- if (props.hasOwnProperty('scene'))
- {
- path_scene = props.scene;
- }
-
- let near = 10.0;
- let far = 10000.0;
- if (props.hasOwnProperty('near'))
- {
- near = parseFloat(props.near);
- }
- if (props.hasOwnProperty('far'))
- {
- far = parseFloat(props.far);
- }
-
- let bg_doc = new BackgroundDocument(near, far);
- await bg_doc.load_local_xml(path_scene);
- doc.scene.background = bg_doc;
- }
- return doc.scene.background;
- },
- remove: (doc, obj) => {
- create_default_sky(doc);
- }
-}
-
-const env_light = {
- reset: (doc) => {
- create_default_env_light(doc);
- doc.probeUpdater = null;
- },
- create: async (doc, props, mode, parent) => {
- let type = "hemisphere"
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
-
- if (type == "uniform")
- {
- let envLight = new AmbientLight();
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setColor(r,g,b);
- }
- doc.scene.indirectLight = envLight;
- }
- else if (type == "hemisphere")
- {
- let envLight = new HemisphereLight();
-
- if (props.hasOwnProperty('skyColor'))
- {
- const color = props.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setSkyColor(r,g,b);
- }
-
- if (props.hasOwnProperty('groundColor'))
- {
- const color = props.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setGroundColor(r,g,b);
- }
- doc.scene.indirectLight = envLight;
- }
- else if (type == "cube")
- {
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (irradiance_only)
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let envLight = new EnvironmentMap();
- let text = fileLoader.loadTextFile(path_sh);
- if (text!=null)
- {
- envLight.shCoefficients = JSON.parse(text);
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let cube_img = HDRImageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
-
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
-
- doc.scene.indirectLight = envLight;
- }
- }
- }
- else if (type == "probe_grid")
- {
- let probe_data = "assets/probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let probe_grid = probeGridLoader.loadFile(probe_data);
- if (probe_grid == null)
- {
- probe_grid = new ProbeGrid();
-
- if (props.hasOwnProperty('divisions'))
- {
- const divisions = props.divisions.split(',');
- probe_grid.setDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
- if (props.hasOwnProperty('coverage_min'))
- {
- const coverage_min = props.coverage_min.split(',');
- probe_grid.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
- if (props.hasOwnProperty('coverage_max'))
- {
- const coverage_max = props.coverage_max.split(',');
- probe_grid.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
- if (props.hasOwnProperty('ypower'))
- {
- probe_grid.ypower = parseFloat(props.ypower);
- }
- }
-
- if (props.hasOwnProperty('normal_bias'))
- {
- probe_grid.normalBias = parseFloat(props.normal_bias);
- }
-
- if (props.hasOwnProperty('per_primitive'))
- {
- probe_grid.perPrimitive =string_to_boolean(props.per_primitive);
- }
-
- if (props.hasOwnProperty('auto_update') )
- {
- doc.probeUpdater = new ProbeUpdater(doc, probe_grid);
- }
-
- doc.scene.indirectLight = probe_grid;
- }
- else if (type == "lod_probe_grid")
- {
- let probe_data = "assets/lod_probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let probe_grid = LODProbeGridLoader.loadFile(probe_data);
- if (probe_grid == null)
- {
- probe_grid = new LODProbeGrid();
- if (props.hasOwnProperty('base_divisions'))
- {
- const divisions = props.base_divisions.split(',');
- probe_grid.setBaseDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
- if (props.hasOwnProperty('coverage_min'))
- {
- const coverage_min = props.coverage_min.split(',');
- probe_grid.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
- if (props.hasOwnProperty('coverage_max'))
- {
- const coverage_max = props.coverage_max.split(',');
- probe_grid.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
- if (props.hasOwnProperty('sub_division_level'))
- {
- probe_grid.subDivisionLevel = parseFloat(props.sub_division_level);
- }
- }
-
- if (props.hasOwnProperty('normal_bias'))
- {
- probe_grid.normalBias = parseFloat(props.normal_bias);
- }
-
- if (props.hasOwnProperty('per_primitive'))
- {
- probe_grid.perPrimitive =string_to_boolean(props.per_primitive);
- }
- doc.scene.indirectLight = probe_grid;
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- doc.scene.indirectLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- return doc.scene.indirectLight;
- },
- remove: (doc, obj) => {
- create_default_env_light(doc);
- doc.probeUpdater = null;
- },
-}
-
-const group = {
- create: async (doc, props, mode, parent) => {
- const group = new Object3D();
- if (parent != null) {
- parent.add(group);
- }
- else {
- doc.scene.add(group);
- }
- return group;
- }
-}
-
-const plane = {
- create: async (doc, props, mode, parent) => {
- let width = 1.0;
- let height = 1.0;
- if (props.hasOwnProperty('size'))
- {
- let size = props.size.split(',');
- width = parseFloat(size[0]);
- height = parseFloat(size[1]);
- }
-
- const plane = new SimpleModel();
- plane.createPlane(width, height);
-
- if (parent != null) {
- parent.add(plane);
- }
- else {
- doc.scene.add(plane);
- }
- return plane;
- }
-}
-
-
-const box = {
- create: async (doc, props, mode, parent) => {
- let width = 1.0;
- let height = 1.0;
- let depth = 1.0;
- if (props.hasOwnProperty('size'))
- {
- let size = props.size.split(',');
- width = parseFloat(size[0]);
- height = parseFloat(size[1]);
- depth = parseFloat(size[2]);
- }
-
- const box = new SimpleModel();
- box.createBox(width, height, depth);
-
- if (parent != null) {
- parent.add(box);
- }
- else {
- doc.scene.add(box);
- }
- return box;
- }
-}
-
-const sphere = {
- create: async (doc, props, mode, parent) => {
- let radius = 1.0;
- if (props.hasOwnProperty('radius'))
- {
- radius = parseFloat(props.radius);
- }
- let widthSegments = 32;
- if (props.hasOwnProperty('widthSegments'))
- {
- widthSegments = parseInt(props.widthSegments);
- }
- let heightSegments = 16;
- if (props.hasOwnProperty('heightSegments'))
- {
- heightSegments = parseInt(props.heightSegments);
- }
-
- const sphere = new SimpleModel();
- sphere.createSphere(radius, widthSegments, heightSegments);
-
- if (parent != null) {
- parent.add(sphere);
- }
- else {
- doc.scene.add(sphere);
- }
- return sphere;
- }
-}
-
-const model = {
- create: async (doc, props, mode, parent) => {
- let url = "assets/models/model.glb";
- if (props.hasOwnProperty('src'))
- {
- url = props.src;
- }
- let model = gltfLoader.loadModelFromFile(url);
- if (model == null)
- {
- model= new SimpleModel();
- model.createBox(0.5, 1.5, 0.5);
- model.setColor(0.7,0.0,0.7);
- }
- else
- {
- if (props.hasOwnProperty('is_building') && string_to_boolean(props.is_building))
- {
- model.batchPrimitives();
- }
-
- if (model.isBakable)
- {
- if (props.hasOwnProperty('lightmap'))
- {
- let filename = props.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=="hdr")
- {
- let hdr_img = HDRImageLoader.loadFile(filename);
- if (hdr_img!=null)
- {
- model.setLightmap(hdr_img);
- }
- }
- else if (ext=="dds")
- {
- let dds_img = DDSImageLoader.loadFile(filename);
- if (dds_img!=null)
- {
- model.setLightmap(dds_img);
- }
- }
- else if (ext=="png" || ext == "webp")
- {
- let img = imageLoader.loadFile(filename);
- if (img!=null)
- {
- let hdr_img = HDRImageLoader.fromRGBM(img);
- model.setLightmap(hdr_img);
- }
- }
- else if (ext=="csv")
- {
- let text = fileLoader.loadTextFile(filename);
- if (text!=null)
- {
- let path = filename.match(/(.*)[\/\\]/)[1]||'';
- let images = [];
- let ranges = [];
- let lines = text.split(/\r?\n/);
- for(let line of lines)
- {
- let fields = line.split(",");
- if (fields.length<7) continue;
- let fn_img = fields[0];
- let img = imageLoader.loadFile(path + "/" + fn_img);
- if (img == null) continue;
- let low = new Vector3(parseFloat(fields[1]), parseFloat(fields[2]), parseFloat(fields[3]));
- let high = new Vector3(parseFloat(fields[4]), parseFloat(fields[5]), parseFloat(fields[6]));
- images.push(img);
- ranges.push({low, high});
- }
- let hdr_img = HDRImageLoader.fromImages(images, ranges);
- model.setLightmap(hdr_img);
- }
- }
- }
- }
- }
-
- if (parent != null) {
- parent.add(model);
- }
- else {
- doc.scene.add(model);
- }
- return model;
- }
-}
-
-const avatar = {
- create: async (doc, props, mode, parent) => {
- let avatar = await model.create(doc, props, mode, parent);
- doc.avatar = avatar;
- if (!props.hasOwnProperty('lookat_height')) {
- props.lookat_height = '1';
- }
-
- let lookat_height = parseFloat(props.lookat_height);
- avatar.state = "idle";
- avatar.move = null;
-
- const name_idle = props.name_idle;
- const name_forward = props.name_forward;
- const name_backward = props.name_backward;
-
- cam = new Object3D();
- const camera_position = props.camera_position.split(',');
- const [camx, camy, camz] = camera_position;
- cam.setPosition(+camx, +camy, +camz);
- avatar.add(cam);
-
- const anims = gltfLoader.loadAnimationsFromFile(props.url_anim);
- if (props.hasOwnProperty('fix_anims')) {
- doc.loaded_module[props.fix_anims](anims);
- }
-
- let mixer = new AnimCrossFader();
- mixer.add_clips(anims);
- mixer.set_current(name_idle);
- avatar.cur_action = name_idle;
- avatar.mixer = mixer;
-
- const onMove = (forward, turn, run_status)=>
- {
- avatar.move = { forward, turn};
- let action_changed = false;
- let new_action = null;
-
- if (forward > 0)
- {
- if (avatar.state != "forward")
- {
- new_action = name_forward;
- action_changed = true;
- avatar.state = "forward";
- }
- }
- else if (forward < 0)
- {
- if (avatar.state != "backward")
- {
- new_action = name_backward;
- action_changed = true;
- avatar.state = "backward";
- }
- }
- else
- {
- if (avatar.state != "idle")
- {
- new_action = name_idle;
- action_changed = true;
- avatar.state = "idle";
- }
- }
-
- if (action_changed)
- {
- mixer.set_current(new_action);
- avatar.cur_action = new_action;
- }
- }
-
- const joystick = new JoyStick({ width: doc.width, height: doc.height, onMove: onMove});
-
- if (doc.controls != null) {
- doc.controls.dispose();
- doc.controls = null;
- }
-
- const update_avatar = (doc, mixer, delta) => {
- let frame = mixer.get_frame();
- avatar.setAnimationFrame(frame);
-
- joystick.onResize(doc.width, doc.height);
-
- if (avatar.move)
- {
- if (avatar.move.forward !=0)
- {
- let threshold = 0.4;
- let movement = delta * avatar.move.forward * 2.0;
- let pos = avatar.getPosition(new Vector3());
- pos.y += threshold;
-
- if (doc.building.length > 0 && movement !=0)
- {
- // cast front
- {
- let negated = false;
- let dir = avatar.getWorldDirection(new Vector3());
- if (avatar.move.forward < 0)
- {
- dir.negate();
- negated = true;
- }
-
- const intersect = doc.bvh.intersect({origin: pos, direction: dir});
- if (intersect!==null)
- {
- if (!negated)
- {
- if (movement > intersect.distance - 0.3)
- {
- movement = intersect.distance - 0.3;
- }
- }
- else
- {
- if (-movement > intersect.distance - 0.3)
- {
- movement = 0.3 - intersect.distance;
- }
- }
- }
- }
- }
-
- avatar.translateZ(movement);
- pos = avatar.getPosition(new Vector3());
- pos.y += threshold;
-
- if (doc.building.length > 0)
- {
- if (movement !=0)
- {
- // cast up
- {
- let dir = new Vector3(0,1,0);
- const intersect = doc.bvh.intersect({origin: pos, direction: dir});
- if (intersect!==null)
- {
- const targetY = threshold + intersect.distance;
- if (targetY < 2.0)
- {
- avatar.translateZ(-movement);
- pos = avatar.getPosition(new Vector3());
- pos.y += threshold;
- }
- }
- }
-
- // cast left
- {
- let cast_from = avatar.localToWorld(new Vector3(0,0,0));
- let cast_to = avatar.localToWorld(new Vector3(1,0,0));
- let dir = new Vector3();
- dir.subVectors(cast_to, cast_from);
- const intersect = doc.bvh.intersect({origin: pos, direction: dir});
- if (intersect!==null)
- {
- if (intersect.distance < 0.3)
- {
- avatar.translateX(intersect.distance - 0.3);
- pos = avatar.getPosition(new Vector3());
- pos.y += threshold;
- }
- }
- }
-
- // cast right
- {
- let cast_from = avatar.localToWorld(new Vector3(0,0,0));
- let cast_to = avatar.localToWorld(new Vector3(-1,0,0));
- let dir = new Vector3();
- dir.subVectors(cast_to, cast_from);
- const intersect = doc.bvh.intersect({origin: pos, direction: dir});
- if (intersect!==null)
- {
- if (intersect.distance < 0.3)
- {
- avatar.translateX(0.3 - intersect.distance);
- pos = avatar.getPosition(new Vector3());
- pos.y += threshold;
- }
- }
- }
- }
-
-
- // cast down
- {
- let dir = new Vector3(0, -1, 0);
- pos.y += 0.2;
- const intersect = doc.bvh.intersect({origin: pos, direction: dir});
-
- const gravity = 0.3;
- if (intersect!==null)
- {
- const targetY = pos.y - intersect.distance;
- if (targetY > avatar.position.y) {
- //Going up
- avatar.translateY(0.2 * (targetY - avatar.position.y));
- avatar.velocityY = 0;
- }
- else if (targetY < avatar.position.y){
- // Falling
- if (avatar.velocityY == undefined) avatar.velocityY = 0;
- avatar.velocityY += delta * gravity;
- avatar.translateY(-avatar.velocityY);
- if (avatar.position.y < targetY) {
- avatar.velocityY = 0;
- avatar.translateY(targetY - avatar.position.y);
- }
- }
- }
- }
- }
- }
- if (avatar.move.turn != 0)
- {
- avatar.rotateY(-avatar.move.turn * delta);
- }
- }
- let look_from = cam.getWorldPosition(new Vector3());
- let look_at = avatar.getWorldPosition(new Vector3());
- look_at.y += lookat_height;
-
- let dir = new Vector3();
- dir.subVectors(look_from, look_at);
- let dis = dir.length();
- dir.normalize();
- const intersect = doc.bvh.intersect({origin: look_at, direction: dir});
- if (intersect!==null)
- {
- let max_dis = intersect.distance * 0.9 + doc.camera.near;
- if (dis > max_dis)
- {
- dir.multiplyScalar(max_dis);
- look_from.addVectors(look_at, dir);
- }
- }
- let cam_pos = doc.camera.getPosition(new Vector3());
- cam_pos.lerp(look_from, 0.1);
- doc.camera.setPosition(cam_pos);
- doc.camera.lookAt(look_at);
-
- }
- doc.set_tick(mixer, update_avatar);
-
- return avatar;
-
- },
-
- remove: (doc, avatar) =>
- {
- doc.remove_tick(avatar.mixer);
- doc.avatar = null;
- }
-}
-
-const character = {
- create: async (doc, props, mode, parent) => {
- let character = await model.create(doc, props, mode, parent);
- character.state = "idle";
- character.move = null;
- character.name_idle = props.name_idle;
- character.name_forward = props.name_forward;
- character.name_backward = props.name_backward;
-
- const anims = gltfLoader.loadAnimationsFromFile(props.url_anim);
- if (props.hasOwnProperty('fix_anims')) {
- doc.loaded_module[props.fix_anims](anims);
- }
-
- let mixer = new AnimCrossFader();
- mixer.add_clips(anims);
- mixer.set_current(character.name_idle);
- character.cur_action = character.name_idle;
- character.mixer = mixer;
-
- const update_character = (doc, mixer, delta) => {
- let frame = mixer.get_frame();
- character.setAnimationFrame(frame);
- };
- doc.set_tick(mixer, update_character);
-
- return character;
- },
-
- remove: (doc, character) =>
- {
- doc.remove_tick(character.mixer);
- },
-
- set_state: (doc, character, state) => {
- let new_action = null;
- if (state == 'idle') {
- new_action = character.name_idle;
- }
- else if (state == 'forward') {
- new_action = character.name_forward;
- }
- else if (state == 'backward') {
- new_action = character.name_backward;
- }
- character.mixer.set_current(new_action);
- character.state = state;
- }
-}
-
-const directional_light = {
- create: async (doc, props, mode, parent) => {
- const light = new DirectionalLight();
-
- if (props.hasOwnProperty('intensity')) {
- light.intensity = parseFloat(props.intensity);
- }
-
- if (props.hasOwnProperty('target')){
- let target = doc.scene.getObjectByName(props.target);
- light.target = target;
- }
-
- if (props.hasOwnProperty('castShadow') && string_to_boolean(props.castShadow))
- {
- let width = 512;
- let height = 512;
- if (props.hasOwnProperty('size')) {
- const size = props.size.split(',');
- width = parseInt(size[0]);
- height = parseInt(size[1]);
- }
- light.setShadow(true, width, height);
-
- if (props.hasOwnProperty('area')) {
- const area = props.area.split(',');
- let left = parseFloat(area[0]);
- let right = parseFloat(area[1]);
- let top = parseFloat(area[2]);
- let bottom = parseFloat(area[3]);
- let near = parseFloat(area[4]);
- let far = parseFloat(area[5]);
- light.setShadowProjection(left, right, top, bottom, near, far);
- }
-
- if (props.hasOwnProperty('radius'))
- {
- let radius = parseFloat(props.radius);
- light.setShadowRadius(radius);
- }
-
- if (props.hasOwnProperty('bias'))
- {
- light.bias = parseFloat(props.bias);
- }
-
- if (props.hasOwnProperty('force_cull'))
- {
- light.forceCull = string_to_boolean(props.force_cull);
- }
- }
-
- if (parent != null) {
- parent.add(light);
- }
- else {
- doc.scene.add(light);
- }
- return light;
- }
-}
-
-class BackgroundDocument extends BackgroundScene
-{
- constructor(near, far)
- {
- super(null, near, far);
-
- this.Tags = { scene, sky, env_light, group, plane, box, sphere, model, directional_light };
- this.reset();
- }
-
- reset()
- {
- for (let tag in this.Tags)
- {
- if (this.Tags[tag].hasOwnProperty('reset'))
- {
- this.Tags[tag].reset(this);
- }
- }
- }
-
- async create(tag, props, mode, parent = null)
- {
- if (!(tag in this.Tags)) return null;
-
- const obj = await this.Tags[tag].create(this, props, mode, parent);
- if (obj == null) return null;
-
- if (Object.isExtensible(obj))
- {
- obj.tag = tag;
- }
-
- if (props.hasOwnProperty('name'))
- {
- obj.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if (props.hasOwnProperty('texture'))
- {
- let img = imageLoader.loadFile(props.texture);
- if (img!=null)
- {
- obj.setColorTexture(img);
- }
- }
-
- if (props.hasOwnProperty('metalness'))
- {
- obj.metalness = parseFloat(props.metalness);
- }
-
- if (props.hasOwnProperty('roughness'))
- {
- obj.roughness = parseFloat(props.roughness);
- }
-
- return obj;
- }
-
- async load_xml_node(xmlNode, mode, parent = null)
- {
- if (parent == null) {
- parent = this;
- }
- for (let child of xmlNode.children) {
- const obj = await this.create(child.tagName, child.attributes, mode, parent);
- if (obj===null) continue;
- await this.load_xml_node(child, mode, obj);
- }
-
- }
-
- async load_xml(xmlText, mode)
- {
- const parsed = txml.parse(xmlText);
- let root = null;
- for (let top of parsed)
- {
- if (top.tagName == 'document')
- {
- root = top;
- break;
- }
- }
- if (root)
- {
- await this.load_xml_node(root, mode);
- }
- }
-
- async load_local_xml(filename)
- {
- const xmlText = fileLoader.loadTextFile(filename);
- if (xmlText!=null)
- {
- await this.load_xml(xmlText, "local");
- }
- }
-}
-
-
-export class Document
-{
- constructor(view)
- {
- this.view = view;
- this.width = view.clientWidth;
- this.height = view.clientHeight;
- this.Tags = { scene, camera, fog, sky, env_light, control, group, plane, box, sphere, model, avatar, character, directional_light };
- this.reset();
- }
-
- setSize(width, height)
- {
- this.width = width;
- this.height = height;
-
- if (this.camera)
- {
- this.camera.aspect = width / height;
- this.camera.updateProjectionMatrix();
- }
- }
-
- reset()
- {
- if (this.unloadables)
- {
- for (const object of this.unloadables)
- {
- object.unload(this, object);
- }
- }
-
- this.unloadables = [];
- this.updatables = [];
- this.building = [];
-
- for (let tag in this.Tags)
- {
- if (this.Tags[tag].hasOwnProperty('reset'))
- {
- this.Tags[tag].reset(this);
- }
- }
-
- this.loaded_module = null;
- }
-
- tick(delta)
- {
- if (this.controls)
- {
- if (this.controls.hasOwnProperty('update'))
- {
- this.controls.update();
- }
- }
-
- for (const object of this.updatables)
- {
- if (object.tick)
- {
- object.tick(this, object, delta);
- }
- }
- }
-
- render(renderer)
- {
- if (this.scene && this.camera)
- {
- renderer.render(this.scene, this.camera);
- }
-
- if (this.probeUpdater!=null)
- {
- this.probeUpdater.render(renderer);
- }
- }
-
- set_unload(obj, func)
- {
- obj.unload = func;
- this.unloadables.push(obj);
- }
-
- remove_unload(obj)
- {
- for (let i = 0; i < this.unloadables.length; i++)
- {
- if (this.unloadables[i] == obj)
- {
- this.unloadables.splice(i, 1);
- i--;
- }
- }
- }
-
- set_tick(obj, func)
- {
- obj.tick = func;
- this.updatables.push(obj);
- }
-
- remove_tick(obj)
- {
- for (let i = 0; i < this.updatables.length; i++)
- {
- if (this.updatables[i] == obj)
- {
- this.updatables.splice(i, 1);
- i--;
- }
- }
- }
-
- add_building_object(obj) {
- this.building.push(obj);
- }
-
- remove_building_object(obj) {
- for (let i = 0; i < this.building.length; i++) {
- if (this.building[i] == obj) {
- this.building.splice(i, 1);
- i--;
- }
- }
- }
-
- async create(tag, props, mode, parent = null)
- {
- if (!(tag in this.Tags)) return null;
-
- const obj = await this.Tags[tag].create(this, props, mode, parent);
- if (obj == null) return null;
-
- if (Object.isExtensible(obj))
- {
- obj.tag = tag;
- }
-
- if (props.hasOwnProperty('name'))
- {
- obj.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if (props.hasOwnProperty('texture'))
- {
- let img = imageLoader.loadFile(props.texture);
- if (img!=null)
- {
- obj.setColorTexture(img);
- }
- }
-
- if (props.hasOwnProperty('metalness'))
- {
- obj.metalness = parseFloat(props.metalness);
- }
-
- if (props.hasOwnProperty('roughness'))
- {
- obj.roughness = parseFloat(props.roughness);
- }
-
- if (props.hasOwnProperty('is_building') && string_to_boolean(props.is_building))
- {
- obj.isBuilding = true;
- this.add_building_object(obj);
- }
-
- if (props.hasOwnProperty('ontick'))
- {
- this.set_tick(obj, this.loaded_module[props.ontick]);
- }
-
- if (props.hasOwnProperty('onload'))
- {
- obj.load = this.loaded_module[props.onload];
- }
-
- if (props.hasOwnProperty('onunload'))
- {
- this.set_unload(obj, this.loaded_module[props.onunload]);
- }
-
- return obj;
- }
-
- remove(obj)
- {
- const doc = this;
- obj.traverse((child) => {
- this.remove_unload(child);
- this.remove_tick(child);
- this.remove_building_object(child);
- if (child.hasOwnProperty('tag')) {
- const tag = this.Tags[child.tag];
- if (tag.hasOwnProperty('remove')) {
- tag.remove(this, obj);
- }
- }
- });
- if (obj.parent)
- {
- obj.parent.remove(obj);
- }
- }
-
- async load_xml_node(xmlNode, mode, parent = null)
- {
- if (parent == null) {
- parent = this;
- }
- for (let child of xmlNode.children) {
- const obj = await this.create(child.tagName, child.attributes, mode, parent);
- if (obj===null) continue;
- await this.load_xml_node(child, mode, obj);
- if (obj.load) {
- obj.load(this, obj);
- }
- }
-
- }
-
- async load_xml(xmlText, mode)
- {
- const parsed = txml.parse(xmlText);
- let root = null;
- for (let top of parsed)
- {
- if (top.tagName == 'document')
- {
- root = top;
- break;
- }
- }
- if (root)
- {
- await this.load_xml_node(root, mode);
- }
-
- if (this.building.length>0)
- {
- this.bvh = new BoundingVolumeHierarchy(this.building);
- }
- else
- {
- this.bvh = null;
- }
- }
-
- async load_local_xml(filename)
- {
- const xmlText = fileLoader.loadTextFile(filename);
- await this.load_xml(xmlText, "local");
- }
-
- async load(module)
- {
- this.reset();
- this.loaded_module = module;
- await module.load(this);
- }
-
-}
diff --git a/GameDev/bin/Release/project_template/index.js b/GameDev/bin/Release/project_template/index.js
deleted file mode 100644
index 6b4d6aca..00000000
--- a/GameDev/bin/Release/project_template/index.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import { Document } from "./document.js";
-import { Clock } from "./utils/Clock.js";
-import { view } from "./view.js";
-
-import * as module from "./scene.js";
-
-async function init(width, height) {
- renderer = new GLRenderer();
- doc = new Document(view);
- clock = new Clock();
-
- await doc.load(module);
-}
-
-function render(width, height, size_changed) {
- if (size_changed)
- {
- doc.setSize(width, height);
- }
- let delta = clock.getDelta();
- doc.tick(delta);
- doc.render(renderer);
-}
-
-setCallback('init', init);
-setCallback('render', render);
-
diff --git a/GameDev/bin/Release/project_template/math/Box2.js b/GameDev/bin/Release/project_template/math/Box2.js
deleted file mode 100644
index 02dcaa92..00000000
--- a/GameDev/bin/Release/project_template/math/Box2.js
+++ /dev/null
@@ -1,203 +0,0 @@
-import { Vector2 } from './Vector2.js';
-
-const _vector = /*@__PURE__*/ new Vector2();
-
-class Box2 {
-
- constructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {
-
- this.min = min;
- this.max = max;
-
- }
-
- set( min, max ) {
-
- this.min.copy( min );
- this.max.copy( max );
-
- return this;
-
- }
-
- setFromPoints( points ) {
-
- this.makeEmpty();
-
- for ( let i = 0, il = points.length; i < il; i ++ ) {
-
- this.expandByPoint( points[ i ] );
-
- }
-
- return this;
-
- }
-
- setFromCenterAndSize( center, size ) {
-
- const halfSize = _vector.copy( size ).multiplyScalar( 0.5 );
- this.min.copy( center ).sub( halfSize );
- this.max.copy( center ).add( halfSize );
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- copy( box ) {
-
- this.min.copy( box.min );
- this.max.copy( box.max );
-
- return this;
-
- }
-
- makeEmpty() {
-
- this.min.x = this.min.y = + Infinity;
- this.max.x = this.max.y = - Infinity;
-
- return this;
-
- }
-
- isEmpty() {
-
- // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
-
- return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );
-
- }
-
- getCenter( target ) {
-
- return this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
-
- }
-
- getSize( target ) {
-
- return this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );
-
- }
-
- expandByPoint( point ) {
-
- this.min.min( point );
- this.max.max( point );
-
- return this;
-
- }
-
- expandByVector( vector ) {
-
- this.min.sub( vector );
- this.max.add( vector );
-
- return this;
-
- }
-
- expandByScalar( scalar ) {
-
- this.min.addScalar( - scalar );
- this.max.addScalar( scalar );
-
- return this;
-
- }
-
- containsPoint( point ) {
-
- return point.x < this.min.x || point.x > this.max.x ||
- point.y < this.min.y || point.y > this.max.y ? false : true;
-
- }
-
- containsBox( box ) {
-
- return this.min.x <= box.min.x && box.max.x <= this.max.x &&
- this.min.y <= box.min.y && box.max.y <= this.max.y;
-
- }
-
- getParameter( point, target ) {
-
- // This can potentially have a divide by zero if the box
- // has a size dimension of 0.
-
- return target.set(
- ( point.x - this.min.x ) / ( this.max.x - this.min.x ),
- ( point.y - this.min.y ) / ( this.max.y - this.min.y )
- );
-
- }
-
- intersectsBox( box ) {
-
- // using 4 splitting planes to rule out intersections
-
- return box.max.x < this.min.x || box.min.x > this.max.x ||
- box.max.y < this.min.y || box.min.y > this.max.y ? false : true;
-
- }
-
- clampPoint( point, target ) {
-
- return target.copy( point ).clamp( this.min, this.max );
-
- }
-
- distanceToPoint( point ) {
-
- const clampedPoint = _vector.copy( point ).clamp( this.min, this.max );
- return clampedPoint.sub( point ).length();
-
- }
-
- intersect( box ) {
-
- this.min.max( box.min );
- this.max.min( box.max );
-
- return this;
-
- }
-
- union( box ) {
-
- this.min.min( box.min );
- this.max.max( box.max );
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.min.add( offset );
- this.max.add( offset );
-
- return this;
-
- }
-
- equals( box ) {
-
- return box.min.equals( this.min ) && box.max.equals( this.max );
-
- }
-
-}
-
-Box2.prototype.isBox2 = true;
-
-export { Box2 };
diff --git a/GameDev/bin/Release/project_template/math/Box3.js b/GameDev/bin/Release/project_template/math/Box3.js
deleted file mode 100644
index 1a5e4ffd..00000000
--- a/GameDev/bin/Release/project_template/math/Box3.js
+++ /dev/null
@@ -1,518 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-class Box3 {
-
- constructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {
-
- this.min = min;
- this.max = max;
-
- }
-
- set( min, max ) {
-
- this.min.copy( min );
- this.max.copy( max );
-
- return this;
-
- }
-
- setFromArray( array ) {
-
- let minX = + Infinity;
- let minY = + Infinity;
- let minZ = + Infinity;
-
- let maxX = - Infinity;
- let maxY = - Infinity;
- let maxZ = - Infinity;
-
- for ( let i = 0, l = array.length; i < l; i += 3 ) {
-
- const x = array[ i ];
- const y = array[ i + 1 ];
- const z = array[ i + 2 ];
-
- if ( x < minX ) minX = x;
- if ( y < minY ) minY = y;
- if ( z < minZ ) minZ = z;
-
- if ( x > maxX ) maxX = x;
- if ( y > maxY ) maxY = y;
- if ( z > maxZ ) maxZ = z;
-
- }
-
- this.min.set( minX, minY, minZ );
- this.max.set( maxX, maxY, maxZ );
-
- return this;
-
- }
-
- setFromBufferAttribute( attribute ) {
-
- let minX = + Infinity;
- let minY = + Infinity;
- let minZ = + Infinity;
-
- let maxX = - Infinity;
- let maxY = - Infinity;
- let maxZ = - Infinity;
-
- for ( let i = 0, l = attribute.count; i < l; i ++ ) {
-
- const x = attribute.getX( i );
- const y = attribute.getY( i );
- const z = attribute.getZ( i );
-
- if ( x < minX ) minX = x;
- if ( y < minY ) minY = y;
- if ( z < minZ ) minZ = z;
-
- if ( x > maxX ) maxX = x;
- if ( y > maxY ) maxY = y;
- if ( z > maxZ ) maxZ = z;
-
- }
-
- this.min.set( minX, minY, minZ );
- this.max.set( maxX, maxY, maxZ );
-
- return this;
-
- }
-
- setFromPoints( points ) {
-
- this.makeEmpty();
-
- for ( let i = 0, il = points.length; i < il; i ++ ) {
-
- this.expandByPoint( points[ i ] );
-
- }
-
- return this;
-
- }
-
- setFromCenterAndSize( center, size ) {
-
- const halfSize = _vector.copy( size ).multiplyScalar( 0.5 );
-
- this.min.copy( center ).sub( halfSize );
- this.max.copy( center ).add( halfSize );
-
- return this;
-
- }
-
- setFromObject( object ) {
-
- this.makeEmpty();
-
- return this.expandByObject( object );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- copy( box ) {
-
- this.min.copy( box.min );
- this.max.copy( box.max );
-
- return this;
-
- }
-
- makeEmpty() {
-
- this.min.x = this.min.y = this.min.z = + Infinity;
- this.max.x = this.max.y = this.max.z = - Infinity;
-
- return this;
-
- }
-
- isEmpty() {
-
- // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
-
- return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );
-
- }
-
- getCenter( target ) {
-
- return this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
-
- }
-
- getSize( target ) {
-
- return this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );
-
- }
-
- expandByPoint( point ) {
-
- this.min.min( point );
- this.max.max( point );
-
- return this;
-
- }
-
- expandByVector( vector ) {
-
- this.min.sub( vector );
- this.max.add( vector );
-
- return this;
-
- }
-
- expandByScalar( scalar ) {
-
- this.min.addScalar( - scalar );
- this.max.addScalar( scalar );
-
- return this;
-
- }
-
- expandByObject( object ) {
-
- // Computes the world-axis-aligned bounding box of an object (including its children),
- // accounting for both the object's, and children's, world transforms
-
- object.updateWorldMatrix( false, false );
-
- const geometry = object.geometry;
-
- if ( geometry !== undefined ) {
-
- if ( geometry.boundingBox === null ) {
-
- geometry.computeBoundingBox();
-
- }
-
- _box.copy( geometry.boundingBox );
- _box.applyMatrix4( object.matrixWorld );
-
- this.union( _box );
-
- }
-
- const children = object.children;
-
- for ( let i = 0, l = children.length; i < l; i ++ ) {
-
- this.expandByObject( children[ i ] );
-
- }
-
- return this;
-
- }
-
- containsPoint( point ) {
-
- return point.x < this.min.x || point.x > this.max.x ||
- point.y < this.min.y || point.y > this.max.y ||
- point.z < this.min.z || point.z > this.max.z ? false : true;
-
- }
-
- containsBox( box ) {
-
- return this.min.x <= box.min.x && box.max.x <= this.max.x &&
- this.min.y <= box.min.y && box.max.y <= this.max.y &&
- this.min.z <= box.min.z && box.max.z <= this.max.z;
-
- }
-
- getParameter( point, target ) {
-
- // This can potentially have a divide by zero if the box
- // has a size dimension of 0.
-
- return target.set(
- ( point.x - this.min.x ) / ( this.max.x - this.min.x ),
- ( point.y - this.min.y ) / ( this.max.y - this.min.y ),
- ( point.z - this.min.z ) / ( this.max.z - this.min.z )
- );
-
- }
-
- intersectsBox( box ) {
-
- // using 6 splitting planes to rule out intersections.
- return box.max.x < this.min.x || box.min.x > this.max.x ||
- box.max.y < this.min.y || box.min.y > this.max.y ||
- box.max.z < this.min.z || box.min.z > this.max.z ? false : true;
-
- }
-
- intersectsSphere( sphere ) {
-
- // Find the point on the AABB closest to the sphere center.
- this.clampPoint( sphere.center, _vector );
-
- // If that point is inside the sphere, the AABB and sphere intersect.
- return _vector.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );
-
- }
-
- intersectsPlane( plane ) {
-
- // We compute the minimum and maximum dot product values. If those values
- // are on the same side (back or front) of the plane, then there is no intersection.
-
- let min, max;
-
- if ( plane.normal.x > 0 ) {
-
- min = plane.normal.x * this.min.x;
- max = plane.normal.x * this.max.x;
-
- } else {
-
- min = plane.normal.x * this.max.x;
- max = plane.normal.x * this.min.x;
-
- }
-
- if ( plane.normal.y > 0 ) {
-
- min += plane.normal.y * this.min.y;
- max += plane.normal.y * this.max.y;
-
- } else {
-
- min += plane.normal.y * this.max.y;
- max += plane.normal.y * this.min.y;
-
- }
-
- if ( plane.normal.z > 0 ) {
-
- min += plane.normal.z * this.min.z;
- max += plane.normal.z * this.max.z;
-
- } else {
-
- min += plane.normal.z * this.max.z;
- max += plane.normal.z * this.min.z;
-
- }
-
- return ( min <= - plane.constant && max >= - plane.constant );
-
- }
-
- intersectsTriangle( triangle ) {
-
- if ( this.isEmpty() ) {
-
- return false;
-
- }
-
- // compute box center and extents
- this.getCenter( _center );
- _extents.subVectors( this.max, _center );
-
- // translate triangle to aabb origin
- _v0.subVectors( triangle.a, _center );
- _v1.subVectors( triangle.b, _center );
- _v2.subVectors( triangle.c, _center );
-
- // compute edge vectors for triangle
- _f0.subVectors( _v1, _v0 );
- _f1.subVectors( _v2, _v1 );
- _f2.subVectors( _v0, _v2 );
-
- // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
- // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
- // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
- let axes = [
- 0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,
- _f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,
- - _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0
- ];
- if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) {
-
- return false;
-
- }
-
- // test 3 face normals from the aabb
- axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
- if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) {
-
- return false;
-
- }
-
- // finally testing the face normal of the triangle
- // use already existing triangle edge vectors here
- _triangleNormal.crossVectors( _f0, _f1 );
- axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];
-
- return satForAxes( axes, _v0, _v1, _v2, _extents );
-
- }
-
- clampPoint( point, target ) {
-
- return target.copy( point ).clamp( this.min, this.max );
-
- }
-
- distanceToPoint( point ) {
-
- const clampedPoint = _vector.copy( point ).clamp( this.min, this.max );
-
- return clampedPoint.sub( point ).length();
-
- }
-
- getBoundingSphere( target ) {
-
- this.getCenter( target.center );
-
- target.radius = this.getSize( _vector ).length() * 0.5;
-
- return target;
-
- }
-
- intersect( box ) {
-
- this.min.max( box.min );
- this.max.min( box.max );
-
- // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
- if ( this.isEmpty() ) this.makeEmpty();
-
- return this;
-
- }
-
- union( box ) {
-
- this.min.min( box.min );
- this.max.max( box.max );
-
- return this;
-
- }
-
- applyMatrix4( matrix ) {
-
- // transform of empty box is an empty box.
- if ( this.isEmpty() ) return this;
-
- // NOTE: I am using a binary pattern to specify all 2^3 combinations below
- _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
- _points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
- _points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
- _points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
- _points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
- _points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
- _points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
- _points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
-
- this.setFromPoints( _points );
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.min.add( offset );
- this.max.add( offset );
-
- return this;
-
- }
-
- equals( box ) {
-
- return box.min.equals( this.min ) && box.max.equals( this.max );
-
- }
-
-}
-
-Box3.prototype.isBox3 = true;
-
-const _points = [
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3()
-];
-
-const _vector = /*@__PURE__*/ new Vector3();
-
-const _box = /*@__PURE__*/ new Box3();
-
-// triangle centered vertices
-
-const _v0 = /*@__PURE__*/ new Vector3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _v2 = /*@__PURE__*/ new Vector3();
-
-// triangle edge vectors
-
-const _f0 = /*@__PURE__*/ new Vector3();
-const _f1 = /*@__PURE__*/ new Vector3();
-const _f2 = /*@__PURE__*/ new Vector3();
-
-const _center = /*@__PURE__*/ new Vector3();
-const _extents = /*@__PURE__*/ new Vector3();
-const _triangleNormal = /*@__PURE__*/ new Vector3();
-const _testAxis = /*@__PURE__*/ new Vector3();
-
-function satForAxes( axes, v0, v1, v2, extents ) {
-
- for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {
-
- _testAxis.fromArray( axes, i );
- // project the aabb onto the seperating axis
- const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );
- // project all 3 vertices of the triangle onto the seperating axis
- const p0 = v0.dot( _testAxis );
- const p1 = v1.dot( _testAxis );
- const p2 = v2.dot( _testAxis );
- // actual test, basically see if either of the most extreme of the triangle points intersects r
- if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
-
- // points of the projected triangle are outside the projected half-length of the aabb
- // the axis is seperating and we can exit
- return false;
-
- }
-
- }
-
- return true;
-
-}
-
-export { Box3 };
diff --git a/GameDev/bin/Release/project_template/math/Color.js b/GameDev/bin/Release/project_template/math/Color.js
deleted file mode 100644
index 295c60e1..00000000
--- a/GameDev/bin/Release/project_template/math/Color.js
+++ /dev/null
@@ -1,604 +0,0 @@
-import * as MathUtils from './MathUtils.js';
-
-const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,
- 'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,
- 'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,
- 'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,
- 'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,
- 'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,
- 'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,
- 'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,
- 'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,
- 'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,
- 'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,
- 'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,
- 'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,
- 'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,
- 'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,
- 'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,
- 'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,
- 'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,
- 'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,
- 'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,
- 'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,
- 'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,
- 'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,
- 'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };
-
-const _hslA = { h: 0, s: 0, l: 0 };
-const _hslB = { h: 0, s: 0, l: 0 };
-
-function hue2rgb( p, q, t ) {
-
- if ( t < 0 ) t += 1;
- if ( t > 1 ) t -= 1;
- if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
- if ( t < 1 / 2 ) return q;
- if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
- return p;
-
-}
-
-function SRGBToLinear( c ) {
-
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
-
-}
-
-function LinearToSRGB( c ) {
-
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
-
-}
-
-class Color {
-
- constructor( r, g, b ) {
-
- if ( g === undefined && b === undefined ) {
-
- // r is THREE.Color, hex or string
- return this.set( r );
-
- }
-
- return this.setRGB( r, g, b );
-
- }
-
- set( value ) {
-
- if ( value && value.isColor ) {
-
- this.copy( value );
-
- } else if ( typeof value === 'number' ) {
-
- this.setHex( value );
-
- } else if ( typeof value === 'string' ) {
-
- this.setStyle( value );
-
- }
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.r = scalar;
- this.g = scalar;
- this.b = scalar;
-
- return this;
-
- }
-
- setHex( hex ) {
-
- hex = Math.floor( hex );
-
- this.r = ( hex >> 16 & 255 ) / 255;
- this.g = ( hex >> 8 & 255 ) / 255;
- this.b = ( hex & 255 ) / 255;
-
- return this;
-
- }
-
- setRGB( r, g, b ) {
-
- this.r = r;
- this.g = g;
- this.b = b;
-
- return this;
-
- }
-
- setHSL( h, s, l ) {
-
- // h,s,l ranges are in 0.0 - 1.0
- h = MathUtils.euclideanModulo( h, 1 );
- s = MathUtils.clamp( s, 0, 1 );
- l = MathUtils.clamp( l, 0, 1 );
-
- if ( s === 0 ) {
-
- this.r = this.g = this.b = l;
-
- } else {
-
- const p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
- const q = ( 2 * l ) - p;
-
- this.r = hue2rgb( q, p, h + 1 / 3 );
- this.g = hue2rgb( q, p, h );
- this.b = hue2rgb( q, p, h - 1 / 3 );
-
- }
-
- return this;
-
- }
-
- setStyle( style ) {
-
- function handleAlpha( string ) {
-
- if ( string === undefined ) return;
-
- if ( parseFloat( string ) < 1 ) {
-
- console.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );
-
- }
-
- }
-
-
- let m;
-
- if ( m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec( style ) ) {
-
- // rgb / hsl
-
- let color;
- const name = m[ 1 ];
- const components = m[ 2 ];
-
- switch ( name ) {
-
- case 'rgb':
- case 'rgba':
-
- if ( color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
-
- // rgb(255,0,0) rgba(255,0,0,0.5)
- this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;
- this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;
- this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;
-
- handleAlpha( color[ 4 ] );
-
- return this;
-
- }
-
- if ( color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
-
- // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
- this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;
- this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;
- this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;
-
- handleAlpha( color[ 4 ] );
-
- return this;
-
- }
-
- break;
-
- case 'hsl':
- case 'hsla':
-
- if ( color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
-
- // hsl(120,50%,50%) hsla(120,50%,50%,0.5)
- const h = parseFloat( color[ 1 ] ) / 360;
- const s = parseInt( color[ 2 ], 10 ) / 100;
- const l = parseInt( color[ 3 ], 10 ) / 100;
-
- handleAlpha( color[ 4 ] );
-
- return this.setHSL( h, s, l );
-
- }
-
- break;
-
- }
-
- } else if ( m = /^\#([A-Fa-f\d]+)$/.exec( style ) ) {
-
- // hex color
-
- const hex = m[ 1 ];
- const size = hex.length;
-
- if ( size === 3 ) {
-
- // #ff0
- this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255;
- this.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255;
- this.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255;
-
- return this;
-
- } else if ( size === 6 ) {
-
- // #ff0000
- this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255;
- this.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255;
- this.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255;
-
- return this;
-
- }
-
- }
-
- if ( style && style.length > 0 ) {
-
- return this.setColorName( style );
-
- }
-
- return this;
-
- }
-
- setColorName( style ) {
-
- // color keywords
- const hex = _colorKeywords[ style.toLowerCase() ];
-
- if ( hex !== undefined ) {
-
- // red
- this.setHex( hex );
-
- } else {
-
- // unknown color
- console.warn( 'THREE.Color: Unknown color ' + style );
-
- }
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this.r, this.g, this.b );
-
- }
-
- copy( color ) {
-
- this.r = color.r;
- this.g = color.g;
- this.b = color.b;
-
- return this;
-
- }
-
- copyGammaToLinear( color, gammaFactor = 2.0 ) {
-
- this.r = Math.pow( color.r, gammaFactor );
- this.g = Math.pow( color.g, gammaFactor );
- this.b = Math.pow( color.b, gammaFactor );
-
- return this;
-
- }
-
- copyLinearToGamma( color, gammaFactor = 2.0 ) {
-
- const safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;
-
- this.r = Math.pow( color.r, safeInverse );
- this.g = Math.pow( color.g, safeInverse );
- this.b = Math.pow( color.b, safeInverse );
-
- return this;
-
- }
-
- convertGammaToLinear( gammaFactor ) {
-
- this.copyGammaToLinear( this, gammaFactor );
-
- return this;
-
- }
-
- convertLinearToGamma( gammaFactor ) {
-
- this.copyLinearToGamma( this, gammaFactor );
-
- return this;
-
- }
-
- copySRGBToLinear( color ) {
-
- this.r = SRGBToLinear( color.r );
- this.g = SRGBToLinear( color.g );
- this.b = SRGBToLinear( color.b );
-
- return this;
-
- }
-
- copyLinearToSRGB( color ) {
-
- this.r = LinearToSRGB( color.r );
- this.g = LinearToSRGB( color.g );
- this.b = LinearToSRGB( color.b );
-
- return this;
-
- }
-
- convertSRGBToLinear() {
-
- this.copySRGBToLinear( this );
-
- return this;
-
- }
-
- convertLinearToSRGB() {
-
- this.copyLinearToSRGB( this );
-
- return this;
-
- }
-
- getHex() {
-
- return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;
-
- }
-
- getHexString() {
-
- return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 );
-
- }
-
- getHSL( target ) {
-
- // h,s,l ranges are in 0.0 - 1.0
-
- const r = this.r, g = this.g, b = this.b;
-
- const max = Math.max( r, g, b );
- const min = Math.min( r, g, b );
-
- let hue, saturation;
- const lightness = ( min + max ) / 2.0;
-
- if ( min === max ) {
-
- hue = 0;
- saturation = 0;
-
- } else {
-
- const delta = max - min;
-
- saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );
-
- switch ( max ) {
-
- case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;
- case g: hue = ( b - r ) / delta + 2; break;
- case b: hue = ( r - g ) / delta + 4; break;
-
- }
-
- hue /= 6;
-
- }
-
- target.h = hue;
- target.s = saturation;
- target.l = lightness;
-
- return target;
-
- }
-
- getStyle() {
-
- return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';
-
- }
-
- offsetHSL( h, s, l ) {
-
- this.getHSL( _hslA );
-
- _hslA.h += h; _hslA.s += s; _hslA.l += l;
-
- this.setHSL( _hslA.h, _hslA.s, _hslA.l );
-
- return this;
-
- }
-
- add( color ) {
-
- this.r += color.r;
- this.g += color.g;
- this.b += color.b;
-
- return this;
-
- }
-
- addColors( color1, color2 ) {
-
- this.r = color1.r + color2.r;
- this.g = color1.g + color2.g;
- this.b = color1.b + color2.b;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.r += s;
- this.g += s;
- this.b += s;
-
- return this;
-
- }
-
- sub( color ) {
-
- this.r = Math.max( 0, this.r - color.r );
- this.g = Math.max( 0, this.g - color.g );
- this.b = Math.max( 0, this.b - color.b );
-
- return this;
-
- }
-
- multiply( color ) {
-
- this.r *= color.r;
- this.g *= color.g;
- this.b *= color.b;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- this.r *= s;
- this.g *= s;
- this.b *= s;
-
- return this;
-
- }
-
- lerp( color, alpha ) {
-
- this.r += ( color.r - this.r ) * alpha;
- this.g += ( color.g - this.g ) * alpha;
- this.b += ( color.b - this.b ) * alpha;
-
- return this;
-
- }
-
- lerpColors( color1, color2, alpha ) {
-
- this.r = color1.r + ( color2.r - color1.r ) * alpha;
- this.g = color1.g + ( color2.g - color1.g ) * alpha;
- this.b = color1.b + ( color2.b - color1.b ) * alpha;
-
- return this;
-
- }
-
- lerpHSL( color, alpha ) {
-
- this.getHSL( _hslA );
- color.getHSL( _hslB );
-
- const h = MathUtils.lerp( _hslA.h, _hslB.h, alpha );
- const s = MathUtils.lerp( _hslA.s, _hslB.s, alpha );
- const l = MathUtils.lerp( _hslA.l, _hslB.l, alpha );
-
- this.setHSL( h, s, l );
-
- return this;
-
- }
-
- equals( c ) {
-
- return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.r = array[ offset ];
- this.g = array[ offset + 1 ];
- this.b = array[ offset + 2 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.r;
- array[ offset + 1 ] = this.g;
- array[ offset + 2 ] = this.b;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index ) {
-
- this.r = attribute.getX( index );
- this.g = attribute.getY( index );
- this.b = attribute.getZ( index );
-
- if ( attribute.normalized === true ) {
-
- // assuming Uint8Array
-
- this.r /= 255;
- this.g /= 255;
- this.b /= 255;
-
- }
-
- return this;
-
- }
-
- toJSON() {
-
- return this.getHex();
-
- }
-
-}
-
-Color.NAMES = _colorKeywords;
-
-Color.prototype.isColor = true;
-Color.prototype.r = 1;
-Color.prototype.g = 1;
-Color.prototype.b = 1;
-
-export { Color };
diff --git a/GameDev/bin/Release/project_template/math/Cylindrical.js b/GameDev/bin/Release/project_template/math/Cylindrical.js
deleted file mode 100644
index d1288244..00000000
--- a/GameDev/bin/Release/project_template/math/Cylindrical.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
- */
-
-class Cylindrical {
-
- constructor( radius = 1, theta = 0, y = 0 ) {
-
- this.radius = radius; // distance from the origin to a point in the x-z plane
- this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
- this.y = y; // height above the x-z plane
-
- return this;
-
- }
-
- set( radius, theta, y ) {
-
- this.radius = radius;
- this.theta = theta;
- this.y = y;
-
- return this;
-
- }
-
- copy( other ) {
-
- this.radius = other.radius;
- this.theta = other.theta;
- this.y = other.y;
-
- return this;
-
- }
-
- setFromVector3( v ) {
-
- return this.setFromCartesianCoords( v.x, v.y, v.z );
-
- }
-
- setFromCartesianCoords( x, y, z ) {
-
- this.radius = Math.sqrt( x * x + z * z );
- this.theta = Math.atan2( x, z );
- this.y = y;
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Cylindrical };
diff --git a/GameDev/bin/Release/project_template/math/Euler.js b/GameDev/bin/Release/project_template/math/Euler.js
deleted file mode 100644
index 74c93a8a..00000000
--- a/GameDev/bin/Release/project_template/math/Euler.js
+++ /dev/null
@@ -1,322 +0,0 @@
-import { Quaternion } from './Quaternion.js';
-import { Vector3 } from './Vector3.js';
-import { Matrix4 } from './Matrix4.js';
-import { clamp } from './MathUtils.js';
-
-const _matrix = /*@__PURE__*/ new Matrix4();
-const _quaternion = /*@__PURE__*/ new Quaternion();
-
-class Euler {
-
- constructor( x = 0, y = 0, z = 0, order = Euler.DefaultOrder ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._order = order;
-
- }
-
- get x() {
-
- return this._x;
-
- }
-
- set x( value ) {
-
- this._x = value;
- this._onChangeCallback();
-
- }
-
- get y() {
-
- return this._y;
-
- }
-
- set y( value ) {
-
- this._y = value;
- this._onChangeCallback();
-
- }
-
- get z() {
-
- return this._z;
-
- }
-
- set z( value ) {
-
- this._z = value;
- this._onChangeCallback();
-
- }
-
- get order() {
-
- return this._order;
-
- }
-
- set order( value ) {
-
- this._order = value;
- this._onChangeCallback();
-
- }
-
- set( x, y, z, order = this._order ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._order = order;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this._x, this._y, this._z, this._order );
-
- }
-
- copy( euler ) {
-
- this._x = euler._x;
- this._y = euler._y;
- this._z = euler._z;
- this._order = euler._order;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromRotationMatrix( m, order = this._order, update = true ) {
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- const te = m.elements;
- const m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];
- const m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];
- const m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
-
- switch ( order ) {
-
- case 'XYZ':
-
- this._y = Math.asin( clamp( m13, - 1, 1 ) );
-
- if ( Math.abs( m13 ) < 0.9999999 ) {
-
- this._x = Math.atan2( - m23, m33 );
- this._z = Math.atan2( - m12, m11 );
-
- } else {
-
- this._x = Math.atan2( m32, m22 );
- this._z = 0;
-
- }
-
- break;
-
- case 'YXZ':
-
- this._x = Math.asin( - clamp( m23, - 1, 1 ) );
-
- if ( Math.abs( m23 ) < 0.9999999 ) {
-
- this._y = Math.atan2( m13, m33 );
- this._z = Math.atan2( m21, m22 );
-
- } else {
-
- this._y = Math.atan2( - m31, m11 );
- this._z = 0;
-
- }
-
- break;
-
- case 'ZXY':
-
- this._x = Math.asin( clamp( m32, - 1, 1 ) );
-
- if ( Math.abs( m32 ) < 0.9999999 ) {
-
- this._y = Math.atan2( - m31, m33 );
- this._z = Math.atan2( - m12, m22 );
-
- } else {
-
- this._y = 0;
- this._z = Math.atan2( m21, m11 );
-
- }
-
- break;
-
- case 'ZYX':
-
- this._y = Math.asin( - clamp( m31, - 1, 1 ) );
-
- if ( Math.abs( m31 ) < 0.9999999 ) {
-
- this._x = Math.atan2( m32, m33 );
- this._z = Math.atan2( m21, m11 );
-
- } else {
-
- this._x = 0;
- this._z = Math.atan2( - m12, m22 );
-
- }
-
- break;
-
- case 'YZX':
-
- this._z = Math.asin( clamp( m21, - 1, 1 ) );
-
- if ( Math.abs( m21 ) < 0.9999999 ) {
-
- this._x = Math.atan2( - m23, m22 );
- this._y = Math.atan2( - m31, m11 );
-
- } else {
-
- this._x = 0;
- this._y = Math.atan2( m13, m33 );
-
- }
-
- break;
-
- case 'XZY':
-
- this._z = Math.asin( - clamp( m12, - 1, 1 ) );
-
- if ( Math.abs( m12 ) < 0.9999999 ) {
-
- this._x = Math.atan2( m32, m22 );
- this._y = Math.atan2( m13, m11 );
-
- } else {
-
- this._x = Math.atan2( - m23, m33 );
- this._y = 0;
-
- }
-
- break;
-
- default:
-
- console.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );
-
- }
-
- this._order = order;
-
- if ( update === true ) this._onChangeCallback();
-
- return this;
-
- }
-
- setFromQuaternion( q, order, update ) {
-
- _matrix.makeRotationFromQuaternion( q );
-
- return this.setFromRotationMatrix( _matrix, order, update );
-
- }
-
- setFromVector3( v, order = this._order ) {
-
- return this.set( v.x, v.y, v.z, order );
-
- }
-
- reorder( newOrder ) {
-
- // WARNING: this discards revolution information -bhouston
-
- _quaternion.setFromEuler( this );
-
- return this.setFromQuaternion( _quaternion, newOrder );
-
- }
-
- equals( euler ) {
-
- return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );
-
- }
-
- fromArray( array ) {
-
- this._x = array[ 0 ];
- this._y = array[ 1 ];
- this._z = array[ 2 ];
- if ( array[ 3 ] !== undefined ) this._order = array[ 3 ];
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this._x;
- array[ offset + 1 ] = this._y;
- array[ offset + 2 ] = this._z;
- array[ offset + 3 ] = this._order;
-
- return array;
-
- }
-
- toVector3( optionalResult ) {
-
- if ( optionalResult ) {
-
- return optionalResult.set( this._x, this._y, this._z );
-
- } else {
-
- return new Vector3( this._x, this._y, this._z );
-
- }
-
- }
-
- _onChange( callback ) {
-
- this._onChangeCallback = callback;
-
- return this;
-
- }
-
- _onChangeCallback() {}
-
-}
-
-Euler.prototype.isEuler = true;
-
-Euler.DefaultOrder = 'XYZ';
-Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];
-
-export { Euler };
diff --git a/GameDev/bin/Release/project_template/math/Frustum.js b/GameDev/bin/Release/project_template/math/Frustum.js
deleted file mode 100644
index fc6b928a..00000000
--- a/GameDev/bin/Release/project_template/math/Frustum.js
+++ /dev/null
@@ -1,162 +0,0 @@
-import { Vector3 } from './Vector3.js';
-import { Sphere } from './Sphere.js';
-import { Plane } from './Plane.js';
-
-const _sphere = /*@__PURE__*/ new Sphere();
-const _vector = /*@__PURE__*/ new Vector3();
-
-class Frustum {
-
- constructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {
-
- this.planes = [ p0, p1, p2, p3, p4, p5 ];
-
- }
-
- set( p0, p1, p2, p3, p4, p5 ) {
-
- const planes = this.planes;
-
- planes[ 0 ].copy( p0 );
- planes[ 1 ].copy( p1 );
- planes[ 2 ].copy( p2 );
- planes[ 3 ].copy( p3 );
- planes[ 4 ].copy( p4 );
- planes[ 5 ].copy( p5 );
-
- return this;
-
- }
-
- copy( frustum ) {
-
- const planes = this.planes;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- planes[ i ].copy( frustum.planes[ i ] );
-
- }
-
- return this;
-
- }
-
- setFromProjectionMatrix( m ) {
-
- const planes = this.planes;
- const me = m.elements;
- const me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];
- const me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];
- const me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];
- const me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];
-
- planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();
- planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();
- planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();
- planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();
- planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();
- planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
-
- return this;
-
- }
-
- intersectsObject( object ) {
-
- const geometry = object.geometry;
-
- if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
-
- _sphere.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
-
- return this.intersectsSphere( _sphere );
-
- }
-
- intersectsSprite( sprite ) {
-
- _sphere.center.set( 0, 0, 0 );
- _sphere.radius = 0.7071067811865476;
- _sphere.applyMatrix4( sprite.matrixWorld );
-
- return this.intersectsSphere( _sphere );
-
- }
-
- intersectsSphere( sphere ) {
-
- const planes = this.planes;
- const center = sphere.center;
- const negRadius = - sphere.radius;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- const distance = planes[ i ].distanceToPoint( center );
-
- if ( distance < negRadius ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- intersectsBox( box ) {
-
- const planes = this.planes;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- const plane = planes[ i ];
-
- // corner at max distance
-
- _vector.x = plane.normal.x > 0 ? box.max.x : box.min.x;
- _vector.y = plane.normal.y > 0 ? box.max.y : box.min.y;
- _vector.z = plane.normal.z > 0 ? box.max.z : box.min.z;
-
- if ( plane.distanceToPoint( _vector ) < 0 ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- containsPoint( point ) {
-
- const planes = this.planes;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- if ( planes[ i ].distanceToPoint( point ) < 0 ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-
-export { Frustum };
diff --git a/GameDev/bin/Release/project_template/math/Interpolant.js b/GameDev/bin/Release/project_template/math/Interpolant.js
deleted file mode 100644
index dcc550f5..00000000
--- a/GameDev/bin/Release/project_template/math/Interpolant.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Abstract base class of interpolants over parametric samples.
- *
- * The parameter domain is one dimensional, typically the time or a path
- * along a curve defined by the data.
- *
- * The sample values can have any dimensionality and derived classes may
- * apply special interpretations to the data.
- *
- * This class provides the interval seek in a Template Method, deferring
- * the actual interpolation to derived classes.
- *
- * Time complexity is O(1) for linear access crossing at most two points
- * and O(log N) for random access, where N is the number of positions.
- *
- * References:
- *
- * http://www.oodesign.com/template-method-pattern.html
- *
- */
-
-class Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- this.parameterPositions = parameterPositions;
- this._cachedIndex = 0;
-
- this.resultBuffer = resultBuffer !== undefined ?
- resultBuffer : new sampleValues.constructor( sampleSize );
- this.sampleValues = sampleValues;
- this.valueSize = sampleSize;
-
- this.settings = null;
- this.DefaultSettings_ = {};
-
- }
-
- evaluate( t ) {
-
- const pp = this.parameterPositions;
- let i1 = this._cachedIndex,
- t1 = pp[ i1 ],
- t0 = pp[ i1 - 1 ];
-
- validate_interval: {
-
- seek: {
-
- let right;
-
- linear_scan: {
-
- //- See http://jsperf.com/comparison-to-undefined/3
- //- slower code:
- //-
- //- if ( t >= t1 || t1 === undefined ) {
- forward_scan: if ( ! ( t < t1 ) ) {
-
- for ( let giveUpAt = i1 + 2; ; ) {
-
- if ( t1 === undefined ) {
-
- if ( t < t0 ) break forward_scan;
-
- // after end
-
- i1 = pp.length;
- this._cachedIndex = i1;
- return this.afterEnd_( i1 - 1, t, t0 );
-
- }
-
- if ( i1 === giveUpAt ) break; // this loop
-
- t0 = t1;
- t1 = pp[ ++ i1 ];
-
- if ( t < t1 ) {
-
- // we have arrived at the sought interval
- break seek;
-
- }
-
- }
-
- // prepare binary search on the right side of the index
- right = pp.length;
- break linear_scan;
-
- }
-
- //- slower code:
- //- if ( t < t0 || t0 === undefined ) {
- if ( ! ( t >= t0 ) ) {
-
- // looping?
-
- const t1global = pp[ 1 ];
-
- if ( t < t1global ) {
-
- i1 = 2; // + 1, using the scan for the details
- t0 = t1global;
-
- }
-
- // linear reverse scan
-
- for ( let giveUpAt = i1 - 2; ; ) {
-
- if ( t0 === undefined ) {
-
- // before start
-
- this._cachedIndex = 0;
- return this.beforeStart_( 0, t, t1 );
-
- }
-
- if ( i1 === giveUpAt ) break; // this loop
-
- t1 = t0;
- t0 = pp[ -- i1 - 1 ];
-
- if ( t >= t0 ) {
-
- // we have arrived at the sought interval
- break seek;
-
- }
-
- }
-
- // prepare binary search on the left side of the index
- right = i1;
- i1 = 0;
- break linear_scan;
-
- }
-
- // the interval is valid
-
- break validate_interval;
-
- } // linear scan
-
- // binary search
-
- while ( i1 < right ) {
-
- const mid = ( i1 + right ) >>> 1;
-
- if ( t < pp[ mid ] ) {
-
- right = mid;
-
- } else {
-
- i1 = mid + 1;
-
- }
-
- }
-
- t1 = pp[ i1 ];
- t0 = pp[ i1 - 1 ];
-
- // check boundary cases, again
-
- if ( t0 === undefined ) {
-
- this._cachedIndex = 0;
- return this.beforeStart_( 0, t, t1 );
-
- }
-
- if ( t1 === undefined ) {
-
- i1 = pp.length;
- this._cachedIndex = i1;
- return this.afterEnd_( i1 - 1, t0, t );
-
- }
-
- } // seek
-
- this._cachedIndex = i1;
-
- this.intervalChanged_( i1, t0, t1 );
-
- } // validate_interval
-
- return this.interpolate_( i1, t0, t, t1 );
-
- }
-
- getSettings_() {
-
- return this.settings || this.DefaultSettings_;
-
- }
-
- copySampleValue_( index ) {
-
- // copies a sample value to the result buffer
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
- offset = index * stride;
-
- for ( let i = 0; i !== stride; ++ i ) {
-
- result[ i ] = values[ offset + i ];
-
- }
-
- return result;
-
- }
-
- // Template methods for derived classes:
-
- interpolate_( /* i1, t0, t, t1 */ ) {
-
- throw new Error( 'call to abstract method' );
- // implementations shall return this.resultBuffer
-
- }
-
- intervalChanged_( /* i1, t0, t1 */ ) {
-
- // empty
-
- }
-
-}
-
-// ALIAS DEFINITIONS
-
-Interpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_;
-Interpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_;
-
-export { Interpolant };
diff --git a/GameDev/bin/Release/project_template/math/Line3.js b/GameDev/bin/Release/project_template/math/Line3.js
deleted file mode 100644
index bd41206e..00000000
--- a/GameDev/bin/Release/project_template/math/Line3.js
+++ /dev/null
@@ -1,115 +0,0 @@
-import { Vector3 } from './Vector3.js';
-import * as MathUtils from './MathUtils.js';
-
-const _startP = /*@__PURE__*/ new Vector3();
-const _startEnd = /*@__PURE__*/ new Vector3();
-
-class Line3 {
-
- constructor( start = new Vector3(), end = new Vector3() ) {
-
- this.start = start;
- this.end = end;
-
- }
-
- set( start, end ) {
-
- this.start.copy( start );
- this.end.copy( end );
-
- return this;
-
- }
-
- copy( line ) {
-
- this.start.copy( line.start );
- this.end.copy( line.end );
-
- return this;
-
- }
-
- getCenter( target ) {
-
- return target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );
-
- }
-
- delta( target ) {
-
- return target.subVectors( this.end, this.start );
-
- }
-
- distanceSq() {
-
- return this.start.distanceToSquared( this.end );
-
- }
-
- distance() {
-
- return this.start.distanceTo( this.end );
-
- }
-
- at( t, target ) {
-
- return this.delta( target ).multiplyScalar( t ).add( this.start );
-
- }
-
- closestPointToPointParameter( point, clampToLine ) {
-
- _startP.subVectors( point, this.start );
- _startEnd.subVectors( this.end, this.start );
-
- const startEnd2 = _startEnd.dot( _startEnd );
- const startEnd_startP = _startEnd.dot( _startP );
-
- let t = startEnd_startP / startEnd2;
-
- if ( clampToLine ) {
-
- t = MathUtils.clamp( t, 0, 1 );
-
- }
-
- return t;
-
- }
-
- closestPointToPoint( point, clampToLine, target ) {
-
- const t = this.closestPointToPointParameter( point, clampToLine );
-
- return this.delta( target ).multiplyScalar( t ).add( this.start );
-
- }
-
- applyMatrix4( matrix ) {
-
- this.start.applyMatrix4( matrix );
- this.end.applyMatrix4( matrix );
-
- return this;
-
- }
-
- equals( line ) {
-
- return line.start.equals( this.start ) && line.end.equals( this.end );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Line3 };
diff --git a/GameDev/bin/Release/project_template/math/MathUtils.js b/GameDev/bin/Release/project_template/math/MathUtils.js
deleted file mode 100644
index 3de8f5ff..00000000
--- a/GameDev/bin/Release/project_template/math/MathUtils.js
+++ /dev/null
@@ -1,258 +0,0 @@
-const _lut = [];
-
-for ( let i = 0; i < 256; i ++ ) {
-
- _lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 );
-
-}
-
-let _seed = 1234567;
-
-
-const DEG2RAD = Math.PI / 180;
-const RAD2DEG = 180 / Math.PI;
-
-// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
-function generateUUID() {
-
- const d0 = Math.random() * 0xffffffff | 0;
- const d1 = Math.random() * 0xffffffff | 0;
- const d2 = Math.random() * 0xffffffff | 0;
- const d3 = Math.random() * 0xffffffff | 0;
- const uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +
- _lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +
- _lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +
- _lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];
-
- // .toUpperCase() here flattens concatenated strings to save heap memory space.
- return uuid.toUpperCase();
-
-}
-
-function clamp( value, min, max ) {
-
- return Math.max( min, Math.min( max, value ) );
-
-}
-
-// compute euclidian modulo of m % n
-// https://en.wikipedia.org/wiki/Modulo_operation
-function euclideanModulo( n, m ) {
-
- return ( ( n % m ) + m ) % m;
-
-}
-
-// Linear mapping from range to range
-function mapLinear( x, a1, a2, b1, b2 ) {
-
- return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );
-
-}
-
-// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
-function inverseLerp( x, y, value ) {
-
- if ( x !== y ) {
-
- return ( value - x ) / ( y - x );
-
- } else {
-
- return 0;
-
- }
-
-}
-
-// https://en.wikipedia.org/wiki/Linear_interpolation
-function lerp( x, y, t ) {
-
- return ( 1 - t ) * x + t * y;
-
-}
-
-// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
-function damp( x, y, lambda, dt ) {
-
- return lerp( x, y, 1 - Math.exp( - lambda * dt ) );
-
-}
-
-// https://www.desmos.com/calculator/vcsjnyz7x4
-function pingpong( x, length = 1 ) {
-
- return length - Math.abs( euclideanModulo( x, length * 2 ) - length );
-
-}
-
-// http://en.wikipedia.org/wiki/Smoothstep
-function smoothstep( x, min, max ) {
-
- if ( x <= min ) return 0;
- if ( x >= max ) return 1;
-
- x = ( x - min ) / ( max - min );
-
- return x * x * ( 3 - 2 * x );
-
-}
-
-function smootherstep( x, min, max ) {
-
- if ( x <= min ) return 0;
- if ( x >= max ) return 1;
-
- x = ( x - min ) / ( max - min );
-
- return x * x * x * ( x * ( x * 6 - 15 ) + 10 );
-
-}
-
-// Random integer from interval
-function randInt( low, high ) {
-
- return low + Math.floor( Math.random() * ( high - low + 1 ) );
-
-}
-
-// Random float from interval
-function randFloat( low, high ) {
-
- return low + Math.random() * ( high - low );
-
-}
-
-// Random float from <-range/2, range/2> interval
-function randFloatSpread( range ) {
-
- return range * ( 0.5 - Math.random() );
-
-}
-
-// Deterministic pseudo-random float in the interval [ 0, 1 ]
-function seededRandom( s ) {
-
- if ( s !== undefined ) _seed = s % 2147483647;
-
- // Park-Miller algorithm
-
- _seed = _seed * 16807 % 2147483647;
-
- return ( _seed - 1 ) / 2147483646;
-
-}
-
-function degToRad( degrees ) {
-
- return degrees * DEG2RAD;
-
-}
-
-function radToDeg( radians ) {
-
- return radians * RAD2DEG;
-
-}
-
-function isPowerOfTwo( value ) {
-
- return ( value & ( value - 1 ) ) === 0 && value !== 0;
-
-}
-
-function ceilPowerOfTwo( value ) {
-
- return Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );
-
-}
-
-function floorPowerOfTwo( value ) {
-
- return Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );
-
-}
-
-function setQuaternionFromProperEuler( q, a, b, c, order ) {
-
- // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
-
- // rotations are applied to the axes in the order specified by 'order'
- // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
- // angles are in radians
-
- const cos = Math.cos;
- const sin = Math.sin;
-
- const c2 = cos( b / 2 );
- const s2 = sin( b / 2 );
-
- const c13 = cos( ( a + c ) / 2 );
- const s13 = sin( ( a + c ) / 2 );
-
- const c1_3 = cos( ( a - c ) / 2 );
- const s1_3 = sin( ( a - c ) / 2 );
-
- const c3_1 = cos( ( c - a ) / 2 );
- const s3_1 = sin( ( c - a ) / 2 );
-
- switch ( order ) {
-
- case 'XYX':
- q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
- break;
-
- case 'YZY':
- q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
- break;
-
- case 'ZXZ':
- q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
- break;
-
- case 'XZX':
- q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
- break;
-
- case 'YXY':
- q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
- break;
-
- case 'ZYZ':
- q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
- break;
-
- default:
- console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );
-
- }
-
-}
-
-
-
-
-export {
- DEG2RAD,
- RAD2DEG,
- generateUUID,
- clamp,
- euclideanModulo,
- mapLinear,
- inverseLerp,
- lerp,
- damp,
- pingpong,
- smoothstep,
- smootherstep,
- randInt,
- randFloat,
- randFloatSpread,
- seededRandom,
- degToRad,
- radToDeg,
- isPowerOfTwo,
- ceilPowerOfTwo,
- floorPowerOfTwo,
- setQuaternionFromProperEuler,
-};
diff --git a/GameDev/bin/Release/project_template/math/Matrix3.js b/GameDev/bin/Release/project_template/math/Matrix3.js
deleted file mode 100644
index 9005740e..00000000
--- a/GameDev/bin/Release/project_template/math/Matrix3.js
+++ /dev/null
@@ -1,339 +0,0 @@
-class Matrix3 {
-
- constructor() {
-
- this.elements = [
-
- 1, 0, 0,
- 0, 1, 0,
- 0, 0, 1
-
- ];
-
- if ( arguments.length > 0 ) {
-
- console.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );
-
- }
-
- }
-
- set( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
-
- const te = this.elements;
-
- te[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;
- te[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;
- te[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;
-
- return this;
-
- }
-
- identity() {
-
- this.set(
-
- 1, 0, 0,
- 0, 1, 0,
- 0, 0, 1
-
- );
-
- return this;
-
- }
-
- copy( m ) {
-
- const te = this.elements;
- const me = m.elements;
-
- te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];
- te[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];
- te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];
-
- return this;
-
- }
-
- extractBasis( xAxis, yAxis, zAxis ) {
-
- xAxis.setFromMatrix3Column( this, 0 );
- yAxis.setFromMatrix3Column( this, 1 );
- zAxis.setFromMatrix3Column( this, 2 );
-
- return this;
-
- }
-
- setFromMatrix4( m ) {
-
- const me = m.elements;
-
- this.set(
-
- me[ 0 ], me[ 4 ], me[ 8 ],
- me[ 1 ], me[ 5 ], me[ 9 ],
- me[ 2 ], me[ 6 ], me[ 10 ]
-
- );
-
- return this;
-
- }
-
- multiply( m ) {
-
- return this.multiplyMatrices( this, m );
-
- }
-
- premultiply( m ) {
-
- return this.multiplyMatrices( m, this );
-
- }
-
- multiplyMatrices( a, b ) {
-
- const ae = a.elements;
- const be = b.elements;
- const te = this.elements;
-
- const a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];
- const a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];
- const a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];
-
- const b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];
- const b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];
- const b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];
-
- te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;
- te[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;
- te[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;
-
- te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;
- te[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;
- te[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;
-
- te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;
- te[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;
- te[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- const te = this.elements;
-
- te[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;
- te[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;
- te[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;
-
- return this;
-
- }
-
- determinant() {
-
- const te = this.elements;
-
- const a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],
- d = te[ 3 ], e = te[ 4 ], f = te[ 5 ],
- g = te[ 6 ], h = te[ 7 ], i = te[ 8 ];
-
- return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;
-
- }
-
- invert() {
-
- const te = this.elements,
-
- n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],
- n12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],
- n13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],
-
- t11 = n33 * n22 - n32 * n23,
- t12 = n32 * n13 - n33 * n12,
- t13 = n23 * n12 - n22 * n13,
-
- det = n11 * t11 + n21 * t12 + n31 * t13;
-
- if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
-
- const detInv = 1 / det;
-
- te[ 0 ] = t11 * detInv;
- te[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;
- te[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;
-
- te[ 3 ] = t12 * detInv;
- te[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;
- te[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;
-
- te[ 6 ] = t13 * detInv;
- te[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;
- te[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;
-
- return this;
-
- }
-
- transpose() {
-
- let tmp;
- const m = this.elements;
-
- tmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;
- tmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;
- tmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;
-
- return this;
-
- }
-
- getNormalMatrix( matrix4 ) {
-
- return this.setFromMatrix4( matrix4 ).invert().transpose();
-
- }
-
- transposeIntoArray( r ) {
-
- const m = this.elements;
-
- r[ 0 ] = m[ 0 ];
- r[ 1 ] = m[ 3 ];
- r[ 2 ] = m[ 6 ];
- r[ 3 ] = m[ 1 ];
- r[ 4 ] = m[ 4 ];
- r[ 5 ] = m[ 7 ];
- r[ 6 ] = m[ 2 ];
- r[ 7 ] = m[ 5 ];
- r[ 8 ] = m[ 8 ];
-
- return this;
-
- }
-
- setUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {
-
- const c = Math.cos( rotation );
- const s = Math.sin( rotation );
-
- this.set(
- sx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,
- - sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,
- 0, 0, 1
- );
-
- return this;
-
- }
-
- scale( sx, sy ) {
-
- const te = this.elements;
-
- te[ 0 ] *= sx; te[ 3 ] *= sx; te[ 6 ] *= sx;
- te[ 1 ] *= sy; te[ 4 ] *= sy; te[ 7 ] *= sy;
-
- return this;
-
- }
-
- rotate( theta ) {
-
- const c = Math.cos( theta );
- const s = Math.sin( theta );
-
- const te = this.elements;
-
- const a11 = te[ 0 ], a12 = te[ 3 ], a13 = te[ 6 ];
- const a21 = te[ 1 ], a22 = te[ 4 ], a23 = te[ 7 ];
-
- te[ 0 ] = c * a11 + s * a21;
- te[ 3 ] = c * a12 + s * a22;
- te[ 6 ] = c * a13 + s * a23;
-
- te[ 1 ] = - s * a11 + c * a21;
- te[ 4 ] = - s * a12 + c * a22;
- te[ 7 ] = - s * a13 + c * a23;
-
- return this;
-
- }
-
- translate( tx, ty ) {
-
- const te = this.elements;
-
- te[ 0 ] += tx * te[ 2 ]; te[ 3 ] += tx * te[ 5 ]; te[ 6 ] += tx * te[ 8 ];
- te[ 1 ] += ty * te[ 2 ]; te[ 4 ] += ty * te[ 5 ]; te[ 7 ] += ty * te[ 8 ];
-
- return this;
-
- }
-
- equals( matrix ) {
-
- const te = this.elements;
- const me = matrix.elements;
-
- for ( let i = 0; i < 9; i ++ ) {
-
- if ( te[ i ] !== me[ i ] ) return false;
-
- }
-
- return true;
-
- }
-
- fromArray( array, offset = 0 ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.elements[ i ] = array[ i + offset ];
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const te = this.elements;
-
- array[ offset ] = te[ 0 ];
- array[ offset + 1 ] = te[ 1 ];
- array[ offset + 2 ] = te[ 2 ];
-
- array[ offset + 3 ] = te[ 3 ];
- array[ offset + 4 ] = te[ 4 ];
- array[ offset + 5 ] = te[ 5 ];
-
- array[ offset + 6 ] = te[ 6 ];
- array[ offset + 7 ] = te[ 7 ];
- array[ offset + 8 ] = te[ 8 ];
-
- return array;
-
- }
-
- clone() {
-
- return new this.constructor().fromArray( this.elements );
-
- }
-
-}
-
-Matrix3.prototype.isMatrix3 = true;
-
-export { Matrix3 };
diff --git a/GameDev/bin/Release/project_template/math/Matrix4.js b/GameDev/bin/Release/project_template/math/Matrix4.js
deleted file mode 100644
index 5383e24c..00000000
--- a/GameDev/bin/Release/project_template/math/Matrix4.js
+++ /dev/null
@@ -1,885 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-class Matrix4 {
-
- constructor() {
-
- this.elements = [
-
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- ];
-
- if ( arguments.length > 0 ) {
-
- console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );
-
- }
-
- }
-
- set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-
- const te = this.elements;
-
- te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;
- te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;
- te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;
- te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;
-
- return this;
-
- }
-
- identity() {
-
- this.set(
-
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- clone() {
-
- return new Matrix4().fromArray( this.elements );
-
- }
-
- copy( m ) {
-
- const te = this.elements;
- const me = m.elements;
-
- te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];
- te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];
- te[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];
- te[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];
-
- return this;
-
- }
-
- copyPosition( m ) {
-
- const te = this.elements, me = m.elements;
-
- te[ 12 ] = me[ 12 ];
- te[ 13 ] = me[ 13 ];
- te[ 14 ] = me[ 14 ];
-
- return this;
-
- }
-
- setFromMatrix3( m ) {
-
- const me = m.elements;
-
- this.set(
-
- me[ 0 ], me[ 3 ], me[ 6 ], 0,
- me[ 1 ], me[ 4 ], me[ 7 ], 0,
- me[ 2 ], me[ 5 ], me[ 8 ], 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- extractBasis( xAxis, yAxis, zAxis ) {
-
- xAxis.setFromMatrixColumn( this, 0 );
- yAxis.setFromMatrixColumn( this, 1 );
- zAxis.setFromMatrixColumn( this, 2 );
-
- return this;
-
- }
-
- makeBasis( xAxis, yAxis, zAxis ) {
-
- this.set(
- xAxis.x, yAxis.x, zAxis.x, 0,
- xAxis.y, yAxis.y, zAxis.y, 0,
- xAxis.z, yAxis.z, zAxis.z, 0,
- 0, 0, 0, 1
- );
-
- return this;
-
- }
-
- extractRotation( m ) {
-
- // this method does not support reflection matrices
-
- const te = this.elements;
- const me = m.elements;
-
- const scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();
- const scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();
- const scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();
-
- te[ 0 ] = me[ 0 ] * scaleX;
- te[ 1 ] = me[ 1 ] * scaleX;
- te[ 2 ] = me[ 2 ] * scaleX;
- te[ 3 ] = 0;
-
- te[ 4 ] = me[ 4 ] * scaleY;
- te[ 5 ] = me[ 5 ] * scaleY;
- te[ 6 ] = me[ 6 ] * scaleY;
- te[ 7 ] = 0;
-
- te[ 8 ] = me[ 8 ] * scaleZ;
- te[ 9 ] = me[ 9 ] * scaleZ;
- te[ 10 ] = me[ 10 ] * scaleZ;
- te[ 11 ] = 0;
-
- te[ 12 ] = 0;
- te[ 13 ] = 0;
- te[ 14 ] = 0;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- makeRotationFromEuler( euler ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- console.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );
-
- }
-
- const te = this.elements;
-
- const x = euler.x, y = euler.y, z = euler.z;
- const a = Math.cos( x ), b = Math.sin( x );
- const c = Math.cos( y ), d = Math.sin( y );
- const e = Math.cos( z ), f = Math.sin( z );
-
- if ( euler.order === 'XYZ' ) {
-
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
-
- te[ 0 ] = c * e;
- te[ 4 ] = - c * f;
- te[ 8 ] = d;
-
- te[ 1 ] = af + be * d;
- te[ 5 ] = ae - bf * d;
- te[ 9 ] = - b * c;
-
- te[ 2 ] = bf - ae * d;
- te[ 6 ] = be + af * d;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'YXZ' ) {
-
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
-
- te[ 0 ] = ce + df * b;
- te[ 4 ] = de * b - cf;
- te[ 8 ] = a * d;
-
- te[ 1 ] = a * f;
- te[ 5 ] = a * e;
- te[ 9 ] = - b;
-
- te[ 2 ] = cf * b - de;
- te[ 6 ] = df + ce * b;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'ZXY' ) {
-
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
-
- te[ 0 ] = ce - df * b;
- te[ 4 ] = - a * f;
- te[ 8 ] = de + cf * b;
-
- te[ 1 ] = cf + de * b;
- te[ 5 ] = a * e;
- te[ 9 ] = df - ce * b;
-
- te[ 2 ] = - a * d;
- te[ 6 ] = b;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'ZYX' ) {
-
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
-
- te[ 0 ] = c * e;
- te[ 4 ] = be * d - af;
- te[ 8 ] = ae * d + bf;
-
- te[ 1 ] = c * f;
- te[ 5 ] = bf * d + ae;
- te[ 9 ] = af * d - be;
-
- te[ 2 ] = - d;
- te[ 6 ] = b * c;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'YZX' ) {
-
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
- te[ 0 ] = c * e;
- te[ 4 ] = bd - ac * f;
- te[ 8 ] = bc * f + ad;
-
- te[ 1 ] = f;
- te[ 5 ] = a * e;
- te[ 9 ] = - b * e;
-
- te[ 2 ] = - d * e;
- te[ 6 ] = ad * f + bc;
- te[ 10 ] = ac - bd * f;
-
- } else if ( euler.order === 'XZY' ) {
-
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
- te[ 0 ] = c * e;
- te[ 4 ] = - f;
- te[ 8 ] = d * e;
-
- te[ 1 ] = ac * f + bd;
- te[ 5 ] = a * e;
- te[ 9 ] = ad * f - bc;
-
- te[ 2 ] = bc * f - ad;
- te[ 6 ] = b * e;
- te[ 10 ] = bd * f + ac;
-
- }
-
- // bottom row
- te[ 3 ] = 0;
- te[ 7 ] = 0;
- te[ 11 ] = 0;
-
- // last column
- te[ 12 ] = 0;
- te[ 13 ] = 0;
- te[ 14 ] = 0;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- makeRotationFromQuaternion( q ) {
-
- return this.compose( _zero, q, _one );
-
- }
-
- lookAt( eye, target, up ) {
-
- const te = this.elements;
-
- _z.subVectors( eye, target );
-
- if ( _z.lengthSq() === 0 ) {
-
- // eye and target are in the same position
-
- _z.z = 1;
-
- }
-
- _z.normalize();
- _x.crossVectors( up, _z );
-
- if ( _x.lengthSq() === 0 ) {
-
- // up and z are parallel
-
- if ( Math.abs( up.z ) === 1 ) {
-
- _z.x += 0.0001;
-
- } else {
-
- _z.z += 0.0001;
-
- }
-
- _z.normalize();
- _x.crossVectors( up, _z );
-
- }
-
- _x.normalize();
- _y.crossVectors( _z, _x );
-
- te[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;
- te[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;
- te[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;
-
- return this;
-
- }
-
- multiply( m, n ) {
-
- if ( n !== undefined ) {
-
- console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );
- return this.multiplyMatrices( m, n );
-
- }
-
- return this.multiplyMatrices( this, m );
-
- }
-
- premultiply( m ) {
-
- return this.multiplyMatrices( m, this );
-
- }
-
- multiplyMatrices( a, b ) {
-
- const ae = a.elements;
- const be = b.elements;
- const te = this.elements;
-
- const a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];
- const a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];
- const a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];
- const a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];
-
- const b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];
- const b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];
- const b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];
- const b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];
-
- te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
- te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
- te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
- te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
-
- te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
- te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
- te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
- te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
-
- te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
- te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
- te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
- te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
-
- te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
- te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
- te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
- te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- const te = this.elements;
-
- te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;
- te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;
- te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;
- te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;
-
- return this;
-
- }
-
- determinant() {
-
- const te = this.elements;
-
- const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];
- const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];
- const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];
- const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];
-
- //TODO: make this more efficient
- //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
-
- return (
- n41 * (
- + n14 * n23 * n32
- - n13 * n24 * n32
- - n14 * n22 * n33
- + n12 * n24 * n33
- + n13 * n22 * n34
- - n12 * n23 * n34
- ) +
- n42 * (
- + n11 * n23 * n34
- - n11 * n24 * n33
- + n14 * n21 * n33
- - n13 * n21 * n34
- + n13 * n24 * n31
- - n14 * n23 * n31
- ) +
- n43 * (
- + n11 * n24 * n32
- - n11 * n22 * n34
- - n14 * n21 * n32
- + n12 * n21 * n34
- + n14 * n22 * n31
- - n12 * n24 * n31
- ) +
- n44 * (
- - n13 * n22 * n31
- - n11 * n23 * n32
- + n11 * n22 * n33
- + n13 * n21 * n32
- - n12 * n21 * n33
- + n12 * n23 * n31
- )
-
- );
-
- }
-
- transpose() {
-
- const te = this.elements;
- let tmp;
-
- tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;
- tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;
- tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;
-
- tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;
- tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;
- tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;
-
- return this;
-
- }
-
- setPosition( x, y, z ) {
-
- const te = this.elements;
-
- if ( x.isVector3 ) {
-
- te[ 12 ] = x.x;
- te[ 13 ] = x.y;
- te[ 14 ] = x.z;
-
- } else {
-
- te[ 12 ] = x;
- te[ 13 ] = y;
- te[ 14 ] = z;
-
- }
-
- return this;
-
- }
-
- invert() {
-
- // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
- const te = this.elements,
-
- n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],
- n12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],
- n13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],
- n14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],
-
- t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
- t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
- t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
- t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
-
- const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
-
- if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
-
- const detInv = 1 / det;
-
- te[ 0 ] = t11 * detInv;
- te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;
- te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;
- te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;
-
- te[ 4 ] = t12 * detInv;
- te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;
- te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;
- te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;
-
- te[ 8 ] = t13 * detInv;
- te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;
- te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;
- te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;
-
- te[ 12 ] = t14 * detInv;
- te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;
- te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;
- te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;
-
- return this;
-
- }
-
- scale( v ) {
-
- const te = this.elements;
- const x = v.x, y = v.y, z = v.z;
-
- te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;
- te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;
- te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;
- te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;
-
- return this;
-
- }
-
- getMaxScaleOnAxis() {
-
- const te = this.elements;
-
- const scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];
- const scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];
- const scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];
-
- return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );
-
- }
-
- makeTranslation( x, y, z ) {
-
- this.set(
-
- 1, 0, 0, x,
- 0, 1, 0, y,
- 0, 0, 1, z,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationX( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- 1, 0, 0, 0,
- 0, c, - s, 0,
- 0, s, c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationY( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- c, 0, s, 0,
- 0, 1, 0, 0,
- - s, 0, c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationZ( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- c, - s, 0, 0,
- s, c, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationAxis( axis, angle ) {
-
- // Based on http://www.gamedev.net/reference/articles/article1199.asp
-
- const c = Math.cos( angle );
- const s = Math.sin( angle );
- const t = 1 - c;
- const x = axis.x, y = axis.y, z = axis.z;
- const tx = t * x, ty = t * y;
-
- this.set(
-
- tx * x + c, tx * y - s * z, tx * z + s * y, 0,
- tx * y + s * z, ty * y + c, ty * z - s * x, 0,
- tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeScale( x, y, z ) {
-
- this.set(
-
- x, 0, 0, 0,
- 0, y, 0, 0,
- 0, 0, z, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeShear( xy, xz, yx, yz, zx, zy ) {
-
- this.set(
-
- 1, yx, zx, 0,
- xy, 1, zy, 0,
- xz, yz, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- compose( position, quaternion, scale ) {
-
- const te = this.elements;
-
- const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;
- const x2 = x + x, y2 = y + y, z2 = z + z;
- const xx = x * x2, xy = x * y2, xz = x * z2;
- const yy = y * y2, yz = y * z2, zz = z * z2;
- const wx = w * x2, wy = w * y2, wz = w * z2;
-
- const sx = scale.x, sy = scale.y, sz = scale.z;
-
- te[ 0 ] = ( 1 - ( yy + zz ) ) * sx;
- te[ 1 ] = ( xy + wz ) * sx;
- te[ 2 ] = ( xz - wy ) * sx;
- te[ 3 ] = 0;
-
- te[ 4 ] = ( xy - wz ) * sy;
- te[ 5 ] = ( 1 - ( xx + zz ) ) * sy;
- te[ 6 ] = ( yz + wx ) * sy;
- te[ 7 ] = 0;
-
- te[ 8 ] = ( xz + wy ) * sz;
- te[ 9 ] = ( yz - wx ) * sz;
- te[ 10 ] = ( 1 - ( xx + yy ) ) * sz;
- te[ 11 ] = 0;
-
- te[ 12 ] = position.x;
- te[ 13 ] = position.y;
- te[ 14 ] = position.z;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- decompose( position, quaternion, scale ) {
-
- const te = this.elements;
-
- let sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
- const sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
- const sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
-
- // if determine is negative, we need to invert one scale
- const det = this.determinant();
- if ( det < 0 ) sx = - sx;
-
- position.x = te[ 12 ];
- position.y = te[ 13 ];
- position.z = te[ 14 ];
-
- // scale the rotation part
- _m1.copy( this );
-
- const invSX = 1 / sx;
- const invSY = 1 / sy;
- const invSZ = 1 / sz;
-
- _m1.elements[ 0 ] *= invSX;
- _m1.elements[ 1 ] *= invSX;
- _m1.elements[ 2 ] *= invSX;
-
- _m1.elements[ 4 ] *= invSY;
- _m1.elements[ 5 ] *= invSY;
- _m1.elements[ 6 ] *= invSY;
-
- _m1.elements[ 8 ] *= invSZ;
- _m1.elements[ 9 ] *= invSZ;
- _m1.elements[ 10 ] *= invSZ;
-
- quaternion.setFromRotationMatrix( _m1 );
-
- scale.x = sx;
- scale.y = sy;
- scale.z = sz;
-
- return this;
-
- }
-
- makePerspective( left, right, top, bottom, near, far ) {
-
- if ( far === undefined ) {
-
- console.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' );
-
- }
-
- const te = this.elements;
- const x = 2 * near / ( right - left );
- const y = 2 * near / ( top - bottom );
-
- const a = ( right + left ) / ( right - left );
- const b = ( top + bottom ) / ( top - bottom );
- const c = - ( far + near ) / ( far - near );
- const d = - 2 * far * near / ( far - near );
-
- te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
- te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
-
- return this;
-
- }
-
- makeOrthographic( left, right, top, bottom, near, far ) {
-
- const te = this.elements;
- const w = 1.0 / ( right - left );
- const h = 1.0 / ( top - bottom );
- const p = 1.0 / ( far - near );
-
- const x = ( right + left ) * w;
- const y = ( top + bottom ) * h;
- const z = ( far + near ) * p;
-
- te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
- te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z;
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
-
- return this;
-
- }
-
- equals( matrix ) {
-
- const te = this.elements;
- const me = matrix.elements;
-
- for ( let i = 0; i < 16; i ++ ) {
-
- if ( te[ i ] !== me[ i ] ) return false;
-
- }
-
- return true;
-
- }
-
- fromArray( array, offset = 0 ) {
-
- for ( let i = 0; i < 16; i ++ ) {
-
- this.elements[ i ] = array[ i + offset ];
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const te = this.elements;
-
- array[ offset ] = te[ 0 ];
- array[ offset + 1 ] = te[ 1 ];
- array[ offset + 2 ] = te[ 2 ];
- array[ offset + 3 ] = te[ 3 ];
-
- array[ offset + 4 ] = te[ 4 ];
- array[ offset + 5 ] = te[ 5 ];
- array[ offset + 6 ] = te[ 6 ];
- array[ offset + 7 ] = te[ 7 ];
-
- array[ offset + 8 ] = te[ 8 ];
- array[ offset + 9 ] = te[ 9 ];
- array[ offset + 10 ] = te[ 10 ];
- array[ offset + 11 ] = te[ 11 ];
-
- array[ offset + 12 ] = te[ 12 ];
- array[ offset + 13 ] = te[ 13 ];
- array[ offset + 14 ] = te[ 14 ];
- array[ offset + 15 ] = te[ 15 ];
-
- return array;
-
- }
-
-}
-
-Matrix4.prototype.isMatrix4 = true;
-
-const _v1 = /*@__PURE__*/ new Vector3();
-const _m1 = /*@__PURE__*/ new Matrix4();
-const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
-const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
-const _x = /*@__PURE__*/ new Vector3();
-const _y = /*@__PURE__*/ new Vector3();
-const _z = /*@__PURE__*/ new Vector3();
-
-export { Matrix4 };
diff --git a/GameDev/bin/Release/project_template/math/Plane.js b/GameDev/bin/Release/project_template/math/Plane.js
deleted file mode 100644
index fc8a471b..00000000
--- a/GameDev/bin/Release/project_template/math/Plane.js
+++ /dev/null
@@ -1,205 +0,0 @@
-import { Matrix3 } from './Matrix3.js';
-import { Vector3 } from './Vector3.js';
-
-const _vector1 = /*@__PURE__*/ new Vector3();
-const _vector2 = /*@__PURE__*/ new Vector3();
-const _normalMatrix = /*@__PURE__*/ new Matrix3();
-
-class Plane {
-
- constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
-
- // normal is assumed to be normalized
-
- this.normal = normal;
- this.constant = constant;
-
- }
-
- set( normal, constant ) {
-
- this.normal.copy( normal );
- this.constant = constant;
-
- return this;
-
- }
-
- setComponents( x, y, z, w ) {
-
- this.normal.set( x, y, z );
- this.constant = w;
-
- return this;
-
- }
-
- setFromNormalAndCoplanarPoint( normal, point ) {
-
- this.normal.copy( normal );
- this.constant = - point.dot( this.normal );
-
- return this;
-
- }
-
- setFromCoplanarPoints( a, b, c ) {
-
- const normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
-
- // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
-
- this.setFromNormalAndCoplanarPoint( normal, a );
-
- return this;
-
- }
-
- copy( plane ) {
-
- this.normal.copy( plane.normal );
- this.constant = plane.constant;
-
- return this;
-
- }
-
- normalize() {
-
- // Note: will lead to a divide by zero if the plane is invalid.
-
- const inverseNormalLength = 1.0 / this.normal.length();
- this.normal.multiplyScalar( inverseNormalLength );
- this.constant *= inverseNormalLength;
-
- return this;
-
- }
-
- negate() {
-
- this.constant *= - 1;
- this.normal.negate();
-
- return this;
-
- }
-
- distanceToPoint( point ) {
-
- return this.normal.dot( point ) + this.constant;
-
- }
-
- distanceToSphere( sphere ) {
-
- return this.distanceToPoint( sphere.center ) - sphere.radius;
-
- }
-
- projectPoint( point, target ) {
-
- return target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );
-
- }
-
- intersectLine( line, target ) {
-
- const direction = line.delta( _vector1 );
-
- const denominator = this.normal.dot( direction );
-
- if ( denominator === 0 ) {
-
- // line is coplanar, return origin
- if ( this.distanceToPoint( line.start ) === 0 ) {
-
- return target.copy( line.start );
-
- }
-
- // Unsure if this is the correct method to handle this case.
- return null;
-
- }
-
- const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
-
- if ( t < 0 || t > 1 ) {
-
- return null;
-
- }
-
- return target.copy( direction ).multiplyScalar( t ).add( line.start );
-
- }
-
- intersectsLine( line ) {
-
- // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
-
- const startSign = this.distanceToPoint( line.start );
- const endSign = this.distanceToPoint( line.end );
-
- return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
-
- }
-
- intersectsBox( box ) {
-
- return box.intersectsPlane( this );
-
- }
-
- intersectsSphere( sphere ) {
-
- return sphere.intersectsPlane( this );
-
- }
-
- coplanarPoint( target ) {
-
- return target.copy( this.normal ).multiplyScalar( - this.constant );
-
- }
-
- applyMatrix4( matrix, optionalNormalMatrix ) {
-
- const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
-
- const referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
-
- const normal = this.normal.applyMatrix3( normalMatrix ).normalize();
-
- this.constant = - referencePoint.dot( normal );
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.constant -= offset.dot( this.normal );
-
- return this;
-
- }
-
- equals( plane ) {
-
- return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-Plane.prototype.isPlane = true;
-
-export { Plane };
diff --git a/GameDev/bin/Release/project_template/math/Quaternion.js b/GameDev/bin/Release/project_template/math/Quaternion.js
deleted file mode 100644
index 485fe865..00000000
--- a/GameDev/bin/Release/project_template/math/Quaternion.js
+++ /dev/null
@@ -1,689 +0,0 @@
-import * as MathUtils from './MathUtils.js';
-
-class Quaternion {
-
- constructor( x = 0, y = 0, z = 0, w = 1 ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._w = w;
-
- }
-
- static slerp( qa, qb, qm, t ) {
-
- console.warn( 'THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.' );
- return qm.slerpQuaternions( qa, qb, t );
-
- }
-
- static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {
-
- // fuzz-free, array-based Quaternion SLERP operation
-
- let x0 = src0[ srcOffset0 + 0 ],
- y0 = src0[ srcOffset0 + 1 ],
- z0 = src0[ srcOffset0 + 2 ],
- w0 = src0[ srcOffset0 + 3 ];
-
- const x1 = src1[ srcOffset1 + 0 ],
- y1 = src1[ srcOffset1 + 1 ],
- z1 = src1[ srcOffset1 + 2 ],
- w1 = src1[ srcOffset1 + 3 ];
-
- if ( t === 0 ) {
-
- dst[ dstOffset + 0 ] = x0;
- dst[ dstOffset + 1 ] = y0;
- dst[ dstOffset + 2 ] = z0;
- dst[ dstOffset + 3 ] = w0;
- return;
-
- }
-
- if ( t === 1 ) {
-
- dst[ dstOffset + 0 ] = x1;
- dst[ dstOffset + 1 ] = y1;
- dst[ dstOffset + 2 ] = z1;
- dst[ dstOffset + 3 ] = w1;
- return;
-
- }
-
- if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {
-
- let s = 1 - t;
- const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
- dir = ( cos >= 0 ? 1 : - 1 ),
- sqrSin = 1 - cos * cos;
-
- // Skip the Slerp for tiny steps to avoid numeric problems:
- if ( sqrSin > Number.EPSILON ) {
-
- const sin = Math.sqrt( sqrSin ),
- len = Math.atan2( sin, cos * dir );
-
- s = Math.sin( s * len ) / sin;
- t = Math.sin( t * len ) / sin;
-
- }
-
- const tDir = t * dir;
-
- x0 = x0 * s + x1 * tDir;
- y0 = y0 * s + y1 * tDir;
- z0 = z0 * s + z1 * tDir;
- w0 = w0 * s + w1 * tDir;
-
- // Normalize in case we just did a lerp:
- if ( s === 1 - t ) {
-
- const f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );
-
- x0 *= f;
- y0 *= f;
- z0 *= f;
- w0 *= f;
-
- }
-
- }
-
- dst[ dstOffset ] = x0;
- dst[ dstOffset + 1 ] = y0;
- dst[ dstOffset + 2 ] = z0;
- dst[ dstOffset + 3 ] = w0;
-
- }
-
- static multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {
-
- const x0 = src0[ srcOffset0 ];
- const y0 = src0[ srcOffset0 + 1 ];
- const z0 = src0[ srcOffset0 + 2 ];
- const w0 = src0[ srcOffset0 + 3 ];
-
- const x1 = src1[ srcOffset1 ];
- const y1 = src1[ srcOffset1 + 1 ];
- const z1 = src1[ srcOffset1 + 2 ];
- const w1 = src1[ srcOffset1 + 3 ];
-
- dst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
- dst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
- dst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
- dst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;
-
- return dst;
-
- }
-
- get x() {
-
- return this._x;
-
- }
-
- set x( value ) {
-
- this._x = value;
- this._onChangeCallback();
-
- }
-
- get y() {
-
- return this._y;
-
- }
-
- set y( value ) {
-
- this._y = value;
- this._onChangeCallback();
-
- }
-
- get z() {
-
- return this._z;
-
- }
-
- set z( value ) {
-
- this._z = value;
- this._onChangeCallback();
-
- }
-
- get w() {
-
- return this._w;
-
- }
-
- set w( value ) {
-
- this._w = value;
- this._onChangeCallback();
-
- }
-
- set( x, y, z, w ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._w = w;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this._x, this._y, this._z, this._w );
-
- }
-
- copy( quaternion ) {
-
- this._x = quaternion.x;
- this._y = quaternion.y;
- this._z = quaternion.z;
- this._w = quaternion.w;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromEuler( euler, update ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- throw new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' );
-
- }
-
- const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
-
- // http://www.mathworks.com/matlabcentral/fileexchange/
- // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
- // content/SpinCalc.m
-
- const cos = Math.cos;
- const sin = Math.sin;
-
- const c1 = cos( x / 2 );
- const c2 = cos( y / 2 );
- const c3 = cos( z / 2 );
-
- const s1 = sin( x / 2 );
- const s2 = sin( y / 2 );
- const s3 = sin( z / 2 );
-
- switch ( order ) {
-
- case 'XYZ':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'YXZ':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- case 'ZXY':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'ZYX':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- case 'YZX':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'XZY':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- default:
- console.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );
-
- }
-
- if ( update !== false ) this._onChangeCallback();
-
- return this;
-
- }
-
- setFromAxisAngle( axis, angle ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
-
- // assumes axis is normalized
-
- const halfAngle = angle / 2, s = Math.sin( halfAngle );
-
- this._x = axis.x * s;
- this._y = axis.y * s;
- this._z = axis.z * s;
- this._w = Math.cos( halfAngle );
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromRotationMatrix( m ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- const te = m.elements,
-
- m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],
- m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],
- m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],
-
- trace = m11 + m22 + m33;
-
- if ( trace > 0 ) {
-
- const s = 0.5 / Math.sqrt( trace + 1.0 );
-
- this._w = 0.25 / s;
- this._x = ( m32 - m23 ) * s;
- this._y = ( m13 - m31 ) * s;
- this._z = ( m21 - m12 ) * s;
-
- } else if ( m11 > m22 && m11 > m33 ) {
-
- const s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );
-
- this._w = ( m32 - m23 ) / s;
- this._x = 0.25 * s;
- this._y = ( m12 + m21 ) / s;
- this._z = ( m13 + m31 ) / s;
-
- } else if ( m22 > m33 ) {
-
- const s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );
-
- this._w = ( m13 - m31 ) / s;
- this._x = ( m12 + m21 ) / s;
- this._y = 0.25 * s;
- this._z = ( m23 + m32 ) / s;
-
- } else {
-
- const s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );
-
- this._w = ( m21 - m12 ) / s;
- this._x = ( m13 + m31 ) / s;
- this._y = ( m23 + m32 ) / s;
- this._z = 0.25 * s;
-
- }
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromUnitVectors( vFrom, vTo ) {
-
- // assumes direction vectors vFrom and vTo are normalized
-
- let r = vFrom.dot( vTo ) + 1;
-
- if ( r < Number.EPSILON ) {
-
- // vFrom and vTo point in opposite directions
-
- r = 0;
-
- if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {
-
- this._x = - vFrom.y;
- this._y = vFrom.x;
- this._z = 0;
- this._w = r;
-
- } else {
-
- this._x = 0;
- this._y = - vFrom.z;
- this._z = vFrom.y;
- this._w = r;
-
- }
-
- } else {
-
- // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
-
- this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
- this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
- this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
- this._w = r;
-
- }
-
- return this.normalize();
-
- }
-
- angleTo( q ) {
-
- return 2 * Math.acos( Math.abs( MathUtils.clamp( this.dot( q ), - 1, 1 ) ) );
-
- }
-
- rotateTowards( q, step ) {
-
- const angle = this.angleTo( q );
-
- if ( angle === 0 ) return this;
-
- const t = Math.min( 1, step / angle );
-
- this.slerp( q, t );
-
- return this;
-
- }
-
- identity() {
-
- return this.set( 0, 0, 0, 1 );
-
- }
-
- invert() {
-
- // quaternion is assumed to have unit length
-
- return this.conjugate();
-
- }
-
- conjugate() {
-
- this._x *= - 1;
- this._y *= - 1;
- this._z *= - 1;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- dot( v ) {
-
- return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;
-
- }
-
- lengthSq() {
-
- return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
-
- }
-
- length() {
-
- return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );
-
- }
-
- normalize() {
-
- let l = this.length();
-
- if ( l === 0 ) {
-
- this._x = 0;
- this._y = 0;
- this._z = 0;
- this._w = 1;
-
- } else {
-
- l = 1 / l;
-
- this._x = this._x * l;
- this._y = this._y * l;
- this._z = this._z * l;
- this._w = this._w * l;
-
- }
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- multiply( q, p ) {
-
- if ( p !== undefined ) {
-
- console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );
- return this.multiplyQuaternions( q, p );
-
- }
-
- return this.multiplyQuaternions( this, q );
-
- }
-
- premultiply( q ) {
-
- return this.multiplyQuaternions( q, this );
-
- }
-
- multiplyQuaternions( a, b ) {
-
- // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
-
- const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;
- const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;
-
- this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
- this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
- this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
- this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- slerp( qb, t ) {
-
- if ( t === 0 ) return this;
- if ( t === 1 ) return this.copy( qb );
-
- const x = this._x, y = this._y, z = this._z, w = this._w;
-
- // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
-
- let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
-
- if ( cosHalfTheta < 0 ) {
-
- this._w = - qb._w;
- this._x = - qb._x;
- this._y = - qb._y;
- this._z = - qb._z;
-
- cosHalfTheta = - cosHalfTheta;
-
- } else {
-
- this.copy( qb );
-
- }
-
- if ( cosHalfTheta >= 1.0 ) {
-
- this._w = w;
- this._x = x;
- this._y = y;
- this._z = z;
-
- return this;
-
- }
-
- const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
-
- if ( sqrSinHalfTheta <= Number.EPSILON ) {
-
- const s = 1 - t;
- this._w = s * w + t * this._w;
- this._x = s * x + t * this._x;
- this._y = s * y + t * this._y;
- this._z = s * z + t * this._z;
-
- this.normalize();
- this._onChangeCallback();
-
- return this;
-
- }
-
- const sinHalfTheta = Math.sqrt( sqrSinHalfTheta );
- const halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );
- const ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
- ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
-
- this._w = ( w * ratioA + this._w * ratioB );
- this._x = ( x * ratioA + this._x * ratioB );
- this._y = ( y * ratioA + this._y * ratioB );
- this._z = ( z * ratioA + this._z * ratioB );
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- slerpQuaternions( qa, qb, t ) {
-
- this.copy( qa ).slerp( qb, t );
-
- }
-
- random() {
-
- // Derived from http://planning.cs.uiuc.edu/node198.html
- // Note, this source uses w, x, y, z ordering,
- // so we swap the order below.
-
- const u1 = Math.random();
- const sqrt1u1 = Math.sqrt( 1 - u1 );
- const sqrtu1 = Math.sqrt( u1 );
-
- const u2 = 2 * Math.PI * Math.random();
-
- const u3 = 2 * Math.PI * Math.random();
-
- return this.set(
- sqrt1u1 * Math.cos( u2 ),
- sqrtu1 * Math.sin( u3 ),
- sqrtu1 * Math.cos( u3 ),
- sqrt1u1 * Math.sin( u2 ),
- );
-
- }
-
- equals( quaternion ) {
-
- return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this._x = array[ offset ];
- this._y = array[ offset + 1 ];
- this._z = array[ offset + 2 ];
- this._w = array[ offset + 3 ];
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this._x;
- array[ offset + 1 ] = this._y;
- array[ offset + 2 ] = this._z;
- array[ offset + 3 ] = this._w;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index ) {
-
- this._x = attribute.getX( index );
- this._y = attribute.getY( index );
- this._z = attribute.getZ( index );
- this._w = attribute.getW( index );
-
- return this;
-
- }
-
- _onChange( callback ) {
-
- this._onChangeCallback = callback;
-
- return this;
-
- }
-
- _onChangeCallback() {}
-
-}
-
-Quaternion.prototype.isQuaternion = true;
-
-export { Quaternion };
diff --git a/GameDev/bin/Release/project_template/math/Ray.js b/GameDev/bin/Release/project_template/math/Ray.js
deleted file mode 100644
index 5798c7bf..00000000
--- a/GameDev/bin/Release/project_template/math/Ray.js
+++ /dev/null
@@ -1,496 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-const _vector = /*@__PURE__*/ new Vector3();
-const _segCenter = /*@__PURE__*/ new Vector3();
-const _segDir = /*@__PURE__*/ new Vector3();
-const _diff = /*@__PURE__*/ new Vector3();
-
-const _edge1 = /*@__PURE__*/ new Vector3();
-const _edge2 = /*@__PURE__*/ new Vector3();
-const _normal = /*@__PURE__*/ new Vector3();
-
-class Ray {
-
- constructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {
-
- this.origin = origin;
- this.direction = direction;
-
- }
-
- set( origin, direction ) {
-
- this.origin.copy( origin );
- this.direction.copy( direction );
-
- return this;
-
- }
-
- copy( ray ) {
-
- this.origin.copy( ray.origin );
- this.direction.copy( ray.direction );
-
- return this;
-
- }
-
- at( t, target ) {
-
- return target.copy( this.direction ).multiplyScalar( t ).add( this.origin );
-
- }
-
- lookAt( v ) {
-
- this.direction.copy( v ).sub( this.origin ).normalize();
-
- return this;
-
- }
-
- recast( t ) {
-
- this.origin.copy( this.at( t, _vector ) );
-
- return this;
-
- }
-
- closestPointToPoint( point, target ) {
-
- target.subVectors( point, this.origin );
-
- const directionDistance = target.dot( this.direction );
-
- if ( directionDistance < 0 ) {
-
- return target.copy( this.origin );
-
- }
-
- return target.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );
-
- }
-
- distanceToPoint( point ) {
-
- return Math.sqrt( this.distanceSqToPoint( point ) );
-
- }
-
- distanceSqToPoint( point ) {
-
- const directionDistance = _vector.subVectors( point, this.origin ).dot( this.direction );
-
- // point behind the ray
-
- if ( directionDistance < 0 ) {
-
- return this.origin.distanceToSquared( point );
-
- }
-
- _vector.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );
-
- return _vector.distanceToSquared( point );
-
- }
-
- distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {
-
- // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
- // It returns the min distance between the ray and the segment
- // defined by v0 and v1
- // It can also set two optional targets :
- // - The closest point on the ray
- // - The closest point on the segment
-
- _segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );
- _segDir.copy( v1 ).sub( v0 ).normalize();
- _diff.copy( this.origin ).sub( _segCenter );
-
- const segExtent = v0.distanceTo( v1 ) * 0.5;
- const a01 = - this.direction.dot( _segDir );
- const b0 = _diff.dot( this.direction );
- const b1 = - _diff.dot( _segDir );
- const c = _diff.lengthSq();
- const det = Math.abs( 1 - a01 * a01 );
- let s0, s1, sqrDist, extDet;
-
- if ( det > 0 ) {
-
- // The ray and segment are not parallel.
-
- s0 = a01 * b1 - b0;
- s1 = a01 * b0 - b1;
- extDet = segExtent * det;
-
- if ( s0 >= 0 ) {
-
- if ( s1 >= - extDet ) {
-
- if ( s1 <= extDet ) {
-
- // region 0
- // Minimum at interior points of ray and segment.
-
- const invDet = 1 / det;
- s0 *= invDet;
- s1 *= invDet;
- sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;
-
- } else {
-
- // region 1
-
- s1 = segExtent;
- s0 = Math.max( 0, - ( a01 * s1 + b0 ) );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- } else {
-
- // region 5
-
- s1 = - segExtent;
- s0 = Math.max( 0, - ( a01 * s1 + b0 ) );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- } else {
-
- if ( s1 <= - extDet ) {
-
- // region 4
-
- s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );
- s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- } else if ( s1 <= extDet ) {
-
- // region 3
-
- s0 = 0;
- s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );
- sqrDist = s1 * ( s1 + 2 * b1 ) + c;
-
- } else {
-
- // region 2
-
- s0 = Math.max( 0, - ( a01 * segExtent + b0 ) );
- s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- }
-
- } else {
-
- // Ray and segment are parallel.
-
- s1 = ( a01 > 0 ) ? - segExtent : segExtent;
- s0 = Math.max( 0, - ( a01 * s1 + b0 ) );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- if ( optionalPointOnRay ) {
-
- optionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin );
-
- }
-
- if ( optionalPointOnSegment ) {
-
- optionalPointOnSegment.copy( _segDir ).multiplyScalar( s1 ).add( _segCenter );
-
- }
-
- return sqrDist;
-
- }
-
- intersectSphere( sphere, target ) {
-
- _vector.subVectors( sphere.center, this.origin );
- const tca = _vector.dot( this.direction );
- const d2 = _vector.dot( _vector ) - tca * tca;
- const radius2 = sphere.radius * sphere.radius;
-
- if ( d2 > radius2 ) return null;
-
- const thc = Math.sqrt( radius2 - d2 );
-
- // t0 = first intersect point - entrance on front of sphere
- const t0 = tca - thc;
-
- // t1 = second intersect point - exit point on back of sphere
- const t1 = tca + thc;
-
- // test to see if both t0 and t1 are behind the ray - if so, return null
- if ( t0 < 0 && t1 < 0 ) return null;
-
- // test to see if t0 is behind the ray:
- // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
- // in order to always return an intersect point that is in front of the ray.
- if ( t0 < 0 ) return this.at( t1, target );
-
- // else t0 is in front of the ray, so return the first collision point scaled by t0
- return this.at( t0, target );
-
- }
-
- intersectsSphere( sphere ) {
-
- return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
-
- }
-
- distanceToPlane( plane ) {
-
- const denominator = plane.normal.dot( this.direction );
-
- if ( denominator === 0 ) {
-
- // line is coplanar, return origin
- if ( plane.distanceToPoint( this.origin ) === 0 ) {
-
- return 0;
-
- }
-
- // Null is preferable to undefined since undefined means.... it is undefined
-
- return null;
-
- }
-
- const t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;
-
- // Return if the ray never intersects the plane
-
- return t >= 0 ? t : null;
-
- }
-
- intersectPlane( plane, target ) {
-
- const t = this.distanceToPlane( plane );
-
- if ( t === null ) {
-
- return null;
-
- }
-
- return this.at( t, target );
-
- }
-
- intersectsPlane( plane ) {
-
- // check if the ray lies on the plane first
-
- const distToPoint = plane.distanceToPoint( this.origin );
-
- if ( distToPoint === 0 ) {
-
- return true;
-
- }
-
- const denominator = plane.normal.dot( this.direction );
-
- if ( denominator * distToPoint < 0 ) {
-
- return true;
-
- }
-
- // ray origin is behind the plane (and is pointing behind it)
-
- return false;
-
- }
-
- intersectBox( box, target ) {
-
- let tmin, tmax, tymin, tymax, tzmin, tzmax;
-
- const invdirx = 1 / this.direction.x,
- invdiry = 1 / this.direction.y,
- invdirz = 1 / this.direction.z;
-
- const origin = this.origin;
-
- if ( invdirx >= 0 ) {
-
- tmin = ( box.min.x - origin.x ) * invdirx;
- tmax = ( box.max.x - origin.x ) * invdirx;
-
- } else {
-
- tmin = ( box.max.x - origin.x ) * invdirx;
- tmax = ( box.min.x - origin.x ) * invdirx;
-
- }
-
- if ( invdiry >= 0 ) {
-
- tymin = ( box.min.y - origin.y ) * invdiry;
- tymax = ( box.max.y - origin.y ) * invdiry;
-
- } else {
-
- tymin = ( box.max.y - origin.y ) * invdiry;
- tymax = ( box.min.y - origin.y ) * invdiry;
-
- }
-
- if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;
-
- // These lines also handle the case where tmin or tmax is NaN
- // (result of 0 * Infinity). x !== x returns true if x is NaN
-
- if ( tymin > tmin || tmin !== tmin ) tmin = tymin;
-
- if ( tymax < tmax || tmax !== tmax ) tmax = tymax;
-
- if ( invdirz >= 0 ) {
-
- tzmin = ( box.min.z - origin.z ) * invdirz;
- tzmax = ( box.max.z - origin.z ) * invdirz;
-
- } else {
-
- tzmin = ( box.max.z - origin.z ) * invdirz;
- tzmax = ( box.min.z - origin.z ) * invdirz;
-
- }
-
- if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;
-
- if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;
-
- if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;
-
- //return point closest to the ray (positive side)
-
- if ( tmax < 0 ) return null;
-
- return this.at( tmin >= 0 ? tmin : tmax, target );
-
- }
-
- intersectsBox( box ) {
-
- return this.intersectBox( box, _vector ) !== null;
-
- }
-
- intersectTriangle( a, b, c, backfaceCulling, target ) {
-
- // Compute the offset origin, edges, and normal.
-
- // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
-
- _edge1.subVectors( b, a );
- _edge2.subVectors( c, a );
- _normal.crossVectors( _edge1, _edge2 );
-
- // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
- // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
- // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
- // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
- // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
- let DdN = this.direction.dot( _normal );
- let sign;
-
- if ( DdN > 0 ) {
-
- if ( backfaceCulling ) return null;
- sign = 1;
-
- } else if ( DdN < 0 ) {
-
- sign = - 1;
- DdN = - DdN;
-
- } else {
-
- return null;
-
- }
-
- _diff.subVectors( this.origin, a );
- const DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );
-
- // b1 < 0, no intersection
- if ( DdQxE2 < 0 ) {
-
- return null;
-
- }
-
- const DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );
-
- // b2 < 0, no intersection
- if ( DdE1xQ < 0 ) {
-
- return null;
-
- }
-
- // b1+b2 > 1, no intersection
- if ( DdQxE2 + DdE1xQ > DdN ) {
-
- return null;
-
- }
-
- // Line intersects triangle, check if ray does.
- const QdN = - sign * _diff.dot( _normal );
-
- // t < 0, no intersection
- if ( QdN < 0 ) {
-
- return null;
-
- }
-
- // Ray intersects triangle.
- return this.at( QdN / DdN, target );
-
- }
-
- applyMatrix4( matrix4 ) {
-
- this.origin.applyMatrix4( matrix4 );
- this.direction.transformDirection( matrix4 );
-
- return this;
-
- }
-
- equals( ray ) {
-
- return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Ray };
diff --git a/GameDev/bin/Release/project_template/math/Sphere.js b/GameDev/bin/Release/project_template/math/Sphere.js
deleted file mode 100644
index 657335ba..00000000
--- a/GameDev/bin/Release/project_template/math/Sphere.js
+++ /dev/null
@@ -1,219 +0,0 @@
-import { Box3 } from './Box3.js';
-import { Vector3 } from './Vector3.js';
-
-const _box = /*@__PURE__*/ new Box3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _toFarthestPoint = /*@__PURE__*/ new Vector3();
-const _toPoint = /*@__PURE__*/ new Vector3();
-
-class Sphere {
-
- constructor( center = new Vector3(), radius = - 1 ) {
-
- this.center = center;
- this.radius = radius;
-
- }
-
- set( center, radius ) {
-
- this.center.copy( center );
- this.radius = radius;
-
- return this;
-
- }
-
- setFromPoints( points, optionalCenter ) {
-
- const center = this.center;
-
- if ( optionalCenter !== undefined ) {
-
- center.copy( optionalCenter );
-
- } else {
-
- _box.setFromPoints( points ).getCenter( center );
-
- }
-
- let maxRadiusSq = 0;
-
- for ( let i = 0, il = points.length; i < il; i ++ ) {
-
- maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
-
- }
-
- this.radius = Math.sqrt( maxRadiusSq );
-
- return this;
-
- }
-
- copy( sphere ) {
-
- this.center.copy( sphere.center );
- this.radius = sphere.radius;
-
- return this;
-
- }
-
- isEmpty() {
-
- return ( this.radius < 0 );
-
- }
-
- makeEmpty() {
-
- this.center.set( 0, 0, 0 );
- this.radius = - 1;
-
- return this;
-
- }
-
- containsPoint( point ) {
-
- return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );
-
- }
-
- distanceToPoint( point ) {
-
- return ( point.distanceTo( this.center ) - this.radius );
-
- }
-
- intersectsSphere( sphere ) {
-
- const radiusSum = this.radius + sphere.radius;
-
- return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );
-
- }
-
- intersectsBox( box ) {
-
- return box.intersectsSphere( this );
-
- }
-
- intersectsPlane( plane ) {
-
- return Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;
-
- }
-
- clampPoint( point, target ) {
-
- const deltaLengthSq = this.center.distanceToSquared( point );
-
- target.copy( point );
-
- if ( deltaLengthSq > ( this.radius * this.radius ) ) {
-
- target.sub( this.center ).normalize();
- target.multiplyScalar( this.radius ).add( this.center );
-
- }
-
- return target;
-
- }
-
- getBoundingBox( target ) {
-
- if ( this.isEmpty() ) {
-
- // Empty sphere produces empty bounding box
- target.makeEmpty();
- return target;
-
- }
-
- target.set( this.center, this.center );
- target.expandByScalar( this.radius );
-
- return target;
-
- }
-
- applyMatrix4( matrix ) {
-
- this.center.applyMatrix4( matrix );
- this.radius = this.radius * matrix.getMaxScaleOnAxis();
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.center.add( offset );
-
- return this;
-
- }
-
- expandByPoint( point ) {
-
- // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
-
- _toPoint.subVectors( point, this.center );
-
- const lengthSq = _toPoint.lengthSq();
-
- if ( lengthSq > ( this.radius * this.radius ) ) {
-
- const length = Math.sqrt( lengthSq );
- const missingRadiusHalf = ( length - this.radius ) * 0.5;
-
- // Nudge this sphere towards the target point. Add half the missing distance to radius,
- // and the other half to position. This gives a tighter enclosure, instead of if
- // the whole missing distance were just added to radius.
-
- this.center.add( _toPoint.multiplyScalar( missingRadiusHalf / length ) );
- this.radius += missingRadiusHalf;
-
- }
-
- return this;
-
- }
-
- union( sphere ) {
-
- // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
-
- // To enclose another sphere into this sphere, we only need to enclose two points:
- // 1) Enclose the farthest point on the other sphere into this sphere.
- // 2) Enclose the opposite point of the farthest point into this sphere.
-
- _toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius );
-
- this.expandByPoint( _v1.copy( sphere.center ).add( _toFarthestPoint ) );
- this.expandByPoint( _v1.copy( sphere.center ).sub( _toFarthestPoint ) );
-
- return this;
-
- }
-
- equals( sphere ) {
-
- return sphere.center.equals( this.center ) && ( sphere.radius === this.radius );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Sphere };
diff --git a/GameDev/bin/Release/project_template/math/Spherical.js b/GameDev/bin/Release/project_template/math/Spherical.js
deleted file mode 100644
index 9b7bb6c6..00000000
--- a/GameDev/bin/Release/project_template/math/Spherical.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
- *
- * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
- * The azimuthal angle (theta) is measured from the positive z-axis.
- */
-
-import * as MathUtils from './MathUtils.js';
-
-class Spherical {
-
- constructor( radius = 1, phi = 0, theta = 0 ) {
-
- this.radius = radius;
- this.phi = phi; // polar angle
- this.theta = theta; // azimuthal angle
-
- return this;
-
- }
-
- set( radius, phi, theta ) {
-
- this.radius = radius;
- this.phi = phi;
- this.theta = theta;
-
- return this;
-
- }
-
- copy( other ) {
-
- this.radius = other.radius;
- this.phi = other.phi;
- this.theta = other.theta;
-
- return this;
-
- }
-
- // restrict phi to be betwee EPS and PI-EPS
- makeSafe() {
-
- const EPS = 0.000001;
- this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
-
- return this;
-
- }
-
- setFromVector3( v ) {
-
- return this.setFromCartesianCoords( v.x, v.y, v.z );
-
- }
-
- setFromCartesianCoords( x, y, z ) {
-
- this.radius = Math.sqrt( x * x + y * y + z * z );
-
- if ( this.radius === 0 ) {
-
- this.theta = 0;
- this.phi = 0;
-
- } else {
-
- this.theta = Math.atan2( x, z );
- this.phi = Math.acos( MathUtils.clamp( y / this.radius, - 1, 1 ) );
-
- }
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Spherical };
diff --git a/GameDev/bin/Release/project_template/math/SphericalHarmonics3.js b/GameDev/bin/Release/project_template/math/SphericalHarmonics3.js
deleted file mode 100644
index 2d8796fb..00000000
--- a/GameDev/bin/Release/project_template/math/SphericalHarmonics3.js
+++ /dev/null
@@ -1,243 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-/**
- * Primary reference:
- * https://graphics.stanford.edu/papers/envmap/envmap.pdf
- *
- * Secondary reference:
- * https://www.ppsloan.org/publications/StupidSH36.pdf
- */
-
-// 3-band SH defined by 9 coefficients
-
-class SphericalHarmonics3 {
-
- constructor() {
-
- this.coefficients = [];
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients.push( new Vector3() );
-
- }
-
- }
-
- set( coefficients ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].copy( coefficients[ i ] );
-
- }
-
- return this;
-
- }
-
- zero() {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].set( 0, 0, 0 );
-
- }
-
- return this;
-
- }
-
- // get the radiance in the direction of the normal
- // target is a Vector3
- getAt( normal, target ) {
-
- // normal is assumed to be unit length
-
- const x = normal.x, y = normal.y, z = normal.z;
-
- const coeff = this.coefficients;
-
- // band 0
- target.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );
-
- // band 1
- target.addScaledVector( coeff[ 1 ], 0.488603 * y );
- target.addScaledVector( coeff[ 2 ], 0.488603 * z );
- target.addScaledVector( coeff[ 3 ], 0.488603 * x );
-
- // band 2
- target.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );
- target.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );
- target.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );
- target.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );
- target.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );
-
- return target;
-
- }
-
- // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal
- // target is a Vector3
- // https://graphics.stanford.edu/papers/envmap/envmap.pdf
- getIrradianceAt( normal, target ) {
-
- // normal is assumed to be unit length
-
- const x = normal.x, y = normal.y, z = normal.z;
-
- const coeff = this.coefficients;
-
- // band 0
- target.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095
-
- // band 1
- target.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603
- target.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );
- target.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );
-
- // band 2
- target.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548
- target.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );
- target.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3
- target.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );
- target.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274
-
- return target;
-
- }
-
- add( sh ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].add( sh.coefficients[ i ] );
-
- }
-
- return this;
-
- }
-
- addScaledSH( sh, s ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );
-
- }
-
- return this;
-
- }
-
- scale( s ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].multiplyScalar( s );
-
- }
-
- return this;
-
- }
-
- lerp( sh, alpha ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );
-
- }
-
- return this;
-
- }
-
- equals( sh ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- if ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- copy( sh ) {
-
- return this.set( sh.coefficients );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- const coefficients = this.coefficients;
-
- for ( let i = 0; i < 9; i ++ ) {
-
- coefficients[ i ].fromArray( array, offset + ( i * 3 ) );
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const coefficients = this.coefficients;
-
- for ( let i = 0; i < 9; i ++ ) {
-
- coefficients[ i ].toArray( array, offset + ( i * 3 ) );
-
- }
-
- return array;
-
- }
-
- // evaluate the basis functions
- // shBasis is an Array[ 9 ]
- static getBasisAt( normal, shBasis ) {
-
- // normal is assumed to be unit length
-
- const x = normal.x, y = normal.y, z = normal.z;
-
- // band 0
- shBasis[ 0 ] = 0.282095;
-
- // band 1
- shBasis[ 1 ] = 0.488603 * y;
- shBasis[ 2 ] = 0.488603 * z;
- shBasis[ 3 ] = 0.488603 * x;
-
- // band 2
- shBasis[ 4 ] = 1.092548 * x * y;
- shBasis[ 5 ] = 1.092548 * y * z;
- shBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );
- shBasis[ 7 ] = 1.092548 * x * z;
- shBasis[ 8 ] = 0.546274 * ( x * x - y * y );
-
- }
-
-}
-
-SphericalHarmonics3.prototype.isSphericalHarmonics3 = true;
-
-export { SphericalHarmonics3 };
diff --git a/GameDev/bin/Release/project_template/math/Triangle.js b/GameDev/bin/Release/project_template/math/Triangle.js
deleted file mode 100644
index 617ca629..00000000
--- a/GameDev/bin/Release/project_template/math/Triangle.js
+++ /dev/null
@@ -1,299 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-const _v0 = /*@__PURE__*/ new Vector3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _v2 = /*@__PURE__*/ new Vector3();
-const _v3 = /*@__PURE__*/ new Vector3();
-
-const _vab = /*@__PURE__*/ new Vector3();
-const _vac = /*@__PURE__*/ new Vector3();
-const _vbc = /*@__PURE__*/ new Vector3();
-const _vap = /*@__PURE__*/ new Vector3();
-const _vbp = /*@__PURE__*/ new Vector3();
-const _vcp = /*@__PURE__*/ new Vector3();
-
-class Triangle {
-
- constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
-
- this.a = a;
- this.b = b;
- this.c = c;
-
- }
-
- static getNormal( a, b, c, target ) {
-
- target.subVectors( c, b );
- _v0.subVectors( a, b );
- target.cross( _v0 );
-
- const targetLengthSq = target.lengthSq();
- if ( targetLengthSq > 0 ) {
-
- return target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );
-
- }
-
- return target.set( 0, 0, 0 );
-
- }
-
- // static/instance method to calculate barycentric coordinates
- // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
- static getBarycoord( point, a, b, c, target ) {
-
- _v0.subVectors( c, a );
- _v1.subVectors( b, a );
- _v2.subVectors( point, a );
-
- const dot00 = _v0.dot( _v0 );
- const dot01 = _v0.dot( _v1 );
- const dot02 = _v0.dot( _v2 );
- const dot11 = _v1.dot( _v1 );
- const dot12 = _v1.dot( _v2 );
-
- const denom = ( dot00 * dot11 - dot01 * dot01 );
-
- // collinear or singular triangle
- if ( denom === 0 ) {
-
- // arbitrary location outside of triangle?
- // not sure if this is the best idea, maybe should be returning undefined
- return target.set( - 2, - 1, - 1 );
-
- }
-
- const invDenom = 1 / denom;
- const u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;
- const v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;
-
- // barycentric coordinates must always sum to 1
- return target.set( 1 - u - v, v, u );
-
- }
-
- static containsPoint( point, a, b, c ) {
-
- this.getBarycoord( point, a, b, c, _v3 );
-
- return ( _v3.x >= 0 ) && ( _v3.y >= 0 ) && ( ( _v3.x + _v3.y ) <= 1 );
-
- }
-
- static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) {
-
- this.getBarycoord( point, p1, p2, p3, _v3 );
-
- target.set( 0, 0 );
- target.addScaledVector( uv1, _v3.x );
- target.addScaledVector( uv2, _v3.y );
- target.addScaledVector( uv3, _v3.z );
-
- return target;
-
- }
-
- static isFrontFacing( a, b, c, direction ) {
-
- _v0.subVectors( c, b );
- _v1.subVectors( a, b );
-
- // strictly front facing
- return ( _v0.cross( _v1 ).dot( direction ) < 0 ) ? true : false;
-
- }
-
- set( a, b, c ) {
-
- this.a.copy( a );
- this.b.copy( b );
- this.c.copy( c );
-
- return this;
-
- }
-
- setFromPointsAndIndices( points, i0, i1, i2 ) {
-
- this.a.copy( points[ i0 ] );
- this.b.copy( points[ i1 ] );
- this.c.copy( points[ i2 ] );
-
- return this;
-
- }
-
- setFromAttributeAndIndices( attribute, i0, i1, i2 ) {
-
- this.a.fromBufferAttribute( attribute, i0 );
- this.b.fromBufferAttribute( attribute, i1 );
- this.c.fromBufferAttribute( attribute, i2 );
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- copy( triangle ) {
-
- this.a.copy( triangle.a );
- this.b.copy( triangle.b );
- this.c.copy( triangle.c );
-
- return this;
-
- }
-
- getArea() {
-
- _v0.subVectors( this.c, this.b );
- _v1.subVectors( this.a, this.b );
-
- return _v0.cross( _v1 ).length() * 0.5;
-
- }
-
- getMidpoint( target ) {
-
- return target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );
-
- }
-
- getNormal( target ) {
-
- return Triangle.getNormal( this.a, this.b, this.c, target );
-
- }
-
- getPlane( target ) {
-
- return target.setFromCoplanarPoints( this.a, this.b, this.c );
-
- }
-
- getBarycoord( point, target ) {
-
- return Triangle.getBarycoord( point, this.a, this.b, this.c, target );
-
- }
-
- getUV( point, uv1, uv2, uv3, target ) {
-
- return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
-
- }
-
- containsPoint( point ) {
-
- return Triangle.containsPoint( point, this.a, this.b, this.c );
-
- }
-
- isFrontFacing( direction ) {
-
- return Triangle.isFrontFacing( this.a, this.b, this.c, direction );
-
- }
-
- intersectsBox( box ) {
-
- return box.intersectsTriangle( this );
-
- }
-
- closestPointToPoint( p, target ) {
-
- const a = this.a, b = this.b, c = this.c;
- let v, w;
-
- // algorithm thanks to Real-Time Collision Detection by Christer Ericson,
- // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,
- // under the accompanying license; see chapter 5.1.5 for detailed explanation.
- // basically, we're distinguishing which of the voronoi regions of the triangle
- // the point lies in with the minimum amount of redundant computation.
-
- _vab.subVectors( b, a );
- _vac.subVectors( c, a );
- _vap.subVectors( p, a );
- const d1 = _vab.dot( _vap );
- const d2 = _vac.dot( _vap );
- if ( d1 <= 0 && d2 <= 0 ) {
-
- // vertex region of A; barycentric coords (1, 0, 0)
- return target.copy( a );
-
- }
-
- _vbp.subVectors( p, b );
- const d3 = _vab.dot( _vbp );
- const d4 = _vac.dot( _vbp );
- if ( d3 >= 0 && d4 <= d3 ) {
-
- // vertex region of B; barycentric coords (0, 1, 0)
- return target.copy( b );
-
- }
-
- const vc = d1 * d4 - d3 * d2;
- if ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {
-
- v = d1 / ( d1 - d3 );
- // edge region of AB; barycentric coords (1-v, v, 0)
- return target.copy( a ).addScaledVector( _vab, v );
-
- }
-
- _vcp.subVectors( p, c );
- const d5 = _vab.dot( _vcp );
- const d6 = _vac.dot( _vcp );
- if ( d6 >= 0 && d5 <= d6 ) {
-
- // vertex region of C; barycentric coords (0, 0, 1)
- return target.copy( c );
-
- }
-
- const vb = d5 * d2 - d1 * d6;
- if ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {
-
- w = d2 / ( d2 - d6 );
- // edge region of AC; barycentric coords (1-w, 0, w)
- return target.copy( a ).addScaledVector( _vac, w );
-
- }
-
- const va = d3 * d6 - d5 * d4;
- if ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {
-
- _vbc.subVectors( c, b );
- w = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );
- // edge region of BC; barycentric coords (0, 1-w, w)
- return target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC
-
- }
-
- // face region
- const denom = 1 / ( va + vb + vc );
- // u = va * denom
- v = vb * denom;
- w = vc * denom;
-
- return target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );
-
- }
-
- equals( triangle ) {
-
- return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );
-
- }
-
-}
-
-export { Triangle };
diff --git a/GameDev/bin/Release/project_template/math/Vector2.js b/GameDev/bin/Release/project_template/math/Vector2.js
deleted file mode 100644
index 88592aa3..00000000
--- a/GameDev/bin/Release/project_template/math/Vector2.js
+++ /dev/null
@@ -1,484 +0,0 @@
-class Vector2 {
-
- constructor( x = 0, y = 0 ) {
-
- this.x = x;
- this.y = y;
-
- }
-
- get width() {
-
- return this.x;
-
- }
-
- set width( value ) {
-
- this.x = value;
-
- }
-
- get height() {
-
- return this.y;
-
- }
-
- set height( value ) {
-
- this.y = value;
-
- }
-
- set( x, y ) {
-
- this.x = x;
- this.y = y;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- case 0: return this.x;
- case 1: return this.y;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
-
- return this;
-
- }
-
- multiply( v ) {
-
- this.x *= v.x;
- this.y *= v.y;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
-
- return this;
-
- }
-
- divide( v ) {
-
- this.x /= v.x;
- this.y /= v.y;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- applyMatrix3( m ) {
-
- const x = this.x, y = this.y;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];
- this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];
-
- return this;
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y;
-
- }
-
- cross( v ) {
-
- return this.x * v.y - this.y * v.x;
-
- }
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- angle() {
-
- // computes the angle in radians with respect to the positive x-axis
-
- const angle = Math.atan2( - this.y, - this.x ) + Math.PI;
-
- return angle;
-
- }
-
- distanceTo( v ) {
-
- return Math.sqrt( this.distanceToSquared( v ) );
-
- }
-
- distanceToSquared( v ) {
-
- const dx = this.x - v.x, dy = this.y - v.y;
- return dx * dx + dy * dy;
-
- }
-
- manhattanDistanceTo( v ) {
-
- return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
-
- return this;
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
-
- return this;
-
- }
-
- rotateAround( center, angle ) {
-
- const c = Math.cos( angle ), s = Math.sin( angle );
-
- const x = this.x - center.x;
- const y = this.y - center.y;
-
- this.x = x * c - y * s + center.x;
- this.y = x * s + y * c + center.y;
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
-
- }
-
-}
-
-Vector2.prototype.isVector2 = true;
-
-export { Vector2 };
diff --git a/GameDev/bin/Release/project_template/math/Vector3.js b/GameDev/bin/Release/project_template/math/Vector3.js
deleted file mode 100644
index d3303860..00000000
--- a/GameDev/bin/Release/project_template/math/Vector3.js
+++ /dev/null
@@ -1,745 +0,0 @@
-import * as MathUtils from './MathUtils.js';
-import { Quaternion } from './Quaternion.js';
-
-class Vector3 {
-
- constructor( x = 0, y = 0, z = 0 ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
-
- }
-
- set( x, y, z ) {
-
- if ( z === undefined ) z = this.z; // sprite.scale.set(x,y)
-
- this.x = x;
- this.y = y;
- this.z = z;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
- this.z = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setZ( z ) {
-
- this.z = z;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- case 2: this.z = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- case 0: return this.x;
- case 1: return this.y;
- case 2: return this.z;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y, this.z );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
- this.z = v.z;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
- this.z += v.z;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
- this.z += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
- this.z = a.z + b.z;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
- this.z += v.z * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
- this.z -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
- this.z = a.z - b.z;
-
- return this;
-
- }
-
- multiply( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );
- return this.multiplyVectors( v, w );
-
- }
-
- this.x *= v.x;
- this.y *= v.y;
- this.z *= v.z;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
- this.z *= scalar;
-
- return this;
-
- }
-
- multiplyVectors( a, b ) {
-
- this.x = a.x * b.x;
- this.y = a.y * b.y;
- this.z = a.z * b.z;
-
- return this;
-
- }
-
- applyEuler( euler ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' );
-
- }
-
- return this.applyQuaternion( _quaternion.setFromEuler( euler ) );
-
- }
-
- applyAxisAngle( axis, angle ) {
-
- return this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) );
-
- }
-
- applyMatrix3( m ) {
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;
- this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;
- this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;
-
- return this;
-
- }
-
- applyNormalMatrix( m ) {
-
- return this.applyMatrix3( m ).normalize();
-
- }
-
- applyMatrix4( m ) {
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- const w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );
-
- this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;
- this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;
- this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;
-
- return this;
-
- }
-
- applyQuaternion( q ) {
-
- const x = this.x, y = this.y, z = this.z;
- const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
-
- // calculate quat * vector
-
- const ix = qw * x + qy * z - qz * y;
- const iy = qw * y + qz * x - qx * z;
- const iz = qw * z + qx * y - qy * x;
- const iw = - qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
-
- this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;
- this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;
- this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;
-
- return this;
-
- }
-
- project( camera ) {
-
- return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );
-
- }
-
- unproject( camera ) {
-
- return this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );
-
- }
-
- transformDirection( m ) {
-
- // input: THREE.Matrix4 affine matrix
- // vector interpreted as a direction
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;
- this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;
- this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;
-
- return this.normalize();
-
- }
-
- divide( v ) {
-
- this.x /= v.x;
- this.y /= v.y;
- this.z /= v.z;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
- this.z = Math.min( this.z, v.z );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
- this.z = Math.max( this.z, v.z );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
- this.z = Math.floor( this.z );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
- this.z = Math.ceil( this.z );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
- this.z = Math.round( this.z );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
- this.z = - this.z;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y + this.z * v.z;
-
- }
-
- // TODO lengthSquared?
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y + this.z * this.z;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
- this.z += ( v.z - this.z ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
- this.z = v1.z + ( v2.z - v1.z ) * alpha;
-
- return this;
-
- }
-
- cross( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );
- return this.crossVectors( v, w );
-
- }
-
- return this.crossVectors( this, v );
-
- }
-
- crossVectors( a, b ) {
-
- const ax = a.x, ay = a.y, az = a.z;
- const bx = b.x, by = b.y, bz = b.z;
-
- this.x = ay * bz - az * by;
- this.y = az * bx - ax * bz;
- this.z = ax * by - ay * bx;
-
- return this;
-
- }
-
- projectOnVector( v ) {
-
- const denominator = v.lengthSq();
-
- if ( denominator === 0 ) return this.set( 0, 0, 0 );
-
- const scalar = v.dot( this ) / denominator;
-
- return this.copy( v ).multiplyScalar( scalar );
-
- }
-
- projectOnPlane( planeNormal ) {
-
- _vector.copy( this ).projectOnVector( planeNormal );
-
- return this.sub( _vector );
-
- }
-
- reflect( normal ) {
-
- // reflect incident vector off plane orthogonal to normal
- // normal is assumed to have unit length
-
- return this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
-
- }
-
- angleTo( v ) {
-
- const denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );
-
- if ( denominator === 0 ) return Math.PI / 2;
-
- const theta = this.dot( v ) / denominator;
-
- // clamp, to handle numerical problems
-
- return Math.acos( MathUtils.clamp( theta, - 1, 1 ) );
-
- }
-
- distanceTo( v ) {
-
- return Math.sqrt( this.distanceToSquared( v ) );
-
- }
-
- distanceToSquared( v ) {
-
- const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
-
- return dx * dx + dy * dy + dz * dz;
-
- }
-
- manhattanDistanceTo( v ) {
-
- return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );
-
- }
-
- setFromSpherical( s ) {
-
- return this.setFromSphericalCoords( s.radius, s.phi, s.theta );
-
- }
-
- setFromSphericalCoords( radius, phi, theta ) {
-
- const sinPhiRadius = Math.sin( phi ) * radius;
-
- this.x = sinPhiRadius * Math.sin( theta );
- this.y = Math.cos( phi ) * radius;
- this.z = sinPhiRadius * Math.cos( theta );
-
- return this;
-
- }
-
- setFromCylindrical( c ) {
-
- return this.setFromCylindricalCoords( c.radius, c.theta, c.y );
-
- }
-
- setFromCylindricalCoords( radius, theta, y ) {
-
- this.x = radius * Math.sin( theta );
- this.y = y;
- this.z = radius * Math.cos( theta );
-
- return this;
-
- }
-
- setFromMatrixPosition( m ) {
-
- const e = m.elements;
-
- this.x = e[ 12 ];
- this.y = e[ 13 ];
- this.z = e[ 14 ];
-
- return this;
-
- }
-
- setFromMatrixScale( m ) {
-
- const sx = this.setFromMatrixColumn( m, 0 ).length();
- const sy = this.setFromMatrixColumn( m, 1 ).length();
- const sz = this.setFromMatrixColumn( m, 2 ).length();
-
- this.x = sx;
- this.y = sy;
- this.z = sz;
-
- return this;
-
- }
-
- setFromMatrixColumn( m, index ) {
-
- return this.fromArray( m.elements, index * 4 );
-
- }
-
- setFromMatrix3Column( m, index ) {
-
- return this.fromArray( m.elements, index * 3 );
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
- this.z = array[ offset + 2 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
- array[ offset + 2 ] = this.z;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
- this.z = attribute.getZ( index );
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
- this.z = Math.random();
-
- return this;
-
- }
-
- randomDirection() {
-
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
-
- const u = ( Math.random() - 0.5 ) * 2;
- const t = Math.random() * Math.PI * 2;
- const f = Math.sqrt( 1 - u ** 2 );
-
- this.x = f * Math.cos( t );
- this.y = f * Math.sin( t );
- this.z = u;
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
- yield this.z;
-
- }
-
-}
-
-Vector3.prototype.isVector3 = true;
-
-const _vector = /*@__PURE__*/ new Vector3();
-const _quaternion = /*@__PURE__*/ new Quaternion();
-
-export { Vector3 };
diff --git a/GameDev/bin/Release/project_template/math/Vector4.js b/GameDev/bin/Release/project_template/math/Vector4.js
deleted file mode 100644
index c9af047a..00000000
--- a/GameDev/bin/Release/project_template/math/Vector4.js
+++ /dev/null
@@ -1,664 +0,0 @@
-class Vector4 {
-
- constructor( x = 0, y = 0, z = 0, w = 1 ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
-
- }
-
- get width() {
-
- return this.z;
-
- }
-
- set width( value ) {
-
- this.z = value;
-
- }
-
- get height() {
-
- return this.w;
-
- }
-
- set height( value ) {
-
- this.w = value;
-
- }
-
- set( x, y, z, w ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
- this.z = scalar;
- this.w = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setZ( z ) {
-
- this.z = z;
-
- return this;
-
- }
-
- setW( w ) {
-
- this.w = w;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- case 2: this.z = value; break;
- case 3: this.w = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- 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: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y, this.z, this.w );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
- this.z = v.z;
- this.w = ( v.w !== undefined ) ? v.w : 1;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
- this.z += v.z;
- this.w += v.w;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
- this.z += s;
- this.w += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
- this.z = a.z + b.z;
- this.w = a.w + b.w;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
- this.z += v.z * s;
- this.w += v.w * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z;
- this.w -= v.w;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
- this.z -= s;
- this.w -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
- this.z = a.z - b.z;
- this.w = a.w - b.w;
-
- return this;
-
- }
-
- multiply( v ) {
-
- this.x *= v.x;
- this.y *= v.y;
- this.z *= v.z;
- this.w *= v.w;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
- this.z *= scalar;
- this.w *= scalar;
-
- return this;
-
- }
-
- applyMatrix4( m ) {
-
- const x = this.x, y = this.y, z = this.z, w = this.w;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;
- this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;
- this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;
- this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- setAxisAngleFromQuaternion( q ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
-
- // q is assumed to be normalized
-
- this.w = 2 * Math.acos( q.w );
-
- const s = Math.sqrt( 1 - q.w * q.w );
-
- if ( s < 0.0001 ) {
-
- this.x = 1;
- this.y = 0;
- this.z = 0;
-
- } else {
-
- this.x = q.x / s;
- this.y = q.y / s;
- this.z = q.z / s;
-
- }
-
- return this;
-
- }
-
- setAxisAngleFromRotationMatrix( m ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- let angle, x, y, z; // variables for result
- const epsilon = 0.01, // margin to allow for rounding errors
- epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees
-
- te = m.elements,
-
- m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],
- m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],
- m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
-
- if ( ( Math.abs( m12 - m21 ) < epsilon ) &&
- ( Math.abs( m13 - m31 ) < epsilon ) &&
- ( Math.abs( m23 - m32 ) < epsilon ) ) {
-
- // singularity found
- // first check for identity matrix which must have +1 for all terms
- // in leading diagonal and zero in other terms
-
- if ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&
- ( Math.abs( m13 + m31 ) < epsilon2 ) &&
- ( Math.abs( m23 + m32 ) < epsilon2 ) &&
- ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {
-
- // this singularity is identity matrix so angle = 0
-
- this.set( 1, 0, 0, 0 );
-
- return this; // zero angle, arbitrary axis
-
- }
-
- // otherwise this singularity is angle = 180
-
- angle = Math.PI;
-
- const xx = ( m11 + 1 ) / 2;
- const yy = ( m22 + 1 ) / 2;
- const zz = ( m33 + 1 ) / 2;
- const xy = ( m12 + m21 ) / 4;
- const xz = ( m13 + m31 ) / 4;
- const yz = ( m23 + m32 ) / 4;
-
- if ( ( xx > yy ) && ( xx > zz ) ) {
-
- // m11 is the largest diagonal term
-
- if ( xx < epsilon ) {
-
- x = 0;
- y = 0.707106781;
- z = 0.707106781;
-
- } else {
-
- x = Math.sqrt( xx );
- y = xy / x;
- z = xz / x;
-
- }
-
- } else if ( yy > zz ) {
-
- // m22 is the largest diagonal term
-
- if ( yy < epsilon ) {
-
- x = 0.707106781;
- y = 0;
- z = 0.707106781;
-
- } else {
-
- y = Math.sqrt( yy );
- x = xy / y;
- z = yz / y;
-
- }
-
- } else {
-
- // m33 is the largest diagonal term so base result on this
-
- if ( zz < epsilon ) {
-
- x = 0.707106781;
- y = 0.707106781;
- z = 0;
-
- } else {
-
- z = Math.sqrt( zz );
- x = xz / z;
- y = yz / z;
-
- }
-
- }
-
- this.set( x, y, z, angle );
-
- return this; // return 180 deg rotation
-
- }
-
- // as we have reached here there are no singularities so we can handle normally
-
- let s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +
- ( m13 - m31 ) * ( m13 - m31 ) +
- ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize
-
- if ( Math.abs( s ) < 0.001 ) s = 1;
-
- // prevent divide by zero, should not happen if matrix is orthogonal and should be
- // caught by singularity test above, but I've left it in just in case
-
- this.x = ( m32 - m23 ) / s;
- this.y = ( m13 - m31 ) / s;
- this.z = ( m21 - m12 ) / s;
- this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );
-
- return this;
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
- this.z = Math.min( this.z, v.z );
- this.w = Math.min( this.w, v.w );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
- this.z = Math.max( this.z, v.z );
- this.w = Math.max( this.w, v.w );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
- this.w = Math.max( min.w, Math.min( max.w, this.w ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
- this.w = Math.max( minVal, Math.min( maxVal, this.w ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
- this.z = Math.floor( this.z );
- this.w = Math.floor( this.w );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
- this.z = Math.ceil( this.z );
- this.w = Math.ceil( this.w );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
- this.z = Math.round( this.z );
- this.w = Math.round( this.w );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
- this.z = - this.z;
- this.w = - this.w;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
-
- }
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
- this.z += ( v.z - this.z ) * alpha;
- this.w += ( v.w - this.w ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
- this.z = v1.z + ( v2.z - v1.z ) * alpha;
- this.w = v1.w + ( v2.w - v1.w ) * alpha;
-
- return this;
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
- this.z = array[ offset + 2 ];
- this.w = array[ offset + 3 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
- array[ offset + 2 ] = this.z;
- array[ offset + 3 ] = this.w;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
- this.z = attribute.getZ( index );
- this.w = attribute.getW( index );
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
- this.z = Math.random();
- this.w = Math.random();
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
- yield this.z;
- yield this.w;
-
- }
-
-}
-
-Vector4.prototype.isVector4 = true;
-
-export { Vector4 };
diff --git a/GameDev/bin/Release/project_template/math/interpolants/CubicInterpolant.js b/GameDev/bin/Release/project_template/math/interpolants/CubicInterpolant.js
deleted file mode 100644
index 3484dbfa..00000000
--- a/GameDev/bin/Release/project_template/math/interpolants/CubicInterpolant.js
+++ /dev/null
@@ -1,151 +0,0 @@
-import { ZeroCurvatureEnding } from '../../constants.js';
-import { Interpolant } from '../Interpolant.js';
-import { WrapAroundEnding, ZeroSlopeEnding } from '../../constants.js';
-
-/**
- * Fast and simple cubic spline interpolant.
- *
- * It was derived from a Hermitian construction setting the first derivative
- * at each sample position to the linear slope between neighboring positions
- * over their parameter interval.
- */
-
-class CubicInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- this._weightPrev = - 0;
- this._offsetPrev = - 0;
- this._weightNext = - 0;
- this._offsetNext = - 0;
-
- this.DefaultSettings_ = {
-
- endingStart: ZeroCurvatureEnding,
- endingEnd: ZeroCurvatureEnding
-
- };
-
- }
-
- intervalChanged_( i1, t0, t1 ) {
-
- const pp = this.parameterPositions;
- let iPrev = i1 - 2,
- iNext = i1 + 1,
-
- tPrev = pp[ iPrev ],
- tNext = pp[ iNext ];
-
- if ( tPrev === undefined ) {
-
- switch ( this.getSettings_().endingStart ) {
-
- case ZeroSlopeEnding:
-
- // f'(t0) = 0
- iPrev = i1;
- tPrev = 2 * t0 - t1;
-
- break;
-
- case WrapAroundEnding:
-
- // use the other end of the curve
- iPrev = pp.length - 2;
- tPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];
-
- break;
-
- default: // ZeroCurvatureEnding
-
- // f''(t0) = 0 a.k.a. Natural Spline
- iPrev = i1;
- tPrev = t1;
-
- }
-
- }
-
- if ( tNext === undefined ) {
-
- switch ( this.getSettings_().endingEnd ) {
-
- case ZeroSlopeEnding:
-
- // f'(tN) = 0
- iNext = i1;
- tNext = 2 * t1 - t0;
-
- break;
-
- case WrapAroundEnding:
-
- // use the other end of the curve
- iNext = 1;
- tNext = t1 + pp[ 1 ] - pp[ 0 ];
-
- break;
-
- default: // ZeroCurvatureEnding
-
- // f''(tN) = 0, a.k.a. Natural Spline
- iNext = i1 - 1;
- tNext = t0;
-
- }
-
- }
-
- const halfDt = ( t1 - t0 ) * 0.5,
- stride = this.valueSize;
-
- this._weightPrev = halfDt / ( t0 - tPrev );
- this._weightNext = halfDt / ( tNext - t1 );
- this._offsetPrev = iPrev * stride;
- this._offsetNext = iNext * stride;
-
- }
-
- interpolate_( i1, t0, t, t1 ) {
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
-
- o1 = i1 * stride, o0 = o1 - stride,
- oP = this._offsetPrev, oN = this._offsetNext,
- wP = this._weightPrev, wN = this._weightNext,
-
- p = ( t - t0 ) / ( t1 - t0 ),
- pp = p * p,
- ppp = pp * p;
-
- // evaluate polynomials
-
- const sP = - wP * ppp + 2 * wP * pp - wP * p;
- const s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;
- const s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;
- const sN = wN * ppp - wN * pp;
-
- // combine data linearly
-
- for ( let i = 0; i !== stride; ++ i ) {
-
- result[ i ] =
- sP * values[ oP + i ] +
- s0 * values[ o0 + i ] +
- s1 * values[ o1 + i ] +
- sN * values[ oN + i ];
-
- }
-
- return result;
-
- }
-
-}
-
-export { CubicInterpolant };
diff --git a/GameDev/bin/Release/project_template/math/interpolants/DiscreteInterpolant.js b/GameDev/bin/Release/project_template/math/interpolants/DiscreteInterpolant.js
deleted file mode 100644
index 38ff2702..00000000
--- a/GameDev/bin/Release/project_template/math/interpolants/DiscreteInterpolant.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Interpolant } from '../Interpolant.js';
-
-/**
- *
- * Interpolant that evaluates to the sample value at the position preceeding
- * the parameter.
- */
-
-class DiscreteInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- }
-
- interpolate_( i1 /*, t0, t, t1 */ ) {
-
- return this.copySampleValue_( i1 - 1 );
-
- }
-
-}
-
-
-export { DiscreteInterpolant };
diff --git a/GameDev/bin/Release/project_template/math/interpolants/LinearInterpolant.js b/GameDev/bin/Release/project_template/math/interpolants/LinearInterpolant.js
deleted file mode 100644
index dae736e2..00000000
--- a/GameDev/bin/Release/project_template/math/interpolants/LinearInterpolant.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Interpolant } from '../Interpolant.js';
-
-class LinearInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- }
-
- interpolate_( i1, t0, t, t1 ) {
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
-
- offset1 = i1 * stride,
- offset0 = offset1 - stride,
-
- weight1 = ( t - t0 ) / ( t1 - t0 ),
- weight0 = 1 - weight1;
-
- for ( let i = 0; i !== stride; ++ i ) {
-
- result[ i ] =
- values[ offset0 + i ] * weight0 +
- values[ offset1 + i ] * weight1;
-
- }
-
- return result;
-
- }
-
-}
-
-
-export { LinearInterpolant };
diff --git a/GameDev/bin/Release/project_template/math/interpolants/QuaternionLinearInterpolant.js b/GameDev/bin/Release/project_template/math/interpolants/QuaternionLinearInterpolant.js
deleted file mode 100644
index 3b8bd4f2..00000000
--- a/GameDev/bin/Release/project_template/math/interpolants/QuaternionLinearInterpolant.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import { Interpolant } from '../Interpolant.js';
-import { Quaternion } from '../Quaternion.js';
-
-/**
- * Spherical linear unit quaternion interpolant.
- */
-
-class QuaternionLinearInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- }
-
- interpolate_( i1, t0, t, t1 ) {
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
-
- alpha = ( t - t0 ) / ( t1 - t0 );
-
- let offset = i1 * stride;
-
- for ( let end = offset + stride; offset !== end; offset += 4 ) {
-
- Quaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );
-
- }
-
- return result;
-
- }
-
-}
-
-
-export { QuaternionLinearInterpolant };
diff --git a/GameDev/bin/Release/project_template/project.json b/GameDev/bin/Release/project_template/project.json
deleted file mode 100644
index 06493ab8..00000000
--- a/GameDev/bin/Release/project_template/project.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "project_name": "xml_based",
- "targets": [
- {
- "name": "target",
- "input": "index.js",
- "output": "bundle_index.js",
- "dirty": true
- }
- ]
-}
\ No newline at end of file
diff --git a/GameDev/bin/Release/project_template/scene.js b/GameDev/bin/Release/project_template/scene.js
deleted file mode 100644
index b6af3ec7..00000000
--- a/GameDev/bin/Release/project_template/scene.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export async function load(doc)
-{
- doc.load_local_xml("scene.xml");
-}
-
diff --git a/GameDev/bin/Release/project_template/scene.xml b/GameDev/bin/Release/project_template/scene.xml
deleted file mode 100644
index 476de974..00000000
--- a/GameDev/bin/Release/project_template/scene.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/GameDev/bin/Release/project_template/txml.js b/GameDev/bin/Release/project_template/txml.js
deleted file mode 100644
index e1a81018..00000000
--- a/GameDev/bin/Release/project_template/txml.js
+++ /dev/null
@@ -1,482 +0,0 @@
-'use strict';
-
-// ==ClosureCompiler==
-// @output_file_name default.js
-// @compilation_level SIMPLE_OPTIMIZATIONS
-// ==/ClosureCompiler==
-// module.exports = {
-// parse: parse,
-// simplify: simplify,
-// simplifyLostLess: simplifyLostLess,
-// filter: filter,
-// stringify: stringify,
-// toContentString: toContentString,
-// getElementById: getElementById,
-// getElementsByClassName: getElementsByClassName,
-// transformStream: transformStream,
-// };
-
-/**
- * @author: Tobias Nickel
- * @created: 06.04.2015
- * I needed a small xmlparser chat can be used in a worker.
- */
-
-/**
- * @typedef tNode
- * @property {string} tagName
- * @property {object} attributes
- * @property {(tNode|string)[]} children
- **/
-
-/**
- * @typedef TParseOptions
- * @property {number} [pos]
- * @property {string[]} [noChildNodes]
- * @property {boolean} [setPos]
- * @property {boolean} [keepComments]
- * @property {boolean} [keepWhitespace]
- * @property {boolean} [simplify]
- * @property {(a: tNode, b: tNode) => boolean} [filter]
- */
-
-/**
- * parseXML / html into a DOM Object. with no validation and some failur tolerance
- * @param {string} S your XML to parse
- * @param {TParseOptions} [options] all other options:
- * @return {(tNode | string)[]}
- */
-function parse(S, options) {
- "txml";
- options = options || {};
-
- var pos = options.pos || 0;
- var keepComments = !!options.keepComments;
- var keepWhitespace = !!options.keepWhitespace;
-
- var openBracket = "<";
- var openBracketCC = "<".charCodeAt(0);
- var closeBracket = ">";
- var closeBracketCC = ">".charCodeAt(0);
- var minusCC = "-".charCodeAt(0);
- var slashCC = "/".charCodeAt(0);
- var exclamationCC = '!'.charCodeAt(0);
- var singleQuoteCC = "'".charCodeAt(0);
- var doubleQuoteCC = '"'.charCodeAt(0);
- var openCornerBracketCC = '['.charCodeAt(0);
- var closeCornerBracketCC = ']'.charCodeAt(0);
-
-
- /**
- * parsing a list of entries
- */
- function parseChildren(tagName) {
- var children = [];
- while (S[pos]) {
- if (S.charCodeAt(pos) == openBracketCC) {
- if (S.charCodeAt(pos + 1) === slashCC) {
- var closeStart = pos + 2;
- pos = S.indexOf(closeBracket, pos);
-
- var closeTag = S.substring(closeStart, pos);
- if (closeTag.indexOf(tagName) == -1) {
- var parsedText = S.substring(0, pos).split('\n');
- throw new Error(
- 'Unexpected close tag\nLine: ' + (parsedText.length - 1) +
- '\nColumn: ' + (parsedText[parsedText.length - 1].length + 1) +
- '\nChar: ' + S[pos]
- );
- }
-
- if (pos + 1) pos += 1;
-
- return children;
- } else if (S.charCodeAt(pos + 1) === exclamationCC) {
- if (S.charCodeAt(pos + 2) == minusCC) {
- //comment support
- const startCommentPos = pos;
- while (pos !== -1 && !(S.charCodeAt(pos) === closeBracketCC && S.charCodeAt(pos - 1) == minusCC && S.charCodeAt(pos - 2) == minusCC && pos != -1)) {
- pos = S.indexOf(closeBracket, pos + 1);
- }
- if (pos === -1) {
- pos = S.length;
- }
- if (keepComments) {
- children.push(S.substring(startCommentPos, pos + 1));
- }
- } else if (
- S.charCodeAt(pos + 2) === openCornerBracketCC &&
- S.charCodeAt(pos + 8) === openCornerBracketCC &&
- S.substr(pos + 3, 5).toLowerCase() === 'cdata'
- ) {
- // cdata
- var cdataEndIndex = S.indexOf(']]>', pos);
- if (cdataEndIndex == -1) {
- children.push(S.substr(pos + 9));
- pos = S.length;
- } else {
- children.push(S.substring(pos + 9, cdataEndIndex));
- pos = cdataEndIndex + 3;
- }
- continue;
- } else {
- // doctypesupport
- const startDoctype = pos + 1;
- pos += 2;
- var encapsuled = false;
- while ((S.charCodeAt(pos) !== closeBracketCC || encapsuled === true) && S[pos]) {
- if (S.charCodeAt(pos) === openCornerBracketCC) {
- encapsuled = true;
- } else if (encapsuled === true && S.charCodeAt(pos) === closeCornerBracketCC) {
- encapsuled = false;
- }
- pos++;
- }
- children.push(S.substring(startDoctype, pos));
- }
- pos++;
- continue;
- }
- var node = parseNode();
- children.push(node);
- if (node.tagName[0] === '?') {
- children.push(...node.children);
- node.children = [];
- }
- } else {
- var text = parseText();
- if (keepWhitespace) {
- if (text.length > 0) {
- children.push(text);
- }
- } else {
- var trimmed = text.trim();
- if (trimmed.length > 0) {
- children.push(trimmed);
- }
- }
- pos++;
- }
- }
- return children;
- }
-
- /**
- * returns the text outside of texts until the first '<'
- */
- function parseText() {
- var start = pos;
- pos = S.indexOf(openBracket, pos) - 1;
- if (pos === -2)
- pos = S.length;
- return S.slice(start, pos + 1);
- }
- /**
- * returns text until the first nonAlphabetic letter
- */
- var nameSpacer = '\r\n\t>/= ';
-
- function parseName() {
- var start = pos;
- while (nameSpacer.indexOf(S[pos]) === -1 && S[pos]) {
- pos++;
- }
- return S.slice(start, pos);
- }
- /**
- * is parsing a node, including tagName, Attributes and its children,
- * to parse children it uses the parseChildren again, that makes the parsing recursive
- */
- var NoChildNodes = options.noChildNodes || ['img', 'br', 'input', 'meta', 'link', 'hr'];
-
- function parseNode() {
- pos++;
- const tagName = parseName();
- const attributes = {};
- let children = [];
-
- // parsing attributes
- while (S.charCodeAt(pos) !== closeBracketCC && S[pos]) {
- var c = S.charCodeAt(pos);
- if ((c > 64 && c < 91) || (c > 96 && c < 123)) {
- //if('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(S[pos])!==-1 ){
- var name = parseName();
- // search beginning of the string
- var code = S.charCodeAt(pos);
- while (code && code !== singleQuoteCC && code !== doubleQuoteCC && !((code > 64 && code < 91) || (code > 96 && code < 123)) && code !== closeBracketCC) {
- pos++;
- code = S.charCodeAt(pos);
- }
- if (code === singleQuoteCC || code === doubleQuoteCC) {
- var value = parseString();
- if (pos === -1) {
- return {
- tagName,
- attributes,
- children,
- };
- }
- } else {
- value = null;
- pos--;
- }
- attributes[name] = value;
- }
- pos++;
- }
- // optional parsing of children
- if (S.charCodeAt(pos - 1) !== slashCC) {
- if (tagName == "script") {
- var start = pos + 1;
- pos = S.indexOf('', pos);
- children = [S.slice(start, pos)];
- pos += 9;
- } else if (tagName == "style") {
- var start = pos + 1;
- pos = S.indexOf('', pos);
- children = [S.slice(start, pos)];
- pos += 8;
- } else if (NoChildNodes.indexOf(tagName) === -1) {
- pos++;
- children = parseChildren(tagName);
- } else {
- pos++;
- }
- } else {
- pos++;
- }
- return {
- tagName,
- attributes,
- children,
- };
- }
-
- /**
- * is parsing a string, that starts with a char and with the same usually ' or "
- */
-
- function parseString() {
- var startChar = S[pos];
- var startpos = pos + 1;
- pos = S.indexOf(startChar, startpos);
- return S.slice(startpos, pos);
- }
-
- /**
- *
- */
- function findElements() {
- var r = new RegExp('\\s' + options.attrName + '\\s*=[\'"]' + options.attrValue + '[\'"]').exec(S);
- if (r) {
- return r.index;
- } else {
- return -1;
- }
- }
-
- var out = null;
- if (options.attrValue !== undefined) {
- options.attrName = options.attrName || 'id';
- var out = [];
-
- while ((pos = findElements()) !== -1) {
- pos = S.lastIndexOf('<', pos);
- if (pos !== -1) {
- out.push(parseNode());
- }
- S = S.substr(pos);
- pos = 0;
- }
- } else if (options.parseNode) {
- out = parseNode();
- } else {
- out = parseChildren('');
- }
-
- if (options.filter) {
- out = filter(out, options.filter);
- }
-
- if (options.simplify) {
- return simplify(Array.isArray(out) ? out : [out]);
- }
-
- if (options.setPos) {
- out.pos = pos;
- }
-
- return out;
-}
-
-/**
- * transform the DomObject to an object that is like the object of PHP`s simple_xmp_load_*() methods.
- * this format helps you to write that is more likely to keep your program working, even if there a small changes in the XML schema.
- * be aware, that it is not possible to reproduce the original xml from a simplified version, because the order of elements is not saved.
- * therefore your program will be more flexible and easier to read.
- *
- * @param {tNode[]} children the childrenList
- */
-function simplify(children) {
- var out = {};
- if (!children.length) {
- return '';
- }
-
- if (children.length === 1 && typeof children[0] == 'string') {
- return children[0];
- }
- // map each object
- children.forEach(function(child) {
- if (typeof child !== 'object') {
- return;
- }
- if (!out[child.tagName])
- out[child.tagName] = [];
- var kids = simplify(child.children);
- out[child.tagName].push(kids);
- if (Object.keys(child.attributes).length && typeof kids !== 'string') {
- kids._attributes = child.attributes;
- }
- });
-
- for (var i in out) {
- if (out[i].length == 1) {
- out[i] = out[i][0];
- }
- }
-
- return out;
-}
-
-/**
- * similar to simplify, but lost less
- *
- * @param {tNode[]} children the childrenList
- */
-function simplifyLostLess(children, parentAttributes = {}) {
- var out = {};
- if (!children.length) {
- return out;
- }
-
- if (children.length === 1 && typeof children[0] == 'string') {
- return Object.keys(parentAttributes).length ? {
- _attributes: parentAttributes,
- value: children[0]
- } : children[0];
- }
- // map each object
- children.forEach(function(child) {
- if (typeof child !== 'object') {
- return;
- }
- if (!out[child.tagName])
- out[child.tagName] = [];
- var kids = simplifyLostLess(child.children || [], child.attributes);
- out[child.tagName].push(kids);
- if (Object.keys(child.attributes).length) {
- kids._attributes = child.attributes;
- }
- });
-
- return out;
-}
-/**
- * behaves the same way as Array.filter, if the filter method return true, the element is in the resultList
- * @params children{Array} the children of a node
- * @param f{function} the filter method
- */
-function filter(children, f, dept = 0, path = '') {
- var out = [];
- children.forEach(function(child, i) {
- if (typeof(child) === 'object' && f(child, i, dept, path)) out.push(child);
- if (child.children) {
- var kids = filter(child.children, f, dept + 1, (path ? path + '.' : '') + i + '.' + child.tagName);
- out = out.concat(kids);
- }
- });
- return out;
-}
-/**
- * stringify a previously parsed string object.
- * this is useful,
- * 1. to remove whitespace
- * 2. to recreate xml data, with some changed data.
- * @param {tNode} O the object to Stringify
- */
-function stringify(O) {
- var out = '';
-
- function writeChildren(O) {
- if (O) {
- for (var i = 0; i < O.length; i++) {
- if (typeof O[i] == 'string') {
- out += O[i].trim();
- } else {
- writeNode(O[i]);
- }
- }
- }
- }
-
- function writeNode(N) {
- out += "<" + N.tagName;
- for (var i in N.attributes) {
- if (N.attributes[i] === null) {
- out += ' ' + i;
- } else if (N.attributes[i].indexOf('"') === -1) {
- out += ' ' + i + '="' + N.attributes[i].trim() + '"';
- } else {
- out += ' ' + i + "='" + N.attributes[i].trim() + "'";
- }
- }
- if (N.tagName[0] === '?') {
- out += '?>';
- return;
- }
- out += '>';
- writeChildren(N.children);
- out += '' + N.tagName + '>';
- }
- writeChildren(O);
-
- return out;
-}
-
-/**
- * use this method to read the text content, of some node.
- * It is great if you have mixed content like:
- * this text has some big text and a link
- * @return {string}
- */
-function toContentString(tDom) {
- if (Array.isArray(tDom)) {
- var out = '';
- tDom.forEach(function(e) {
- out += ' ' + toContentString(e);
- out = out.trim();
- });
- return out;
- } else if (typeof tDom === 'object') {
- return toContentString(tDom.children)
- } else {
- return ' ' + tDom;
- }
-}
-function getElementById(S, id, simplified) {
- var out = parse(S, {
- attrValue: id
- });
- return simplified ? tXml.simplify(out) : out[0];
-}
-function getElementsByClassName(S, classname, simplified) {
- const out = parse(S, {
- attrName: 'class',
- attrValue: '[a-zA-Z0-9- ]*' + classname + '[a-zA-Z0-9- ]*'
- });
- return simplified ? tXml.simplify(out) : out;
-}
-
-export { filter, getElementById, getElementsByClassName, parse, simplify, simplifyLostLess, stringify, toContentString };
-
diff --git a/GameDev/bin/Release/project_template/utils/Clock.js b/GameDev/bin/Release/project_template/utils/Clock.js
deleted file mode 100644
index 94cae91e..00000000
--- a/GameDev/bin/Release/project_template/utils/Clock.js
+++ /dev/null
@@ -1,68 +0,0 @@
-class Clock {
-
- constructor( autoStart = true ) {
-
- this.autoStart = autoStart;
-
- this.startTime = 0;
- this.oldTime = 0;
- this.elapsedTime = 0;
-
- this.running = false;
-
- }
-
- start() {
-
- this.startTime = now();
-
- this.oldTime = this.startTime;
- this.elapsedTime = 0;
- this.running = true;
-
- }
-
- stop() {
-
- this.getElapsedTime();
- this.running = false;
- this.autoStart = false;
-
- }
-
- getElapsedTime() {
-
- this.getDelta();
- return this.elapsedTime;
-
- }
-
- getDelta() {
-
- let diff = 0;
-
- if ( this.autoStart && ! this.running ) {
-
- this.start();
- return 0;
-
- }
-
- if ( this.running ) {
-
- const newTime = now();
-
- diff = ( newTime - this.oldTime ) / 1000;
- this.oldTime = newTime;
-
- this.elapsedTime += diff;
-
- }
-
- return diff;
-
- }
-
-}
-
-export { Clock };
diff --git a/GameDev/bin/Release/project_template/view.js b/GameDev/bin/Release/project_template/view.js
deleted file mode 100644
index 6f179efb..00000000
--- a/GameDev/bin/Release/project_template/view.js
+++ /dev/null
@@ -1,155 +0,0 @@
-import { EventDispatcher } from "./controls/EventDispatcher.js";
-
-class View extends EventDispatcher {
-
- get clientWidth() {
- return gamePlayer.width;
- }
-
- get clientHeight() {
- return gamePlayer.height;
- }
-
- setPointerCapture() {
- gamePlayer.message("setPointerCapture", "");
- }
-
- releasePointerCapture() {
- gamePlayer.message("releasePointerCapture", "");
- }
-}
-
-const view = new View();
-
-function makeMouseEvent(e, type) {
- let event = {
- type: type,
- pointerType: "mouse",
- pointerId: 0,
- clientX: e.x,
- clientY: e.y,
- deltaY: e.delta,
- button: e.button
- };
-
- return event;
-}
-
-function OnMouseDown(e) {
- let event = makeMouseEvent(e, "pointerdown");
- view.dispatchEvent(event);
-}
-
-function OnMouseUp(e) {
- let event = makeMouseEvent(e, "pointerup");
- view.dispatchEvent(event);
-}
-
-function OnMouseMove(e) {
- let event = makeMouseEvent(e, "pointermove");
- view.dispatchEvent(event);
-}
-
-function OnMouseWheel(e) {
- let event = makeMouseEvent(e, "wheel");
- view.dispatchEvent(event);
-}
-
-setCallback('OnMouseDown', OnMouseDown);
-setCallback('OnMouseUp', OnMouseUp);
-setCallback('OnMouseMove', OnMouseMove);
-setCallback('OnMouseWheel', OnMouseWheel);
-
-
-function makeTouchEvent(e, type) {
- let event = {
- type: type,
- pointerType: "touch",
- pointerId: e.pointerId,
- pageX: e.x,
- pageY: e.y,
- deltaY: 0,
- button: -1
- };
-
- return event;
-}
-
-function OnTouchDown(e) {
- let event = makeTouchEvent(e, "pointerdown");
- view.dispatchEvent(event);
-}
-
-function OnTouchUp(e) {
- let event = makeTouchEvent(e, "pointerup");
- view.dispatchEvent(event);
-}
-
-function OnTouchMove(e) {
- let event = makeTouchEvent(e, "pointermove");
- view.dispatchEvent(event);
-}
-
-setCallback('OnTouchDown', OnTouchDown);
-setCallback('OnTouchUp', OnTouchUp);
-setCallback('OnTouchMove', OnTouchMove);
-
-
-class UIViewDispatcher extends EventDispatcher {
-
- constructor(view3d){
- super();
- this.view = view3d;
- view3d.onMouseDown = (e)=>{
- let event = makeMouseEvent(e, "pointerdown");
- this.dispatchEvent(event);
- };
- view3d.onMouseUp = (e)=>{
- let event = makeMouseEvent(e, "pointerup");
- this.dispatchEvent(event);
- };
- view3d.onMouseMove = (e)=>{
- let event = makeMouseEvent(e, "pointermove");
- this.dispatchEvent(event);
- };
- view3d.onMouseWheel = (e)=>{
- let event = makeMouseEvent(e, "wheel");
- this.dispatchEvent(event);
- };
- view3d.onTouchDown = (e)=>{
- let event = makeTouchEvent(e, "pointerdown");
- print(JSON.stringify(event));
- this.dispatchEvent(event);
- }
- view3d.onTouchUp = (e)=>{
- let event = makeTouchEvent(e, "pointerup");
- print(JSON.stringify(event));
- this.dispatchEvent(event);
- }
- view3d.onTouchMove = (e)=>{
- let event = makeTouchEvent(e, "pointermove");
- print(JSON.stringify(event));
- this.dispatchEvent(event);
- }
- }
-
- get clientWidth() {
- return this.view.size.x;
- }
-
- get clientHeight() {
- return this.view.size.y;
- }
-
- setPointerCapture() {
- gamePlayer.message("setPointerCapture", "");
- }
-
- releasePointerCapture() {
- gamePlayer.message("releasePointerCapture", "");
- }
-}
-
-
-export { view, UIViewDispatcher };
-
diff --git a/GameDev/bin/Release/swresample-3.dll b/GameDev/bin/Release/swresample-3.dll
deleted file mode 100644
index b2492ed0..00000000
Binary files a/GameDev/bin/Release/swresample-3.dll and /dev/null differ
diff --git a/GameDev/bin/Release/swscale-5.dll b/GameDev/bin/Release/swscale-5.dll
deleted file mode 100644
index 3315062c..00000000
Binary files a/GameDev/bin/Release/swscale-5.dll and /dev/null differ
diff --git a/GameDev/bin/Release/v8.dll b/GameDev/bin/Release/v8.dll
deleted file mode 100644
index 7737c6ae..00000000
Binary files a/GameDev/bin/Release/v8.dll and /dev/null differ
diff --git a/GameDev/bin/Release/v8_libbase.dll b/GameDev/bin/Release/v8_libbase.dll
deleted file mode 100644
index 419e0f91..00000000
Binary files a/GameDev/bin/Release/v8_libbase.dll and /dev/null differ
diff --git a/GameDev/bin/Release/v8_libplatform.dll b/GameDev/bin/Release/v8_libplatform.dll
deleted file mode 100644
index fb940ec9..00000000
Binary files a/GameDev/bin/Release/v8_libplatform.dll and /dev/null differ
diff --git a/GameDev/bin/Release/xmleditor/bundle_index.js b/GameDev/bin/Release/xmleditor/bundle_index.js
deleted file mode 100644
index 8d037b72..00000000
--- a/GameDev/bin/Release/xmleditor/bundle_index.js
+++ /dev/null
@@ -1,7898 +0,0 @@
-/**
- * https://github.com/mrdoob/eventdispatcher.js/
- */
-
-class EventDispatcher {
-
- addEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) this._listeners = {};
-
- const listeners = this._listeners;
-
- if ( listeners[ type ] === undefined ) {
-
- listeners[ type ] = [];
-
- }
-
- if ( listeners[ type ].indexOf( listener ) === - 1 ) {
-
- listeners[ type ].push( listener );
-
- }
-
- }
-
- hasEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) return false;
-
- const listeners = this._listeners;
-
- return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
-
- }
-
- removeEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) return;
-
- const listeners = this._listeners;
- const listenerArray = listeners[ type ];
-
- if ( listenerArray !== undefined ) {
-
- const index = listenerArray.indexOf( listener );
-
- if ( index !== - 1 ) {
-
- listenerArray.splice( index, 1 );
-
- }
-
- }
-
- }
-
- dispatchEvent( event ) {
- if ( this._listeners === undefined ) return;
-
- const listeners = this._listeners;
- const listenerArray = listeners[event.type];
-
- if ( listenerArray !== undefined ) {
-
- event.target = this;
-
- // Make a copy, in case listeners are removed while iterating.
- const array = listenerArray.slice( 0 );
-
- for ( let i = 0, l = array.length; i < l; i ++ ) {
-
- array[ i ].call( this, event );
-
- }
-
- event.target = null;
-
- }
-
- }
-
-}
-
-const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
-const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
-
-for ( let i = 0; i < 256; i ++ ) {
-
- ( i < 16 ? '0' : '' ) + ( i ).toString( 16 );
-
-}
-
-function clamp( value, min, max ) {
-
- return Math.max( min, Math.min( max, value ) );
-
-}
-
-class Quaternion {
-
- constructor( x = 0, y = 0, z = 0, w = 1 ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._w = w;
-
- }
-
- static slerp( qa, qb, qm, t ) {
-
- console.warn( 'THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.' );
- return qm.slerpQuaternions( qa, qb, t );
-
- }
-
- static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {
-
- // fuzz-free, array-based Quaternion SLERP operation
-
- let x0 = src0[ srcOffset0 + 0 ],
- y0 = src0[ srcOffset0 + 1 ],
- z0 = src0[ srcOffset0 + 2 ],
- w0 = src0[ srcOffset0 + 3 ];
-
- const x1 = src1[ srcOffset1 + 0 ],
- y1 = src1[ srcOffset1 + 1 ],
- z1 = src1[ srcOffset1 + 2 ],
- w1 = src1[ srcOffset1 + 3 ];
-
- if ( t === 0 ) {
-
- dst[ dstOffset + 0 ] = x0;
- dst[ dstOffset + 1 ] = y0;
- dst[ dstOffset + 2 ] = z0;
- dst[ dstOffset + 3 ] = w0;
- return;
-
- }
-
- if ( t === 1 ) {
-
- dst[ dstOffset + 0 ] = x1;
- dst[ dstOffset + 1 ] = y1;
- dst[ dstOffset + 2 ] = z1;
- dst[ dstOffset + 3 ] = w1;
- return;
-
- }
-
- if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {
-
- let s = 1 - t;
- const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
- dir = ( cos >= 0 ? 1 : - 1 ),
- sqrSin = 1 - cos * cos;
-
- // Skip the Slerp for tiny steps to avoid numeric problems:
- if ( sqrSin > Number.EPSILON ) {
-
- const sin = Math.sqrt( sqrSin ),
- len = Math.atan2( sin, cos * dir );
-
- s = Math.sin( s * len ) / sin;
- t = Math.sin( t * len ) / sin;
-
- }
-
- const tDir = t * dir;
-
- x0 = x0 * s + x1 * tDir;
- y0 = y0 * s + y1 * tDir;
- z0 = z0 * s + z1 * tDir;
- w0 = w0 * s + w1 * tDir;
-
- // Normalize in case we just did a lerp:
- if ( s === 1 - t ) {
-
- const f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );
-
- x0 *= f;
- y0 *= f;
- z0 *= f;
- w0 *= f;
-
- }
-
- }
-
- dst[ dstOffset ] = x0;
- dst[ dstOffset + 1 ] = y0;
- dst[ dstOffset + 2 ] = z0;
- dst[ dstOffset + 3 ] = w0;
-
- }
-
- static multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {
-
- const x0 = src0[ srcOffset0 ];
- const y0 = src0[ srcOffset0 + 1 ];
- const z0 = src0[ srcOffset0 + 2 ];
- const w0 = src0[ srcOffset0 + 3 ];
-
- const x1 = src1[ srcOffset1 ];
- const y1 = src1[ srcOffset1 + 1 ];
- const z1 = src1[ srcOffset1 + 2 ];
- const w1 = src1[ srcOffset1 + 3 ];
-
- dst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
- dst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
- dst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
- dst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;
-
- return dst;
-
- }
-
- get x() {
-
- return this._x;
-
- }
-
- set x( value ) {
-
- this._x = value;
- this._onChangeCallback();
-
- }
-
- get y() {
-
- return this._y;
-
- }
-
- set y( value ) {
-
- this._y = value;
- this._onChangeCallback();
-
- }
-
- get z() {
-
- return this._z;
-
- }
-
- set z( value ) {
-
- this._z = value;
- this._onChangeCallback();
-
- }
-
- get w() {
-
- return this._w;
-
- }
-
- set w( value ) {
-
- this._w = value;
- this._onChangeCallback();
-
- }
-
- set( x, y, z, w ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._w = w;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this._x, this._y, this._z, this._w );
-
- }
-
- copy( quaternion ) {
-
- this._x = quaternion.x;
- this._y = quaternion.y;
- this._z = quaternion.z;
- this._w = quaternion.w;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromEuler( euler, update ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- throw new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' );
-
- }
-
- const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
-
- // http://www.mathworks.com/matlabcentral/fileexchange/
- // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
- // content/SpinCalc.m
-
- const cos = Math.cos;
- const sin = Math.sin;
-
- const c1 = cos( x / 2 );
- const c2 = cos( y / 2 );
- const c3 = cos( z / 2 );
-
- const s1 = sin( x / 2 );
- const s2 = sin( y / 2 );
- const s3 = sin( z / 2 );
-
- switch ( order ) {
-
- case 'XYZ':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'YXZ':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- case 'ZXY':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'ZYX':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- case 'YZX':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'XZY':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- default:
- console.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );
-
- }
-
- if ( update !== false ) this._onChangeCallback();
-
- return this;
-
- }
-
- setFromAxisAngle( axis, angle ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
-
- // assumes axis is normalized
-
- const halfAngle = angle / 2, s = Math.sin( halfAngle );
-
- this._x = axis.x * s;
- this._y = axis.y * s;
- this._z = axis.z * s;
- this._w = Math.cos( halfAngle );
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromRotationMatrix( m ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- const te = m.elements,
-
- m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],
- m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],
- m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],
-
- trace = m11 + m22 + m33;
-
- if ( trace > 0 ) {
-
- const s = 0.5 / Math.sqrt( trace + 1.0 );
-
- this._w = 0.25 / s;
- this._x = ( m32 - m23 ) * s;
- this._y = ( m13 - m31 ) * s;
- this._z = ( m21 - m12 ) * s;
-
- } else if ( m11 > m22 && m11 > m33 ) {
-
- const s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );
-
- this._w = ( m32 - m23 ) / s;
- this._x = 0.25 * s;
- this._y = ( m12 + m21 ) / s;
- this._z = ( m13 + m31 ) / s;
-
- } else if ( m22 > m33 ) {
-
- const s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );
-
- this._w = ( m13 - m31 ) / s;
- this._x = ( m12 + m21 ) / s;
- this._y = 0.25 * s;
- this._z = ( m23 + m32 ) / s;
-
- } else {
-
- const s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );
-
- this._w = ( m21 - m12 ) / s;
- this._x = ( m13 + m31 ) / s;
- this._y = ( m23 + m32 ) / s;
- this._z = 0.25 * s;
-
- }
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromUnitVectors( vFrom, vTo ) {
-
- // assumes direction vectors vFrom and vTo are normalized
-
- let r = vFrom.dot( vTo ) + 1;
-
- if ( r < Number.EPSILON ) {
-
- // vFrom and vTo point in opposite directions
-
- r = 0;
-
- if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {
-
- this._x = - vFrom.y;
- this._y = vFrom.x;
- this._z = 0;
- this._w = r;
-
- } else {
-
- this._x = 0;
- this._y = - vFrom.z;
- this._z = vFrom.y;
- this._w = r;
-
- }
-
- } else {
-
- // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
-
- this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
- this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
- this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
- this._w = r;
-
- }
-
- return this.normalize();
-
- }
-
- angleTo( q ) {
-
- return 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );
-
- }
-
- rotateTowards( q, step ) {
-
- const angle = this.angleTo( q );
-
- if ( angle === 0 ) return this;
-
- const t = Math.min( 1, step / angle );
-
- this.slerp( q, t );
-
- return this;
-
- }
-
- identity() {
-
- return this.set( 0, 0, 0, 1 );
-
- }
-
- invert() {
-
- // quaternion is assumed to have unit length
-
- return this.conjugate();
-
- }
-
- conjugate() {
-
- this._x *= - 1;
- this._y *= - 1;
- this._z *= - 1;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- dot( v ) {
-
- return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;
-
- }
-
- lengthSq() {
-
- return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
-
- }
-
- length() {
-
- return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );
-
- }
-
- normalize() {
-
- let l = this.length();
-
- if ( l === 0 ) {
-
- this._x = 0;
- this._y = 0;
- this._z = 0;
- this._w = 1;
-
- } else {
-
- l = 1 / l;
-
- this._x = this._x * l;
- this._y = this._y * l;
- this._z = this._z * l;
- this._w = this._w * l;
-
- }
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- multiply( q, p ) {
-
- if ( p !== undefined ) {
-
- console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );
- return this.multiplyQuaternions( q, p );
-
- }
-
- return this.multiplyQuaternions( this, q );
-
- }
-
- premultiply( q ) {
-
- return this.multiplyQuaternions( q, this );
-
- }
-
- multiplyQuaternions( a, b ) {
-
- // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
-
- const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;
- const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;
-
- this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
- this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
- this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
- this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- slerp( qb, t ) {
-
- if ( t === 0 ) return this;
- if ( t === 1 ) return this.copy( qb );
-
- const x = this._x, y = this._y, z = this._z, w = this._w;
-
- // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
-
- let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
-
- if ( cosHalfTheta < 0 ) {
-
- this._w = - qb._w;
- this._x = - qb._x;
- this._y = - qb._y;
- this._z = - qb._z;
-
- cosHalfTheta = - cosHalfTheta;
-
- } else {
-
- this.copy( qb );
-
- }
-
- if ( cosHalfTheta >= 1.0 ) {
-
- this._w = w;
- this._x = x;
- this._y = y;
- this._z = z;
-
- return this;
-
- }
-
- const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
-
- if ( sqrSinHalfTheta <= Number.EPSILON ) {
-
- const s = 1 - t;
- this._w = s * w + t * this._w;
- this._x = s * x + t * this._x;
- this._y = s * y + t * this._y;
- this._z = s * z + t * this._z;
-
- this.normalize();
- this._onChangeCallback();
-
- return this;
-
- }
-
- const sinHalfTheta = Math.sqrt( sqrSinHalfTheta );
- const halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );
- const ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
- ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
-
- this._w = ( w * ratioA + this._w * ratioB );
- this._x = ( x * ratioA + this._x * ratioB );
- this._y = ( y * ratioA + this._y * ratioB );
- this._z = ( z * ratioA + this._z * ratioB );
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- slerpQuaternions( qa, qb, t ) {
-
- this.copy( qa ).slerp( qb, t );
-
- }
-
- random() {
-
- // Derived from http://planning.cs.uiuc.edu/node198.html
- // Note, this source uses w, x, y, z ordering,
- // so we swap the order below.
-
- const u1 = Math.random();
- const sqrt1u1 = Math.sqrt( 1 - u1 );
- const sqrtu1 = Math.sqrt( u1 );
-
- const u2 = 2 * Math.PI * Math.random();
-
- const u3 = 2 * Math.PI * Math.random();
-
- return this.set(
- sqrt1u1 * Math.cos( u2 ),
- sqrtu1 * Math.sin( u3 ),
- sqrtu1 * Math.cos( u3 ),
- sqrt1u1 * Math.sin( u2 ),
- );
-
- }
-
- equals( quaternion ) {
-
- return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this._x = array[ offset ];
- this._y = array[ offset + 1 ];
- this._z = array[ offset + 2 ];
- this._w = array[ offset + 3 ];
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this._x;
- array[ offset + 1 ] = this._y;
- array[ offset + 2 ] = this._z;
- array[ offset + 3 ] = this._w;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index ) {
-
- this._x = attribute.getX( index );
- this._y = attribute.getY( index );
- this._z = attribute.getZ( index );
- this._w = attribute.getW( index );
-
- return this;
-
- }
-
- _onChange( callback ) {
-
- this._onChangeCallback = callback;
-
- return this;
-
- }
-
- _onChangeCallback() {}
-
-}
-
-Quaternion.prototype.isQuaternion = true;
-
-/**
- * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
- *
- * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
- * The azimuthal angle (theta) is measured from the positive z-axis.
- */
-
-class Spherical {
-
- constructor( radius = 1, phi = 0, theta = 0 ) {
-
- this.radius = radius;
- this.phi = phi; // polar angle
- this.theta = theta; // azimuthal angle
-
- return this;
-
- }
-
- set( radius, phi, theta ) {
-
- this.radius = radius;
- this.phi = phi;
- this.theta = theta;
-
- return this;
-
- }
-
- copy( other ) {
-
- this.radius = other.radius;
- this.phi = other.phi;
- this.theta = other.theta;
-
- return this;
-
- }
-
- // restrict phi to be betwee EPS and PI-EPS
- makeSafe() {
-
- const EPS = 0.000001;
- this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
-
- return this;
-
- }
-
- setFromVector3( v ) {
-
- return this.setFromCartesianCoords( v.x, v.y, v.z );
-
- }
-
- setFromCartesianCoords( x, y, z ) {
-
- this.radius = Math.sqrt( x * x + y * y + z * z );
-
- if ( this.radius === 0 ) {
-
- this.theta = 0;
- this.phi = 0;
-
- } else {
-
- this.theta = Math.atan2( x, z );
- this.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );
-
- }
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-class Vector2 {
-
- constructor( x = 0, y = 0 ) {
-
- this.x = x;
- this.y = y;
-
- }
-
- get width() {
-
- return this.x;
-
- }
-
- set width( value ) {
-
- this.x = value;
-
- }
-
- get height() {
-
- return this.y;
-
- }
-
- set height( value ) {
-
- this.y = value;
-
- }
-
- set( x, y ) {
-
- this.x = x;
- this.y = y;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- case 0: return this.x;
- case 1: return this.y;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
-
- return this;
-
- }
-
- multiply( v ) {
-
- this.x *= v.x;
- this.y *= v.y;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
-
- return this;
-
- }
-
- divide( v ) {
-
- this.x /= v.x;
- this.y /= v.y;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- applyMatrix3( m ) {
-
- const x = this.x, y = this.y;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];
- this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];
-
- return this;
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y;
-
- }
-
- cross( v ) {
-
- return this.x * v.y - this.y * v.x;
-
- }
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- angle() {
-
- // computes the angle in radians with respect to the positive x-axis
-
- const angle = Math.atan2( - this.y, - this.x ) + Math.PI;
-
- return angle;
-
- }
-
- distanceTo( v ) {
-
- return Math.sqrt( this.distanceToSquared( v ) );
-
- }
-
- distanceToSquared( v ) {
-
- const dx = this.x - v.x, dy = this.y - v.y;
- return dx * dx + dy * dy;
-
- }
-
- manhattanDistanceTo( v ) {
-
- return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
-
- return this;
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
-
- return this;
-
- }
-
- rotateAround( center, angle ) {
-
- const c = Math.cos( angle ), s = Math.sin( angle );
-
- const x = this.x - center.x;
- const y = this.y - center.y;
-
- this.x = x * c - y * s + center.x;
- this.y = x * s + y * c + center.y;
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
-
- }
-
-}
-
-Vector2.prototype.isVector2 = true;
-
-class Vector3 {
-
- constructor( x = 0, y = 0, z = 0 ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
-
- }
-
- set( x, y, z ) {
-
- if ( z === undefined ) z = this.z; // sprite.scale.set(x,y)
-
- this.x = x;
- this.y = y;
- this.z = z;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
- this.z = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setZ( z ) {
-
- this.z = z;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- case 2: this.z = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- case 0: return this.x;
- case 1: return this.y;
- case 2: return this.z;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y, this.z );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
- this.z = v.z;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
- this.z += v.z;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
- this.z += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
- this.z = a.z + b.z;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
- this.z += v.z * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
- this.z -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
- this.z = a.z - b.z;
-
- return this;
-
- }
-
- multiply( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );
- return this.multiplyVectors( v, w );
-
- }
-
- this.x *= v.x;
- this.y *= v.y;
- this.z *= v.z;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
- this.z *= scalar;
-
- return this;
-
- }
-
- multiplyVectors( a, b ) {
-
- this.x = a.x * b.x;
- this.y = a.y * b.y;
- this.z = a.z * b.z;
-
- return this;
-
- }
-
- applyEuler( euler ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' );
-
- }
-
- return this.applyQuaternion( _quaternion.setFromEuler( euler ) );
-
- }
-
- applyAxisAngle( axis, angle ) {
-
- return this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) );
-
- }
-
- applyMatrix3( m ) {
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;
- this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;
- this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;
-
- return this;
-
- }
-
- applyNormalMatrix( m ) {
-
- return this.applyMatrix3( m ).normalize();
-
- }
-
- applyMatrix4( m ) {
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- const w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );
-
- this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;
- this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;
- this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;
-
- return this;
-
- }
-
- applyQuaternion( q ) {
-
- const x = this.x, y = this.y, z = this.z;
- const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
-
- // calculate quat * vector
-
- const ix = qw * x + qy * z - qz * y;
- const iy = qw * y + qz * x - qx * z;
- const iz = qw * z + qx * y - qy * x;
- const iw = - qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
-
- this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;
- this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;
- this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;
-
- return this;
-
- }
-
- project( camera ) {
-
- return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );
-
- }
-
- unproject( camera ) {
-
- return this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );
-
- }
-
- transformDirection( m ) {
-
- // input: THREE.Matrix4 affine matrix
- // vector interpreted as a direction
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;
- this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;
- this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;
-
- return this.normalize();
-
- }
-
- divide( v ) {
-
- this.x /= v.x;
- this.y /= v.y;
- this.z /= v.z;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
- this.z = Math.min( this.z, v.z );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
- this.z = Math.max( this.z, v.z );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
- this.z = Math.floor( this.z );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
- this.z = Math.ceil( this.z );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
- this.z = Math.round( this.z );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
- this.z = - this.z;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y + this.z * v.z;
-
- }
-
- // TODO lengthSquared?
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y + this.z * this.z;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
- this.z += ( v.z - this.z ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
- this.z = v1.z + ( v2.z - v1.z ) * alpha;
-
- return this;
-
- }
-
- cross( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );
- return this.crossVectors( v, w );
-
- }
-
- return this.crossVectors( this, v );
-
- }
-
- crossVectors( a, b ) {
-
- const ax = a.x, ay = a.y, az = a.z;
- const bx = b.x, by = b.y, bz = b.z;
-
- this.x = ay * bz - az * by;
- this.y = az * bx - ax * bz;
- this.z = ax * by - ay * bx;
-
- return this;
-
- }
-
- projectOnVector( v ) {
-
- const denominator = v.lengthSq();
-
- if ( denominator === 0 ) return this.set( 0, 0, 0 );
-
- const scalar = v.dot( this ) / denominator;
-
- return this.copy( v ).multiplyScalar( scalar );
-
- }
-
- projectOnPlane( planeNormal ) {
-
- _vector.copy( this ).projectOnVector( planeNormal );
-
- return this.sub( _vector );
-
- }
-
- reflect( normal ) {
-
- // reflect incident vector off plane orthogonal to normal
- // normal is assumed to have unit length
-
- return this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
-
- }
-
- angleTo( v ) {
-
- const denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );
-
- if ( denominator === 0 ) return Math.PI / 2;
-
- const theta = this.dot( v ) / denominator;
-
- // clamp, to handle numerical problems
-
- return Math.acos( clamp( theta, - 1, 1 ) );
-
- }
-
- distanceTo( v ) {
-
- return Math.sqrt( this.distanceToSquared( v ) );
-
- }
-
- distanceToSquared( v ) {
-
- const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
-
- return dx * dx + dy * dy + dz * dz;
-
- }
-
- manhattanDistanceTo( v ) {
-
- return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );
-
- }
-
- setFromSpherical( s ) {
-
- return this.setFromSphericalCoords( s.radius, s.phi, s.theta );
-
- }
-
- setFromSphericalCoords( radius, phi, theta ) {
-
- const sinPhiRadius = Math.sin( phi ) * radius;
-
- this.x = sinPhiRadius * Math.sin( theta );
- this.y = Math.cos( phi ) * radius;
- this.z = sinPhiRadius * Math.cos( theta );
-
- return this;
-
- }
-
- setFromCylindrical( c ) {
-
- return this.setFromCylindricalCoords( c.radius, c.theta, c.y );
-
- }
-
- setFromCylindricalCoords( radius, theta, y ) {
-
- this.x = radius * Math.sin( theta );
- this.y = y;
- this.z = radius * Math.cos( theta );
-
- return this;
-
- }
-
- setFromMatrixPosition( m ) {
-
- const e = m.elements;
-
- this.x = e[ 12 ];
- this.y = e[ 13 ];
- this.z = e[ 14 ];
-
- return this;
-
- }
-
- setFromMatrixScale( m ) {
-
- const sx = this.setFromMatrixColumn( m, 0 ).length();
- const sy = this.setFromMatrixColumn( m, 1 ).length();
- const sz = this.setFromMatrixColumn( m, 2 ).length();
-
- this.x = sx;
- this.y = sy;
- this.z = sz;
-
- return this;
-
- }
-
- setFromMatrixColumn( m, index ) {
-
- return this.fromArray( m.elements, index * 4 );
-
- }
-
- setFromMatrix3Column( m, index ) {
-
- return this.fromArray( m.elements, index * 3 );
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
- this.z = array[ offset + 2 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
- array[ offset + 2 ] = this.z;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
- this.z = attribute.getZ( index );
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
- this.z = Math.random();
-
- return this;
-
- }
-
- randomDirection() {
-
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
-
- const u = ( Math.random() - 0.5 ) * 2;
- const t = Math.random() * Math.PI * 2;
- const f = Math.sqrt( 1 - u ** 2 );
-
- this.x = f * Math.cos( t );
- this.y = f * Math.sin( t );
- this.z = u;
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
- yield this.z;
-
- }
-
-}
-
-Vector3.prototype.isVector3 = true;
-
-const _vector = /*@__PURE__*/ new Vector3();
-const _quaternion = /*@__PURE__*/ new Quaternion();
-
-class Matrix4 {
-
- constructor() {
-
- this.elements = [
-
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- ];
-
- if ( arguments.length > 0 ) {
-
- console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );
-
- }
-
- }
-
- set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-
- const te = this.elements;
-
- te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;
- te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;
- te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;
- te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;
-
- return this;
-
- }
-
- identity() {
-
- this.set(
-
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- clone() {
-
- return new Matrix4().fromArray( this.elements );
-
- }
-
- copy( m ) {
-
- const te = this.elements;
- const me = m.elements;
-
- te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];
- te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];
- te[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];
- te[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];
-
- return this;
-
- }
-
- copyPosition( m ) {
-
- const te = this.elements, me = m.elements;
-
- te[ 12 ] = me[ 12 ];
- te[ 13 ] = me[ 13 ];
- te[ 14 ] = me[ 14 ];
-
- return this;
-
- }
-
- setFromMatrix3( m ) {
-
- const me = m.elements;
-
- this.set(
-
- me[ 0 ], me[ 3 ], me[ 6 ], 0,
- me[ 1 ], me[ 4 ], me[ 7 ], 0,
- me[ 2 ], me[ 5 ], me[ 8 ], 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- extractBasis( xAxis, yAxis, zAxis ) {
-
- xAxis.setFromMatrixColumn( this, 0 );
- yAxis.setFromMatrixColumn( this, 1 );
- zAxis.setFromMatrixColumn( this, 2 );
-
- return this;
-
- }
-
- makeBasis( xAxis, yAxis, zAxis ) {
-
- this.set(
- xAxis.x, yAxis.x, zAxis.x, 0,
- xAxis.y, yAxis.y, zAxis.y, 0,
- xAxis.z, yAxis.z, zAxis.z, 0,
- 0, 0, 0, 1
- );
-
- return this;
-
- }
-
- extractRotation( m ) {
-
- // this method does not support reflection matrices
-
- const te = this.elements;
- const me = m.elements;
-
- const scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();
- const scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();
- const scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();
-
- te[ 0 ] = me[ 0 ] * scaleX;
- te[ 1 ] = me[ 1 ] * scaleX;
- te[ 2 ] = me[ 2 ] * scaleX;
- te[ 3 ] = 0;
-
- te[ 4 ] = me[ 4 ] * scaleY;
- te[ 5 ] = me[ 5 ] * scaleY;
- te[ 6 ] = me[ 6 ] * scaleY;
- te[ 7 ] = 0;
-
- te[ 8 ] = me[ 8 ] * scaleZ;
- te[ 9 ] = me[ 9 ] * scaleZ;
- te[ 10 ] = me[ 10 ] * scaleZ;
- te[ 11 ] = 0;
-
- te[ 12 ] = 0;
- te[ 13 ] = 0;
- te[ 14 ] = 0;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- makeRotationFromEuler( euler ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- console.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );
-
- }
-
- const te = this.elements;
-
- const x = euler.x, y = euler.y, z = euler.z;
- const a = Math.cos( x ), b = Math.sin( x );
- const c = Math.cos( y ), d = Math.sin( y );
- const e = Math.cos( z ), f = Math.sin( z );
-
- if ( euler.order === 'XYZ' ) {
-
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
-
- te[ 0 ] = c * e;
- te[ 4 ] = - c * f;
- te[ 8 ] = d;
-
- te[ 1 ] = af + be * d;
- te[ 5 ] = ae - bf * d;
- te[ 9 ] = - b * c;
-
- te[ 2 ] = bf - ae * d;
- te[ 6 ] = be + af * d;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'YXZ' ) {
-
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
-
- te[ 0 ] = ce + df * b;
- te[ 4 ] = de * b - cf;
- te[ 8 ] = a * d;
-
- te[ 1 ] = a * f;
- te[ 5 ] = a * e;
- te[ 9 ] = - b;
-
- te[ 2 ] = cf * b - de;
- te[ 6 ] = df + ce * b;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'ZXY' ) {
-
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
-
- te[ 0 ] = ce - df * b;
- te[ 4 ] = - a * f;
- te[ 8 ] = de + cf * b;
-
- te[ 1 ] = cf + de * b;
- te[ 5 ] = a * e;
- te[ 9 ] = df - ce * b;
-
- te[ 2 ] = - a * d;
- te[ 6 ] = b;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'ZYX' ) {
-
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
-
- te[ 0 ] = c * e;
- te[ 4 ] = be * d - af;
- te[ 8 ] = ae * d + bf;
-
- te[ 1 ] = c * f;
- te[ 5 ] = bf * d + ae;
- te[ 9 ] = af * d - be;
-
- te[ 2 ] = - d;
- te[ 6 ] = b * c;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'YZX' ) {
-
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
- te[ 0 ] = c * e;
- te[ 4 ] = bd - ac * f;
- te[ 8 ] = bc * f + ad;
-
- te[ 1 ] = f;
- te[ 5 ] = a * e;
- te[ 9 ] = - b * e;
-
- te[ 2 ] = - d * e;
- te[ 6 ] = ad * f + bc;
- te[ 10 ] = ac - bd * f;
-
- } else if ( euler.order === 'XZY' ) {
-
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
- te[ 0 ] = c * e;
- te[ 4 ] = - f;
- te[ 8 ] = d * e;
-
- te[ 1 ] = ac * f + bd;
- te[ 5 ] = a * e;
- te[ 9 ] = ad * f - bc;
-
- te[ 2 ] = bc * f - ad;
- te[ 6 ] = b * e;
- te[ 10 ] = bd * f + ac;
-
- }
-
- // bottom row
- te[ 3 ] = 0;
- te[ 7 ] = 0;
- te[ 11 ] = 0;
-
- // last column
- te[ 12 ] = 0;
- te[ 13 ] = 0;
- te[ 14 ] = 0;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- makeRotationFromQuaternion( q ) {
-
- return this.compose( _zero, q, _one );
-
- }
-
- lookAt( eye, target, up ) {
-
- const te = this.elements;
-
- _z.subVectors( eye, target );
-
- if ( _z.lengthSq() === 0 ) {
-
- // eye and target are in the same position
-
- _z.z = 1;
-
- }
-
- _z.normalize();
- _x.crossVectors( up, _z );
-
- if ( _x.lengthSq() === 0 ) {
-
- // up and z are parallel
-
- if ( Math.abs( up.z ) === 1 ) {
-
- _z.x += 0.0001;
-
- } else {
-
- _z.z += 0.0001;
-
- }
-
- _z.normalize();
- _x.crossVectors( up, _z );
-
- }
-
- _x.normalize();
- _y.crossVectors( _z, _x );
-
- te[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;
- te[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;
- te[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;
-
- return this;
-
- }
-
- multiply( m, n ) {
-
- if ( n !== undefined ) {
-
- console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );
- return this.multiplyMatrices( m, n );
-
- }
-
- return this.multiplyMatrices( this, m );
-
- }
-
- premultiply( m ) {
-
- return this.multiplyMatrices( m, this );
-
- }
-
- multiplyMatrices( a, b ) {
-
- const ae = a.elements;
- const be = b.elements;
- const te = this.elements;
-
- const a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];
- const a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];
- const a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];
- const a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];
-
- const b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];
- const b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];
- const b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];
- const b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];
-
- te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
- te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
- te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
- te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
-
- te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
- te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
- te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
- te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
-
- te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
- te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
- te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
- te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
-
- te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
- te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
- te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
- te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- const te = this.elements;
-
- te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;
- te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;
- te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;
- te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;
-
- return this;
-
- }
-
- determinant() {
-
- const te = this.elements;
-
- const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];
- const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];
- const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];
- const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];
-
- //TODO: make this more efficient
- //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
-
- return (
- n41 * (
- + n14 * n23 * n32
- - n13 * n24 * n32
- - n14 * n22 * n33
- + n12 * n24 * n33
- + n13 * n22 * n34
- - n12 * n23 * n34
- ) +
- n42 * (
- + n11 * n23 * n34
- - n11 * n24 * n33
- + n14 * n21 * n33
- - n13 * n21 * n34
- + n13 * n24 * n31
- - n14 * n23 * n31
- ) +
- n43 * (
- + n11 * n24 * n32
- - n11 * n22 * n34
- - n14 * n21 * n32
- + n12 * n21 * n34
- + n14 * n22 * n31
- - n12 * n24 * n31
- ) +
- n44 * (
- - n13 * n22 * n31
- - n11 * n23 * n32
- + n11 * n22 * n33
- + n13 * n21 * n32
- - n12 * n21 * n33
- + n12 * n23 * n31
- )
-
- );
-
- }
-
- transpose() {
-
- const te = this.elements;
- let tmp;
-
- tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;
- tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;
- tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;
-
- tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;
- tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;
- tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;
-
- return this;
-
- }
-
- setPosition( x, y, z ) {
-
- const te = this.elements;
-
- if ( x.isVector3 ) {
-
- te[ 12 ] = x.x;
- te[ 13 ] = x.y;
- te[ 14 ] = x.z;
-
- } else {
-
- te[ 12 ] = x;
- te[ 13 ] = y;
- te[ 14 ] = z;
-
- }
-
- return this;
-
- }
-
- invert() {
-
- // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
- const te = this.elements,
-
- n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],
- n12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],
- n13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],
- n14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],
-
- t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
- t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
- t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
- t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
-
- const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
-
- if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
-
- const detInv = 1 / det;
-
- te[ 0 ] = t11 * detInv;
- te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;
- te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;
- te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;
-
- te[ 4 ] = t12 * detInv;
- te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;
- te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;
- te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;
-
- te[ 8 ] = t13 * detInv;
- te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;
- te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;
- te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;
-
- te[ 12 ] = t14 * detInv;
- te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;
- te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;
- te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;
-
- return this;
-
- }
-
- scale( v ) {
-
- const te = this.elements;
- const x = v.x, y = v.y, z = v.z;
-
- te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;
- te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;
- te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;
- te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;
-
- return this;
-
- }
-
- getMaxScaleOnAxis() {
-
- const te = this.elements;
-
- const scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];
- const scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];
- const scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];
-
- return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );
-
- }
-
- makeTranslation( x, y, z ) {
-
- this.set(
-
- 1, 0, 0, x,
- 0, 1, 0, y,
- 0, 0, 1, z,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationX( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- 1, 0, 0, 0,
- 0, c, - s, 0,
- 0, s, c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationY( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- c, 0, s, 0,
- 0, 1, 0, 0,
- - s, 0, c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationZ( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- c, - s, 0, 0,
- s, c, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationAxis( axis, angle ) {
-
- // Based on http://www.gamedev.net/reference/articles/article1199.asp
-
- const c = Math.cos( angle );
- const s = Math.sin( angle );
- const t = 1 - c;
- const x = axis.x, y = axis.y, z = axis.z;
- const tx = t * x, ty = t * y;
-
- this.set(
-
- tx * x + c, tx * y - s * z, tx * z + s * y, 0,
- tx * y + s * z, ty * y + c, ty * z - s * x, 0,
- tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeScale( x, y, z ) {
-
- this.set(
-
- x, 0, 0, 0,
- 0, y, 0, 0,
- 0, 0, z, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeShear( xy, xz, yx, yz, zx, zy ) {
-
- this.set(
-
- 1, yx, zx, 0,
- xy, 1, zy, 0,
- xz, yz, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- compose( position, quaternion, scale ) {
-
- const te = this.elements;
-
- const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;
- const x2 = x + x, y2 = y + y, z2 = z + z;
- const xx = x * x2, xy = x * y2, xz = x * z2;
- const yy = y * y2, yz = y * z2, zz = z * z2;
- const wx = w * x2, wy = w * y2, wz = w * z2;
-
- const sx = scale.x, sy = scale.y, sz = scale.z;
-
- te[ 0 ] = ( 1 - ( yy + zz ) ) * sx;
- te[ 1 ] = ( xy + wz ) * sx;
- te[ 2 ] = ( xz - wy ) * sx;
- te[ 3 ] = 0;
-
- te[ 4 ] = ( xy - wz ) * sy;
- te[ 5 ] = ( 1 - ( xx + zz ) ) * sy;
- te[ 6 ] = ( yz + wx ) * sy;
- te[ 7 ] = 0;
-
- te[ 8 ] = ( xz + wy ) * sz;
- te[ 9 ] = ( yz - wx ) * sz;
- te[ 10 ] = ( 1 - ( xx + yy ) ) * sz;
- te[ 11 ] = 0;
-
- te[ 12 ] = position.x;
- te[ 13 ] = position.y;
- te[ 14 ] = position.z;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- decompose( position, quaternion, scale ) {
-
- const te = this.elements;
-
- let sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
- const sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
- const sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
-
- // if determine is negative, we need to invert one scale
- const det = this.determinant();
- if ( det < 0 ) sx = - sx;
-
- position.x = te[ 12 ];
- position.y = te[ 13 ];
- position.z = te[ 14 ];
-
- // scale the rotation part
- _m1.copy( this );
-
- const invSX = 1 / sx;
- const invSY = 1 / sy;
- const invSZ = 1 / sz;
-
- _m1.elements[ 0 ] *= invSX;
- _m1.elements[ 1 ] *= invSX;
- _m1.elements[ 2 ] *= invSX;
-
- _m1.elements[ 4 ] *= invSY;
- _m1.elements[ 5 ] *= invSY;
- _m1.elements[ 6 ] *= invSY;
-
- _m1.elements[ 8 ] *= invSZ;
- _m1.elements[ 9 ] *= invSZ;
- _m1.elements[ 10 ] *= invSZ;
-
- quaternion.setFromRotationMatrix( _m1 );
-
- scale.x = sx;
- scale.y = sy;
- scale.z = sz;
-
- return this;
-
- }
-
- makePerspective( left, right, top, bottom, near, far ) {
-
- if ( far === undefined ) {
-
- console.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' );
-
- }
-
- const te = this.elements;
- const x = 2 * near / ( right - left );
- const y = 2 * near / ( top - bottom );
-
- const a = ( right + left ) / ( right - left );
- const b = ( top + bottom ) / ( top - bottom );
- const c = - ( far + near ) / ( far - near );
- const d = - 2 * far * near / ( far - near );
-
- te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
- te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
-
- return this;
-
- }
-
- makeOrthographic( left, right, top, bottom, near, far ) {
-
- const te = this.elements;
- const w = 1.0 / ( right - left );
- const h = 1.0 / ( top - bottom );
- const p = 1.0 / ( far - near );
-
- const x = ( right + left ) * w;
- const y = ( top + bottom ) * h;
- const z = ( far + near ) * p;
-
- te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
- te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z;
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
-
- return this;
-
- }
-
- equals( matrix ) {
-
- const te = this.elements;
- const me = matrix.elements;
-
- for ( let i = 0; i < 16; i ++ ) {
-
- if ( te[ i ] !== me[ i ] ) return false;
-
- }
-
- return true;
-
- }
-
- fromArray( array, offset = 0 ) {
-
- for ( let i = 0; i < 16; i ++ ) {
-
- this.elements[ i ] = array[ i + offset ];
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const te = this.elements;
-
- array[ offset ] = te[ 0 ];
- array[ offset + 1 ] = te[ 1 ];
- array[ offset + 2 ] = te[ 2 ];
- array[ offset + 3 ] = te[ 3 ];
-
- array[ offset + 4 ] = te[ 4 ];
- array[ offset + 5 ] = te[ 5 ];
- array[ offset + 6 ] = te[ 6 ];
- array[ offset + 7 ] = te[ 7 ];
-
- array[ offset + 8 ] = te[ 8 ];
- array[ offset + 9 ] = te[ 9 ];
- array[ offset + 10 ] = te[ 10 ];
- array[ offset + 11 ] = te[ 11 ];
-
- array[ offset + 12 ] = te[ 12 ];
- array[ offset + 13 ] = te[ 13 ];
- array[ offset + 14 ] = te[ 14 ];
- array[ offset + 15 ] = te[ 15 ];
-
- return array;
-
- }
-
-}
-
-Matrix4.prototype.isMatrix4 = true;
-
-const _v1 = /*@__PURE__*/ new Vector3();
-const _m1 = /*@__PURE__*/ new Matrix4();
-const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
-const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
-const _x = /*@__PURE__*/ new Vector3();
-const _y = /*@__PURE__*/ new Vector3();
-const _z = /*@__PURE__*/ new Vector3();
-
-// This set of controls performs orbiting, dollying (zooming), and panning.
-// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
-//
-// Orbit - left mouse / touch: one-finger move
-// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
-
-const _changeEvent = { type: 'change' };
-const _startEvent = { type: 'start' };
-const _endEvent = { type: 'end' };
-
-class OrbitControls extends EventDispatcher {
-
- constructor( object, domElement ) {
-
- super();
-
- if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' );
-
- this.object = object;
- this.domElement = domElement;
-
- // Set to false to disable this control
- this.enabled = true;
-
- // "target" sets the location of focus, where the object orbits around
- this.target = new Vector3();
-
- // How far you can dolly in and out ( PerspectiveCamera only )
- this.minDistance = 0;
- this.maxDistance = Infinity;
-
- // How far you can zoom in and out ( OrthographicCamera only )
- this.minZoom = 0;
- this.maxZoom = Infinity;
-
- // How far you can orbit vertically, upper and lower limits.
- // Range is 0 to Math.PI radians.
- this.minPolarAngle = 0; // radians
- this.maxPolarAngle = Math.PI; // radians
-
- // How far you can orbit horizontally, upper and lower limits.
- // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
- this.minAzimuthAngle = - Infinity; // radians
- this.maxAzimuthAngle = Infinity; // radians
-
- // Set to true to enable damping (inertia)
- // If damping is enabled, you must call controls.update() in your animation loop
- this.enableDamping = false;
- this.dampingFactor = 0.05;
-
- // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
- // Set to false to disable zooming
- this.enableZoom = true;
- this.zoomSpeed = 1.0;
-
- // Set to false to disable rotating
- this.enableRotate = true;
- this.rotateSpeed = 1.0;
-
- // Set to false to disable panning
- this.enablePan = true;
- this.panSpeed = 1.0;
- this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
- this.keyPanSpeed = 7.0; // pixels moved per arrow key push
-
- // Set to true to automatically rotate around the target
- // If auto-rotate is enabled, you must call controls.update() in your animation loop
- this.autoRotate = false;
- this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60
-
- // The four arrow keys
- this.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' };
-
- // Mouse buttons
- this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };
-
- // Touch fingers
- this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };
-
- // for reset
- this.target0 = this.target.clone();
- this.position0 = this.object.getPosition(new Vector3());
-
- // this.zoom0 = this.object.zoom;
- this.zoom0 = 1.0;
-
- // the target DOM element for key events
- this._domElementKeyEvents = null;
-
- //
- // public methods
- //
-
- this.getPolarAngle = function () {
-
- return spherical.phi;
-
- };
-
- this.getAzimuthalAngle = function () {
-
- return spherical.theta;
-
- };
-
- this.getDistance = function () {
- let position = this.object.getPosition(new Vector3());
- return position.distanceTo( this.target );
-
- };
-
- this.listenToKeyEvents = function ( domElement ) {
-
- domElement.addEventListener( 'keydown', onKeyDown );
- this._domElementKeyEvents = domElement;
-
- };
-
- this.saveState = function () {
-
- scope.target0.copy(scope.target);
- this.object.getPosition(scope.position0);
-
- // scope.zoom0 = scope.object.zoom;
- scope.zoom0 = 1.0;
-
- };
-
- this.reset = function () {
-
- scope.target.copy(scope.target0);
-
- this.object.getPosition(scope.position0);
-
- // scope.object.zoom = scope.zoom0;
-
- scope.object.updateProjectionMatrix();
- scope.dispatchEvent( _changeEvent );
-
- scope.update();
-
- state = STATE.NONE;
-
- };
-
- // this method is exposed, but perhaps it would be better if we can make it private...
- this.update = function () {
-
- const offset = new Vector3();
-
- // so camera.up is the orbit axis
- let camera_up = object.getUp(new Vector3());
- const quat = new Quaternion().setFromUnitVectors(camera_up, new Vector3(0, 1, 0));
- const quatInverse = quat.clone().invert();
-
- const lastPosition = new Vector3();
- const lastQuaternion = new Quaternion();
-
- const twoPI = 2 * Math.PI;
-
- return function update() {
-
- const position = scope.object.getPosition(new Vector3());
-
- offset.copy( position ).sub( scope.target );
-
- // rotate offset to "y-axis-is-up" space
- offset.applyQuaternion( quat );
-
- // angle from z-axis around y-axis
- spherical.setFromVector3( offset );
-
- if ( scope.autoRotate && state === STATE.NONE ) {
-
- rotateLeft( getAutoRotationAngle() );
-
- }
-
- if ( scope.enableDamping ) {
-
- spherical.theta += sphericalDelta.theta * scope.dampingFactor;
- spherical.phi += sphericalDelta.phi * scope.dampingFactor;
-
- } else {
-
- spherical.theta += sphericalDelta.theta;
- spherical.phi += sphericalDelta.phi;
-
- }
-
- // restrict theta to be between desired limits
-
- let min = scope.minAzimuthAngle;
- let max = scope.maxAzimuthAngle;
-
- if ( isFinite( min ) && isFinite( max ) ) {
-
- if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI;
-
- if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI;
-
- if ( min <= max ) {
-
- spherical.theta = Math.max( min, Math.min( max, spherical.theta ) );
-
- } else {
-
- spherical.theta = ( spherical.theta > ( min + max ) / 2 ) ?
- Math.max( min, spherical.theta ) :
- Math.min( max, spherical.theta );
-
- }
-
- }
-
- // restrict phi to be between desired limits
- spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
-
- spherical.makeSafe();
-
-
- spherical.radius *= scale;
-
- // restrict radius to be between desired limits
- spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
-
- // move target to panned location
-
- if ( scope.enableDamping === true ) {
-
- scope.target.addScaledVector( panOffset, scope.dampingFactor );
-
- } else {
-
- scope.target.add( panOffset );
-
- }
-
- offset.setFromSpherical( spherical );
-
- // rotate offset back to "camera-up-vector-is-up" space
- offset.applyQuaternion( quatInverse );
-
- position.copy(scope.target).add(offset);
- scope.object.setPosition(position);
-
- scope.object.lookAt( scope.target );
-
- if ( scope.enableDamping === true ) {
-
- sphericalDelta.theta *= ( 1 - scope.dampingFactor );
- sphericalDelta.phi *= ( 1 - scope.dampingFactor );
-
- panOffset.multiplyScalar( 1 - scope.dampingFactor );
-
- } else {
-
- sphericalDelta.set( 0, 0, 0 );
-
- panOffset.set( 0, 0, 0 );
-
- }
-
- 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
-
- const quaternion = scope.object.getQuaternion(new Quaternion());
-
- if ( zoomChanged ||
- lastPosition.distanceToSquared(position) > EPS ||
- 8 * (1 - lastQuaternion.dot(quaternion) ) > EPS ) {
-
- scope.dispatchEvent( _changeEvent );
-
- lastPosition.copy(position );
- lastQuaternion.copy(quaternion);
- zoomChanged = false;
-
- return true;
-
- }
-
- return false;
-
- };
-
- }();
-
- this.dispose = function () {
-
- scope.domElement.removeEventListener( 'contextmenu', onContextMenu );
-
- scope.domElement.removeEventListener( 'pointerdown', onPointerDown );
- scope.domElement.removeEventListener( 'pointercancel', onPointerCancel );
- scope.domElement.removeEventListener( 'wheel', onMouseWheel );
-
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
-
-
- if ( scope._domElementKeyEvents !== null ) {
-
- scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );
-
- }
-
- //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
-
- };
-
- //
- // internals
- //
-
- const scope = this;
-
- const STATE = {
- NONE: - 1,
- ROTATE: 0,
- DOLLY: 1,
- PAN: 2,
- TOUCH_ROTATE: 3,
- TOUCH_PAN: 4,
- TOUCH_DOLLY_PAN: 5,
- TOUCH_DOLLY_ROTATE: 6
- };
-
- let state = STATE.NONE;
-
- const EPS = 0.000001;
-
- // current position in spherical coordinates
- const spherical = new Spherical();
- const sphericalDelta = new Spherical();
-
- let scale = 1;
- const panOffset = new Vector3();
- let zoomChanged = false;
-
- const rotateStart = new Vector2();
- const rotateEnd = new Vector2();
- const rotateDelta = new Vector2();
-
- const panStart = new Vector2();
- const panEnd = new Vector2();
- const panDelta = new Vector2();
-
- const dollyStart = new Vector2();
- const dollyEnd = new Vector2();
- const dollyDelta = new Vector2();
-
- const pointers = [];
- const pointerPositions = {};
-
- function getAutoRotationAngle() {
-
- return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
-
- }
-
- function getZoomScale() {
-
- return Math.pow( 0.95, scope.zoomSpeed );
-
- }
-
- function rotateLeft( angle ) {
-
- sphericalDelta.theta -= angle;
-
- }
-
- function rotateUp( angle ) {
-
- sphericalDelta.phi -= angle;
-
- }
-
- const panLeft = function () {
-
- const v = new Vector3();
-
- return function panLeft( distance, objectMatrix ) {
-
- v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
- v.multiplyScalar( - distance );
-
- panOffset.add( v );
-
- };
-
- }();
-
- const panUp = function () {
-
- const v = new Vector3();
-
- return function panUp( distance, objectMatrix ) {
-
- if ( scope.screenSpacePanning === true ) {
-
- v.setFromMatrixColumn( objectMatrix, 1 );
-
- } else {
- let up = scope.object.getUp(new Vector3());
- v.setFromMatrixColumn( objectMatrix, 0 );
- v.crossVectors(up, v );
-
- }
-
- v.multiplyScalar( distance );
-
- panOffset.add( v );
-
- };
-
- }();
-
- // deltaX and deltaY are in pixels; right and down are positive
- const pan = function () {
-
- const offset = new Vector3();
-
- return function pan( deltaX, deltaY ) {
-
- const element = scope.domElement;
-
- if ( scope.object.isPerspectiveCamera ) {
-
- // perspective
- const position = scope.object.getPosition(new Vector3());
- offset.copy( position ).sub( scope.target );
- let targetDistance = offset.length();
-
- // half of the fov is center to top of screen
- targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
-
- const matrix = scope.object.getMatrix(new Matrix4());
- // we use only clientHeight here so aspect ratio does not distort speed
- panLeft(2 * deltaX * targetDistance / element.clientHeight, matrix );
- panUp(2 * deltaY * targetDistance / element.clientHeight, matrix );
-
- } else if (scope.object.isOrthographicCamera) {
-
- const matrix = scope.object.getMatrix(new Matrix4());
- // orthographic
- panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, matrix );
- panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, matrix );
-
- } else {
-
- // camera neither orthographic nor perspective
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
- scope.enablePan = false;
-
- }
-
- };
-
- }();
-
- function dollyOut( dollyScale ) {
-
- if ( scope.object.isPerspectiveCamera ) {
-
- scale /= dollyScale;
-
- } else if ( scope.object.isOrthographicCamera ) {
-
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
- scope.object.updateProjectionMatrix();
- zoomChanged = true;
-
- } else {
-
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
- scope.enableZoom = false;
-
- }
-
- }
-
- function dollyIn( dollyScale ) {
-
- if ( scope.object.isPerspectiveCamera ) {
-
- scale *= dollyScale;
-
- } else if ( scope.object.isOrthographicCamera ) {
-
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
- scope.object.updateProjectionMatrix();
- zoomChanged = true;
-
- } else {
-
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
- scope.enableZoom = false;
-
- }
-
- }
-
- //
- // event callbacks - update the object state
- //
-
- function handleMouseDownRotate( event ) {
-
- rotateStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseDownDolly( event ) {
-
- dollyStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseDownPan( event ) {
-
- panStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseMoveRotate( event ) {
-
- rotateEnd.set( event.clientX, event.clientY );
-
- rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
-
- const element = scope.domElement;
-
- rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
-
- rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
-
- rotateStart.copy( rotateEnd );
-
- scope.update();
-
- }
-
- function handleMouseMoveDolly( event ) {
-
- dollyEnd.set( event.clientX, event.clientY );
-
- dollyDelta.subVectors( dollyEnd, dollyStart );
-
- if ( dollyDelta.y > 0 ) {
-
- dollyOut( getZoomScale() );
-
- } else if ( dollyDelta.y < 0 ) {
-
- dollyIn( getZoomScale() );
-
- }
-
- dollyStart.copy( dollyEnd );
-
- scope.update();
-
- }
-
- function handleMouseMovePan( event ) {
-
- panEnd.set( event.clientX, event.clientY );
-
- panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
-
- pan( panDelta.x, panDelta.y );
-
- panStart.copy( panEnd );
-
- scope.update();
-
- }
-
- function handleMouseWheel( event ) {
-
- if ( event.deltaY < 0 ) {
-
- dollyIn( getZoomScale() );
-
- } else if ( event.deltaY > 0 ) {
-
- dollyOut( getZoomScale() );
-
- }
-
- scope.update();
-
- }
-
- function handleKeyDown( event ) {
-
- let needsUpdate = false;
-
- switch ( event.code ) {
-
- case scope.keys.UP:
- pan( 0, scope.keyPanSpeed );
- needsUpdate = true;
- break;
-
- case scope.keys.BOTTOM:
- pan( 0, - scope.keyPanSpeed );
- needsUpdate = true;
- break;
-
- case scope.keys.LEFT:
- pan( scope.keyPanSpeed, 0 );
- needsUpdate = true;
- break;
-
- case scope.keys.RIGHT:
- pan( - scope.keyPanSpeed, 0 );
- needsUpdate = true;
- break;
-
- }
-
- if ( needsUpdate ) {
-
- // prevent the browser from scrolling on cursor keys
- // event.preventDefault();
-
- scope.update();
-
- }
-
-
- }
-
- function handleTouchStartRotate() {
-
- if ( pointers.length === 1 ) {
-
- rotateStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
-
- } else {
-
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
-
- rotateStart.set( x, y );
-
- }
-
- }
-
- function handleTouchStartPan() {
-
- if ( pointers.length === 1 ) {
-
- panStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
-
- } else {
-
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
-
- panStart.set( x, y );
-
- }
-
- }
-
- function handleTouchStartDolly() {
-
- const dx = pointers[ 0 ].pageX - pointers[ 1 ].pageX;
- const dy = pointers[ 0 ].pageY - pointers[ 1 ].pageY;
-
- const distance = Math.sqrt( dx * dx + dy * dy );
-
- dollyStart.set( 0, distance );
-
- }
-
- function handleTouchStartDollyPan() {
-
- if ( scope.enableZoom ) handleTouchStartDolly();
-
- if ( scope.enablePan ) handleTouchStartPan();
-
- }
-
- function handleTouchStartDollyRotate() {
-
- if ( scope.enableZoom ) handleTouchStartDolly();
-
- if ( scope.enableRotate ) handleTouchStartRotate();
-
- }
-
- function handleTouchMoveRotate( event ) {
-
- if ( pointers.length == 1 ) {
-
- rotateEnd.set( event.pageX, event.pageY );
-
- } else {
-
- const position = getSecondPointerPosition( event );
-
- const x = 0.5 * ( event.pageX + position.x );
- const y = 0.5 * ( event.pageY + position.y );
-
- rotateEnd.set( x, y );
-
- }
-
- rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
-
- const element = scope.domElement;
-
- rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
-
- rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
-
- rotateStart.copy( rotateEnd );
-
- }
-
- function handleTouchMovePan( event ) {
-
- if ( pointers.length === 1 ) {
-
- panEnd.set( event.pageX, event.pageY );
-
- } else {
-
- const position = getSecondPointerPosition( event );
-
- const x = 0.5 * ( event.pageX + position.x );
- const y = 0.5 * ( event.pageY + position.y );
-
- panEnd.set( x, y );
-
- }
-
- panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
-
- pan( panDelta.x, panDelta.y );
-
- panStart.copy( panEnd );
-
- }
-
- function handleTouchMoveDolly( event ) {
-
- const position = getSecondPointerPosition( event );
-
- const dx = event.pageX - position.x;
- const dy = event.pageY - position.y;
-
- const distance = Math.sqrt( dx * dx + dy * dy );
-
- dollyEnd.set( 0, distance );
-
- dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );
-
- dollyOut( dollyDelta.y );
-
- dollyStart.copy( dollyEnd );
-
- }
-
- function handleTouchMoveDollyPan( event ) {
-
- if ( scope.enableZoom ) handleTouchMoveDolly( event );
-
- if ( scope.enablePan ) handleTouchMovePan( event );
-
- }
-
- function handleTouchMoveDollyRotate( event ) {
-
- if ( scope.enableZoom ) handleTouchMoveDolly( event );
-
- if ( scope.enableRotate ) handleTouchMoveRotate( event );
-
- }
-
- //
- // event handlers - FSM: listen for events and reset state
- //
-
- function onPointerDown( event ) {
-
- if ( scope.enabled === false ) return;
-
- if ( pointers.length === 0 ) {
-
- scope.domElement.setPointerCapture();
-
- scope.domElement.addEventListener( 'pointermove', onPointerMove );
- scope.domElement.addEventListener( 'pointerup', onPointerUp );
-
- }
-
- //
-
- addPointer( event );
-
- if ( event.pointerType === 'touch' ) {
-
- onTouchStart( event );
-
- } else {
-
- onMouseDown( event );
-
- }
-
- }
-
- function onPointerMove( event ) {
-
- if ( scope.enabled === false ) return;
-
- if ( event.pointerType === 'touch' ) {
-
- onTouchMove( event );
-
- } else {
-
- onMouseMove( event );
-
- }
-
- }
-
- function onPointerUp( event ) {
-
- removePointer( event );
-
- if ( pointers.length === 0 ) {
-
- scope.domElement.releasePointerCapture();
-
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
-
- }
-
- scope.dispatchEvent( _endEvent );
-
- state = STATE.NONE;
-
- }
-
- function onPointerCancel( event ) {
-
- removePointer( event );
-
- }
-
- function onMouseDown( event ) {
-
- let mouseAction;
-
- switch ( event.button ) {
-
- case 0:
-
- mouseAction = scope.mouseButtons.LEFT;
- break;
-
- case 1:
-
- mouseAction = scope.mouseButtons.MIDDLE;
- break;
-
- case 2:
-
- mouseAction = scope.mouseButtons.RIGHT;
- break;
-
- default:
-
- mouseAction = - 1;
-
- }
-
- switch ( mouseAction ) {
-
- case MOUSE.DOLLY:
-
- if ( scope.enableZoom === false ) return;
-
- handleMouseDownDolly( event );
-
- state = STATE.DOLLY;
-
- break;
-
- case MOUSE.ROTATE:
-
- if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
-
- if ( scope.enablePan === false ) return;
-
- handleMouseDownPan( event );
-
- state = STATE.PAN;
-
- } else {
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseDownRotate( event );
-
- state = STATE.ROTATE;
-
- }
-
- break;
-
- case MOUSE.PAN:
-
- if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseDownRotate( event );
-
- state = STATE.ROTATE;
-
- } else {
-
- if ( scope.enablePan === false ) return;
-
- handleMouseDownPan( event );
-
- state = STATE.PAN;
-
- }
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- if ( state !== STATE.NONE ) {
-
- scope.dispatchEvent( _startEvent );
-
- }
-
- }
-
- function onMouseMove( event ) {
-
- if ( scope.enabled === false ) return;
-
- switch ( state ) {
-
- case STATE.ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseMoveRotate( event );
-
- break;
-
- case STATE.DOLLY:
-
- if ( scope.enableZoom === false ) return;
-
- handleMouseMoveDolly( event );
-
- break;
-
- case STATE.PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleMouseMovePan( event );
-
- break;
-
- }
-
- }
-
- function onMouseWheel( event ) {
-
- if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
-
- // event.preventDefault();
-
- scope.dispatchEvent( _startEvent );
-
- handleMouseWheel( event );
-
- scope.dispatchEvent( _endEvent );
-
- }
-
- function onKeyDown( event ) {
-
- if ( scope.enabled === false || scope.enablePan === false ) return;
-
- handleKeyDown( event );
-
- }
-
- function onTouchStart( event ) {
-
- trackPointer( event );
-
- switch ( pointers.length ) {
-
- case 1:
-
- switch ( scope.touches.ONE ) {
-
- case TOUCH.ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleTouchStartRotate();
-
- state = STATE.TOUCH_ROTATE;
-
- break;
-
- case TOUCH.PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleTouchStartPan();
-
- state = STATE.TOUCH_PAN;
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- break;
-
- case 2:
-
- switch ( scope.touches.TWO ) {
-
- case TOUCH.DOLLY_PAN:
-
- if ( scope.enableZoom === false && scope.enablePan === false ) return;
-
- handleTouchStartDollyPan();
-
- state = STATE.TOUCH_DOLLY_PAN;
-
- break;
-
- case TOUCH.DOLLY_ROTATE:
-
- if ( scope.enableZoom === false && scope.enableRotate === false ) return;
-
- handleTouchStartDollyRotate();
-
- state = STATE.TOUCH_DOLLY_ROTATE;
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- if ( state !== STATE.NONE ) {
-
- scope.dispatchEvent( _startEvent );
-
- }
-
- }
-
- function onTouchMove( event ) {
-
- trackPointer( event );
-
- switch ( state ) {
-
- case STATE.TOUCH_ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleTouchMoveRotate( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleTouchMovePan( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_DOLLY_PAN:
-
- if ( scope.enableZoom === false && scope.enablePan === false ) return;
-
- handleTouchMoveDollyPan( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_DOLLY_ROTATE:
-
- if ( scope.enableZoom === false && scope.enableRotate === false ) return;
-
- handleTouchMoveDollyRotate( event );
-
- scope.update();
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- }
-
- function onContextMenu( event ) {
-
- if ( scope.enabled === false ) return;
-
- // event.preventDefault();
-
- }
-
- function addPointer( event ) {
-
- pointers.push( event );
-
- }
-
- function removePointer( event ) {
-
- delete pointerPositions[ event.pointerId ];
-
- for ( let i = 0; i < pointers.length; i ++ ) {
-
- if ( pointers[ i ].pointerId == event.pointerId ) {
-
- pointers.splice( i, 1 );
- return;
-
- }
-
- }
-
- }
-
- function trackPointer( event ) {
-
- let position = pointerPositions[ event.pointerId ];
-
- if ( position === undefined ) {
-
- position = new Vector2();
- pointerPositions[ event.pointerId ] = position;
-
- }
-
- position.set( event.pageX, event.pageY );
-
- }
-
- function getSecondPointerPosition( event ) {
-
- const pointer = ( event.pointerId === pointers[ 0 ].pointerId ) ? pointers[ 1 ] : pointers[ 0 ];
-
- return pointerPositions[ pointer.pointerId ];
-
- }
-
- //
-
- scope.domElement.addEventListener( 'contextmenu', onContextMenu );
-
- scope.domElement.addEventListener( 'pointerdown', onPointerDown );
- scope.domElement.addEventListener( 'pointercancel', onPointerCancel );
- scope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } );
-
- // force an update at start
-
- this.update();
-
- }
-
-}
-
-class View extends EventDispatcher {
-
- get clientWidth() {
- return gamePlayer.width;
- }
-
- get clientHeight() {
- return gamePlayer.height;
- }
-
- setPointerCapture() {
- gamePlayer.message("setPointerCapture", "");
- }
-
- releasePointerCapture() {
- gamePlayer.message("releasePointerCapture", "");
- }
-}
-
-const view = new View();
-
-function makeMouseEvent(e, type) {
- let event = {
- type: type,
- pointerType: "mouse",
- pointerId: 0,
- clientX: e.x,
- clientY: e.y,
- deltaY: e.delta,
- button: e.button
- };
-
- return event;
-}
-
-function OnMouseDown(e) {
- let event = makeMouseEvent(e, "pointerdown");
- view.dispatchEvent(event);
-}
-
-function OnMouseUp(e) {
- let event = makeMouseEvent(e, "pointerup");
- view.dispatchEvent(event);
-}
-
-function OnMouseMove(e) {
- let event = makeMouseEvent(e, "pointermove");
- view.dispatchEvent(event);
-}
-
-function OnMouseWheel(e) {
- let event = makeMouseEvent(e, "wheel");
- view.dispatchEvent(event);
-}
-
-setCallback('OnMouseDown', OnMouseDown);
-setCallback('OnMouseUp', OnMouseUp);
-setCallback('OnMouseMove', OnMouseMove);
-setCallback('OnMouseWheel', OnMouseWheel);
-
-
-function makeTouchEvent(e, type) {
- let event = {
- type: type,
- pointerType: "touch",
- pointerId: e.pointerId,
- pageX: e.x,
- pageY: e.y,
- deltaY: 0,
- button: -1
- };
-
- return event;
-}
-
-function OnTouchDown(e) {
- let event = makeTouchEvent(e, "pointerdown");
- view.dispatchEvent(event);
-}
-
-function OnTouchUp(e) {
- let event = makeTouchEvent(e, "pointerup");
- view.dispatchEvent(event);
-}
-
-function OnTouchMove(e) {
- let event = makeTouchEvent(e, "pointermove");
- view.dispatchEvent(event);
-}
-
-setCallback('OnTouchDown', OnTouchDown);
-setCallback('OnTouchUp', OnTouchUp);
-setCallback('OnTouchMove', OnTouchMove);
-
-// ==ClosureCompiler==
-// @output_file_name default.js
-// @compilation_level SIMPLE_OPTIMIZATIONS
-// ==/ClosureCompiler==
-// module.exports = {
-// parse: parse,
-// simplify: simplify,
-// simplifyLostLess: simplifyLostLess,
-// filter: filter,
-// stringify: stringify,
-// toContentString: toContentString,
-// getElementById: getElementById,
-// getElementsByClassName: getElementsByClassName,
-// transformStream: transformStream,
-// };
-
-/**
- * @author: Tobias Nickel
- * @created: 06.04.2015
- * I needed a small xmlparser chat can be used in a worker.
- */
-
-/**
- * @typedef tNode
- * @property {string} tagName
- * @property {object} attributes
- * @property {(tNode|string)[]} children
- **/
-
-/**
- * @typedef TParseOptions
- * @property {number} [pos]
- * @property {string[]} [noChildNodes]
- * @property {boolean} [setPos]
- * @property {boolean} [keepComments]
- * @property {boolean} [keepWhitespace]
- * @property {boolean} [simplify]
- * @property {(a: tNode, b: tNode) => boolean} [filter]
- */
-
-/**
- * parseXML / html into a DOM Object. with no validation and some failur tolerance
- * @param {string} S your XML to parse
- * @param {TParseOptions} [options] all other options:
- * @return {(tNode | string)[]}
- */
-function parse(S, options) {
- "txml";
- options = options || {};
-
- var pos = options.pos || 0;
- var keepComments = !!options.keepComments;
- var keepWhitespace = !!options.keepWhitespace;
-
- var openBracket = "<";
- var openBracketCC = "<".charCodeAt(0);
- var closeBracket = ">";
- var closeBracketCC = ">".charCodeAt(0);
- var minusCC = "-".charCodeAt(0);
- var slashCC = "/".charCodeAt(0);
- var exclamationCC = '!'.charCodeAt(0);
- var singleQuoteCC = "'".charCodeAt(0);
- var doubleQuoteCC = '"'.charCodeAt(0);
- var openCornerBracketCC = '['.charCodeAt(0);
- var closeCornerBracketCC = ']'.charCodeAt(0);
-
-
- /**
- * parsing a list of entries
- */
- function parseChildren(tagName) {
- var children = [];
- while (S[pos]) {
- if (S.charCodeAt(pos) == openBracketCC) {
- if (S.charCodeAt(pos + 1) === slashCC) {
- var closeStart = pos + 2;
- pos = S.indexOf(closeBracket, pos);
-
- var closeTag = S.substring(closeStart, pos);
- if (closeTag.indexOf(tagName) == -1) {
- var parsedText = S.substring(0, pos).split('\n');
- throw new Error(
- 'Unexpected close tag\nLine: ' + (parsedText.length - 1) +
- '\nColumn: ' + (parsedText[parsedText.length - 1].length + 1) +
- '\nChar: ' + S[pos]
- );
- }
-
- if (pos + 1) pos += 1;
-
- return children;
- } else if (S.charCodeAt(pos + 1) === exclamationCC) {
- if (S.charCodeAt(pos + 2) == minusCC) {
- //comment support
- const startCommentPos = pos;
- while (pos !== -1 && !(S.charCodeAt(pos) === closeBracketCC && S.charCodeAt(pos - 1) == minusCC && S.charCodeAt(pos - 2) == minusCC && pos != -1)) {
- pos = S.indexOf(closeBracket, pos + 1);
- }
- if (pos === -1) {
- pos = S.length;
- }
- if (keepComments) {
- children.push(S.substring(startCommentPos, pos + 1));
- }
- } else if (
- S.charCodeAt(pos + 2) === openCornerBracketCC &&
- S.charCodeAt(pos + 8) === openCornerBracketCC &&
- S.substr(pos + 3, 5).toLowerCase() === 'cdata'
- ) {
- // cdata
- var cdataEndIndex = S.indexOf(']]>', pos);
- if (cdataEndIndex == -1) {
- children.push(S.substr(pos + 9));
- pos = S.length;
- } else {
- children.push(S.substring(pos + 9, cdataEndIndex));
- pos = cdataEndIndex + 3;
- }
- continue;
- } else {
- // doctypesupport
- const startDoctype = pos + 1;
- pos += 2;
- var encapsuled = false;
- while ((S.charCodeAt(pos) !== closeBracketCC || encapsuled === true) && S[pos]) {
- if (S.charCodeAt(pos) === openCornerBracketCC) {
- encapsuled = true;
- } else if (encapsuled === true && S.charCodeAt(pos) === closeCornerBracketCC) {
- encapsuled = false;
- }
- pos++;
- }
- children.push(S.substring(startDoctype, pos));
- }
- pos++;
- continue;
- }
- var node = parseNode();
- children.push(node);
- if (node.tagName[0] === '?') {
- children.push(...node.children);
- node.children = [];
- }
- } else {
- var text = parseText();
- if (keepWhitespace) {
- if (text.length > 0) {
- children.push(text);
- }
- } else {
- var trimmed = text.trim();
- if (trimmed.length > 0) {
- children.push(trimmed);
- }
- }
- pos++;
- }
- }
- return children;
- }
-
- /**
- * returns the text outside of texts until the first '<'
- */
- function parseText() {
- var start = pos;
- pos = S.indexOf(openBracket, pos) - 1;
- if (pos === -2)
- pos = S.length;
- return S.slice(start, pos + 1);
- }
- /**
- * returns text until the first nonAlphabetic letter
- */
- var nameSpacer = '\r\n\t>/= ';
-
- function parseName() {
- var start = pos;
- while (nameSpacer.indexOf(S[pos]) === -1 && S[pos]) {
- pos++;
- }
- return S.slice(start, pos);
- }
- /**
- * is parsing a node, including tagName, Attributes and its children,
- * to parse children it uses the parseChildren again, that makes the parsing recursive
- */
- var NoChildNodes = options.noChildNodes || ['img', 'br', 'input', 'meta', 'link', 'hr'];
-
- function parseNode() {
- pos++;
- const tagName = parseName();
- const attributes = {};
- let children = [];
-
- // parsing attributes
- while (S.charCodeAt(pos) !== closeBracketCC && S[pos]) {
- var c = S.charCodeAt(pos);
- if ((c > 64 && c < 91) || (c > 96 && c < 123)) {
- //if('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(S[pos])!==-1 ){
- var name = parseName();
- // search beginning of the string
- var code = S.charCodeAt(pos);
- while (code && code !== singleQuoteCC && code !== doubleQuoteCC && !((code > 64 && code < 91) || (code > 96 && code < 123)) && code !== closeBracketCC) {
- pos++;
- code = S.charCodeAt(pos);
- }
- if (code === singleQuoteCC || code === doubleQuoteCC) {
- var value = parseString();
- if (pos === -1) {
- return {
- tagName,
- attributes,
- children,
- };
- }
- } else {
- value = null;
- pos--;
- }
- attributes[name] = value;
- }
- pos++;
- }
- // optional parsing of children
- if (S.charCodeAt(pos - 1) !== slashCC) {
- if (tagName == "script") {
- var start = pos + 1;
- pos = S.indexOf('', pos);
- children = [S.slice(start, pos)];
- pos += 9;
- } else if (tagName == "style") {
- var start = pos + 1;
- pos = S.indexOf('', pos);
- children = [S.slice(start, pos)];
- pos += 8;
- } else if (NoChildNodes.indexOf(tagName) === -1) {
- pos++;
- children = parseChildren(tagName);
- } else {
- pos++;
- }
- } else {
- pos++;
- }
- return {
- tagName,
- attributes,
- children,
- };
- }
-
- /**
- * is parsing a string, that starts with a char and with the same usually ' or "
- */
-
- function parseString() {
- var startChar = S[pos];
- var startpos = pos + 1;
- pos = S.indexOf(startChar, startpos);
- return S.slice(startpos, pos);
- }
-
- /**
- *
- */
- function findElements() {
- var r = new RegExp('\\s' + options.attrName + '\\s*=[\'"]' + options.attrValue + '[\'"]').exec(S);
- if (r) {
- return r.index;
- } else {
- return -1;
- }
- }
-
- var out = null;
- if (options.attrValue !== undefined) {
- options.attrName = options.attrName || 'id';
- var out = [];
-
- while ((pos = findElements()) !== -1) {
- pos = S.lastIndexOf('<', pos);
- if (pos !== -1) {
- out.push(parseNode());
- }
- S = S.substr(pos);
- pos = 0;
- }
- } else if (options.parseNode) {
- out = parseNode();
- } else {
- out = parseChildren('');
- }
-
- if (options.filter) {
- out = filter(out, options.filter);
- }
-
- if (options.simplify) {
- return simplify(Array.isArray(out) ? out : [out]);
- }
-
- if (options.setPos) {
- out.pos = pos;
- }
-
- return out;
-}
-
-/**
- * transform the DomObject to an object that is like the object of PHP`s simple_xmp_load_*() methods.
- * this format helps you to write that is more likely to keep your program working, even if there a small changes in the XML schema.
- * be aware, that it is not possible to reproduce the original xml from a simplified version, because the order of elements is not saved.
- * therefore your program will be more flexible and easier to read.
- *
- * @param {tNode[]} children the childrenList
- */
-function simplify(children) {
- var out = {};
- if (!children.length) {
- return '';
- }
-
- if (children.length === 1 && typeof children[0] == 'string') {
- return children[0];
- }
- // map each object
- children.forEach(function(child) {
- if (typeof child !== 'object') {
- return;
- }
- if (!out[child.tagName])
- out[child.tagName] = [];
- var kids = simplify(child.children);
- out[child.tagName].push(kids);
- if (Object.keys(child.attributes).length && typeof kids !== 'string') {
- kids._attributes = child.attributes;
- }
- });
-
- for (var i in out) {
- if (out[i].length == 1) {
- out[i] = out[i][0];
- }
- }
-
- return out;
-}
-/**
- * behaves the same way as Array.filter, if the filter method return true, the element is in the resultList
- * @params children{Array} the children of a node
- * @param f{function} the filter method
- */
-function filter(children, f, dept = 0, path = '') {
- var out = [];
- children.forEach(function(child, i) {
- if (typeof(child) === 'object' && f(child, i, dept, path)) out.push(child);
- if (child.children) {
- var kids = filter(child.children, f, dept + 1, (path ? path + '.' : '') + i + '.' + child.tagName);
- out = out.concat(kids);
- }
- });
- return out;
-}
-
-function genNode(node, level)
-{
- let code = "";
- for(let i=0;i\n`;
- return code;
- }
- else
- {
- code += ">\n";
- }
-
- for (let child of children)
- {
- code += genNode(child, level+1);
- }
-
- for(let i=0;i\n`;
-
- return code;
-}
-
-function genXML(nodes)
-{
- let xml = "";
- for (let top of nodes)
- {
- if (top.tagName =="?xml")
- {
- let version = top.attributes.version;
- xml += `\n`;
- }
- else
- {
- xml += genNode(top, 0);
- }
-
- }
- return xml;
-
-}
-
-function uuid(len, radix) {
- var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
- var uuid = [], i;
- radix = radix || chars.length;
-
- if (len) {
- // Compact form
- for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
- } else {
- // rfc4122, version 4 form
- var r;
-
- // rfc4122 requires these characters
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
- uuid[14] = '4';
-
- // Fill in random data. At i==19 set the high bits of clock sequence as
- // per rfc4122, sec. 4.1.5
- for (i = 0; i < 36; i++) {
- if (!uuid[i]) {
- r = 0 | Math.random()*16;
- uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
- }
- }
- }
-
- return uuid.join('');
-}
-
-function string_to_boolean(string) {
- switch (string.toLowerCase().trim()) {
- case "true":
- case "yes":
- case "1":
- return true;
-
- case "false":
- case "no":
- case "0":
- case null:
- return false;
-
- default:
- return Boolean(string);
- }
-}
-
-class LightmapBaker
-{
- constructor(doc, iterations, num_rays)
- {
- this.doc = doc;
- this.lst = [];
- for (let obj of doc.bakables)
- {
- let xml_node = doc.internal_index[obj.uuid].xml_node;
- let attributes = xml_node.attributes;
- if ("lightmap" in attributes)
- {
- let filename = attributes.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=='hdr')
- {
- this.lst.push({ model: obj, lightmap: filename, count: -1 });
- }
- }
- }
- if (this.lst.length<1)
- {
- print("No bakable object found!");
- return;
- }
-
- this.iterations = iterations;
- this.num_rays_final = num_rays;
- this.iter = 0;
- this.idx_model = 0;
- this.idx_texel = 0;
- this.check_time = now();
- }
-
- render(renderer)
- {
- if (this.lst.length<1)
- {
- this.doc.lightmap_bake = null;
- return;
- }
-
- let frame_time = now();
-
- while(this.doc.lightmap_bake != null)
- {
- let cur_time = now();
- if (cur_time -frame_time>=10) break;
-
- let item = this.lst[this.idx_model];
- if (item.count<0)
- {
- item.count = item.model.initializeLightmap(renderer);
- }
-
- if (cur_time - this.check_time>=500)
- {
- print(`Building LOD Probe-Grid, iteration: ${this.iter+1}/${this.iterations}, model: ${this.idx_model+1}/${this.lst.length}, texel: ${this.idx_texel +1}/${item.count}`);
- this.check_time = cur_time;
- }
-
- let num_rays = (this.num_rays_final >> (this.iterations - this.iter));
- if (num_rays < 1) num_rays = 1;
- let count_texels = renderer.updateLightmap(this.doc.scene, item.model, this.idx_texel, num_rays, 1.0);
- this.idx_texel += count_texels;
- if (this.idx_texel>=item.count)
- {
- renderer.filterLightmap(item.model);
- this.idx_texel = 0;
- this.idx_model++;
- if (this.idx_model >= this.lst.length)
- {
- this.idx_model = 0;
- this.iter++;
- if (this.iter >= this.iterations)
- {
- this.doc.lightmap_bake = null;
- print("Saving lightmaps.");
- for (let item of this.lst)
- {
- let hdr_image = item.model.getLightmap();
- let res = HDRImageSaver.saveFile(hdr_image, item.lightmap);
- if (!res)
- {
- print(`Failed to save ${item.lightmap}`);
- }
- }
-
- }
-
- }
-
- }
- }
-
- }
-}
-
-class EnvMapGen
-{
- constructor(doc, proxy, xml_node, irradiance_only = false)
- {
- this.doc = doc;
- this.xml_node = xml_node;
- this.irradiance_only = irradiance_only;
-
- this.cube_target = new CubeRenderTarget(128,128);
- this.envMapCreator = new EnvironmentMapCreator();
- this.iter = 0;
- }
-
- render(renderer)
- {
- print(`Building environemnt map, iteration: ${this.iter}`);
- let props = this.xml_node.attributes;
-
- let x = 0.0;
- let y = 0.0;
- let z = 0.0;
- if ("probe_position" in props)
- {
- let probe_position = props.probe_position;
- let position = probe_position.split(',');
- x = parseFloat(position[0]);
- y = parseFloat(position[1]);
- z = parseFloat(position[2]);
- }
-
- renderer.renderCube(this.doc.scene, this.cube_target, new Vector3(x, y,z));
-
- let envLight = this.envMapCreator.create(this.cube_target, this.irradiance_only);
- if (props.hasOwnProperty('dynamic_map'))
- {
- envLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- this.doc.scene.indirectLight = envLight;
-
- this.iter++;
- if (this.iter > 5)
- {
- print("Saving environemnt map.");
- if (this.irradiance_only)
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let text = JSON.stringify(envLight.shCoefficients);
- let res = fileSaver.saveTextFile(path_sh, text);
-
- if (!res)
- {
- print("Failed to save enviroment map.");
- }
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let down_img = this.cube_target.getHDRCubeImage();
-
- let res = HDRImageSaver.saveCubeToFile(down_img,
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (!res)
- {
- print("Failed to save enviroment map.");
- }
-
- }
- else
- {
- let down_img = this.cube_target.getCubeImage();
-
- let res = imageSaver.saveCubeToFile(down_img,
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (!res)
- {
- print("Failed to save enviroment map.");
- }
- }
- }
-
- this.doc.env_gen = null;
- }
- }
-
-}
-
-class GPUProbeGridBaker
-{
- constructor(doc, proxy, xml_node, iterations, num_rays)
- {
- this.doc = doc;
- this.xml_node = xml_node;
-
- this.probe_grid = new ProbeGrid();
- this.probe_grid.setDivisions(proxy.divisions);
- this.probe_grid.setCoverageMin(proxy.coverageMin);
- this.probe_grid.setCoverageMax(proxy.coverageMax);
- this.probe_grid.ypower = proxy.ypower;
-
- print("Constructing visibility information...");
- this.probe_grid.constructVisibility(doc.scene);
-
- let props = this.xml_node.attributes;
- if (props.hasOwnProperty('dynamic_map'))
- {
- this.probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- if (props.hasOwnProperty('normal_bias'))
- {
- this.probe_grid.normalBias = parseFloat(props.normal_bias);
- }
- if (props.hasOwnProperty('per_primitive'))
- {
- this.probe_grid.perPrimitive = string_to_boolean(props.per_primitive);
- }
- this.doc.scene.indirectLight = this.probe_grid;
-
- let divisions = this.probe_grid.divisions;
- this.probe_count = divisions.x*divisions.y*divisions.z;
-
- this.probe_idx = 0;
- this.iterations = iterations;
- this.num_rays_final = num_rays;
- this.iter = 0;
- this.check_time = now();
- }
-
- render(renderer)
- {
- let frame_time = now();
-
- if (frame_time - this.check_time>=500)
- {
- print(`Building probe-grid, iteration: ${this.iter+1}/${this.iterations}, probe: ${this.probe_idx +1}/${this.probe_count}`);
- this.check_time = frame_time;
- }
-
- while(now()-frame_time<10)
- {
- if (this.doc.probe_grid_bake == null) break;
- let num_rays = (this.num_rays_final >> (this.iterations - this.iter));
- let num_probes = renderer.updateProbes(this.doc.scene, this.probe_grid, this.probe_idx, num_rays, 0.5, 1.0);
- this.probe_idx += num_probes;
- if (this.probe_idx>=this.probe_count)
- {
- this.probe_idx = 0;
- this.iter++;
-
- if (this.iter >= this.iterations)
- {
- print("Saving probe-grid.");
- let props = this.xml_node.attributes;
- let probe_data = "assets/probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let res = probeGridSaver.saveFile(this.probe_grid, probe_data);
- if (!res)
- {
- print("Failed to save probe-grid.");
- }
- this.doc.probe_grid_bake = null;
- }
- }
- }
- }
-}
-
-class GPULODProbeGridBaker
-{
- constructor(doc, proxy, xml_node, iterations, num_rays)
- {
- this.doc = doc;
- this.xml_node = xml_node;
-
- this.cube_target = new CubeRenderTarget(64,64);
- this.probe_grid = this.doc.scene.indirectLight;
-
- print("Constructing visibility information...");
- this.probe_grid.constructVisibility(doc.scene);
-
- this.probe_count = this.probe_grid.numberOfProbes;
- this.probe_idx = 0;
-
- this.iterations = iterations;
- this.num_rays_final = num_rays;
- this.iter = 0;
- this.check_time = now();
-
- }
-
- render(renderer)
- {
- let frame_time = now();
-
- if (frame_time - this.check_time>=500)
- {
- print(`Building LOD Probe-Grid, iteration: ${this.iter+1}/${this.iterations}, probe: ${this.probe_idx +1}/${this.probe_count}`);
- this.check_time = frame_time;
- }
-
- while(now()-frame_time<10)
- {
- if (this.doc.lod_probe_grid_bake == null) break;
- let num_rays = (this.num_rays_final >> (this.iterations - this.iter));
- let num_probes = renderer.updateProbes(this.doc.scene, this.probe_grid, this.probe_idx, num_rays, 0.5, 1.0);
- this.probe_idx += num_probes;
- if (this.probe_idx>=this.probe_count)
- {
- this.probe_idx = 0;
- this.iter++;
-
- if (this.iter >= this.iterations)
- {
- print("Saving probe-grid.");
- let props = this.xml_node.attributes;
- let probe_data = "assets/lod_probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let res = LODProbeGridSaver.saveFile(this.probe_grid, probe_data);
- if (!res)
- {
- print("Failed to save probe-grid.");
- }
- this.doc.lod_probe_grid_bake = null;
- }
- }
- }
-
- }
-
-}
-
-// Tags
-const create_default_controls = (doc)=>{
- if (doc.controls)
- doc.controls.dispose();
- doc.controls = new OrbitControls(doc.camera, doc.view);
- doc.controls.enableDamping = true;
- doc.controls.target.set(0, 1.5, 0);
-};
-
-const create_default_sky = (doc)=>{
- let bg = new HemisphereBackground();
- bg.setSkyColor(0.318, 0.318, 0.318);
- bg.setGroundColor(0.01, 0.025, 0.025);
- doc.scene.background = bg;
-};
-
-const create_default_env_light = (doc) =>{
- let envLight = new HemisphereLight();
- envLight.setSkyColor(0.318, 0.318, 0.318);
- envLight.setGroundColor(0.01, 0.025, 0.025);
- doc.scene.indirectLight = envLight;
-};
-
-const scene = {
- reset: (doc) => {
- doc.scene = new Scene();
- },
- create: (doc, props, mode, parent) => {
- doc.scene = new Scene();
- create_default_sky(doc);
- create_default_env_light(doc);
- return doc.scene;
- },
- generate: (doc, obj, input) =>{
- generate_lightmap(doc, input);
- }
-};
-
-const camera = {
- reset: (doc) => {
- doc.camera = new PerspectiveCamera(45, doc.width / doc.height, 0.1, 100);
- doc.camera.setPosition(0, 1.5, 5.0);
- },
-
- create: (doc, props, mode, parent) => {
- let fov = 50.0;
- let near = 0.1;
- let far = 200.0;
- if (props.hasOwnProperty("fov"))
- {
- fov = parseFloat(props.fov);
- }
- if (props.hasOwnProperty("near"))
- {
- near = parseFloat(props.near);
- }
- if (props.hasOwnProperty("far"))
- {
- far = parseFloat(props.far);
- }
- doc.camera = new PerspectiveCamera(fov, doc.width / doc.height, near, far);
- create_default_controls(doc);
- return doc.camera;
- },
-
- remove: (doc, obj) => {
- camera.reset(doc);
- create_default_controls(doc);
- }
-};
-
-const control = {
- reset: (doc) => {
- create_default_controls(doc);
- },
- create: (doc, props, mode, parent) =>{
- let type = 'orbit';
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == 'orbit')
- {
- let from_x = 0.0;
- let from_y = 1.5;
- let from_z = 5.0;
- if (props.hasOwnProperty("look_from"))
- {
- let look_from = props.look_from.split(',');
- from_x = parseFloat(look_from[0]);
- from_y = parseFloat(look_from[1]);
- from_z = parseFloat(look_from[2]);
- }
-
- let to_x = 0.0;
- let to_y = 1.5;
- let to_z = 0.0;
- if (props.hasOwnProperty("look_at"))
- {
- let look_at = props.look_at.split(',');
- to_x = parseFloat(look_at[0]);
- to_y = parseFloat(look_at[1]);
- to_z = parseFloat(look_at[2]);
- }
-
- doc.camera.setPosition(from_x, from_y, from_z);
- if (doc.controls != null)
- doc.controls.dispose();
- doc.controls = new OrbitControls(doc.camera, doc.view);
- doc.controls.enableDamping = true;
- doc.controls.target.set(to_x, to_y, to_z);
- }
- return doc.controls;
- },
- remove: (doc, obj) => {
- create_default_controls(doc);
- }
-
-};
-
-const fog = {
- create: (doc, props, mode, parent) =>{
- doc.scene.fog = new Fog();
- if (props.hasOwnProperty("density"))
- {
- doc.scene.fog.density = parseFloat(props.density);
- }
- return doc.scene.fog;
- },
- tuning: (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("density" in input)
- {
- let density = input.density;
- props.density = density;
- obj.density = parseFloat(density);
- }
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
- return "";
- },
- remove: (doc, fog) => {
- doc.scene.fog = null;
- }
-};
-
-const create_uniform_sky = (doc, props) => {
- let bg = new ColorBackground();
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setColor(r,g,b);
- }
- doc.scene.background = bg;
- return bg;
-};
-
-const create_hemisphere_sky = (doc, props)=>{
- let bg = new HemisphereBackground();
-
- if (props.hasOwnProperty('skyColor'))
- {
- const color = props.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setSkyColor(r,g,b);
- }
-
- if (props.hasOwnProperty('groundColor'))
- {
- const color = props.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setGroundColor(r,g,b);
-
- }
-
- doc.scene.background = bg;
- return bg;
-};
-
-const create_cube_sky = (doc, props)=>{
- let bg = new CubeBackground();
-
- let url = "assets/textures";
- let posx = "face0.jpg";
- let negx = "face1.jpg";
- let posy = "face2.jpg";
- let negy = "face3.jpg";
- let posz = "face4.jpg";
- let negz = "face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (cube_img!=null)
- {
- bg.setCubemap(cube_img);
- }
- doc.scene.background = bg;
-
- return bg;
-};
-
-const create_background_scene = (doc, props)=>{
- let path_scene = "terrain.xml";
- if (props.hasOwnProperty('scene'))
- {
- path_scene = props.scene;
- }
-
- let near = 10.0;
- let far = 10000.0;
- if (props.hasOwnProperty('near'))
- {
- near = parseFloat(props.near);
- }
- if (props.hasOwnProperty('far'))
- {
- far = parseFloat(props.far);
- }
-
- let bg_doc = new BackgroundDocument(near, far);
- bg_doc.load_local_xml(path_scene);
- doc.scene.background = bg_doc;
-
- return bg_doc;
-};
-
-const tuning_uniform_sky = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-};
-
-const tuning_hemisphere_sky = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("skyColor" in input)
- {
- props.skyColor = input.skyColor;
- const color = input.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setSkyColor(r,g,b);
- }
-
- if ("groundColor" in input)
- {
- props.groundColor = input.groundColor;
- const color = input.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setGroundColor(r,g,b);
- }
-};
-
-const tuning_cube_sky = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- let reload = false;
- if ("path" in input)
- {
- props.path = input.path;
- reload = true;
- }
- if ("posx" in input)
- {
- props.posx = input.posx;
- reload = true;
- }
- if ("negx" in input)
- {
- props.negx = input.negx;
- reload = true;
- }
- if ("posy" in input)
- {
- props.posy = input.posy;
- reload = true;
- }
- if ("negy" in input)
- {
- props.negy = input.negy;
- reload = true;
- }
- if ("posz" in input)
- {
- props.posz = input.posz;
- reload = true;
- }
- if ("negz" in input)
- {
- props.negz = input.negz;
- reload = true;
- }
- if (reload)
- {
- const url = props.path;
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+props.posx, url+"/"+props.negx,
- url+"/"+props.posy, url+"/"+props.negy,
- url+"/"+props.posz, url+"/"+props.negz);
-
- obj.setCubemap(cube_img);
- }
-};
-
-const tuning_background_scene = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("scene" in input)
- {
- props.scene = input.scene;
- obj.load_local_xml(input.scene);
- }
- if ("near" in input)
- {
- props.near = input.near;
- obj.near = parseFloat(input.near);
- }
- if ("far" in input)
- {
- props.far = input.far;
- obj.far = parseFloat(input.far);
- }
-};
-
-const sky = {
- reset: (doc) => {
- create_default_sky(doc);
- },
- create: (doc, props, mode, parent) => {
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- return create_uniform_sky(doc,props);
- }
- else if (type == "hemisphere")
- {
- return create_hemisphere_sky(doc,props);
- }
- else if (type == "cube")
- {
- return create_cube_sky(doc,props);
- }
- else if (type == "scene")
- {
- return create_background_scene(doc,props);
- }
- },
- remove: (doc, obj) => {
- create_default_sky(doc);
- },
- tuning: (doc, obj, input) => {
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- if (input.hasOwnProperty('type'))
- {
- node.attributes = {};
- node.attributes.type = input.type;
- doc.external_index.index[key].attributes = node.attributes;
- let obj_new = sky.create(doc, node.attributes, "local", doc.scene);
- obj_new.uuid = key;
- obj_new.tag = "sky";
- doc.internal_index[key].obj = obj_new;
- return JSON.stringify(node.attributes);
- }
- else
- {
- let props = node.attributes;
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- tuning_uniform_sky(doc, obj, input);
- }
- else if (type=="hemisphere")
- {
- tuning_hemisphere_sky(doc, obj, input);
- }
- else if (type=="cube")
- {
- tuning_cube_sky(doc, obj, input);
- }
- else if (type=="scene")
- {
- tuning_background_scene(doc, obj, input);
- }
- }
- return ""
- }
-};
-
-const create_uniform_env_light = (doc, props) => {
- let envLight = new AmbientLight();
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setColor(r,g,b);
- }
- doc.scene.indirectLight = envLight;
- return envLight;
-};
-
-const create_hemisphere_env_light = (doc, props) => {
- let envLight = new HemisphereLight();
-
- if (props.hasOwnProperty('skyColor'))
- {
- const color = props.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setSkyColor(r,g,b);
- }
-
- if (props.hasOwnProperty('groundColor'))
- {
- const color = props.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setGroundColor(r,g,b);
- }
- doc.scene.indirectLight = envLight;
- return envLight;
-};
-
-const create_cube_env_light = (doc, props) => {
- const proxy = new SimpleModel();
- proxy.createBox(0.3, 0.3, 0.3);
-
- if (props.hasOwnProperty('probe_position'))
- {
- const position = props.probe_position.split(',');
- proxy.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
- proxy.setColor(0.7,0.0,0.7);
- doc.scene.addWidget(proxy);
-
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (irradiance_only)
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let envLight = new EnvironmentMap();
- let text = fileLoader.loadTextFile(path_sh);
- if (text!=null)
- {
- envLight.shCoefficients = JSON.parse(text);
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let cube_img = HDRImageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
- doc.scene.indirectLight = envLight;
- }
- }
-
- return proxy;
-};
-
-const create_probe_grid = (doc, props) => {
- const proxy = new ProbeGridWidget();
- if (props.hasOwnProperty('divisions'))
- {
- const divisions = props.divisions.split(',');
- proxy.setDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
- if (props.hasOwnProperty('coverage_min'))
- {
- const coverage_min = props.coverage_min.split(',');
- proxy.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
- if (props.hasOwnProperty('coverage_max'))
- {
- const coverage_max = props.coverage_max.split(',');
- proxy.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
- if (props.hasOwnProperty('ypower'))
- {
- proxy.ypower = parseFloat(props.ypower);
- }
- doc.scene.addWidget(proxy);
-
- let probe_data = "assets/probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
-
- let probe_grid = probeGridLoader.loadFile(probe_data);
- if (probe_grid == null)
- {
- probe_grid = new ProbeGrid();
- probe_grid.setDivisions(proxy.divisions);
- probe_grid.setCoverageMin(proxy.coverageMin);
- probe_grid.setCoverageMax(proxy.coverageMax);
- probe_grid.ypower = proxy.ypower;
- }
- else
- {
- proxy.setDivisions(probe_grid.divisions);
- proxy.setCoverageMin(probe_grid.coverageMin);
- proxy.setCoverageMax(probe_grid.coverageMax);
- proxy.ypower = probe_grid.ypower;
-
- props.divisions = `${probe_grid.divisions.x}, ${probe_grid.divisions.y}, ${probe_grid.divisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.ypower = `${probe_grid.ypower}`;
- }
-
- if (props.hasOwnProperty('normal_bias'))
- {
- probe_grid.normalBias = parseFloat(props.normal_bias);
- }
-
- if (props.hasOwnProperty('per_primitive'))
- {
- probe_grid.perPrimitive =string_to_boolean(props.per_primitive);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return proxy;
-};
-
-const create_lod_probe_grid = (doc, props) => {
- const proxy = new LODProbeGridWidget();
- if (props.hasOwnProperty('base_divisions'))
- {
- const divisions = props.base_divisions.split(',');
- proxy.setBaseDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
- if (props.hasOwnProperty('coverage_min'))
- {
- const coverage_min = props.coverage_min.split(',');
- proxy.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
- if (props.hasOwnProperty('coverage_max'))
- {
- const coverage_max = props.coverage_max.split(',');
- proxy.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
- proxy.subDivisionLevel = 2;
- if (props.hasOwnProperty('sub_division_level'))
- {
- proxy.subDivisionLevel = parseInt(props.sub_division_level);
- }
-
- doc.scene.addWidget(proxy);
-
- let probe_data = "assets/lod_probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
-
- let probe_grid = LODProbeGridLoader.loadFile(probe_data);
- if (probe_grid == null)
- {
- probe_grid = new LODProbeGrid();
- probe_grid.setBaseDivisions(proxy.baseDivisions);
- probe_grid.setCoverageMin(proxy.coverageMin);
- probe_grid.setCoverageMax(proxy.coverageMax);
- probe_grid.subDivisionLevel = proxy.subDivisionLevel;
- }
- else
- {
- proxy.setBaseDivisions(probe_grid.baseDivisions);
- proxy.setCoverageMin(probe_grid.coverageMin);
- proxy.setCoverageMax(probe_grid.coverageMax);
- proxy.subDivisionLevel = probe_grid.subDivisionLevel;
-
- props.base_divisions = `${probe_grid.baseDivisions.x}, ${probe_grid.baseDivisions.y}, ${probe_grid.baseDivisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.sub_division_level = `${probe_grid.subDivisionLevel}`;
- }
- proxy.probeGrid = probe_grid;
-
- if (props.hasOwnProperty('normal_bias'))
- {
- probe_grid.normalBias = parseFloat(props.normal_bias);
- }
-
- if (props.hasOwnProperty('per_primitive'))
- {
- probe_grid.perPrimitive =string_to_boolean(props.per_primitive);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return proxy;
-};
-
-const tuning_ambient_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- return "";
-};
-
-
-const tuning_hemisphere_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("skyColor" in input)
- {
- props.skyColor = input.skyColor;
- const color = input.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setSkyColor(r,g,b);
- }
-
- if ("groundColor" in input)
- {
- props.groundColor = input.groundColor;
- const color = input.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setGroundColor(r,g,b);
- }
-
- return ""
-};
-
-const tuning_cube_env_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("probe_position" in input)
- {
- let probe_position = input.probe_position;
- props.probe_position = probe_position;
- let position = probe_position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- let reload = false;
-
- if ("irradiance_only" in input)
- {
- props.irradiance_only = input.irradiance_only;
- reload = true;
- }
-
- if ("path" in input)
- {
- props.path = input.path;
- reload = true;
- }
- if ("posx" in input)
- {
- props.posx = input.posx;
- reload = true;
- }
- if ("negx" in input)
- {
- props.negx = input.negx;
- reload = true;
- }
- if ("posy" in input)
- {
- props.posy = input.posy;
- reload = true;
- }
- if ("negy" in input)
- {
- props.negy = input.negy;
- reload = true;
- }
- if ("posz" in input)
- {
- props.posz = input.posz;
- reload = true;
- }
- if ("negz" in input)
- {
- props.negz = input.negz;
- reload = true;
- }
-
- if ("path_sh" in input)
- {
- props.path_sh = input.path_sh;
- reload = true;
- }
-
- if (reload)
- {
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (irradiance_only )
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let envLight = new EnvironmentMap();
- let text = fileLoader.loadTextFile(path_sh);
- if (text!=null)
- {
- envLight.shCoefficients = JSON.parse(text);
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let cube_img = HDRImageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- envLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = envLight;
- }
- else
- {
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- envLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = envLight;
- }
- }
- }
- return "";
-};
-
-const tuning_probe_grid = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("probe_data" in input)
- {
- props.probe_data = input.probe_data;
-
- let probe_grid = probeGridLoader.loadFile(input.probe_data);
- if (probe_grid == null)
- {
- probe_grid = new ProbeGrid();
- probe_grid.setDivisions(obj.divisions);
- probe_grid.setCoverageMin(obj.coverageMin);
- probe_grid.setCoverageMax(obj.coverageMax);
- probe_grid.ypower = obj.ypower;
- }
- else
- {
- obj.setDivisions(probe_grid.divisions);
- obj.setCoverageMin(probe_grid.coverageMin);
- obj.setCoverageMax(probe_grid.coverageMax);
- obj.ypower = probe_grid.ypower;
-
- props.divisions = `${probe_grid.divisions.x}, ${probe_grid.divisions.y}, ${probe_grid.divisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.ypower = `${probe_grid.ypower}`;
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return JSON.stringify(props);
- }
-
- if ("divisions" in input)
- {
- props.divisions = input.divisions;
- let divisions = input.divisions.split(',');
- obj.setDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
-
- if ("coverage_min" in input)
- {
- props.coverage_min = input.coverage_min;
- let coverage_min = input.coverage_min.split(',');
- obj.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
-
- if ("coverage_max" in input)
- {
- props.coverage_max = input.coverage_max;
- let coverage_max = input.coverage_max.split(',');
- obj.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
-
- if ("ypower" in input)
- {
- props.ypower = input.ypower;
- obj.ypower = parseFloat(input.ypower);
- }
-
- if ("normal_bias" in input)
- {
- props.normal_bias = input.normal_bias;
- doc.scene.indirectLight.normalBias = parseFloat(input.normal_bias);
- }
-
- if ("per_primitive" in input)
- {
- props.per_primitive = input.per_primitive;
- doc.scene.indirectLight.perPrimitive =string_to_boolean(input.per_primitive);
- }
-
- if ("auto_area" in input)
- {
- let aabb = doc.scene.getBoundingBox();
- let minPos = aabb.minPos;
- let maxPos = aabb.maxPos;
- let size_x = maxPos.x - minPos.x;
- let size_y = maxPos.y - minPos.y;
- let size_z = maxPos.z - minPos.z;
- let div_x = Math.ceil(size_x); if (div_x<2) div_x = 2;
- let div_y = Math.ceil(size_y); if (div_y<2) div_y = 2;
- let div_z = Math.ceil(size_z); if (div_z<2) div_z = 2;
- obj.setDivisions(div_x, div_y, div_z);
- obj.setCoverageMin(minPos);
- obj.setCoverageMax(maxPos);
- props.divisions = `${div_x}, ${div_y}, ${div_z}`;
- props.coverage_min = `${minPos.x}, ${minPos.y}, ${minPos.z}`;
- props.coverage_max = `${maxPos.x}, ${maxPos.y}, ${maxPos.z}`;
- let ret = { divisions: props.divisions, coverage_min: props.coverage_min, coverage_max: props.coverage_max };
- return JSON.stringify(ret);
- }
-
- return "";
-
-};
-
-const tuning_lod_probe_grid = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("probe_data" in input)
- {
- props.probe_data = input.probe_data;
-
- let probe_grid = LODProbeGridLoader.loadFile(input.probe_data);
- if (probe_grid == null)
- {
- probe_grid = new LODProbeGrid();
- probe_grid.setBaseDivisions(obj.baseDivisions);
- probe_grid.setCoverageMin(obj.coverageMin);
- probe_grid.setCoverageMax(obj.coverageMax);
- probe_grid.subDivisionLevel = obj.subDivisionLevel;
- }
- else
- {
- obj.setBaseDivisions(probe_grid.baseDivisions);
- obj.setCoverageMin(probe_grid.coverageMin);
- obj.setCoverageMax(probe_grid.coverageMax);
- obj.subDivisionLevel = probe_grid.subDivisionLevel;
-
- props.base_divisions = `${probe_grid.baseDivisions.x}, ${probe_grid.baseDivisions.y}, ${probe_grid.baseDivisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.sub_division_level = `${probe_grid.subDivisionLevel}`;
- }
- obj.probeGrid = probe_grid;
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return JSON.stringify(props);
- }
-
- if ("base_divisions" in input)
- {
- props.base_divisions = input.base_divisions;
- let divisions = input.base_divisions.split(',');
- obj.setBaseDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
-
- if ("coverage_min" in input)
- {
- props.coverage_min = input.coverage_min;
- let coverage_min = input.coverage_min.split(',');
- obj.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
-
- if ("coverage_max" in input)
- {
- props.coverage_max = input.coverage_max;
- let coverage_max = input.coverage_max.split(',');
- obj.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
-
- if ("sub_division_level" in input)
- {
- props.sub_division_level = input.sub_division_level;
- obj.subDivisionLevel = parseInt(input.sub_division_level);
- }
-
- if ("normal_bias" in input)
- {
- props.normal_bias = input.normal_bias;
- obj.probeGrid.normalBias = parseFloat(input.normal_bias);
- }
-
- if ("per_primitive" in input)
- {
- props.per_primitive = input.per_primitive;
- obj.probeGrid.perPrimitive =string_to_boolean(input.per_primitive);
- }
-
- if ("auto_area" in input)
- {
- let aabb = doc.scene.getBoundingBox();
- let minPos = aabb.minPos;
- let maxPos = aabb.maxPos;
- let size_x = maxPos.x - minPos.x;
- let size_y = maxPos.y - minPos.y;
- let size_z = maxPos.z - minPos.z;
- let div_x = Math.ceil(size_x / 4); if (div_x<2) div_x = 2;
- let div_y = Math.ceil(size_y / 4); if (div_y<2) div_y = 2;
- let div_z = Math.ceil(size_z / 4); if (div_z<2) div_z = 2;
- obj.setBaseDivisions(div_x, div_y, div_z);
- obj.setCoverageMin(minPos);
- obj.setCoverageMax(maxPos);
- obj.subDivisionLevel = 2;
- props.base_divisions = `${div_x}, ${div_y}, ${div_z}`;
- props.coverage_min = `${minPos.x}, ${minPos.y}, ${minPos.z}`;
- props.coverage_max = `${maxPos.x}, ${maxPos.y}, ${maxPos.z}`;
- props.sub_division_level = "2";
- let ret = { base_divisions: props.base_divisions, coverage_min: props.coverage_min, coverage_max: props.coverage_max, sub_division_level: "2" };
- return JSON.stringify(ret);
- }
-
- return "";
-
-};
-
-const initialize_lod_probe_grid = (doc, obj, input) =>{
- let probe_grid = obj.probeGrid;
-
- doc.lod_probe_grid_bake = null;
- probe_grid.setBaseDivisions(obj.baseDivisions);
- probe_grid.setCoverageMin(obj.coverageMin);
- probe_grid.setCoverageMax(obj.coverageMax);
- probe_grid.subDivisionLevel = obj.subDivisionLevel;
- probe_grid.initialize(doc.renderer, doc.scene);
- return probe_grid.numberOfProbes;
-};
-
-
-const generate_lightmap = (doc, input) =>{
- let iterations = parseInt(input.iterations);
- let num_rays = parseInt(input.num_rays);
- doc.lightmap_bake = new LightmapBaker(doc, iterations, num_rays);
-};
-
-const generate_cube_env_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (!irradiance_only)
- {
- props.path = input.path;
- props.posx = input.posx;
- props.negx = input.negx;
- props.posy = input.posy;
- props.negy = input.negy;
- props.posz = input.posz;
- props.negz = input.negz;
- }
- doc.env_gen = new EnvMapGen(doc, obj, node, irradiance_only);
-};
-
-const generate_probe_grid = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let iterations = parseInt(input.iterations);
- let num_rays = parseInt(input.num_rays);
- doc.probe_grid_bake = new GPUProbeGridBaker(doc, obj, node, iterations, num_rays);
-};
-
-
-const generate_lod_probe_grid = (doc, obj, input) =>{
- initialize_lod_probe_grid(doc, obj);
- let node = doc.internal_index[obj.uuid].xml_node;
- let iterations = parseInt(input.iterations);
- let num_rays = parseInt(input.num_rays);
- doc.lod_probe_grid_bake = new GPULODProbeGridBaker(doc, obj, node, iterations, num_rays);
-};
-
-const env_light = {
- reset: (doc) => {
- create_default_env_light(doc);
- },
- create: (doc, props, mode, parent) => {
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
-
- let ret = null;
-
- if (type == "uniform")
- {
- ret = create_uniform_env_light(doc,props);
- }
- else if (type == "hemisphere")
- {
- ret = create_hemisphere_env_light(doc,props);
- }
- else if (type == "cube")
- {
- ret = create_cube_env_light(doc,props);
- }
- else if (type == "probe_grid")
- {
- ret = create_probe_grid(doc, props);
- }
- else if (type == "lod_probe_grid")
- {
- ret = create_lod_probe_grid(doc, props);
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- doc.scene.indirectLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- return ret;
- },
- remove: (doc, obj) => {
- create_default_env_light(doc);
-
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- let props = node.attributes;
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
-
- if (type == "cube" || type =="probe_grid" || type == "lod_probe_grid")
- {
- doc.scene.removeWidget(obj);
- }
-
- },
-
- tuning: (doc, obj, input) => {
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- if (input.hasOwnProperty('type'))
- {
- doc.remove(obj);
- node.attributes = {};
- node.attributes.type = input.type;
- doc.external_index.index[key].attributes = node.attributes;
- let obj_new = env_light.create(doc, node.attributes, "local", doc.scene);
- obj_new.uuid = key;
- obj_new.tag = "env_light";
- doc.internal_index[key].obj = obj_new;
- return JSON.stringify(node.attributes);
- }
- else
- {
- let props = node.attributes;
-
- if (input.hasOwnProperty('dynamic_map'))
- {
- props.dynamic_map = input.dynamic_map;
- doc.scene.indirectLight.dynamicMap = string_to_boolean(input.dynamic_map);
- return ""
- }
-
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- return tuning_ambient_light(doc, obj, input);
- }
- else if (type=="hemisphere")
- {
- return tuning_hemisphere_light(doc, obj, input);
- }
- else if (type=="cube")
- {
- return tuning_cube_env_light(doc,obj,input);
- }
- else if (type == "probe_grid")
- {
- return tuning_probe_grid(doc,obj,input);
- }
- else if (type == "lod_probe_grid")
- {
- return tuning_lod_probe_grid(doc,obj,input);
- }
- }
-
- },
-
- initialize: (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if (props.type == "lod_probe_grid")
- {
- return initialize_lod_probe_grid(doc,obj);
- }
- return "";
- },
-
- generate: (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if (props.type == "cube")
- {
- generate_cube_env_light(doc,obj,input);
- }
- else if (props.type == "probe_grid")
- {
- generate_probe_grid(doc,obj,input);
- }
- else if (props.type == "lod_probe_grid")
- {
- generate_lod_probe_grid(doc,obj,input);
- }
- }
-
-};
-
-
-const tuning_object3d = (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("name" in input)
- {
- props.name = input.name;
- obj.name = input.name;
- }
- if ("position" in input)
- {
- props.position = input.position;
- let position = input.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
- if ("rotation" in input)
- {
- props.rotation = input.rotation;
- let rotation = input.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
- if ("scale" in input)
- {
- props.scale = input.scale;
- let scale = input.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
- if ('is_building' in input)
- {
- props.is_building = input.is_building;
- obj.isBuilding = string_to_boolean(input.is_building);
- }
-};
-
-const tuning_material = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if ("texture" in input)
- {
- props.texture = input.texture;
- let img = imageLoader.loadFile(input.texture);
- obj.setColorTexture(img);
- }
-
- if ("metalness" in input)
- {
- let metalness = input.metalness;
- props.metalness = metalness;
- obj.metalness = parseFloat(metalness);
- }
-
- if ("roughness" in input)
- {
- let roughness = input.roughness;
- props.roughness = roughness;
- obj.roughness = parseFloat(roughness);
- }
-};
-
-const group = {
- create: (doc, props, mode, parent) => {
- const group = new Object3D();
- if (parent != null) {
- parent.add(group);
- }
- else {
- doc.scene.add(group);
- }
- return group;
- },
-
- tuning: (doc, obj, input) => {
- tuning_object3d(doc, obj, input);
- return "";
- }
-};
-
-const plane = {
- create: (doc, props, mode, parent) => {
- let width = 1.0;
- let height = 1.0;
- if (props.hasOwnProperty('size'))
- {
- let size = props.size.split(',');
- width = parseFloat(size[0]);
- height = parseFloat(size[1]);
- }
-
- const plane = new SimpleModel();
- plane.createPlane(width, height);
-
- if (parent != null) {
- parent.add(plane);
- }
- else {
- doc.scene.add(plane);
- }
- return plane;
- },
-
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("size" in input)
- {
- props.size = input.size;
- let size = input.size.split(',');
- let width = parseFloat(size[0]);
- let height = parseFloat(size[1]);
- obj.createPlane(width, height);
- }
- tuning_object3d(doc, obj, input);
- tuning_material(doc, obj, input);
- return "";
- }
-};
-
-
-const box = {
- create: (doc, props, mode, parent) => {
- let width = 1.0;
- let height = 1.0;
- let depth = 1.0;
- if (props.hasOwnProperty('size'))
- {
- let size = props.size.split(',');
- width = parseFloat(size[0]);
- height = parseFloat(size[1]);
- depth = parseFloat(size[2]);
- }
-
- const box = new SimpleModel();
- box.createBox(width, height, depth);
-
- if (parent != null) {
- parent.add(box);
- }
- else {
- doc.scene.add(box);
- }
- return box;
- },
-
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("size" in input)
- {
- props.size = input.size;
- let size = input.size.split(',');
- let width = parseFloat(size[0]);
- let height = parseFloat(size[1]);
- let depth = parseFloat(size[2]);
- obj.createBox(width, height, depth);
- }
- tuning_object3d(doc, obj, input);
- tuning_material(doc, obj, input);
- return "";
- }
-};
-
-const sphere = {
- create: (doc, props, mode, parent) => {
- let radius = 1.0;
- if (props.hasOwnProperty('radius'))
- {
- radius = parseFloat(props.radius);
- }
- let widthSegments = 32;
- if (props.hasOwnProperty('widthSegments'))
- {
- widthSegments = parseInt(props.widthSegments);
- }
- let heightSegments = 16;
- if (props.hasOwnProperty('heightSegments'))
- {
- heightSegments = parseInt(props.heightSegments);
- }
-
- const sphere = new SimpleModel();
- sphere.createSphere(radius, widthSegments, heightSegments);
-
- if (parent != null) {
- parent.add(sphere);
- }
- else {
- doc.scene.add(sphere);
- }
- return sphere;
- },
-
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- let to_create = false;
-
- let radius = 1.0;
- if ("radius" in input)
- {
- props.radius = input.radius;
- radius = parseFloat(input.radius);
- to_create = true;
- }
-
- let widthSegments = 32;
- if ("widthSegments" in input)
- {
- props.widthSegments = input.widthSegments;
- widthSegments = parseInt(input.widthSegments);
- to_create = true;
- }
-
- let heightSegments = 16;
- if ("heightSegments" in input)
- {
- props.heightSegments = input.heightSegments;
- heightSegments = parseInt(input.heightSegments);
- to_create = true;
- }
-
- if (to_create)
- {
- obj.createSphere(radius, widthSegments, heightSegments);
- }
-
- tuning_object3d(doc, obj, input);
- tuning_material(doc, obj, input);
- return "";
- }
-};
-
-const model = {
- create: (doc, props, mode, parent) => {
- let url = "assets/models/model.glb";
- if (props.hasOwnProperty('src'))
- {
- url = props.src;
- }
- let model = gltfLoader.loadModelFromFile(url);
- if (model == null)
- {
- model= new SimpleModel();
- model.createBox(0.5, 1.5, 0.5);
- model.setColor(0.7,0.0,0.7);
- }
- else
- {
- if (props.hasOwnProperty('is_building') && string_to_boolean(props.is_building))
- {
- model.batchPrimitives();
- }
-
- if (model.isBakable)
- {
- doc.bakables.push(model);
-
- if (props.hasOwnProperty('lightmap'))
- {
- let filename = props.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=="hdr")
- {
- let hdr_img = HDRImageLoader.loadFile(filename);
- if (hdr_img!=null)
- {
- model.setLightmap(hdr_img);
- }
- }
- else if (ext=="dds")
- {
- let dds_img = DDSImageLoader.loadFile(filename);
- if (dds_img!=null)
- {
- model.setLightmap(dds_img);
- }
- }
- else if (ext=="png" || ext == "webp")
- {
- let img = imageLoader.loadFile(filename);
- if (img!=null)
- {
- let hdr_img = HDRImageLoader.fromRGBM(img);
- model.setLightmap(hdr_img);
- }
- }
- else if (ext=="csv")
- {
- let text = fileLoader.loadTextFile(filename);
- if (text!=null)
- {
- let path = filename.match(/(.*)[\/\\]/)[1]||'';
- let images = [];
- let ranges = [];
- let lines = text.split(/\r?\n/);
- for(let line of lines)
- {
- let fields = line.split(",");
- if (fields.length<7) continue;
- let fn_img = fields[0];
- let img = imageLoader.loadFile(path + "/" + fn_img);
- if (img == null) continue;
- let low = new Vector3(parseFloat(fields[1]), parseFloat(fields[2]), parseFloat(fields[3]));
- let high = new Vector3(parseFloat(fields[4]), parseFloat(fields[5]), parseFloat(fields[6]));
- images.push(img);
- ranges.push({low, high});
- }
- let hdr_img = HDRImageLoader.fromImages(images, ranges);
- model.setLightmap(hdr_img);
- }
- }
- }
- }
- }
-
-
- if (parent != null) {
- parent.add(model);
- }
- else {
- doc.scene.add(model);
- }
- return model;
- },
-
- tuning: (doc, obj, input) => {
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- let props = node.attributes;
- if (input.hasOwnProperty('src'))
- {
- doc.remove(obj);
- props.src = input.src;
- let obj_new = model.create(doc, props, "local", obj.parent);
- obj_new.uuid = key;
- obj_new.tag = "model";
-
- if (props.hasOwnProperty('name'))
- {
- obj_new.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj_new.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj_new.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj_new.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- obj_new.setToonShading(16, 5.0, new Vector3(1.0, 1.0, 0.2));
-
- doc.internal_index[key].obj = obj_new;
- }
- else
- {
- if ("is_building" in input)
- {
- props.is_building = input.is_building;
- if (string_to_boolean(props.is_building))
- {
- obj.batchPrimitives();
- }
- }
-
- if ("lightmap" in input)
- {
- props.lightmap = input.lightmap;
- if (obj.isBakable)
- {
- let filename = input.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=="hdr")
- {
- let hdr_img = HDRImageLoader.loadFile(filename);
- if (hdr_img!=null)
- {
- obj.setLightmap(hdr_img);
- }
- }
- else if (ext=="dds")
- {
- let dds_img = DDSImageLoader.loadFile(filename);
- if (dds_img!=null)
- {
- obj.setLightmap(dds_img);
- }
- }
- else if (ext=="png" || ext == "webp")
- {
- let img = imageLoader.loadFile(filename);
- if (img!=null)
- {
- let hdr_img = HDRImageLoader.fromRGBM(img);
- obj.setLightmap(hdr_img);
- }
- }
- else if (ext=="csv")
- {
- let text = fileLoader.loadTextFile(filename);
- if (text!=null)
- {
- let path = filename.match(/(.*)[\/\\]/)[1]||'';
- let images = [];
- let ranges = [];
- let lines = text.split(/\r?\n/);
- for(let line of lines)
- {
- let fields = line.split(",");
- if (fields.length<7) continue;
- let fn_img = fields[0];
- let img = imageLoader.loadFile(path + "/" + fn_img);
- if (img == null) continue;
- let low = new Vector3(parseFloat(fields[1]), parseFloat(fields[2]), parseFloat(fields[3]));
- let high = new Vector3(parseFloat(fields[4]), parseFloat(fields[5]), parseFloat(fields[6]));
- images.push(img);
- ranges.push({low, high});
- }
- let hdr_img = HDRImageLoader.fromImages(images, ranges);
- obj.setLightmap(hdr_img);
- }
- }
- }
-
- }
- tuning_object3d(doc, obj, input);
- }
- return "";
- },
-
- generate: (doc, obj, input) =>{
- if (doc.renderer.compressLightmap(doc.scene, obj))
- {
- doc.renderer.decompressLightmap(doc.scene, obj);
- }
- }
-};
-
-const avatar = {
- create: (doc, props, mode, parent) => {
- let avatar = model.create(doc, { ...props}, mode, parent);
- return avatar;
- },
-
- tuning: (doc, obj, input) => {
- model.tuning(doc,obj,input);
- return "";
- }
-};
-
-
-const directional_light = {
- create: (doc, props, mode, parent) => {
- const light = new DirectionalLight();
-
- if (props.hasOwnProperty('intensity')) {
- light.intensity = parseFloat(props.intensity);
- }
-
- if (props.hasOwnProperty('target')){
- let target = doc.scene.getObjectByName(props.target);
- light.target = target;
- }
-
- if (props.hasOwnProperty('castShadow') && string_to_boolean(props.castShadow))
- {
- let width = 512;
- let height = 512;
- if (props.hasOwnProperty('size')) {
- const size = props.size.split(',');
- width = parseInt(size[0]);
- height = parseInt(size[1]);
- }
- light.setShadow(true, width, height);
-
- if (props.hasOwnProperty('area')) {
- const area = props.area.split(',');
- let left = parseFloat(area[0]);
- let right = parseFloat(area[1]);
- let bottom = parseFloat(area[2]);
- let top = parseFloat(area[3]);
- let near = parseFloat(area[4]);
- let far = parseFloat(area[5]);
- light.setShadowProjection(left, right, bottom, top, near, far);
- }
-
- if (props.hasOwnProperty('radius'))
- {
- let radius = parseFloat(props.radius);
- light.setShadowRadius(radius);
- }
-
- if (props.hasOwnProperty('bias'))
- {
- light.bias = parseFloat(props.bias);
- }
-
- if (props.hasOwnProperty('force_cull'))
- {
- light.forceCull = string_to_boolean(props.force_cull);
- }
- }
-
- if (parent != null) {
- parent.add(light);
- }
- else {
- doc.scene.add(light);
- }
- doc.scene.addWidget(light);
- return light;
- },
- remove: (doc, obj) => {
- doc.scene.removeWidget(obj);
- },
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("intensity" in input)
- {
- let intensity = input.intensity;
- props.intensity = intensity;
- obj.intensity = parseFloat(intensity);
- }
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if ("target" in input)
- {
- props.target = input.target;
- let target = doc.scene.getObjectByName(input.target);
- obj.target = target;
- }
-
- if ("castShadow" in input)
- {
- props.castShadow = input.castShadow;
-
- let castShadow = string_to_boolean(input.castShadow);
- let width = 512;
- let height = 512;
- if (input.hasOwnProperty('size')) {
- props.size = input.size;
- let size = input.size.split(',');
- width = parseInt(size[0]);
- height = parseInt(size[1]);
- }
- obj.setShadow(castShadow, width, height);
- }
-
- if ("area" in input)
- {
- props.area = input.area;
- const area = input.area.split(',');
- let left = parseFloat(area[0]);
- let right = parseFloat(area[1]);
- let bottom = parseFloat(area[2]);
- let top = parseFloat(area[3]);
- let near = parseFloat(area[4]);
- let far = parseFloat(area[5]);
- obj.setShadowProjection(left, right, bottom, top, near, far);
- }
-
- if ("radius" in input)
- {
- props.radius = input.radius;
- let radius = parseFloat(input.radius);
- obj.setShadowRadius(radius);
- }
-
- if ("bias" in input)
- {
- props.bias = input.bias;
- obj.bias = parseFloat(input.bias);
- }
-
- if ("force_cull" in input)
- {
- props.force_cull = input.force_cull;
- obj.forceCull = string_to_boolean(input.force_cull);
- }
-
- if ("auto_area" in input)
- {
- let aabb = obj.getBoundingBox(doc.scene);
- let minPos = aabb.minPos;
- let maxPos = aabb.maxPos;
- obj.setShadowProjection(minPos.x, maxPos.x, minPos.y, maxPos.y, -maxPos.z, -minPos.z);
- props.area = `${minPos.x}, ${maxPos.x}, ${minPos.y}, ${maxPos.y}, ${-maxPos.z}, ${-minPos.z}`;
- let ret = { area: props.area };
- return JSON.stringify(ret);
- }
-
- tuning_object3d(doc, obj, input);
-
- return "";
- }
-};
-
-class BackgroundDocument extends BackgroundScene
-{
- constructor(near, far)
- {
- super(null, near, far);
-
- this.Tags = { scene, sky, env_light, group, plane, box, sphere, model, directional_light };
- this.reset();
- }
-
- reset()
- {
- for (let tag in this.Tags)
- {
- if (this.Tags[tag].hasOwnProperty('reset'))
- {
- this.Tags[tag].reset(this);
- }
- }
- }
-
- create(tag, props, mode, parent = null)
- {
- if (!(tag in this.Tags)) return null;
-
- const obj = this.Tags[tag].create(this, props, mode, parent);
- if (obj == null) return null;
-
- if (Object.isExtensible(obj))
- {
- obj.tag = tag;
- }
-
- if (props.hasOwnProperty('name'))
- {
- obj.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if (props.hasOwnProperty('texture'))
- {
- let img = imageLoader.loadFile(props.texture);
- if (img!=null)
- {
- obj.setColorTexture(img);
- }
- }
-
- if (props.hasOwnProperty('metalness'))
- {
- obj.metalness = parseFloat(props.metalness);
- }
-
- if (props.hasOwnProperty('roughness'))
- {
- obj.roughness = parseFloat(props.roughness);
- }
-
- if (props.hasOwnProperty('is_building'))
- {
- obj.isBuilding = string_to_boolean(props.is_building);
- }
-
- return obj;
- }
-
- load_xml_node(xmlNode, mode, parent = null)
- {
- if (parent == null) {
- parent = this;
- }
- for (let child of xmlNode.children) {
- const obj = this.create(child.tagName, child.attributes, mode, parent);
- if (obj===null) continue;
- this.load_xml_node(child, mode, obj);
- }
-
- }
-
- load_xml(xmlText, mode)
- {
- const parsed = parse(xmlText);
- let root = null;
- for (let top of parsed)
- {
- if (top.tagName == 'document')
- {
- root = top;
- break;
- }
- }
- if (root)
- {
- this.load_xml_node(root, mode);
- }
- }
-
- load_local_xml(filename)
- {
- const xmlText = fileLoader.loadTextFile(filename);
- if (xmlText!=null)
- {
- this.load_xml(xmlText, "local");
- }
- }
-}
-
-class Document
-{
- constructor(view)
- {
- this.view = view;
- this.width = view.clientWidth;
- this.height = view.clientHeight;
- this.Tags = { scene, camera, fog, sky, env_light, control, group, plane, box, sphere, model, avatar, directional_light };
- this.picked_key = "";
- this.reset();
- }
-
- setSize(width, height)
- {
- this.width = width;
- this.height = height;
-
- if (this.camera)
- {
- this.camera.aspect = width / height;
- this.camera.updateProjectionMatrix();
- }
- }
-
- reset()
- {
- this.saved_text = "";
-
- if (this.picked_key!="")
- {
- gamePlayer.message("object_picked", "");
- this.picked_key = "";
- }
-
- for (let tag in this.Tags)
- {
- if (this.Tags[tag].hasOwnProperty('reset'))
- {
- this.Tags[tag].reset(this);
- }
- }
-
- this.internal_index = {};
- this.external_index = {};
- this.external_index.index = {};
- this.bakables = [];
-
- this.lightmap_bake = null;
- this.env_gen = null;
- this.probe_grid_bake = null;
- this.lod_probe_grid_bake = null;
- }
-
- tick(delta)
- {
- if (this.controls)
- {
- if (this.controls.hasOwnProperty('update'))
- {
- this.controls.update();
- }
- }
- }
-
- render(renderer)
- {
- this.renderer = renderer;
-
- if (this.lightmap_bake!=null)
- {
- this.lightmap_bake.render(renderer);
- }
-
- if (this.env_gen!=null)
- {
- this.env_gen.render(renderer);
- }
-
- if (this.probe_grid_bake!=null)
- {
- this.probe_grid_bake.render(renderer);
- }
-
- if (this.lod_probe_grid_bake!=null)
- {
- this.lod_probe_grid_bake.render(renderer);
- }
-
- if (this.scene && this.camera)
- {
- renderer.render(this.scene, this.camera);
- }
- }
-
- create(tag, props, mode, parent = null)
- {
- if (!(tag in this.Tags)) return null;
-
- const obj = this.Tags[tag].create(this, props, mode, parent);
- if (obj == null) return null;
-
- obj.uuid = uuid();
- obj.tag = tag;
-
- if (props.hasOwnProperty('name'))
- {
- obj.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if (props.hasOwnProperty('texture'))
- {
- let img = imageLoader.loadFile(props.texture);
- if (img!=null)
- {
- obj.setColorTexture(img);
- }
- }
-
- if (props.hasOwnProperty('metalness'))
- {
- obj.metalness = parseFloat(props.metalness);
- }
-
- if (props.hasOwnProperty('roughness'))
- {
- obj.roughness = parseFloat(props.roughness);
- }
-
- if (props.hasOwnProperty('is_building'))
- {
- obj.isBuilding = string_to_boolean(props.is_building);
- }
-
- return obj;
- }
-
- remove(obj)
- {
- if (obj.hasOwnProperty('tag')) {
- const tag = this.Tags[obj.tag];
- if (tag.hasOwnProperty('remove')) {
- tag.remove(this, obj);
- }
- }
-
- {
- let index = this.bakables.indexOf(obj);
- if (index>=0)
- {
- this.bakables.splice(index, 1);
- }
- }
-
- if (obj.parent)
- {
- obj.parent.remove(obj);
- }
- }
-
- load_xml_node(xmlNode, mode, parent = null)
- {
- for (let child of xmlNode.children) {
- let obj = null;
- if (parent == null)
- {
- obj = this.create(child.tagName, child.attributes, mode, this);
- }
- else
- {
- obj = this.create(child.tagName, child.attributes, mode, parent);
- }
- if (obj===null) continue;
-
- let key = obj.uuid;
-
- let internal_node = {};
- internal_node.obj = obj;
- internal_node.xml_node = child;
- this.internal_index[key] = internal_node;
-
- let external_node = {};
- external_node.tagName = child.tagName;
- external_node.attributes = child.attributes;
- external_node.children = [];
-
- if(child.tagName == "scene")
- {
- this.external_index.root = key;
- }
- else if (parent!=null)
- {
- let parent_key = parent.uuid;
- let external_node_parent = this.external_index.index[parent.uuid];
- external_node.parent = parent_key;
- external_node_parent.children.push(key);
- }
- this.external_index.index[key] = external_node;
-
- this.load_xml_node(child, mode, obj);
- }
- }
-
-
- load_xml(xmlText, mode)
- {
- this.xml_nodes = parse(xmlText, {keepComments: true});
- this.saved_text = genXML(this.xml_nodes);
-
- let root = null;
- for (let top of this.xml_nodes)
- {
- if (top.tagName == 'document')
- {
- root = top;
- break;
- }
- }
- if (root)
- {
- this.load_xml_node(root, mode);
- }
-
- gamePlayer.message("index_loaded", JSON.stringify(this.external_index));
- }
-
- is_modified()
- {
- let gen_xml = genXML(this.xml_nodes);
- return gen_xml != this.saved_text;
- }
-
- get_xml()
- {
- this.saved_text = genXML(this.xml_nodes);
- return this.saved_text;
- }
-
- picking(state)
- {
- if (state)
- {
- this.controls.enabled = false;
- view.addEventListener("pointerdown", picking_pointerdown);
- }
- else
- {
- this.controls.enabled = true;
- view.removeEventListener("pointerdown", picking_pointerdown);
- }
- }
-
- pick_obj(key)
- {
- let obj = null;
- if (key!="")
- {
- obj = this.internal_index[key].obj;
- }
-
- if (this.picked_key != "")
- {
- if (this.picked_key in this.internal_index)
- {
- let picked_obj = this.internal_index[this.picked_key].obj;
- if (picked_obj.hasOwnProperty("setToonShading"))
- {
- picked_obj.setToonShading(0);
- }
- }
- }
-
- this.picked_key = key;
-
- if (obj!=null)
- {
- if (obj.hasOwnProperty("setToonShading"))
- {
- obj.setToonShading(16, 5.0, new Vector3(1.0, 1.0, 0.2));
- }
- }
- gamePlayer.message("object_picked", key);
- }
-
- tuning(input)
- {
- if (this.picked_key=="") return "";
- let picked_obj = this.internal_index[this.picked_key].obj;
- let node = this.internal_index[this.picked_key].xml_node;
- let tag = node.tagName;
-
- if (!(tag in this.Tags)) return "";
- return this.Tags[tag].tuning(this, picked_obj, input);
- }
-
- initialize(input)
- {
- if (this.picked_key=="") return "";
- let picked_obj = this.internal_index[this.picked_key].obj;
- let node = this.internal_index[this.picked_key].xml_node;
- let tag = node.tagName;
-
- if (!(tag in this.Tags)) return "";
- return this.Tags[tag].initialize(this, picked_obj, input);
- }
-
- generate(input)
- {
- if (this.picked_key=="") return;
- let picked_obj = this.internal_index[this.picked_key].obj;
- let node = this.internal_index[this.picked_key].xml_node;
- let tag = node.tagName;
-
- if (!(tag in this.Tags)) return;
- this.Tags[tag].generate(this, picked_obj, input);
- }
-
- req_create(base_key, tag)
- {
- let internal_node_base = this.internal_index[base_key];
- let external_node_base = this.external_index.index[base_key];
-
- let xmlNode = internal_node_base.xml_node;
- let parent = internal_node_base.obj;
-
- let child = {tagName:tag, attributes: {}, children: []};
- xmlNode.children.push(child);
-
- let obj = this.create(tag, {}, "local", parent);
- let key = obj.uuid;
-
- let internal_node = {};
- internal_node.obj = obj;
- internal_node.xml_node = child;
- this.internal_index[key] = internal_node;
-
- let external_node = {tagName:tag, attributes: {}, children: []};
- external_node.parent = base_key;
- external_node_base.children.push(key);
- this.external_index.index[key] = external_node;
-
- let msg = {};
- msg[key] = external_node;
-
- gamePlayer.message("object_created", JSON.stringify(msg));
-
- this.pick_obj(key);
- }
-
- req_remove(key)
- {
- let internal_node = this.internal_index[key];
- let external_node = this.external_index.index[key];
-
- let base_key = external_node.parent;
- let internal_node_base = this.internal_index[base_key];
- let external_node_base = this.external_index.index[base_key];
-
- let xmlNode = internal_node.xml_node;
- let xmlNode_parent = internal_node_base.xml_node;
- {
- let idx = xmlNode_parent.children.indexOf(xmlNode);
- if (idx>-1)
- {
- xmlNode_parent.children.splice(idx, 1);
- }
- }
-
- let obj = internal_node.obj;
- this.remove(obj);
-
- {
- let idx = external_node_base.children.indexOf(key);
- if (idx>-1)
- {
- external_node_base.children.splice(idx,1);
- }
- }
-
- delete this.internal_index[key];
- delete this.external_index.index[key];
-
- gamePlayer.message("object_removed", key);
-
- this.pick_obj("");
- }
-}
-
-function picking_pointerdown(event)
-{
- let x = event.clientX;
- let y = event.clientY;
-
- let intersect = gamePlayer.pickObject(x,y);
- if (intersect!=null)
- {
- doc.pick_obj(intersect.uuid);
- }
- else if (doc.scene.background!=null)
- {
- doc.pick_obj(doc.scene.background.uuid);
- }
- else
- {
- doc.pick_obj(doc.scene.uuid);
- }
-}
-
-class Clock {
-
- constructor( autoStart = true ) {
-
- this.autoStart = autoStart;
-
- this.startTime = 0;
- this.oldTime = 0;
- this.elapsedTime = 0;
-
- this.running = false;
-
- }
-
- start() {
-
- this.startTime = now();
-
- this.oldTime = this.startTime;
- this.elapsedTime = 0;
- this.running = true;
-
- }
-
- stop() {
-
- this.getElapsedTime();
- this.running = false;
- this.autoStart = false;
-
- }
-
- getElapsedTime() {
-
- this.getDelta();
- return this.elapsedTime;
-
- }
-
- getDelta() {
-
- let diff = 0;
-
- if ( this.autoStart && ! this.running ) {
-
- this.start();
- return 0;
-
- }
-
- if ( this.running ) {
-
- const newTime = now();
-
- diff = ( newTime - this.oldTime ) / 1000;
- this.oldTime = newTime;
-
- this.elapsedTime += diff;
-
- }
-
- return diff;
-
- }
-
-}
-
-function isModified(x)
-{
- return JSON.stringify(doc.is_modified());
-}
-
-function setXML(xml)
-{
- doc.reset();
- doc.load_xml(xml, "local");
- return "";
-}
-
-function getXML(x)
-{
- return doc.get_xml();
-}
-
-function picking(state)
-{
- let bstate = state=="on";
- gamePlayer.picking = bstate;
- doc.picking(bstate);
- return "";
-}
-
-function pick_obj(key)
-{
- doc.pick_obj(key);
- return "";
-}
-
-function tuning(args)
-{
- let input = JSON.parse(args);
- return doc.tuning(input);
-}
-
-function initialize(args)
-{
- let input = JSON.parse(args);
- return doc.initialize(input);
-}
-
-function generate(args)
-{
- let input = JSON.parse(args);
- doc.generate(input);
- return "";
-}
-
-function create(args)
-{
- let input = JSON.parse(args);
- let base_key = input.base_key;
- let tag = input.tag;
- doc.req_create(base_key, tag);
- return "";
-}
-
-function remove(key)
-{
- doc.req_remove(key);
- return "";
-}
-
-function init(width, height)
-{
- renderer = new GLRenderer();
- doc = new Document(view);
- clock = new Clock();
-
- message_map = { isModified, setXML, getXML, picking, pick_obj, tuning, initialize, generate, create, remove};
-}
-
-function render(width, height, size_changed)
-{
- if (size_changed)
- {
- doc.setSize(width, height);
- }
- let delta = clock.getDelta();
- doc.tick(delta);
- doc.render(renderer);
-
-}
-
-function message_handling(name, msg)
-{
- if (name in message_map)
- {
- return message_map[name](msg);
- }
- return "";
-}
-
-setCallback('init', init);
-setCallback('render', render);
-setCallback('message', message_handling);
diff --git a/GameDev/bin/Release/xmleditor/controls/EventDispatcher.js b/GameDev/bin/Release/xmleditor/controls/EventDispatcher.js
deleted file mode 100644
index 0a40a60e..00000000
--- a/GameDev/bin/Release/xmleditor/controls/EventDispatcher.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * https://github.com/mrdoob/eventdispatcher.js/
- */
-
-class EventDispatcher {
-
- addEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) this._listeners = {};
-
- const listeners = this._listeners;
-
- if ( listeners[ type ] === undefined ) {
-
- listeners[ type ] = [];
-
- }
-
- if ( listeners[ type ].indexOf( listener ) === - 1 ) {
-
- listeners[ type ].push( listener );
-
- }
-
- }
-
- hasEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) return false;
-
- const listeners = this._listeners;
-
- return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
-
- }
-
- removeEventListener( type, listener ) {
-
- if ( this._listeners === undefined ) return;
-
- const listeners = this._listeners;
- const listenerArray = listeners[ type ];
-
- if ( listenerArray !== undefined ) {
-
- const index = listenerArray.indexOf( listener );
-
- if ( index !== - 1 ) {
-
- listenerArray.splice( index, 1 );
-
- }
-
- }
-
- }
-
- dispatchEvent( event ) {
- if ( this._listeners === undefined ) return;
-
- const listeners = this._listeners;
- const listenerArray = listeners[event.type];
-
- if ( listenerArray !== undefined ) {
-
- event.target = this;
-
- // Make a copy, in case listeners are removed while iterating.
- const array = listenerArray.slice( 0 );
-
- for ( let i = 0, l = array.length; i < l; i ++ ) {
-
- array[ i ].call( this, event );
-
- }
-
- event.target = null;
-
- }
-
- }
-
-}
-
-
-export { EventDispatcher };
diff --git a/GameDev/bin/Release/xmleditor/controls/OrbitControls.js b/GameDev/bin/Release/xmleditor/controls/OrbitControls.js
deleted file mode 100644
index 74a34db6..00000000
--- a/GameDev/bin/Release/xmleditor/controls/OrbitControls.js
+++ /dev/null
@@ -1,1261 +0,0 @@
-import { EventDispatcher } from "./EventDispatcher.js";
-import { MOUSE, TOUCH } from "./constants.js";
-import { Quaternion } from "../math/Quaternion.js";
-import { Spherical } from "../math/Spherical.js";
-import { Vector2 } from "../math/Vector2.js";
-import { Vector3 } from "../math/Vector3.js";
-import { Matrix4 } from "../math/Matrix4.js";
-
-
-// This set of controls performs orbiting, dollying (zooming), and panning.
-// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
-//
-// Orbit - left mouse / touch: one-finger move
-// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
-
-const _changeEvent = { type: 'change' };
-const _startEvent = { type: 'start' };
-const _endEvent = { type: 'end' };
-
-class OrbitControls extends EventDispatcher {
-
- constructor( object, domElement ) {
-
- super();
-
- if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' );
-
- this.object = object;
- this.domElement = domElement;
-
- // Set to false to disable this control
- this.enabled = true;
-
- // "target" sets the location of focus, where the object orbits around
- this.target = new Vector3();
-
- // How far you can dolly in and out ( PerspectiveCamera only )
- this.minDistance = 0;
- this.maxDistance = Infinity;
-
- // How far you can zoom in and out ( OrthographicCamera only )
- this.minZoom = 0;
- this.maxZoom = Infinity;
-
- // How far you can orbit vertically, upper and lower limits.
- // Range is 0 to Math.PI radians.
- this.minPolarAngle = 0; // radians
- this.maxPolarAngle = Math.PI; // radians
-
- // How far you can orbit horizontally, upper and lower limits.
- // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
- this.minAzimuthAngle = - Infinity; // radians
- this.maxAzimuthAngle = Infinity; // radians
-
- // Set to true to enable damping (inertia)
- // If damping is enabled, you must call controls.update() in your animation loop
- this.enableDamping = false;
- this.dampingFactor = 0.05;
-
- // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
- // Set to false to disable zooming
- this.enableZoom = true;
- this.zoomSpeed = 1.0;
-
- // Set to false to disable rotating
- this.enableRotate = true;
- this.rotateSpeed = 1.0;
-
- // Set to false to disable panning
- this.enablePan = true;
- this.panSpeed = 1.0;
- this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
- this.keyPanSpeed = 7.0; // pixels moved per arrow key push
-
- // Set to true to automatically rotate around the target
- // If auto-rotate is enabled, you must call controls.update() in your animation loop
- this.autoRotate = false;
- this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60
-
- // The four arrow keys
- this.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' };
-
- // Mouse buttons
- this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };
-
- // Touch fingers
- this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };
-
- // for reset
- this.target0 = this.target.clone();
- this.position0 = this.object.getPosition(new Vector3());
-
- // this.zoom0 = this.object.zoom;
- this.zoom0 = 1.0;
-
- // the target DOM element for key events
- this._domElementKeyEvents = null;
-
- //
- // public methods
- //
-
- this.getPolarAngle = function () {
-
- return spherical.phi;
-
- };
-
- this.getAzimuthalAngle = function () {
-
- return spherical.theta;
-
- };
-
- this.getDistance = function () {
- let position = this.object.getPosition(new Vector3());
- return position.distanceTo( this.target );
-
- };
-
- this.listenToKeyEvents = function ( domElement ) {
-
- domElement.addEventListener( 'keydown', onKeyDown );
- this._domElementKeyEvents = domElement;
-
- };
-
- this.saveState = function () {
-
- scope.target0.copy(scope.target);
- this.object.getPosition(scope.position0);
-
- // scope.zoom0 = scope.object.zoom;
- scope.zoom0 = 1.0;
-
- };
-
- this.reset = function () {
-
- scope.target.copy(scope.target0);
-
- this.object.getPosition(scope.position0);
-
- // scope.object.zoom = scope.zoom0;
-
- scope.object.updateProjectionMatrix();
- scope.dispatchEvent( _changeEvent );
-
- scope.update();
-
- state = STATE.NONE;
-
- };
-
- // this method is exposed, but perhaps it would be better if we can make it private...
- this.update = function () {
-
- const offset = new Vector3();
-
- // so camera.up is the orbit axis
- let camera_up = object.getUp(new Vector3());
- const quat = new Quaternion().setFromUnitVectors(camera_up, new Vector3(0, 1, 0));
- const quatInverse = quat.clone().invert();
-
- const lastPosition = new Vector3();
- const lastQuaternion = new Quaternion();
-
- const twoPI = 2 * Math.PI;
-
- return function update() {
-
- const position = scope.object.getPosition(new Vector3());
-
- offset.copy( position ).sub( scope.target );
-
- // rotate offset to "y-axis-is-up" space
- offset.applyQuaternion( quat );
-
- // angle from z-axis around y-axis
- spherical.setFromVector3( offset );
-
- if ( scope.autoRotate && state === STATE.NONE ) {
-
- rotateLeft( getAutoRotationAngle() );
-
- }
-
- if ( scope.enableDamping ) {
-
- spherical.theta += sphericalDelta.theta * scope.dampingFactor;
- spherical.phi += sphericalDelta.phi * scope.dampingFactor;
-
- } else {
-
- spherical.theta += sphericalDelta.theta;
- spherical.phi += sphericalDelta.phi;
-
- }
-
- // restrict theta to be between desired limits
-
- let min = scope.minAzimuthAngle;
- let max = scope.maxAzimuthAngle;
-
- if ( isFinite( min ) && isFinite( max ) ) {
-
- if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI;
-
- if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI;
-
- if ( min <= max ) {
-
- spherical.theta = Math.max( min, Math.min( max, spherical.theta ) );
-
- } else {
-
- spherical.theta = ( spherical.theta > ( min + max ) / 2 ) ?
- Math.max( min, spherical.theta ) :
- Math.min( max, spherical.theta );
-
- }
-
- }
-
- // restrict phi to be between desired limits
- spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
-
- spherical.makeSafe();
-
-
- spherical.radius *= scale;
-
- // restrict radius to be between desired limits
- spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
-
- // move target to panned location
-
- if ( scope.enableDamping === true ) {
-
- scope.target.addScaledVector( panOffset, scope.dampingFactor );
-
- } else {
-
- scope.target.add( panOffset );
-
- }
-
- offset.setFromSpherical( spherical );
-
- // rotate offset back to "camera-up-vector-is-up" space
- offset.applyQuaternion( quatInverse );
-
- position.copy(scope.target).add(offset);
- scope.object.setPosition(position)
-
- scope.object.lookAt( scope.target );
-
- if ( scope.enableDamping === true ) {
-
- sphericalDelta.theta *= ( 1 - scope.dampingFactor );
- sphericalDelta.phi *= ( 1 - scope.dampingFactor );
-
- panOffset.multiplyScalar( 1 - scope.dampingFactor );
-
- } else {
-
- sphericalDelta.set( 0, 0, 0 );
-
- panOffset.set( 0, 0, 0 );
-
- }
-
- 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
-
- const quaternion = scope.object.getQuaternion(new Quaternion());
-
- if ( zoomChanged ||
- lastPosition.distanceToSquared(position) > EPS ||
- 8 * (1 - lastQuaternion.dot(quaternion) ) > EPS ) {
-
- scope.dispatchEvent( _changeEvent );
-
- lastPosition.copy(position );
- lastQuaternion.copy(quaternion);
- zoomChanged = false;
-
- return true;
-
- }
-
- return false;
-
- };
-
- }();
-
- this.dispose = function () {
-
- scope.domElement.removeEventListener( 'contextmenu', onContextMenu );
-
- scope.domElement.removeEventListener( 'pointerdown', onPointerDown );
- scope.domElement.removeEventListener( 'pointercancel', onPointerCancel );
- scope.domElement.removeEventListener( 'wheel', onMouseWheel );
-
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
-
-
- if ( scope._domElementKeyEvents !== null ) {
-
- scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );
-
- }
-
- //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
-
- };
-
- //
- // internals
- //
-
- const scope = this;
-
- const STATE = {
- NONE: - 1,
- ROTATE: 0,
- DOLLY: 1,
- PAN: 2,
- TOUCH_ROTATE: 3,
- TOUCH_PAN: 4,
- TOUCH_DOLLY_PAN: 5,
- TOUCH_DOLLY_ROTATE: 6
- };
-
- let state = STATE.NONE;
-
- const EPS = 0.000001;
-
- // current position in spherical coordinates
- const spherical = new Spherical();
- const sphericalDelta = new Spherical();
-
- let scale = 1;
- const panOffset = new Vector3();
- let zoomChanged = false;
-
- const rotateStart = new Vector2();
- const rotateEnd = new Vector2();
- const rotateDelta = new Vector2();
-
- const panStart = new Vector2();
- const panEnd = new Vector2();
- const panDelta = new Vector2();
-
- const dollyStart = new Vector2();
- const dollyEnd = new Vector2();
- const dollyDelta = new Vector2();
-
- const pointers = [];
- const pointerPositions = {};
-
- function getAutoRotationAngle() {
-
- return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
-
- }
-
- function getZoomScale() {
-
- return Math.pow( 0.95, scope.zoomSpeed );
-
- }
-
- function rotateLeft( angle ) {
-
- sphericalDelta.theta -= angle;
-
- }
-
- function rotateUp( angle ) {
-
- sphericalDelta.phi -= angle;
-
- }
-
- const panLeft = function () {
-
- const v = new Vector3();
-
- return function panLeft( distance, objectMatrix ) {
-
- v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
- v.multiplyScalar( - distance );
-
- panOffset.add( v );
-
- };
-
- }();
-
- const panUp = function () {
-
- const v = new Vector3();
-
- return function panUp( distance, objectMatrix ) {
-
- if ( scope.screenSpacePanning === true ) {
-
- v.setFromMatrixColumn( objectMatrix, 1 );
-
- } else {
- let up = scope.object.getUp(new Vector3());
- v.setFromMatrixColumn( objectMatrix, 0 );
- v.crossVectors(up, v );
-
- }
-
- v.multiplyScalar( distance );
-
- panOffset.add( v );
-
- };
-
- }();
-
- // deltaX and deltaY are in pixels; right and down are positive
- const pan = function () {
-
- const offset = new Vector3();
-
- return function pan( deltaX, deltaY ) {
-
- const element = scope.domElement;
-
- if ( scope.object.isPerspectiveCamera ) {
-
- // perspective
- const position = scope.object.getPosition(new Vector3());
- offset.copy( position ).sub( scope.target );
- let targetDistance = offset.length();
-
- // half of the fov is center to top of screen
- targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
-
- const matrix = scope.object.getMatrix(new Matrix4());
- // we use only clientHeight here so aspect ratio does not distort speed
- panLeft(2 * deltaX * targetDistance / element.clientHeight, matrix );
- panUp(2 * deltaY * targetDistance / element.clientHeight, matrix );
-
- } else if (scope.object.isOrthographicCamera) {
-
- const matrix = scope.object.getMatrix(new Matrix4());
- // orthographic
- panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, matrix );
- panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, matrix );
-
- } else {
-
- // camera neither orthographic nor perspective
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
- scope.enablePan = false;
-
- }
-
- };
-
- }();
-
- function dollyOut( dollyScale ) {
-
- if ( scope.object.isPerspectiveCamera ) {
-
- scale /= dollyScale;
-
- } else if ( scope.object.isOrthographicCamera ) {
-
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
- scope.object.updateProjectionMatrix();
- zoomChanged = true;
-
- } else {
-
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
- scope.enableZoom = false;
-
- }
-
- }
-
- function dollyIn( dollyScale ) {
-
- if ( scope.object.isPerspectiveCamera ) {
-
- scale *= dollyScale;
-
- } else if ( scope.object.isOrthographicCamera ) {
-
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
- scope.object.updateProjectionMatrix();
- zoomChanged = true;
-
- } else {
-
- console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
- scope.enableZoom = false;
-
- }
-
- }
-
- //
- // event callbacks - update the object state
- //
-
- function handleMouseDownRotate( event ) {
-
- rotateStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseDownDolly( event ) {
-
- dollyStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseDownPan( event ) {
-
- panStart.set( event.clientX, event.clientY );
-
- }
-
- function handleMouseMoveRotate( event ) {
-
- rotateEnd.set( event.clientX, event.clientY );
-
- rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
-
- const element = scope.domElement;
-
- rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
-
- rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
-
- rotateStart.copy( rotateEnd );
-
- scope.update();
-
- }
-
- function handleMouseMoveDolly( event ) {
-
- dollyEnd.set( event.clientX, event.clientY );
-
- dollyDelta.subVectors( dollyEnd, dollyStart );
-
- if ( dollyDelta.y > 0 ) {
-
- dollyOut( getZoomScale() );
-
- } else if ( dollyDelta.y < 0 ) {
-
- dollyIn( getZoomScale() );
-
- }
-
- dollyStart.copy( dollyEnd );
-
- scope.update();
-
- }
-
- function handleMouseMovePan( event ) {
-
- panEnd.set( event.clientX, event.clientY );
-
- panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
-
- pan( panDelta.x, panDelta.y );
-
- panStart.copy( panEnd );
-
- scope.update();
-
- }
-
- function handleMouseWheel( event ) {
-
- if ( event.deltaY < 0 ) {
-
- dollyIn( getZoomScale() );
-
- } else if ( event.deltaY > 0 ) {
-
- dollyOut( getZoomScale() );
-
- }
-
- scope.update();
-
- }
-
- function handleKeyDown( event ) {
-
- let needsUpdate = false;
-
- switch ( event.code ) {
-
- case scope.keys.UP:
- pan( 0, scope.keyPanSpeed );
- needsUpdate = true;
- break;
-
- case scope.keys.BOTTOM:
- pan( 0, - scope.keyPanSpeed );
- needsUpdate = true;
- break;
-
- case scope.keys.LEFT:
- pan( scope.keyPanSpeed, 0 );
- needsUpdate = true;
- break;
-
- case scope.keys.RIGHT:
- pan( - scope.keyPanSpeed, 0 );
- needsUpdate = true;
- break;
-
- }
-
- if ( needsUpdate ) {
-
- // prevent the browser from scrolling on cursor keys
- // event.preventDefault();
-
- scope.update();
-
- }
-
-
- }
-
- function handleTouchStartRotate() {
-
- if ( pointers.length === 1 ) {
-
- rotateStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
-
- } else {
-
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
-
- rotateStart.set( x, y );
-
- }
-
- }
-
- function handleTouchStartPan() {
-
- if ( pointers.length === 1 ) {
-
- panStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
-
- } else {
-
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
-
- panStart.set( x, y );
-
- }
-
- }
-
- function handleTouchStartDolly() {
-
- const dx = pointers[ 0 ].pageX - pointers[ 1 ].pageX;
- const dy = pointers[ 0 ].pageY - pointers[ 1 ].pageY;
-
- const distance = Math.sqrt( dx * dx + dy * dy );
-
- dollyStart.set( 0, distance );
-
- }
-
- function handleTouchStartDollyPan() {
-
- if ( scope.enableZoom ) handleTouchStartDolly();
-
- if ( scope.enablePan ) handleTouchStartPan();
-
- }
-
- function handleTouchStartDollyRotate() {
-
- if ( scope.enableZoom ) handleTouchStartDolly();
-
- if ( scope.enableRotate ) handleTouchStartRotate();
-
- }
-
- function handleTouchMoveRotate( event ) {
-
- if ( pointers.length == 1 ) {
-
- rotateEnd.set( event.pageX, event.pageY );
-
- } else {
-
- const position = getSecondPointerPosition( event );
-
- const x = 0.5 * ( event.pageX + position.x );
- const y = 0.5 * ( event.pageY + position.y );
-
- rotateEnd.set( x, y );
-
- }
-
- rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );
-
- const element = scope.domElement;
-
- rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height
-
- rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
-
- rotateStart.copy( rotateEnd );
-
- }
-
- function handleTouchMovePan( event ) {
-
- if ( pointers.length === 1 ) {
-
- panEnd.set( event.pageX, event.pageY );
-
- } else {
-
- const position = getSecondPointerPosition( event );
-
- const x = 0.5 * ( event.pageX + position.x );
- const y = 0.5 * ( event.pageY + position.y );
-
- panEnd.set( x, y );
-
- }
-
- panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );
-
- pan( panDelta.x, panDelta.y );
-
- panStart.copy( panEnd );
-
- }
-
- function handleTouchMoveDolly( event ) {
-
- const position = getSecondPointerPosition( event );
-
- const dx = event.pageX - position.x;
- const dy = event.pageY - position.y;
-
- const distance = Math.sqrt( dx * dx + dy * dy );
-
- dollyEnd.set( 0, distance );
-
- dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );
-
- dollyOut( dollyDelta.y );
-
- dollyStart.copy( dollyEnd );
-
- }
-
- function handleTouchMoveDollyPan( event ) {
-
- if ( scope.enableZoom ) handleTouchMoveDolly( event );
-
- if ( scope.enablePan ) handleTouchMovePan( event );
-
- }
-
- function handleTouchMoveDollyRotate( event ) {
-
- if ( scope.enableZoom ) handleTouchMoveDolly( event );
-
- if ( scope.enableRotate ) handleTouchMoveRotate( event );
-
- }
-
- //
- // event handlers - FSM: listen for events and reset state
- //
-
- function onPointerDown( event ) {
-
- if ( scope.enabled === false ) return;
-
- if ( pointers.length === 0 ) {
-
- scope.domElement.setPointerCapture();
-
- scope.domElement.addEventListener( 'pointermove', onPointerMove );
- scope.domElement.addEventListener( 'pointerup', onPointerUp );
-
- }
-
- //
-
- addPointer( event );
-
- if ( event.pointerType === 'touch' ) {
-
- onTouchStart( event );
-
- } else {
-
- onMouseDown( event );
-
- }
-
- }
-
- function onPointerMove( event ) {
-
- if ( scope.enabled === false ) return;
-
- if ( event.pointerType === 'touch' ) {
-
- onTouchMove( event );
-
- } else {
-
- onMouseMove( event );
-
- }
-
- }
-
- function onPointerUp( event ) {
-
- removePointer( event );
-
- if ( pointers.length === 0 ) {
-
- scope.domElement.releasePointerCapture();
-
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
-
- }
-
- scope.dispatchEvent( _endEvent );
-
- state = STATE.NONE;
-
- }
-
- function onPointerCancel( event ) {
-
- removePointer( event );
-
- }
-
- function onMouseDown( event ) {
-
- let mouseAction;
-
- switch ( event.button ) {
-
- case 0:
-
- mouseAction = scope.mouseButtons.LEFT;
- break;
-
- case 1:
-
- mouseAction = scope.mouseButtons.MIDDLE;
- break;
-
- case 2:
-
- mouseAction = scope.mouseButtons.RIGHT;
- break;
-
- default:
-
- mouseAction = - 1;
-
- }
-
- switch ( mouseAction ) {
-
- case MOUSE.DOLLY:
-
- if ( scope.enableZoom === false ) return;
-
- handleMouseDownDolly( event );
-
- state = STATE.DOLLY;
-
- break;
-
- case MOUSE.ROTATE:
-
- if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
-
- if ( scope.enablePan === false ) return;
-
- handleMouseDownPan( event );
-
- state = STATE.PAN;
-
- } else {
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseDownRotate( event );
-
- state = STATE.ROTATE;
-
- }
-
- break;
-
- case MOUSE.PAN:
-
- if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseDownRotate( event );
-
- state = STATE.ROTATE;
-
- } else {
-
- if ( scope.enablePan === false ) return;
-
- handleMouseDownPan( event );
-
- state = STATE.PAN;
-
- }
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- if ( state !== STATE.NONE ) {
-
- scope.dispatchEvent( _startEvent );
-
- }
-
- }
-
- function onMouseMove( event ) {
-
- if ( scope.enabled === false ) return;
-
- switch ( state ) {
-
- case STATE.ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleMouseMoveRotate( event );
-
- break;
-
- case STATE.DOLLY:
-
- if ( scope.enableZoom === false ) return;
-
- handleMouseMoveDolly( event );
-
- break;
-
- case STATE.PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleMouseMovePan( event );
-
- break;
-
- }
-
- }
-
- function onMouseWheel( event ) {
-
- if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
-
- // event.preventDefault();
-
- scope.dispatchEvent( _startEvent );
-
- handleMouseWheel( event );
-
- scope.dispatchEvent( _endEvent );
-
- }
-
- function onKeyDown( event ) {
-
- if ( scope.enabled === false || scope.enablePan === false ) return;
-
- handleKeyDown( event );
-
- }
-
- function onTouchStart( event ) {
-
- trackPointer( event );
-
- switch ( pointers.length ) {
-
- case 1:
-
- switch ( scope.touches.ONE ) {
-
- case TOUCH.ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleTouchStartRotate();
-
- state = STATE.TOUCH_ROTATE;
-
- break;
-
- case TOUCH.PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleTouchStartPan();
-
- state = STATE.TOUCH_PAN;
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- break;
-
- case 2:
-
- switch ( scope.touches.TWO ) {
-
- case TOUCH.DOLLY_PAN:
-
- if ( scope.enableZoom === false && scope.enablePan === false ) return;
-
- handleTouchStartDollyPan();
-
- state = STATE.TOUCH_DOLLY_PAN;
-
- break;
-
- case TOUCH.DOLLY_ROTATE:
-
- if ( scope.enableZoom === false && scope.enableRotate === false ) return;
-
- handleTouchStartDollyRotate();
-
- state = STATE.TOUCH_DOLLY_ROTATE;
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- if ( state !== STATE.NONE ) {
-
- scope.dispatchEvent( _startEvent );
-
- }
-
- }
-
- function onTouchMove( event ) {
-
- trackPointer( event );
-
- switch ( state ) {
-
- case STATE.TOUCH_ROTATE:
-
- if ( scope.enableRotate === false ) return;
-
- handleTouchMoveRotate( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_PAN:
-
- if ( scope.enablePan === false ) return;
-
- handleTouchMovePan( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_DOLLY_PAN:
-
- if ( scope.enableZoom === false && scope.enablePan === false ) return;
-
- handleTouchMoveDollyPan( event );
-
- scope.update();
-
- break;
-
- case STATE.TOUCH_DOLLY_ROTATE:
-
- if ( scope.enableZoom === false && scope.enableRotate === false ) return;
-
- handleTouchMoveDollyRotate( event );
-
- scope.update();
-
- break;
-
- default:
-
- state = STATE.NONE;
-
- }
-
- }
-
- function onContextMenu( event ) {
-
- if ( scope.enabled === false ) return;
-
- // event.preventDefault();
-
- }
-
- function addPointer( event ) {
-
- pointers.push( event );
-
- }
-
- function removePointer( event ) {
-
- delete pointerPositions[ event.pointerId ];
-
- for ( let i = 0; i < pointers.length; i ++ ) {
-
- if ( pointers[ i ].pointerId == event.pointerId ) {
-
- pointers.splice( i, 1 );
- return;
-
- }
-
- }
-
- }
-
- function trackPointer( event ) {
-
- let position = pointerPositions[ event.pointerId ];
-
- if ( position === undefined ) {
-
- position = new Vector2();
- pointerPositions[ event.pointerId ] = position;
-
- }
-
- position.set( event.pageX, event.pageY );
-
- }
-
- function getSecondPointerPosition( event ) {
-
- const pointer = ( event.pointerId === pointers[ 0 ].pointerId ) ? pointers[ 1 ] : pointers[ 0 ];
-
- return pointerPositions[ pointer.pointerId ];
-
- }
-
- //
-
- scope.domElement.addEventListener( 'contextmenu', onContextMenu );
-
- scope.domElement.addEventListener( 'pointerdown', onPointerDown );
- scope.domElement.addEventListener( 'pointercancel', onPointerCancel );
- scope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } );
-
- // force an update at start
-
- this.update();
-
- }
-
-}
-
-
-// This set of controls performs orbiting, dollying (zooming), and panning.
-// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
-// This is very similar to OrbitControls, another set of touch behavior
-//
-// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
-// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-// Pan - left mouse, or arrow keys / touch: one-finger move
-
-class MapControls extends OrbitControls {
-
- constructor( object, domElement ) {
-
- super( object, domElement );
-
- this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up
-
- this.mouseButtons.LEFT = MOUSE.PAN;
- this.mouseButtons.RIGHT = MOUSE.ROTATE;
-
- this.touches.ONE = TOUCH.PAN;
- this.touches.TWO = TOUCH.DOLLY_ROTATE;
-
- }
-
-}
-
-export { OrbitControls, MapControls };
diff --git a/GameDev/bin/Release/xmleditor/controls/constants.js b/GameDev/bin/Release/xmleditor/controls/constants.js
deleted file mode 100644
index ef811450..00000000
--- a/GameDev/bin/Release/xmleditor/controls/constants.js
+++ /dev/null
@@ -1,2 +0,0 @@
-export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
-export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
diff --git a/GameDev/bin/Release/xmleditor/editor_document.js b/GameDev/bin/Release/xmleditor/editor_document.js
deleted file mode 100644
index 5e7a9191..00000000
--- a/GameDev/bin/Release/xmleditor/editor_document.js
+++ /dev/null
@@ -1,3224 +0,0 @@
-import { OrbitControls } from "./controls/OrbitControls.js";
-import { Vector3 } from "./math/Vector3.js";
-import { Vector4 } from "./math/Vector4.js";
-import { Matrix4 } from "./math/Matrix4.js";
-import { view } from "./view.js";
-
-import * as txml from "./txml.js";
-import { genXML } from "./genXML.js";
-
-function uuid(len, radix) {
- var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
- var uuid = [], i;
- radix = radix || chars.length;
-
- if (len) {
- // Compact form
- for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
- } else {
- // rfc4122, version 4 form
- var r;
-
- // rfc4122 requires these characters
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
- uuid[14] = '4';
-
- // Fill in random data. At i==19 set the high bits of clock sequence as
- // per rfc4122, sec. 4.1.5
- for (i = 0; i < 36; i++) {
- if (!uuid[i]) {
- r = 0 | Math.random()*16;
- uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
- }
- }
- }
-
- return uuid.join('');
-}
-
-function string_to_boolean(string) {
- switch (string.toLowerCase().trim()) {
- case "true":
- case "yes":
- case "1":
- return true;
-
- case "false":
- case "no":
- case "0":
- case null:
- return false;
-
- default:
- return Boolean(string);
- }
-}
-
-class LightmapBaker
-{
- constructor(doc, iterations, num_rays)
- {
- this.doc = doc;
- this.lst = [];
- for (let obj of doc.bakables)
- {
- let xml_node = doc.internal_index[obj.uuid].xml_node;
- let attributes = xml_node.attributes;
- if ("lightmap" in attributes)
- {
- let filename = attributes.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=='hdr')
- {
- this.lst.push({ model: obj, lightmap: filename, count: -1 });
- }
- }
- }
- if (this.lst.length<1)
- {
- print("No bakable object found!");
- return;
- }
-
- this.iterations = iterations;
- this.num_rays_final = num_rays;
- this.iter = 0;
- this.idx_model = 0;
- this.idx_texel = 0;
- this.check_time = now();
- }
-
- render(renderer)
- {
- if (this.lst.length<1)
- {
- this.doc.lightmap_bake = null;
- return;
- }
-
- let frame_time = now();
-
- while(this.doc.lightmap_bake != null)
- {
- let cur_time = now();
- if (cur_time -frame_time>=10) break;
-
- let item = this.lst[this.idx_model];
- if (item.count<0)
- {
- item.count = item.model.initializeLightmap(renderer);
- }
-
- if (cur_time - this.check_time>=500)
- {
- print(`Building LOD Probe-Grid, iteration: ${this.iter+1}/${this.iterations}, model: ${this.idx_model+1}/${this.lst.length}, texel: ${this.idx_texel +1}/${item.count}`);
- this.check_time = cur_time;
- }
-
- let num_rays = (this.num_rays_final >> (this.iterations - this.iter));
- if (num_rays < 1) num_rays = 1;
- let count_texels = renderer.updateLightmap(this.doc.scene, item.model, this.idx_texel, num_rays, 1.0);
- this.idx_texel += count_texels;
- if (this.idx_texel>=item.count)
- {
- renderer.filterLightmap(item.model);
- this.idx_texel = 0;
- this.idx_model++;
- if (this.idx_model >= this.lst.length)
- {
- this.idx_model = 0;
- this.iter++;
- if (this.iter >= this.iterations)
- {
- this.doc.lightmap_bake = null;
- print("Saving lightmaps.");
- for (let item of this.lst)
- {
- let hdr_image = item.model.getLightmap();
- let res = HDRImageSaver.saveFile(hdr_image, item.lightmap);
- if (!res)
- {
- print(`Failed to save ${item.lightmap}`);
- }
- }
-
- }
-
- }
-
- }
- }
-
- }
-}
-
-class EnvMapGen
-{
- constructor(doc, proxy, xml_node, irradiance_only = false)
- {
- this.doc = doc;
- this.xml_node = xml_node;
- this.irradiance_only = irradiance_only;
-
- this.cube_target = new CubeRenderTarget(128,128);
- this.envMapCreator = new EnvironmentMapCreator();
- this.iter = 0;
- }
-
- render(renderer)
- {
- print(`Building environemnt map, iteration: ${this.iter}`);
- let props = this.xml_node.attributes;
-
- let x = 0.0;
- let y = 0.0;
- let z = 0.0;
- if ("probe_position" in props)
- {
- let probe_position = props.probe_position;
- let position = probe_position.split(',');
- x = parseFloat(position[0]);
- y = parseFloat(position[1]);
- z = parseFloat(position[2]);
- }
-
- renderer.renderCube(this.doc.scene, this.cube_target, new Vector3(x, y,z));
-
- let envLight = this.envMapCreator.create(this.cube_target, this.irradiance_only);
- if (props.hasOwnProperty('dynamic_map'))
- {
- envLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- this.doc.scene.indirectLight = envLight;
-
- this.iter++;
- if (this.iter > 5)
- {
- print("Saving environemnt map.");
- if (this.irradiance_only)
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let text = JSON.stringify(envLight.shCoefficients);
- let res = fileSaver.saveTextFile(path_sh, text);
-
- if (!res)
- {
- print("Failed to save enviroment map.");
- }
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let down_img = this.cube_target.getHDRCubeImage();
-
- let res = HDRImageSaver.saveCubeToFile(down_img,
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (!res)
- {
- print("Failed to save enviroment map.");
- }
-
- }
- else
- {
- let down_img = this.cube_target.getCubeImage();
-
- let res = imageSaver.saveCubeToFile(down_img,
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (!res)
- {
- print("Failed to save enviroment map.");
- }
- }
- }
-
- this.doc.env_gen = null;
- }
- }
-
-}
-
-class ProbeGridBaker
-{
- constructor(doc, proxy, xml_node, iterations)
- {
- this.doc = doc;
- this.xml_node = xml_node;
-
- this.cube_target = new CubeRenderTarget(64,64);
- this.probe_grid = new ProbeGrid();
- this.probe_grid.setDivisions(proxy.divisions);
- this.probe_grid.setCoverageMin(proxy.coverageMin);
- this.probe_grid.setCoverageMax(proxy.coverageMax);
- this.probe_grid.ypower = proxy.ypower;
-
- print("Constructing visibility information...");
- this.probe_grid.constructVisibility(doc.scene);
-
- let props = this.xml_node.attributes;
- if (props.hasOwnProperty('dynamic_map'))
- {
- this.probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- if (props.hasOwnProperty('normal_bias'))
- {
- this.probe_grid.normalBias = parseFloat(props.normal_bias);
- }
- if (props.hasOwnProperty('per_primitive'))
- {
- this.probe_grid.perPrimitive = string_to_boolean(props.per_primitive);
- }
- this.doc.scene.indirectLight = this.probe_grid;
-
- let divisions = this.probe_grid.divisions;
- this.probe_count = divisions.x*divisions.y*divisions.z;
-
- this.update_lst = [];
- this.diff_stack = [];
-
- for (let i=0; i< this.probe_count; i++)
- {
- this.update_lst.push(i);
- }
- this.update_count = this.update_lst.length;
- this.probe_idx = 0;
-
- this.iterations = iterations;
- this.iter = 0;
- this.check_time = now();
-
- }
-
- render(renderer)
- {
- let frame_time = now();
-
- if (frame_time - this.check_time>=500)
- {
- print(`Building probe-grid, iteration: ${this.iter+1}/${this.iterations}, probe: ${this.probe_idx +1}/${this.update_count}`);
- this.check_time = frame_time;
- }
-
- let divisions = this.probe_grid.divisions;
- this.probe_grid.recordReferences = true;
- while(now()-frame_time<10)
- {
- if (this.doc.probe_grid_bake == null) break;
-
- let x = this.update_lst[this.probe_idx];
- let y = x / divisions.x;
- let z = y / divisions.y;
- y = y % divisions.y;
- x = x % divisions.x;
- let v_idx = new Vector3(x,y,z);
-
- renderer.updateProbe(this.doc.scene, this.cube_target, this.probe_grid, v_idx);
- this.probe_idx++;
- if (this.probe_idx>=this.update_count)
- {
- this.probe_idx = 0;
- this.iter++;
-
- if (this.iter < this.iterations)
- {
- let ref_arr = this.probe_grid.getReferences();
- let new_lst = [];
- let diff_lst = [];
- for (let i of this.update_lst)
- {
- if (ref_arr[i])
- {
- new_lst.push(i);
- }
- else
- {
- diff_lst.push(i);
- }
- }
-
- if (diff_lst.length>0)
- {
- this.diff_stack.push(diff_lst);
- }
-
- if (this.iter == this.iterations -1)
- {
- for(let j = this.diff_stack.length-1; j>=0; j--)
- {
- new_lst = new_lst.concat(this.diff_stack[j]);
- }
- }
-
- this.update_lst = new_lst;
- this.update_count = this.update_lst.length;
- }
- else
- {
- print("Saving probe-grid.");
- let props = this.xml_node.attributes;
- let probe_data = "assets/probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let res = probeGridSaver.saveFile(this.probe_grid, probe_data);
- if (!res)
- {
- print("Failed to save probe-grid.");
- }
- this.doc.probe_grid_bake = null;
- }
- }
- }
- this.probe_grid.recordReferences = false;
- }
-
-}
-
-class LODProbeGridBaker
-{
- constructor(doc, proxy, xml_node, iterations)
- {
- this.doc = doc;
- this.xml_node = xml_node;
-
- this.cube_target = new CubeRenderTarget(64,64);
- this.probe_grid = this.doc.scene.indirectLight;
-
- print("Constructing visibility information...");
- this.probe_grid.constructVisibility(doc.scene);
-
- this.probe_count = this.probe_grid.numberOfProbes;
- this.probe_idx = 0;
-
- this.iterations = iterations;
- this.iter = 0;
- this.check_time = now();
-
- }
-
- render(renderer)
- {
- let frame_time = now();
-
- if (frame_time - this.check_time>=500)
- {
- print(`Building LOD Probe-Grid, iteration: ${this.iter+1}/${this.iterations}, probe: ${this.probe_idx +1}/${this.probe_count}`);
- this.check_time = frame_time;
- }
- while(now()-frame_time<10)
- {
- if (this.doc.lod_probe_grid_bake == null) break;
- renderer.updateProbe(this.doc.scene, this.cube_target, this.probe_grid, this.probe_idx);
- this.probe_idx++;
- if (this.probe_idx>=this.probe_count)
- {
- this.probe_idx = 0;
- this.iter++;
-
- if (this.iter >= this.iterations)
- {
- print("Saving LOD Probe-Grid.");
- let props = this.xml_node.attributes;
- let probe_data = "assets/lod_probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let res = LODProbeGridSaver.saveFile(this.probe_grid, probe_data);
- if (!res)
- {
- print("Failed to save probe-grid.");
- }
- this.doc.lod_probe_grid_bake = null;
- }
- }
- }
- }
-
-}
-
-class GPUProbeGridBaker
-{
- constructor(doc, proxy, xml_node, iterations, num_rays)
- {
- this.doc = doc;
- this.xml_node = xml_node;
-
- this.probe_grid = new ProbeGrid();
- this.probe_grid.setDivisions(proxy.divisions);
- this.probe_grid.setCoverageMin(proxy.coverageMin);
- this.probe_grid.setCoverageMax(proxy.coverageMax);
- this.probe_grid.ypower = proxy.ypower;
-
- print("Constructing visibility information...");
- this.probe_grid.constructVisibility(doc.scene);
-
- let props = this.xml_node.attributes;
- if (props.hasOwnProperty('dynamic_map'))
- {
- this.probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- if (props.hasOwnProperty('normal_bias'))
- {
- this.probe_grid.normalBias = parseFloat(props.normal_bias);
- }
- if (props.hasOwnProperty('per_primitive'))
- {
- this.probe_grid.perPrimitive = string_to_boolean(props.per_primitive);
- }
- this.doc.scene.indirectLight = this.probe_grid;
-
- let divisions = this.probe_grid.divisions;
- this.probe_count = divisions.x*divisions.y*divisions.z;
-
- this.probe_idx = 0;
- this.iterations = iterations;
- this.num_rays_final = num_rays;
- this.iter = 0;
- this.check_time = now();
- }
-
- render(renderer)
- {
- let frame_time = now();
-
- if (frame_time - this.check_time>=500)
- {
- print(`Building probe-grid, iteration: ${this.iter+1}/${this.iterations}, probe: ${this.probe_idx +1}/${this.probe_count}`);
- this.check_time = frame_time;
- }
-
- while(now()-frame_time<10)
- {
- if (this.doc.probe_grid_bake == null) break;
- let num_rays = (this.num_rays_final >> (this.iterations - this.iter));
- let num_probes = renderer.updateProbes(this.doc.scene, this.probe_grid, this.probe_idx, num_rays, 0.5, 1.0);
- this.probe_idx += num_probes;
- if (this.probe_idx>=this.probe_count)
- {
- this.probe_idx = 0;
- this.iter++;
-
- if (this.iter >= this.iterations)
- {
- print("Saving probe-grid.");
- let props = this.xml_node.attributes;
- let probe_data = "assets/probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let res = probeGridSaver.saveFile(this.probe_grid, probe_data);
- if (!res)
- {
- print("Failed to save probe-grid.");
- }
- this.doc.probe_grid_bake = null;
- }
- }
- }
- }
-}
-
-class GPULODProbeGridBaker
-{
- constructor(doc, proxy, xml_node, iterations, num_rays)
- {
- this.doc = doc;
- this.xml_node = xml_node;
-
- this.cube_target = new CubeRenderTarget(64,64);
- this.probe_grid = this.doc.scene.indirectLight;
-
- print("Constructing visibility information...");
- this.probe_grid.constructVisibility(doc.scene);
-
- this.probe_count = this.probe_grid.numberOfProbes;
- this.probe_idx = 0;
-
- this.iterations = iterations;
- this.num_rays_final = num_rays;
- this.iter = 0;
- this.check_time = now();
-
- }
-
- render(renderer)
- {
- let frame_time = now();
-
- if (frame_time - this.check_time>=500)
- {
- print(`Building LOD Probe-Grid, iteration: ${this.iter+1}/${this.iterations}, probe: ${this.probe_idx +1}/${this.probe_count}`);
- this.check_time = frame_time;
- }
-
- while(now()-frame_time<10)
- {
- if (this.doc.lod_probe_grid_bake == null) break;
- let num_rays = (this.num_rays_final >> (this.iterations - this.iter));
- let num_probes = renderer.updateProbes(this.doc.scene, this.probe_grid, this.probe_idx, num_rays, 0.5, 1.0);
- this.probe_idx += num_probes;
- if (this.probe_idx>=this.probe_count)
- {
- this.probe_idx = 0;
- this.iter++;
-
- if (this.iter >= this.iterations)
- {
- print("Saving probe-grid.");
- let props = this.xml_node.attributes;
- let probe_data = "assets/lod_probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
- let res = LODProbeGridSaver.saveFile(this.probe_grid, probe_data);
- if (!res)
- {
- print("Failed to save probe-grid.");
- }
- this.doc.lod_probe_grid_bake = null;
- }
- }
- }
-
- }
-
-}
-
-// Tags
-const create_default_controls = (doc)=>{
- if (doc.controls)
- doc.controls.dispose();
- doc.controls = new OrbitControls(doc.camera, doc.view);
- doc.controls.enableDamping = true;
- doc.controls.target.set(0, 1.5, 0);
-}
-
-const create_default_sky = (doc)=>{
- let bg = new HemisphereBackground();
- bg.setSkyColor(0.318, 0.318, 0.318);
- bg.setGroundColor(0.01, 0.025, 0.025);
- doc.scene.background = bg;
-}
-
-const create_default_env_light = (doc) =>{
- let envLight = new HemisphereLight();
- envLight.setSkyColor(0.318, 0.318, 0.318);
- envLight.setGroundColor(0.01, 0.025, 0.025);
- doc.scene.indirectLight = envLight;
-}
-
-const scene = {
- reset: (doc) => {
- doc.scene = new Scene();
- },
- create: (doc, props, mode, parent) => {
- doc.scene = new Scene();
- create_default_sky(doc);
- create_default_env_light(doc);
- return doc.scene;
- },
- generate: (doc, obj, input) =>{
- generate_lightmap(doc, input);
- }
-}
-
-const camera = {
- reset: (doc) => {
- doc.camera = new PerspectiveCamera(45, doc.width / doc.height, 0.1, 100);
- doc.camera.setPosition(0, 1.5, 5.0);
- },
-
- create: (doc, props, mode, parent) => {
- let fov = 50.0;
- let near = 0.1;
- let far = 200.0;
- if (props.hasOwnProperty("fov"))
- {
- fov = parseFloat(props.fov);
- }
- if (props.hasOwnProperty("near"))
- {
- near = parseFloat(props.near);
- }
- if (props.hasOwnProperty("far"))
- {
- far = parseFloat(props.far);
- }
- doc.camera = new PerspectiveCamera(fov, doc.width / doc.height, near, far);
- create_default_controls(doc);
- return doc.camera;
- },
-
- remove: (doc, obj) => {
- camera.reset(doc);
- create_default_controls(doc);
- }
-}
-
-const control = {
- reset: (doc) => {
- create_default_controls(doc);
- },
- create: (doc, props, mode, parent) =>{
- let type = 'orbit';
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == 'orbit')
- {
- let from_x = 0.0;
- let from_y = 1.5;
- let from_z = 5.0;
- if (props.hasOwnProperty("look_from"))
- {
- let look_from = props.look_from.split(',');
- from_x = parseFloat(look_from[0]);
- from_y = parseFloat(look_from[1]);
- from_z = parseFloat(look_from[2]);
- }
-
- let to_x = 0.0;
- let to_y = 1.5;
- let to_z = 0.0;
- if (props.hasOwnProperty("look_at"))
- {
- let look_at = props.look_at.split(',');
- to_x = parseFloat(look_at[0]);
- to_y = parseFloat(look_at[1]);
- to_z = parseFloat(look_at[2]);
- }
-
- doc.camera.setPosition(from_x, from_y, from_z);
- if (doc.controls != null)
- doc.controls.dispose();
- doc.controls = new OrbitControls(doc.camera, doc.view);
- doc.controls.enableDamping = true;
- doc.controls.target.set(to_x, to_y, to_z);
- }
- return doc.controls;
- },
- remove: (doc, obj) => {
- create_default_controls(doc);
- }
-
-}
-
-const fog = {
- create: (doc, props, mode, parent) =>{
- doc.scene.fog = new Fog();
- if (props.hasOwnProperty("density"))
- {
- doc.scene.fog.density = parseFloat(props.density);
- }
- return doc.scene.fog;
- },
- tuning: (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("density" in input)
- {
- let density = input.density;
- props.density = density;
- obj.density = parseFloat(density);
- }
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
- return "";
- },
- remove: (doc, fog) => {
- doc.scene.fog = null;
- }
-}
-
-const create_uniform_sky = (doc, props) => {
- let bg = new ColorBackground();
- let envLight = null;
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setColor(r,g,b);
- }
- doc.scene.background = bg;
- return bg;
-}
-
-const create_hemisphere_sky = (doc, props)=>{
- let bg = new HemisphereBackground();
-
- if (props.hasOwnProperty('skyColor'))
- {
- const color = props.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setSkyColor(r,g,b);
- }
-
- if (props.hasOwnProperty('groundColor'))
- {
- const color = props.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- bg.setGroundColor(r,g,b);
-
- }
-
- doc.scene.background = bg;
- return bg;
-}
-
-const create_cube_sky = (doc, props)=>{
- let bg = new CubeBackground();
-
- let url = "assets/textures";
- let posx = "face0.jpg";
- let negx = "face1.jpg";
- let posy = "face2.jpg";
- let negy = "face3.jpg";
- let posz = "face4.jpg";
- let negz = "face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- if (cube_img!=null)
- {
- bg.setCubemap(cube_img);
- }
- doc.scene.background = bg;
-
- return bg;
-}
-
-const create_background_scene = (doc, props)=>{
- let path_scene = "terrain.xml";
- if (props.hasOwnProperty('scene'))
- {
- path_scene = props.scene;
- }
-
- let near = 10.0;
- let far = 10000.0;
- if (props.hasOwnProperty('near'))
- {
- near = parseFloat(props.near);
- }
- if (props.hasOwnProperty('far'))
- {
- far = parseFloat(props.far);
- }
-
- let bg_doc = new BackgroundDocument(near, far);
- bg_doc.load_local_xml(path_scene);
- doc.scene.background = bg_doc;
-
- return bg_doc;
-}
-
-const tuning_uniform_sky = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-}
-
-const tuning_hemisphere_sky = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("skyColor" in input)
- {
- props.skyColor = input.skyColor;
- const color = input.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setSkyColor(r,g,b);
- }
-
- if ("groundColor" in input)
- {
- props.groundColor = input.groundColor;
- const color = input.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setGroundColor(r,g,b);
- }
-}
-
-const tuning_cube_sky = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- let reload = false;
- if ("path" in input)
- {
- props.path = input.path;
- reload = true;
- }
- if ("posx" in input)
- {
- props.posx = input.posx;
- reload = true;
- }
- if ("negx" in input)
- {
- props.negx = input.negx;
- reload = true;
- }
- if ("posy" in input)
- {
- props.posy = input.posy;
- reload = true;
- }
- if ("negy" in input)
- {
- props.negy = input.negy;
- reload = true;
- }
- if ("posz" in input)
- {
- props.posz = input.posz;
- reload = true;
- }
- if ("negz" in input)
- {
- props.negz = input.negz;
- reload = true;
- }
- if (reload)
- {
- const url = props.path;
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+props.posx, url+"/"+props.negx,
- url+"/"+props.posy, url+"/"+props.negy,
- url+"/"+props.posz, url+"/"+props.negz);
-
- obj.setCubemap(cube_img);
- }
-}
-
-const tuning_background_scene = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("scene" in input)
- {
- props.scene = input.scene;
- obj.load_local_xml(input.scene);
- }
- if ("near" in input)
- {
- props.near = input.near;
- obj.near = parseFloat(input.near);
- }
- if ("far" in input)
- {
- props.far = input.far;
- obj.far = parseFloat(input.far);
- }
-}
-
-const sky = {
- reset: (doc) => {
- create_default_sky(doc);
- },
- create: (doc, props, mode, parent) => {
- let type = "hemisphere"
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- return create_uniform_sky(doc,props);
- }
- else if (type == "hemisphere")
- {
- return create_hemisphere_sky(doc,props);
- }
- else if (type == "cube")
- {
- return create_cube_sky(doc,props);
- }
- else if (type == "scene")
- {
- return create_background_scene(doc,props);
- }
- },
- remove: (doc, obj) => {
- create_default_sky(doc);
- },
- tuning: (doc, obj, input) => {
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- if (input.hasOwnProperty('type'))
- {
- node.attributes = {};
- node.attributes.type = input.type;
- doc.external_index.index[key].attributes = node.attributes;
- let obj_new = sky.create(doc, node.attributes, "local", doc.scene);
- obj_new.uuid = key;
- obj_new.tag = "sky";
- doc.internal_index[key].obj = obj_new;
- return JSON.stringify(node.attributes);
- }
- else
- {
- let props = node.attributes;
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- tuning_uniform_sky(doc, obj, input);
- }
- else if (type=="hemisphere")
- {
- tuning_hemisphere_sky(doc, obj, input);
- }
- else if (type=="cube")
- {
- tuning_cube_sky(doc, obj, input);
- }
- else if (type=="scene")
- {
- tuning_background_scene(doc, obj, input);
- }
- }
- return ""
- }
-}
-
-const create_uniform_env_light = (doc, props) => {
- let envLight = new AmbientLight();
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setColor(r,g,b);
- }
- doc.scene.indirectLight = envLight;
- return envLight;
-}
-
-const create_hemisphere_env_light = (doc, props) => {
- let envLight = new HemisphereLight();
-
- if (props.hasOwnProperty('skyColor'))
- {
- const color = props.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setSkyColor(r,g,b);
- }
-
- if (props.hasOwnProperty('groundColor'))
- {
- const color = props.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- envLight.setGroundColor(r,g,b);
- }
- doc.scene.indirectLight = envLight;
- return envLight;
-}
-
-const create_cube_env_light = (doc, props) => {
- const proxy = new SimpleModel();
- proxy.createBox(0.3, 0.3, 0.3);
-
- if (props.hasOwnProperty('probe_position'))
- {
- const position = props.probe_position.split(',');
- proxy.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
- proxy.setColor(0.7,0.0,0.7);
- doc.scene.addWidget(proxy);
-
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (irradiance_only)
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let envLight = new EnvironmentMap();
- let text = fileLoader.loadTextFile(path_sh);
- if (text!=null)
- {
- envLight.shCoefficients = JSON.parse(text);
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let cube_img = HDRImageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
- doc.scene.indirectLight = envLight;
- }
- }
-
- return proxy;
-}
-
-const create_probe_grid = (doc, props) => {
- const proxy = new ProbeGridWidget();
- if (props.hasOwnProperty('divisions'))
- {
- const divisions = props.divisions.split(',');
- proxy.setDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
- if (props.hasOwnProperty('coverage_min'))
- {
- const coverage_min = props.coverage_min.split(',');
- proxy.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
- if (props.hasOwnProperty('coverage_max'))
- {
- const coverage_max = props.coverage_max.split(',');
- proxy.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
- if (props.hasOwnProperty('ypower'))
- {
- proxy.ypower = parseFloat(props.ypower);
- }
- doc.scene.addWidget(proxy);
-
- let probe_data = "assets/probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
-
- let probe_grid = probeGridLoader.loadFile(probe_data);
- if (probe_grid == null)
- {
- probe_grid = new ProbeGrid();
- probe_grid.setDivisions(proxy.divisions);
- probe_grid.setCoverageMin(proxy.coverageMin);
- probe_grid.setCoverageMax(proxy.coverageMax);
- probe_grid.ypower = proxy.ypower;
- }
- else
- {
- proxy.setDivisions(probe_grid.divisions);
- proxy.setCoverageMin(probe_grid.coverageMin);
- proxy.setCoverageMax(probe_grid.coverageMax);
- proxy.ypower = probe_grid.ypower;
-
- props.divisions = `${probe_grid.divisions.x}, ${probe_grid.divisions.y}, ${probe_grid.divisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.ypower = `${probe_grid.ypower}`;
- }
-
- if (props.hasOwnProperty('normal_bias'))
- {
- probe_grid.normalBias = parseFloat(props.normal_bias);
- }
-
- if (props.hasOwnProperty('per_primitive'))
- {
- probe_grid.perPrimitive =string_to_boolean(props.per_primitive);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return proxy;
-}
-
-const create_lod_probe_grid = (doc, props) => {
- const proxy = new LODProbeGridWidget();
- if (props.hasOwnProperty('base_divisions'))
- {
- const divisions = props.base_divisions.split(',');
- proxy.setBaseDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
- if (props.hasOwnProperty('coverage_min'))
- {
- const coverage_min = props.coverage_min.split(',');
- proxy.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
- if (props.hasOwnProperty('coverage_max'))
- {
- const coverage_max = props.coverage_max.split(',');
- proxy.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
- proxy.subDivisionLevel = 2;
- if (props.hasOwnProperty('sub_division_level'))
- {
- proxy.subDivisionLevel = parseInt(props.sub_division_level);
- }
-
- doc.scene.addWidget(proxy);
-
- let probe_data = "assets/lod_probes.dat";
- if (props.hasOwnProperty('probe_data'))
- {
- probe_data = props.probe_data;
- }
-
- let probe_grid = LODProbeGridLoader.loadFile(probe_data);
- if (probe_grid == null)
- {
- probe_grid = new LODProbeGrid();
- probe_grid.setBaseDivisions(proxy.baseDivisions);
- probe_grid.setCoverageMin(proxy.coverageMin);
- probe_grid.setCoverageMax(proxy.coverageMax);
- probe_grid.subDivisionLevel = proxy.subDivisionLevel;
- }
- else
- {
- proxy.setBaseDivisions(probe_grid.baseDivisions);
- proxy.setCoverageMin(probe_grid.coverageMin);
- proxy.setCoverageMax(probe_grid.coverageMax);
- proxy.subDivisionLevel = probe_grid.subDivisionLevel;
-
- props.base_divisions = `${probe_grid.baseDivisions.x}, ${probe_grid.baseDivisions.y}, ${probe_grid.baseDivisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.sub_division_level = `${probe_grid.subDivisionLevel}`;
- }
- proxy.probeGrid = probe_grid;
-
- if (props.hasOwnProperty('normal_bias'))
- {
- probe_grid.normalBias = parseFloat(props.normal_bias);
- }
-
- if (props.hasOwnProperty('per_primitive'))
- {
- probe_grid.perPrimitive =string_to_boolean(props.per_primitive);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return proxy;
-}
-
-const tuning_ambient_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- return "";
-}
-
-
-const tuning_hemisphere_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("skyColor" in input)
- {
- props.skyColor = input.skyColor;
- const color = input.skyColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setSkyColor(r,g,b);
- }
-
- if ("groundColor" in input)
- {
- props.groundColor = input.groundColor;
- const color = input.groundColor.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setGroundColor(r,g,b);
- }
-
- return ""
-}
-
-const tuning_cube_env_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("probe_position" in input)
- {
- let probe_position = input.probe_position;
- props.probe_position = probe_position;
- let position = probe_position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- let reload = false;
-
- if ("irradiance_only" in input)
- {
- props.irradiance_only = input.irradiance_only;
- reload = true;
- }
-
- if ("path" in input)
- {
- props.path = input.path;
- reload = true;
- }
- if ("posx" in input)
- {
- props.posx = input.posx;
- reload = true;
- }
- if ("negx" in input)
- {
- props.negx = input.negx;
- reload = true;
- }
- if ("posy" in input)
- {
- props.posy = input.posy;
- reload = true;
- }
- if ("negy" in input)
- {
- props.negy = input.negy;
- reload = true;
- }
- if ("posz" in input)
- {
- props.posz = input.posz;
- reload = true;
- }
- if ("negz" in input)
- {
- props.negz = input.negz;
- reload = true;
- }
-
- if ("path_sh" in input)
- {
- props.path_sh = input.path_sh;
- reload = true;
- }
-
- if (reload)
- {
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (irradiance_only )
- {
- let path_sh = "assets/sh.json";
- if (props.hasOwnProperty('path_sh'))
- {
- path_sh = props.path_sh;
- }
-
- let envLight = new EnvironmentMap();
- let text = fileLoader.loadTextFile(path_sh);
- if (text!=null)
- {
- envLight.shCoefficients = JSON.parse(text);
- }
- doc.scene.indirectLight = envLight;
- }
- else
- {
- let url = "assets/textures";
- let posx = "env_face0.jpg";
- let negx = "env_face1.jpg";
- let posy = "env_face2.jpg";
- let negy = "env_face3.jpg";
- let posz = "env_face4.jpg";
- let negz = "env_face5.jpg";
-
- if (props.hasOwnProperty('path'))
- {
- url = props.path;
- }
- if (props.hasOwnProperty('posx'))
- {
- posx = props.posx;
- }
- if (props.hasOwnProperty('negx'))
- {
- negx = props.negx;
- }
- if (props.hasOwnProperty('posy'))
- {
- posy = props.posy;
- }
- if (props.hasOwnProperty('negy'))
- {
- negy = props.negy;
- }
- if (props.hasOwnProperty('posz'))
- {
- posz = props.posz;
- }
- if (props.hasOwnProperty('negz'))
- {
- negz = props.negz;
- }
-
- if (posx.split('.').pop()=="hdr")
- {
- let cube_img = HDRImageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- envLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = envLight;
- }
- else
- {
-
- let cube_img = imageLoader.loadCubeFromFile(
- url+"/"+posx, url+"/"+negx,
- url+"/"+posy, url+"/"+negy,
- url+"/"+posz, url+"/"+negz);
-
- let envLight = null;
- if (cube_img!=null)
- {
- let envMapCreator = new EnvironmentMapCreator();
- envLight = envMapCreator.create(cube_img);
- }
- else
- {
- envLight = new EnvironmentMap();
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- envLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = envLight;
- }
- }
- }
- return "";
-}
-
-const tuning_probe_grid = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("probe_data" in input)
- {
- props.probe_data = input.probe_data;
-
- let probe_grid = probeGridLoader.loadFile(input.probe_data);
- if (probe_grid == null)
- {
- probe_grid = new ProbeGrid();
- probe_grid.setDivisions(obj.divisions);
- probe_grid.setCoverageMin(obj.coverageMin);
- probe_grid.setCoverageMax(obj.coverageMax);
- probe_grid.ypower = obj.ypower;
- }
- else
- {
- obj.setDivisions(probe_grid.divisions);
- obj.setCoverageMin(probe_grid.coverageMin);
- obj.setCoverageMax(probe_grid.coverageMax);
- obj.ypower = probe_grid.ypower;
-
- props.divisions = `${probe_grid.divisions.x}, ${probe_grid.divisions.y}, ${probe_grid.divisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.ypower = `${probe_grid.ypower}`;
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return JSON.stringify(props);
- }
-
- if ("divisions" in input)
- {
- props.divisions = input.divisions;
- let divisions = input.divisions.split(',');
- obj.setDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
-
- if ("coverage_min" in input)
- {
- props.coverage_min = input.coverage_min;
- let coverage_min = input.coverage_min.split(',');
- obj.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
-
- if ("coverage_max" in input)
- {
- props.coverage_max = input.coverage_max;
- let coverage_max = input.coverage_max.split(',');
- obj.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
-
- if ("ypower" in input)
- {
- props.ypower = input.ypower;
- obj.ypower = parseFloat(input.ypower);
- }
-
- if ("normal_bias" in input)
- {
- props.normal_bias = input.normal_bias;
- doc.scene.indirectLight.normalBias = parseFloat(input.normal_bias);
- }
-
- if ("per_primitive" in input)
- {
- props.per_primitive = input.per_primitive;
- doc.scene.indirectLight.perPrimitive =string_to_boolean(input.per_primitive);
- }
-
- if ("auto_area" in input)
- {
- let aabb = doc.scene.getBoundingBox();
- let minPos = aabb.minPos;
- let maxPos = aabb.maxPos;
- let size_x = maxPos.x - minPos.x;
- let size_y = maxPos.y - minPos.y;
- let size_z = maxPos.z - minPos.z;
- let div_x = Math.ceil(size_x); if (div_x<2) div_x = 2;
- let div_y = Math.ceil(size_y); if (div_y<2) div_y = 2;
- let div_z = Math.ceil(size_z); if (div_z<2) div_z = 2;
- obj.setDivisions(div_x, div_y, div_z);
- obj.setCoverageMin(minPos);
- obj.setCoverageMax(maxPos);
- props.divisions = `${div_x}, ${div_y}, ${div_z}`;
- props.coverage_min = `${minPos.x}, ${minPos.y}, ${minPos.z}`;
- props.coverage_max = `${maxPos.x}, ${maxPos.y}, ${maxPos.z}`;
- let ret = { divisions: props.divisions, coverage_min: props.coverage_min, coverage_max: props.coverage_max };
- return JSON.stringify(ret);
- }
-
- return "";
-
-}
-
-const tuning_lod_probe_grid = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("probe_data" in input)
- {
- props.probe_data = input.probe_data;
-
- let probe_grid = LODProbeGridLoader.loadFile(input.probe_data);
- if (probe_grid == null)
- {
- probe_grid = new LODProbeGrid();
- probe_grid.setBaseDivisions(obj.baseDivisions);
- probe_grid.setCoverageMin(obj.coverageMin);
- probe_grid.setCoverageMax(obj.coverageMax);
- probe_grid.subDivisionLevel = obj.subDivisionLevel;
- }
- else
- {
- obj.setBaseDivisions(probe_grid.baseDivisions);
- obj.setCoverageMin(probe_grid.coverageMin);
- obj.setCoverageMax(probe_grid.coverageMax);
- obj.subDivisionLevel = probe_grid.subDivisionLevel;
-
- props.base_divisions = `${probe_grid.baseDivisions.x}, ${probe_grid.baseDivisions.y}, ${probe_grid.baseDivisions.z}`;
- props.coverage_min = `${probe_grid.coverageMin.x}, ${probe_grid.coverageMin.y}, ${probe_grid.coverageMin.z}`;
- props.coverage_max = `${probe_grid.coverageMax.x}, ${probe_grid.coverageMax.y}, ${probe_grid.coverageMax.z}`;
- props.sub_division_level = `${probe_grid.subDivisionLevel}`;
- }
- obj.probeGrid = probe_grid;
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- probe_grid.dynamicMap = string_to_boolean(props.dynamic_map);
- }
-
- doc.scene.indirectLight = probe_grid;
-
- return JSON.stringify(props);
- }
-
- if ("base_divisions" in input)
- {
- props.base_divisions = input.base_divisions;
- let divisions = input.base_divisions.split(',');
- obj.setBaseDivisions(parseInt(divisions[0]), parseInt(divisions[1]), parseInt(divisions[2]));
- }
-
- if ("coverage_min" in input)
- {
- props.coverage_min = input.coverage_min;
- let coverage_min = input.coverage_min.split(',');
- obj.setCoverageMin(parseFloat(coverage_min[0]), parseFloat(coverage_min[1]), parseFloat(coverage_min[2]));
- }
-
- if ("coverage_max" in input)
- {
- props.coverage_max = input.coverage_max;
- let coverage_max = input.coverage_max.split(',');
- obj.setCoverageMax(parseFloat(coverage_max[0]), parseFloat(coverage_max[1]), parseFloat(coverage_max[2]));
- }
-
- if ("sub_division_level" in input)
- {
- props.sub_division_level = input.sub_division_level;
- obj.subDivisionLevel = parseInt(input.sub_division_level);
- }
-
- if ("normal_bias" in input)
- {
- props.normal_bias = input.normal_bias;
- obj.probeGrid.normalBias = parseFloat(input.normal_bias);
- }
-
- if ("per_primitive" in input)
- {
- props.per_primitive = input.per_primitive;
- obj.probeGrid.perPrimitive =string_to_boolean(input.per_primitive);
- }
-
- if ("auto_area" in input)
- {
- let aabb = doc.scene.getBoundingBox();
- let minPos = aabb.minPos;
- let maxPos = aabb.maxPos;
- let size_x = maxPos.x - minPos.x;
- let size_y = maxPos.y - minPos.y;
- let size_z = maxPos.z - minPos.z;
- let div_x = Math.ceil(size_x / 4); if (div_x<2) div_x = 2;
- let div_y = Math.ceil(size_y / 4); if (div_y<2) div_y = 2;
- let div_z = Math.ceil(size_z / 4); if (div_z<2) div_z = 2;
- obj.setBaseDivisions(div_x, div_y, div_z);
- obj.setCoverageMin(minPos);
- obj.setCoverageMax(maxPos);
- obj.subDivisionLevel = 2;
- props.base_divisions = `${div_x}, ${div_y}, ${div_z}`;
- props.coverage_min = `${minPos.x}, ${minPos.y}, ${minPos.z}`;
- props.coverage_max = `${maxPos.x}, ${maxPos.y}, ${maxPos.z}`;
- props.sub_division_level = "2";
- let ret = { base_divisions: props.base_divisions, coverage_min: props.coverage_min, coverage_max: props.coverage_max, sub_division_level: "2" };
- return JSON.stringify(ret);
- }
-
- return "";
-
-}
-
-const initialize_lod_probe_grid = (doc, obj, input) =>{
- let probe_grid = obj.probeGrid;
-
- doc.lod_probe_grid_bake = null;
- probe_grid.setBaseDivisions(obj.baseDivisions);
- probe_grid.setCoverageMin(obj.coverageMin);
- probe_grid.setCoverageMax(obj.coverageMax);
- probe_grid.subDivisionLevel = obj.subDivisionLevel;
- probe_grid.initialize(doc.renderer, doc.scene);
- return probe_grid.numberOfProbes;
-}
-
-
-const generate_lightmap = (doc, input) =>{
- let iterations = parseInt(input.iterations);
- let num_rays = parseInt(input.num_rays);
- doc.lightmap_bake = new LightmapBaker(doc, iterations, num_rays)
-}
-
-const generate_cube_env_light = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- let irradiance_only = false;
- if (props.hasOwnProperty('irradiance_only'))
- {
- irradiance_only = string_to_boolean(props.irradiance_only);
- }
-
- if (!irradiance_only)
- {
- props.path = input.path;
- props.posx = input.posx;
- props.negx = input.negx;
- props.posy = input.posy;
- props.negy = input.negy;
- props.posz = input.posz;
- props.negz = input.negz;
- }
- doc.env_gen = new EnvMapGen(doc, obj, node, irradiance_only);
-}
-
-const generate_probe_grid = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let iterations = parseInt(input.iterations);
- let num_rays = parseInt(input.num_rays);
- doc.probe_grid_bake = new GPUProbeGridBaker(doc, obj, node, iterations, num_rays);
-}
-
-
-const generate_lod_probe_grid = (doc, obj, input) =>{
- initialize_lod_probe_grid(doc, obj, input);
- let node = doc.internal_index[obj.uuid].xml_node;
- let iterations = parseInt(input.iterations);
- let num_rays = parseInt(input.num_rays);
- doc.lod_probe_grid_bake = new GPULODProbeGridBaker(doc, obj, node, iterations, num_rays);
-}
-
-const env_light = {
- reset: (doc) => {
- create_default_env_light(doc);
- },
- create: (doc, props, mode, parent) => {
- let type = "hemisphere"
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
-
- let ret = null;
-
- if (type == "uniform")
- {
- ret = create_uniform_env_light(doc,props);
- }
- else if (type == "hemisphere")
- {
- ret = create_hemisphere_env_light(doc,props);
- }
- else if (type == "cube")
- {
- ret = create_cube_env_light(doc,props);
- }
- else if (type == "probe_grid")
- {
- ret = create_probe_grid(doc, props);
- }
- else if (type == "lod_probe_grid")
- {
- ret = create_lod_probe_grid(doc, props);
- }
-
- if (props.hasOwnProperty('dynamic_map'))
- {
- doc.scene.indirectLight.dynamicMap = string_to_boolean(props.dynamic_map);
- }
- return ret;
- },
- remove: (doc, obj) => {
- create_default_env_light(doc);
-
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- let props = node.attributes;
- let type = "hemisphere"
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
-
- if (type == "cube" || type =="probe_grid" || type == "lod_probe_grid")
- {
- doc.scene.removeWidget(obj);
- }
-
- },
-
- tuning: (doc, obj, input) => {
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- if (input.hasOwnProperty('type'))
- {
- doc.remove(obj);
- node.attributes = {};
- node.attributes.type = input.type;
- doc.external_index.index[key].attributes = node.attributes;
- let obj_new = env_light.create(doc, node.attributes, "local", doc.scene);
- obj_new.uuid = key;
- obj_new.tag = "env_light";
- doc.internal_index[key].obj = obj_new;
- return JSON.stringify(node.attributes);
- }
- else
- {
- let props = node.attributes;
-
- if (input.hasOwnProperty('dynamic_map'))
- {
- props.dynamic_map = input.dynamic_map;
- doc.scene.indirectLight.dynamicMap = string_to_boolean(input.dynamic_map);
- return ""
- }
-
- let type = "hemisphere";
- if (props.hasOwnProperty("type"))
- {
- type = props.type;
- }
- if (type == "uniform")
- {
- return tuning_ambient_light(doc, obj, input);
- }
- else if (type=="hemisphere")
- {
- return tuning_hemisphere_light(doc, obj, input);
- }
- else if (type=="cube")
- {
- return tuning_cube_env_light(doc,obj,input);
- }
- else if (type == "probe_grid")
- {
- return tuning_probe_grid(doc,obj,input);
- }
- else if (type == "lod_probe_grid")
- {
- return tuning_lod_probe_grid(doc,obj,input);
- }
- }
-
- },
-
- initialize: (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if (props.type == "lod_probe_grid")
- {
- return initialize_lod_probe_grid(doc,obj,input);
- }
- return "";
- },
-
- generate: (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if (props.type == "cube")
- {
- generate_cube_env_light(doc,obj,input);
- }
- else if (props.type == "probe_grid")
- {
- generate_probe_grid(doc,obj,input);
- }
- else if (props.type == "lod_probe_grid")
- {
- generate_lod_probe_grid(doc,obj,input);
- }
- }
-
-}
-
-
-const tuning_object3d = (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("name" in input)
- {
- props.name = input.name;
- obj.name = input.name;
- }
- if ("position" in input)
- {
- props.position = input.position;
- let position = input.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
- if ("rotation" in input)
- {
- props.rotation = input.rotation;
- let rotation = input.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
- if ("scale" in input)
- {
- props.scale = input.scale;
- let scale = input.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
- if ('is_building' in input)
- {
- props.is_building = input.is_building;
- obj.isBuilding = string_to_boolean(input.is_building);
- }
-}
-
-const tuning_material = (doc, obj, input) =>{
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if ("texture" in input)
- {
- props.texture = input.texture;
- let img = imageLoader.loadFile(input.texture);
- obj.setColorTexture(img);
- }
-
- if ("metalness" in input)
- {
- let metalness = input.metalness;
- props.metalness = metalness;
- obj.metalness = parseFloat(metalness);
- }
-
- if ("roughness" in input)
- {
- let roughness = input.roughness;
- props.roughness = roughness;
- obj.roughness = parseFloat(roughness);
- }
-}
-
-const group = {
- create: (doc, props, mode, parent) => {
- const group = new Object3D();
- if (parent != null) {
- parent.add(group);
- }
- else {
- doc.scene.add(group);
- }
- return group;
- },
-
- tuning: (doc, obj, input) => {
- tuning_object3d(doc, obj, input);
- return "";
- }
-}
-
-const plane = {
- create: (doc, props, mode, parent) => {
- let width = 1.0;
- let height = 1.0;
- if (props.hasOwnProperty('size'))
- {
- let size = props.size.split(',');
- width = parseFloat(size[0]);
- height = parseFloat(size[1]);
- }
-
- const plane = new SimpleModel();
- plane.createPlane(width, height);
-
- if (parent != null) {
- parent.add(plane);
- }
- else {
- doc.scene.add(plane);
- }
- return plane;
- },
-
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("size" in input)
- {
- props.size = input.size;
- let size = input.size.split(',');
- let width = parseFloat(size[0]);
- let height = parseFloat(size[1]);
- obj.createPlane(width, height);
- }
- tuning_object3d(doc, obj, input);
- tuning_material(doc, obj, input);
- return "";
- }
-}
-
-
-const box = {
- create: (doc, props, mode, parent) => {
- let width = 1.0;
- let height = 1.0;
- let depth = 1.0;
- if (props.hasOwnProperty('size'))
- {
- let size = props.size.split(',');
- width = parseFloat(size[0]);
- height = parseFloat(size[1]);
- depth = parseFloat(size[2]);
- }
-
- const box = new SimpleModel();
- box.createBox(width, height, depth);
-
- if (parent != null) {
- parent.add(box);
- }
- else {
- doc.scene.add(box);
- }
- return box;
- },
-
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
- if ("size" in input)
- {
- props.size = input.size;
- let size = input.size.split(',');
- let width = parseFloat(size[0]);
- let height = parseFloat(size[1]);
- let depth = parseFloat(size[2]);
- obj.createBox(width, height, depth);
- }
- tuning_object3d(doc, obj, input);
- tuning_material(doc, obj, input);
- return "";
- }
-}
-
-const sphere = {
- create: (doc, props, mode, parent) => {
- let radius = 1.0;
- if (props.hasOwnProperty('radius'))
- {
- radius = parseFloat(props.radius);
- }
- let widthSegments = 32;
- if (props.hasOwnProperty('widthSegments'))
- {
- widthSegments = parseInt(props.widthSegments);
- }
- let heightSegments = 16;
- if (props.hasOwnProperty('heightSegments'))
- {
- heightSegments = parseInt(props.heightSegments);
- }
-
- const sphere = new SimpleModel();
- sphere.createSphere(radius, widthSegments, heightSegments);
-
- if (parent != null) {
- parent.add(sphere);
- }
- else {
- doc.scene.add(sphere);
- }
- return sphere;
- },
-
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- let to_create = false;
-
- let radius = 1.0;
- if ("radius" in input)
- {
- props.radius = input.radius;
- radius = parseFloat(input.radius);
- to_create = true;
- }
-
- let widthSegments = 32;
- if ("widthSegments" in input)
- {
- props.widthSegments = input.widthSegments;
- widthSegments = parseInt(input.widthSegments);
- to_create = true;
- }
-
- let heightSegments = 16;
- if ("heightSegments" in input)
- {
- props.heightSegments = input.heightSegments;
- heightSegments = parseInt(input.heightSegments);
- to_create = true;
- }
-
- if (to_create)
- {
- obj.createSphere(radius, widthSegments, heightSegments);
- }
-
- tuning_object3d(doc, obj, input);
- tuning_material(doc, obj, input);
- return "";
- }
-}
-
-const model = {
- create: (doc, props, mode, parent) => {
- let url = "assets/models/model.glb";
- if (props.hasOwnProperty('src'))
- {
- url = props.src;
- }
- let model = gltfLoader.loadModelFromFile(url);
- if (model == null)
- {
- model= new SimpleModel();
- model.createBox(0.5, 1.5, 0.5);
- model.setColor(0.7,0.0,0.7);
- }
- else
- {
- if (props.hasOwnProperty('is_building') && string_to_boolean(props.is_building))
- {
- model.batchPrimitives();
- }
-
- if (model.isBakable)
- {
- doc.bakables.push(model);
-
- if (props.hasOwnProperty('lightmap'))
- {
- let filename = props.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=="hdr")
- {
- let hdr_img = HDRImageLoader.loadFile(filename);
- if (hdr_img!=null)
- {
- model.setLightmap(hdr_img);
- }
- }
- else if (ext=="dds")
- {
- let dds_img = DDSImageLoader.loadFile(filename);
- if (dds_img!=null)
- {
- model.setLightmap(dds_img);
- }
- }
- else if (ext=="png" || ext == "webp")
- {
- let img = imageLoader.loadFile(filename);
- if (img!=null)
- {
- let hdr_img = HDRImageLoader.fromRGBM(img);
- model.setLightmap(hdr_img);
- }
- }
- else if (ext=="csv")
- {
- let text = fileLoader.loadTextFile(filename);
- if (text!=null)
- {
- let path = filename.match(/(.*)[\/\\]/)[1]||'';
- let images = [];
- let ranges = [];
- let lines = text.split(/\r?\n/);
- for(let line of lines)
- {
- let fields = line.split(",");
- if (fields.length<7) continue;
- let fn_img = fields[0];
- let img = imageLoader.loadFile(path + "/" + fn_img);
- if (img == null) continue;
- let low = new Vector3(parseFloat(fields[1]), parseFloat(fields[2]), parseFloat(fields[3]));
- let high = new Vector3(parseFloat(fields[4]), parseFloat(fields[5]), parseFloat(fields[6]));
- images.push(img);
- ranges.push({low, high});
- }
- let hdr_img = HDRImageLoader.fromImages(images, ranges);
- model.setLightmap(hdr_img);
- }
- }
- }
- }
- }
-
-
- if (parent != null) {
- parent.add(model);
- }
- else {
- doc.scene.add(model);
- }
- return model;
- },
-
- tuning: (doc, obj, input) => {
- let key = obj.uuid;
- let node = doc.internal_index[key].xml_node;
- let props = node.attributes;
- if (input.hasOwnProperty('src'))
- {
- doc.remove(obj);
- props.src = input.src;
- let obj_new = model.create(doc, props, "local", obj.parent);
- obj_new.uuid = key;
- obj_new.tag = "model";
-
- if (props.hasOwnProperty('name'))
- {
- obj_new.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj_new.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj_new.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj_new.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- obj_new.setToonShading(16, 5.0, new Vector3(1.0, 1.0, 0.2));
-
- doc.internal_index[key].obj = obj_new;
- }
- else
- {
- if ("is_building" in input)
- {
- props.is_building = input.is_building;
- if (string_to_boolean(props.is_building))
- {
- obj.batchPrimitives();
- }
- }
-
- if ("lightmap" in input)
- {
- props.lightmap = input.lightmap;
- if (obj.isBakable)
- {
- let filename = input.lightmap;
- let ext = filename.split('.').pop().toLowerCase();
- if (ext=="hdr")
- {
- let hdr_img = HDRImageLoader.loadFile(filename);
- if (hdr_img!=null)
- {
- obj.setLightmap(hdr_img);
- }
- }
- else if (ext=="dds")
- {
- let dds_img = DDSImageLoader.loadFile(filename);
- if (dds_img!=null)
- {
- obj.setLightmap(dds_img);
- }
- }
- else if (ext=="png" || ext == "webp")
- {
- let img = imageLoader.loadFile(filename);
- if (img!=null)
- {
- let hdr_img = HDRImageLoader.fromRGBM(img);
- obj.setLightmap(hdr_img);
- }
- }
- else if (ext=="csv")
- {
- let text = fileLoader.loadTextFile(filename);
- if (text!=null)
- {
- let path = filename.match(/(.*)[\/\\]/)[1]||'';
- let images = [];
- let ranges = [];
- let lines = text.split(/\r?\n/);
- for(let line of lines)
- {
- let fields = line.split(",");
- if (fields.length<7) continue;
- let fn_img = fields[0];
- let img = imageLoader.loadFile(path + "/" + fn_img);
- if (img == null) continue;
- let low = new Vector3(parseFloat(fields[1]), parseFloat(fields[2]), parseFloat(fields[3]));
- let high = new Vector3(parseFloat(fields[4]), parseFloat(fields[5]), parseFloat(fields[6]));
- images.push(img);
- ranges.push({low, high});
- }
- let hdr_img = HDRImageLoader.fromImages(images, ranges);
- obj.setLightmap(hdr_img);
- }
- }
- }
-
- }
- tuning_object3d(doc, obj, input);
- }
- return "";
- },
-
- generate: (doc, obj, input) =>{
- if (doc.renderer.compressLightmap(doc.scene, obj))
- {
- doc.renderer.decompressLightmap(doc.scene, obj);
- }
- }
-}
-
-const avatar = {
- create: (doc, props, mode, parent) => {
- let avatar = model.create(doc, { ...props}, mode, parent);
- return avatar;
- },
-
- tuning: (doc, obj, input) => {
- model.tuning(doc,obj,input);
- return "";
- }
-}
-
-
-const directional_light = {
- create: (doc, props, mode, parent) => {
- const light = new DirectionalLight();
-
- if (props.hasOwnProperty('intensity')) {
- light.intensity = parseFloat(props.intensity);
- }
-
- if (props.hasOwnProperty('target')){
- let target = doc.scene.getObjectByName(props.target);
- light.target = target;
- }
-
- if (props.hasOwnProperty('castShadow') && string_to_boolean(props.castShadow))
- {
- let width = 512;
- let height = 512;
- if (props.hasOwnProperty('size')) {
- const size = props.size.split(',');
- width = parseInt(size[0]);
- height = parseInt(size[1]);
- }
- light.setShadow(true, width, height);
-
- if (props.hasOwnProperty('area')) {
- const area = props.area.split(',');
- let left = parseFloat(area[0]);
- let right = parseFloat(area[1]);
- let bottom = parseFloat(area[2]);
- let top = parseFloat(area[3]);
- let near = parseFloat(area[4]);
- let far = parseFloat(area[5]);
- light.setShadowProjection(left, right, bottom, top, near, far);
- }
-
- if (props.hasOwnProperty('radius'))
- {
- let radius = parseFloat(props.radius);
- light.setShadowRadius(radius);
- }
-
- if (props.hasOwnProperty('bias'))
- {
- light.bias = parseFloat(props.bias);
- }
-
- if (props.hasOwnProperty('force_cull'))
- {
- light.forceCull = string_to_boolean(props.force_cull);
- }
- }
-
- if (parent != null) {
- parent.add(light);
- }
- else {
- doc.scene.add(light);
- }
- doc.scene.addWidget(light);
- return light;
- },
- remove: (doc, obj) => {
- doc.scene.removeWidget(obj);
- },
- tuning: (doc, obj, input) => {
- let node = doc.internal_index[obj.uuid].xml_node;
- let props = node.attributes;
-
- if ("intensity" in input)
- {
- let intensity = input.intensity;
- props.intensity = intensity;
- obj.intensity = parseFloat(intensity);
- }
-
- if ("color" in input)
- {
- props.color = input.color;
- const color = input.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if ("target" in input)
- {
- props.target = input.target;
- let target = doc.scene.getObjectByName(input.target);
- obj.target = target;
- }
-
- if ("castShadow" in input)
- {
- props.castShadow = input.castShadow;
-
- let castShadow = string_to_boolean(input.castShadow);
- let width = 512;
- let height = 512;
- if (input.hasOwnProperty('size')) {
- props.size = input.size;
- let size = input.size.split(',');
- width = parseInt(size[0]);
- height = parseInt(size[1]);
- }
- obj.setShadow(castShadow, width, height);
- }
-
- if ("area" in input)
- {
- props.area = input.area;
- const area = input.area.split(',');
- let left = parseFloat(area[0]);
- let right = parseFloat(area[1]);
- let bottom = parseFloat(area[2]);
- let top = parseFloat(area[3]);
- let near = parseFloat(area[4]);
- let far = parseFloat(area[5]);
- obj.setShadowProjection(left, right, bottom, top, near, far);
- }
-
- if ("radius" in input)
- {
- props.radius = input.radius;
- let radius = parseFloat(input.radius);
- obj.setShadowRadius(radius);
- }
-
- if ("bias" in input)
- {
- props.bias = input.bias;
- obj.bias = parseFloat(input.bias);
- }
-
- if ("force_cull" in input)
- {
- props.force_cull = input.force_cull;
- obj.forceCull = string_to_boolean(input.force_cull);
- }
-
- if ("auto_area" in input)
- {
- let aabb = obj.getBoundingBox(doc.scene);
- let minPos = aabb.minPos;
- let maxPos = aabb.maxPos;
- obj.setShadowProjection(minPos.x, maxPos.x, minPos.y, maxPos.y, -maxPos.z, -minPos.z);
- props.area = `${minPos.x}, ${maxPos.x}, ${minPos.y}, ${maxPos.y}, ${-maxPos.z}, ${-minPos.z}`;
- let ret = { area: props.area };
- return JSON.stringify(ret);
- }
-
- tuning_object3d(doc, obj, input);
-
- return "";
- }
-}
-
-class BackgroundDocument extends BackgroundScene
-{
- constructor(near, far)
- {
- super(null, near, far);
-
- this.Tags = { scene, sky, env_light, group, plane, box, sphere, model, directional_light };
- this.reset();
- }
-
- reset()
- {
- for (let tag in this.Tags)
- {
- if (this.Tags[tag].hasOwnProperty('reset'))
- {
- this.Tags[tag].reset(this);
- }
- }
- }
-
- create(tag, props, mode, parent = null)
- {
- if (!(tag in this.Tags)) return null;
-
- const obj = this.Tags[tag].create(this, props, mode, parent);
- if (obj == null) return null;
-
- if (Object.isExtensible(obj))
- {
- obj.tag = tag;
- }
-
- if (props.hasOwnProperty('name'))
- {
- obj.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if (props.hasOwnProperty('texture'))
- {
- let img = imageLoader.loadFile(props.texture);
- if (img!=null)
- {
- obj.setColorTexture(img);
- }
- }
-
- if (props.hasOwnProperty('metalness'))
- {
- obj.metalness = parseFloat(props.metalness);
- }
-
- if (props.hasOwnProperty('roughness'))
- {
- obj.roughness = parseFloat(props.roughness);
- }
-
- if (props.hasOwnProperty('is_building'))
- {
- obj.isBuilding = string_to_boolean(props.is_building);
- }
-
- return obj;
- }
-
- load_xml_node(xmlNode, mode, parent = null)
- {
- if (parent == null) {
- parent = this;
- }
- for (let child of xmlNode.children) {
- const obj = this.create(child.tagName, child.attributes, mode, parent);
- if (obj===null) continue;
- this.load_xml_node(child, mode, obj);
- }
-
- }
-
- load_xml(xmlText, mode)
- {
- const parsed = txml.parse(xmlText);
- let root = null;
- for (let top of parsed)
- {
- if (top.tagName == 'document')
- {
- root = top;
- break;
- }
- }
- if (root)
- {
- this.load_xml_node(root, mode);
- }
- }
-
- load_local_xml(filename)
- {
- const xmlText = fileLoader.loadTextFile(filename);
- if (xmlText!=null)
- {
- this.load_xml(xmlText, "local");
- }
- }
-}
-
-export class Document
-{
- constructor(view)
- {
- this.view = view;
- this.width = view.clientWidth;
- this.height = view.clientHeight;
- this.Tags = { scene, camera, fog, sky, env_light, control, group, plane, box, sphere, model, avatar, directional_light };
- this.picked_key = "";
- this.reset();
- }
-
- setSize(width, height)
- {
- this.width = width;
- this.height = height;
-
- if (this.camera)
- {
- this.camera.aspect = width / height;
- this.camera.updateProjectionMatrix();
- }
- }
-
- reset()
- {
- this.saved_text = "";
-
- if (this.picked_key!="")
- {
- gamePlayer.message("object_picked", "");
- this.picked_key = "";
- }
-
- for (let tag in this.Tags)
- {
- if (this.Tags[tag].hasOwnProperty('reset'))
- {
- this.Tags[tag].reset(this);
- }
- }
-
- this.internal_index = {};
- this.external_index = {};
- this.external_index.index = {};
- this.bakables = [];
-
- this.lightmap_bake = null;
- this.env_gen = null;
- this.probe_grid_bake = null;
- this.lod_probe_grid_bake = null;
- }
-
- tick(delta)
- {
- if (this.controls)
- {
- if (this.controls.hasOwnProperty('update'))
- {
- this.controls.update();
- }
- }
- }
-
- render(renderer)
- {
- this.renderer = renderer;
-
- if (this.lightmap_bake!=null)
- {
- this.lightmap_bake.render(renderer);
- }
-
- if (this.env_gen!=null)
- {
- this.env_gen.render(renderer);
- }
-
- if (this.probe_grid_bake!=null)
- {
- this.probe_grid_bake.render(renderer);
- }
-
- if (this.lod_probe_grid_bake!=null)
- {
- this.lod_probe_grid_bake.render(renderer);
- }
-
- if (this.scene && this.camera)
- {
- renderer.render(this.scene, this.camera);
- }
- }
-
- create(tag, props, mode, parent = null)
- {
- if (!(tag in this.Tags)) return null;
-
- const obj = this.Tags[tag].create(this, props, mode, parent);
- if (obj == null) return null;
-
- obj.uuid = uuid();
- obj.tag = tag;
-
- if (props.hasOwnProperty('name'))
- {
- obj.name = props.name;
- }
-
- if (props.hasOwnProperty('position'))
- {
- const position = props.position.split(',');
- obj.setPosition(parseFloat(position[0]), parseFloat(position[1]), parseFloat(position[2]));
- }
-
- if (props.hasOwnProperty('rotation'))
- {
- const rotation = props.rotation.split(',');
- obj.setRotation(parseFloat(rotation[0])* Math.PI / 180.0, parseFloat(rotation[1])* Math.PI / 180.0, parseFloat(rotation[2])* Math.PI / 180.0);
- }
-
- if (props.hasOwnProperty('scale'))
- {
- const scale = props.scale.split(',');
- obj.setScale(parseFloat(scale[0]), parseFloat(scale[1]), parseFloat(scale[2]));
- }
-
- if (props.hasOwnProperty('color'))
- {
- const color = props.color.split(',');
- const r = parseFloat(color[0]);
- const g = parseFloat(color[1]);
- const b = parseFloat(color[2]);
- obj.setColor(r,g,b);
- }
-
- if (props.hasOwnProperty('texture'))
- {
- let img = imageLoader.loadFile(props.texture);
- if (img!=null)
- {
- obj.setColorTexture(img);
- }
- }
-
- if (props.hasOwnProperty('metalness'))
- {
- obj.metalness = parseFloat(props.metalness);
- }
-
- if (props.hasOwnProperty('roughness'))
- {
- obj.roughness = parseFloat(props.roughness);
- }
-
- if (props.hasOwnProperty('is_building'))
- {
- obj.isBuilding = string_to_boolean(props.is_building);
- }
-
- return obj;
- }
-
- remove(obj)
- {
- if (obj.hasOwnProperty('tag')) {
- const tag = this.Tags[obj.tag];
- if (tag.hasOwnProperty('remove')) {
- tag.remove(this, obj);
- }
- }
-
- {
- let index = this.bakables.indexOf(obj);
- if (index>=0)
- {
- this.bakables.splice(index, 1);
- }
- }
-
- if (obj.parent)
- {
- obj.parent.remove(obj);
- }
- }
-
- load_xml_node(xmlNode, mode, parent = null)
- {
- for (let child of xmlNode.children) {
- let obj = null;
- if (parent == null)
- {
- obj = this.create(child.tagName, child.attributes, mode, this);
- }
- else
- {
- obj = this.create(child.tagName, child.attributes, mode, parent);
- }
- if (obj===null) continue;
-
- let key = obj.uuid;
-
- let internal_node = {};
- internal_node.obj = obj;
- internal_node.xml_node = child;
- this.internal_index[key] = internal_node;
-
- let external_node = {};
- external_node.tagName = child.tagName;
- external_node.attributes = child.attributes;
- external_node.children = [];
-
- if(child.tagName == "scene")
- {
- this.external_index.root = key;
- }
- else if (parent!=null)
- {
- let parent_key = parent.uuid;
- let external_node_parent = this.external_index.index[parent.uuid];
- external_node.parent = parent_key;
- external_node_parent.children.push(key);
- }
- this.external_index.index[key] = external_node;
-
- this.load_xml_node(child, mode, obj);
- }
- }
-
-
- load_xml(xmlText, mode)
- {
- this.xml_nodes = txml.parse(xmlText, {keepComments: true});
- this.saved_text = genXML(this.xml_nodes);
-
- let root = null;
- for (let top of this.xml_nodes)
- {
- if (top.tagName == 'document')
- {
- root = top;
- break;
- }
- }
- if (root)
- {
- this.load_xml_node(root, mode);
- }
-
- gamePlayer.message("index_loaded", JSON.stringify(this.external_index));
- }
-
- is_modified()
- {
- let gen_xml = genXML(this.xml_nodes);
- return gen_xml != this.saved_text;
- }
-
- get_xml()
- {
- this.saved_text = genXML(this.xml_nodes);
- return this.saved_text;
- }
-
- picking(state)
- {
- if (state)
- {
- this.controls.enabled = false;
- view.addEventListener("pointerdown", picking_pointerdown);
- }
- else
- {
- this.controls.enabled = true;
- view.removeEventListener("pointerdown", picking_pointerdown);
- }
- }
-
- pick_obj(key)
- {
- let obj = null;
- if (key!="")
- {
- obj = this.internal_index[key].obj;
- }
-
- if (this.picked_key != "")
- {
- if (this.picked_key in this.internal_index)
- {
- let picked_obj = this.internal_index[this.picked_key].obj;
- if (picked_obj.hasOwnProperty("setToonShading"))
- {
- picked_obj.setToonShading(0);
- }
- }
- }
-
- this.picked_key = key;
-
- if (obj!=null)
- {
- if (obj.hasOwnProperty("setToonShading"))
- {
- obj.setToonShading(16, 5.0, new Vector3(1.0, 1.0, 0.2));
- }
- }
- gamePlayer.message("object_picked", key);
- }
-
- tuning(input)
- {
- if (this.picked_key=="") return "";
- let picked_obj = this.internal_index[this.picked_key].obj;
- let node = this.internal_index[this.picked_key].xml_node;
- let tag = node.tagName;
-
- if (!(tag in this.Tags)) return "";
- return this.Tags[tag].tuning(this, picked_obj, input);
- }
-
- initialize(input)
- {
- if (this.picked_key=="") return "";
- let picked_obj = this.internal_index[this.picked_key].obj;
- let node = this.internal_index[this.picked_key].xml_node;
- let tag = node.tagName;
-
- if (!(tag in this.Tags)) return "";
- return this.Tags[tag].initialize(this, picked_obj, input);
- }
-
- generate(input)
- {
- if (this.picked_key=="") return;
- let picked_obj = this.internal_index[this.picked_key].obj;
- let node = this.internal_index[this.picked_key].xml_node;
- let tag = node.tagName;
-
- if (!(tag in this.Tags)) return;
- this.Tags[tag].generate(this, picked_obj, input);
- }
-
- req_create(base_key, tag)
- {
- let internal_node_base = this.internal_index[base_key];
- let external_node_base = this.external_index.index[base_key];
-
- let xmlNode = internal_node_base.xml_node;
- let parent = internal_node_base.obj;
-
- let child = {tagName:tag, attributes: {}, children: []};
- xmlNode.children.push(child);
-
- let obj = this.create(tag, {}, "local", parent);
- let key = obj.uuid;
-
- let internal_node = {};
- internal_node.obj = obj;
- internal_node.xml_node = child;
- this.internal_index[key] = internal_node;
-
- let external_node = {tagName:tag, attributes: {}, children: []};
- external_node.parent = base_key;
- external_node_base.children.push(key);
- this.external_index.index[key] = external_node;
-
- let msg = {};
- msg[key] = external_node;
-
- gamePlayer.message("object_created", JSON.stringify(msg));
-
- this.pick_obj(key);
- }
-
- req_remove(key)
- {
- let internal_node = this.internal_index[key];
- let external_node = this.external_index.index[key];
-
- let base_key = external_node.parent;
- let internal_node_base = this.internal_index[base_key];
- let external_node_base = this.external_index.index[base_key];
-
- let xmlNode = internal_node.xml_node;
- let xmlNode_parent = internal_node_base.xml_node;
- {
- let idx = xmlNode_parent.children.indexOf(xmlNode);
- if (idx>-1)
- {
- xmlNode_parent.children.splice(idx, 1);
- }
- }
-
- let obj = internal_node.obj;
- this.remove(obj);
-
- {
- let idx = external_node_base.children.indexOf(key);
- if (idx>-1)
- {
- external_node_base.children.splice(idx,1);
- }
- }
-
- delete this.internal_index[key];
- delete this.external_index.index[key];
-
- gamePlayer.message("object_removed", key);
-
- this.pick_obj("");
- }
-}
-
-function picking_pointerdown(event)
-{
- let x = event.clientX;
- let y = event.clientY;
-
- let intersect = gamePlayer.pickObject(x,y);
- if (intersect!=null)
- {
- doc.pick_obj(intersect.uuid);
- }
- else if (doc.scene.background!=null)
- {
- doc.pick_obj(doc.scene.background.uuid);
- }
- else
- {
- doc.pick_obj(doc.scene.uuid);
- }
-}
-
-
-
diff --git a/GameDev/bin/Release/xmleditor/genXML.js b/GameDev/bin/Release/xmleditor/genXML.js
deleted file mode 100644
index 236b355e..00000000
--- a/GameDev/bin/Release/xmleditor/genXML.js
+++ /dev/null
@@ -1,64 +0,0 @@
-function genNode(node, level)
-{
- let code = "";
- for(let i=0;i\n`;
- return code;
- }
- else
- {
- code += ">\n";
- }
-
- for (let child of children)
- {
- code += genNode(child, level+1);
- }
-
- for(let i=0;i\n`;
-
- return code;
-}
-
-export function genXML(nodes)
-{
- let xml = "";
- for (let top of nodes)
- {
- if (top.tagName =="?xml")
- {
- let version = top.attributes.version;
- xml += `\n`;
- }
- else
- {
- xml += genNode(top, 0);
- }
-
- }
- return xml;
-
-}
-
diff --git a/GameDev/bin/Release/xmleditor/index.js b/GameDev/bin/Release/xmleditor/index.js
deleted file mode 100644
index ea979654..00000000
--- a/GameDev/bin/Release/xmleditor/index.js
+++ /dev/null
@@ -1,105 +0,0 @@
-import { Document } from "./editor_document.js";
-import { Clock } from "./utils/Clock.js";
-import { view } from "./view.js";
-
-function isModified(x)
-{
- return JSON.stringify(doc.is_modified());
-}
-
-function setXML(xml)
-{
- doc.reset();
- doc.load_xml(xml, "local");
- return "";
-}
-
-function getXML(x)
-{
- return doc.get_xml();
-}
-
-function picking(state)
-{
- let bstate = state=="on";
- gamePlayer.picking = bstate;
- doc.picking(bstate);
- return "";
-}
-
-function pick_obj(key)
-{
- doc.pick_obj(key);
- return "";
-}
-
-function tuning(args)
-{
- let input = JSON.parse(args);
- return doc.tuning(input);
-}
-
-function initialize(args)
-{
- let input = JSON.parse(args);
- return doc.initialize(input);
-}
-
-function generate(args)
-{
- let input = JSON.parse(args);
- doc.generate(input);
- return "";
-}
-
-function create(args)
-{
- let input = JSON.parse(args);
- let base_key = input.base_key;
- let tag = input.tag;
- doc.req_create(base_key, tag);
- return "";
-}
-
-function remove(key)
-{
- doc.req_remove(key);
- return "";
-}
-
-function init(width, height)
-{
- renderer = new GLRenderer();
- doc = new Document(view);
- clock = new Clock();
-
- message_map = { isModified, setXML, getXML, picking, pick_obj, tuning, initialize, generate, create, remove};
-}
-
-function render(width, height, size_changed)
-{
- if (size_changed)
- {
- doc.setSize(width, height);
- }
- let delta = clock.getDelta();
- doc.tick(delta);
- doc.render(renderer);
-
-}
-
-function message_handling(name, msg)
-{
- if (name in message_map)
- {
- return message_map[name](msg);
- }
- return "";
-}
-
-setCallback('init', init);
-setCallback('render', render);
-setCallback('message', message_handling);
-
-
-
diff --git a/GameDev/bin/Release/xmleditor/math/Box2.js b/GameDev/bin/Release/xmleditor/math/Box2.js
deleted file mode 100644
index 02dcaa92..00000000
--- a/GameDev/bin/Release/xmleditor/math/Box2.js
+++ /dev/null
@@ -1,203 +0,0 @@
-import { Vector2 } from './Vector2.js';
-
-const _vector = /*@__PURE__*/ new Vector2();
-
-class Box2 {
-
- constructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {
-
- this.min = min;
- this.max = max;
-
- }
-
- set( min, max ) {
-
- this.min.copy( min );
- this.max.copy( max );
-
- return this;
-
- }
-
- setFromPoints( points ) {
-
- this.makeEmpty();
-
- for ( let i = 0, il = points.length; i < il; i ++ ) {
-
- this.expandByPoint( points[ i ] );
-
- }
-
- return this;
-
- }
-
- setFromCenterAndSize( center, size ) {
-
- const halfSize = _vector.copy( size ).multiplyScalar( 0.5 );
- this.min.copy( center ).sub( halfSize );
- this.max.copy( center ).add( halfSize );
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- copy( box ) {
-
- this.min.copy( box.min );
- this.max.copy( box.max );
-
- return this;
-
- }
-
- makeEmpty() {
-
- this.min.x = this.min.y = + Infinity;
- this.max.x = this.max.y = - Infinity;
-
- return this;
-
- }
-
- isEmpty() {
-
- // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
-
- return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );
-
- }
-
- getCenter( target ) {
-
- return this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
-
- }
-
- getSize( target ) {
-
- return this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );
-
- }
-
- expandByPoint( point ) {
-
- this.min.min( point );
- this.max.max( point );
-
- return this;
-
- }
-
- expandByVector( vector ) {
-
- this.min.sub( vector );
- this.max.add( vector );
-
- return this;
-
- }
-
- expandByScalar( scalar ) {
-
- this.min.addScalar( - scalar );
- this.max.addScalar( scalar );
-
- return this;
-
- }
-
- containsPoint( point ) {
-
- return point.x < this.min.x || point.x > this.max.x ||
- point.y < this.min.y || point.y > this.max.y ? false : true;
-
- }
-
- containsBox( box ) {
-
- return this.min.x <= box.min.x && box.max.x <= this.max.x &&
- this.min.y <= box.min.y && box.max.y <= this.max.y;
-
- }
-
- getParameter( point, target ) {
-
- // This can potentially have a divide by zero if the box
- // has a size dimension of 0.
-
- return target.set(
- ( point.x - this.min.x ) / ( this.max.x - this.min.x ),
- ( point.y - this.min.y ) / ( this.max.y - this.min.y )
- );
-
- }
-
- intersectsBox( box ) {
-
- // using 4 splitting planes to rule out intersections
-
- return box.max.x < this.min.x || box.min.x > this.max.x ||
- box.max.y < this.min.y || box.min.y > this.max.y ? false : true;
-
- }
-
- clampPoint( point, target ) {
-
- return target.copy( point ).clamp( this.min, this.max );
-
- }
-
- distanceToPoint( point ) {
-
- const clampedPoint = _vector.copy( point ).clamp( this.min, this.max );
- return clampedPoint.sub( point ).length();
-
- }
-
- intersect( box ) {
-
- this.min.max( box.min );
- this.max.min( box.max );
-
- return this;
-
- }
-
- union( box ) {
-
- this.min.min( box.min );
- this.max.max( box.max );
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.min.add( offset );
- this.max.add( offset );
-
- return this;
-
- }
-
- equals( box ) {
-
- return box.min.equals( this.min ) && box.max.equals( this.max );
-
- }
-
-}
-
-Box2.prototype.isBox2 = true;
-
-export { Box2 };
diff --git a/GameDev/bin/Release/xmleditor/math/Box3.js b/GameDev/bin/Release/xmleditor/math/Box3.js
deleted file mode 100644
index 1a5e4ffd..00000000
--- a/GameDev/bin/Release/xmleditor/math/Box3.js
+++ /dev/null
@@ -1,518 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-class Box3 {
-
- constructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {
-
- this.min = min;
- this.max = max;
-
- }
-
- set( min, max ) {
-
- this.min.copy( min );
- this.max.copy( max );
-
- return this;
-
- }
-
- setFromArray( array ) {
-
- let minX = + Infinity;
- let minY = + Infinity;
- let minZ = + Infinity;
-
- let maxX = - Infinity;
- let maxY = - Infinity;
- let maxZ = - Infinity;
-
- for ( let i = 0, l = array.length; i < l; i += 3 ) {
-
- const x = array[ i ];
- const y = array[ i + 1 ];
- const z = array[ i + 2 ];
-
- if ( x < minX ) minX = x;
- if ( y < minY ) minY = y;
- if ( z < minZ ) minZ = z;
-
- if ( x > maxX ) maxX = x;
- if ( y > maxY ) maxY = y;
- if ( z > maxZ ) maxZ = z;
-
- }
-
- this.min.set( minX, minY, minZ );
- this.max.set( maxX, maxY, maxZ );
-
- return this;
-
- }
-
- setFromBufferAttribute( attribute ) {
-
- let minX = + Infinity;
- let minY = + Infinity;
- let minZ = + Infinity;
-
- let maxX = - Infinity;
- let maxY = - Infinity;
- let maxZ = - Infinity;
-
- for ( let i = 0, l = attribute.count; i < l; i ++ ) {
-
- const x = attribute.getX( i );
- const y = attribute.getY( i );
- const z = attribute.getZ( i );
-
- if ( x < minX ) minX = x;
- if ( y < minY ) minY = y;
- if ( z < minZ ) minZ = z;
-
- if ( x > maxX ) maxX = x;
- if ( y > maxY ) maxY = y;
- if ( z > maxZ ) maxZ = z;
-
- }
-
- this.min.set( minX, minY, minZ );
- this.max.set( maxX, maxY, maxZ );
-
- return this;
-
- }
-
- setFromPoints( points ) {
-
- this.makeEmpty();
-
- for ( let i = 0, il = points.length; i < il; i ++ ) {
-
- this.expandByPoint( points[ i ] );
-
- }
-
- return this;
-
- }
-
- setFromCenterAndSize( center, size ) {
-
- const halfSize = _vector.copy( size ).multiplyScalar( 0.5 );
-
- this.min.copy( center ).sub( halfSize );
- this.max.copy( center ).add( halfSize );
-
- return this;
-
- }
-
- setFromObject( object ) {
-
- this.makeEmpty();
-
- return this.expandByObject( object );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- copy( box ) {
-
- this.min.copy( box.min );
- this.max.copy( box.max );
-
- return this;
-
- }
-
- makeEmpty() {
-
- this.min.x = this.min.y = this.min.z = + Infinity;
- this.max.x = this.max.y = this.max.z = - Infinity;
-
- return this;
-
- }
-
- isEmpty() {
-
- // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
-
- return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );
-
- }
-
- getCenter( target ) {
-
- return this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
-
- }
-
- getSize( target ) {
-
- return this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );
-
- }
-
- expandByPoint( point ) {
-
- this.min.min( point );
- this.max.max( point );
-
- return this;
-
- }
-
- expandByVector( vector ) {
-
- this.min.sub( vector );
- this.max.add( vector );
-
- return this;
-
- }
-
- expandByScalar( scalar ) {
-
- this.min.addScalar( - scalar );
- this.max.addScalar( scalar );
-
- return this;
-
- }
-
- expandByObject( object ) {
-
- // Computes the world-axis-aligned bounding box of an object (including its children),
- // accounting for both the object's, and children's, world transforms
-
- object.updateWorldMatrix( false, false );
-
- const geometry = object.geometry;
-
- if ( geometry !== undefined ) {
-
- if ( geometry.boundingBox === null ) {
-
- geometry.computeBoundingBox();
-
- }
-
- _box.copy( geometry.boundingBox );
- _box.applyMatrix4( object.matrixWorld );
-
- this.union( _box );
-
- }
-
- const children = object.children;
-
- for ( let i = 0, l = children.length; i < l; i ++ ) {
-
- this.expandByObject( children[ i ] );
-
- }
-
- return this;
-
- }
-
- containsPoint( point ) {
-
- return point.x < this.min.x || point.x > this.max.x ||
- point.y < this.min.y || point.y > this.max.y ||
- point.z < this.min.z || point.z > this.max.z ? false : true;
-
- }
-
- containsBox( box ) {
-
- return this.min.x <= box.min.x && box.max.x <= this.max.x &&
- this.min.y <= box.min.y && box.max.y <= this.max.y &&
- this.min.z <= box.min.z && box.max.z <= this.max.z;
-
- }
-
- getParameter( point, target ) {
-
- // This can potentially have a divide by zero if the box
- // has a size dimension of 0.
-
- return target.set(
- ( point.x - this.min.x ) / ( this.max.x - this.min.x ),
- ( point.y - this.min.y ) / ( this.max.y - this.min.y ),
- ( point.z - this.min.z ) / ( this.max.z - this.min.z )
- );
-
- }
-
- intersectsBox( box ) {
-
- // using 6 splitting planes to rule out intersections.
- return box.max.x < this.min.x || box.min.x > this.max.x ||
- box.max.y < this.min.y || box.min.y > this.max.y ||
- box.max.z < this.min.z || box.min.z > this.max.z ? false : true;
-
- }
-
- intersectsSphere( sphere ) {
-
- // Find the point on the AABB closest to the sphere center.
- this.clampPoint( sphere.center, _vector );
-
- // If that point is inside the sphere, the AABB and sphere intersect.
- return _vector.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );
-
- }
-
- intersectsPlane( plane ) {
-
- // We compute the minimum and maximum dot product values. If those values
- // are on the same side (back or front) of the plane, then there is no intersection.
-
- let min, max;
-
- if ( plane.normal.x > 0 ) {
-
- min = plane.normal.x * this.min.x;
- max = plane.normal.x * this.max.x;
-
- } else {
-
- min = plane.normal.x * this.max.x;
- max = plane.normal.x * this.min.x;
-
- }
-
- if ( plane.normal.y > 0 ) {
-
- min += plane.normal.y * this.min.y;
- max += plane.normal.y * this.max.y;
-
- } else {
-
- min += plane.normal.y * this.max.y;
- max += plane.normal.y * this.min.y;
-
- }
-
- if ( plane.normal.z > 0 ) {
-
- min += plane.normal.z * this.min.z;
- max += plane.normal.z * this.max.z;
-
- } else {
-
- min += plane.normal.z * this.max.z;
- max += plane.normal.z * this.min.z;
-
- }
-
- return ( min <= - plane.constant && max >= - plane.constant );
-
- }
-
- intersectsTriangle( triangle ) {
-
- if ( this.isEmpty() ) {
-
- return false;
-
- }
-
- // compute box center and extents
- this.getCenter( _center );
- _extents.subVectors( this.max, _center );
-
- // translate triangle to aabb origin
- _v0.subVectors( triangle.a, _center );
- _v1.subVectors( triangle.b, _center );
- _v2.subVectors( triangle.c, _center );
-
- // compute edge vectors for triangle
- _f0.subVectors( _v1, _v0 );
- _f1.subVectors( _v2, _v1 );
- _f2.subVectors( _v0, _v2 );
-
- // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
- // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
- // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
- let axes = [
- 0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,
- _f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,
- - _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0
- ];
- if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) {
-
- return false;
-
- }
-
- // test 3 face normals from the aabb
- axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
- if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) {
-
- return false;
-
- }
-
- // finally testing the face normal of the triangle
- // use already existing triangle edge vectors here
- _triangleNormal.crossVectors( _f0, _f1 );
- axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];
-
- return satForAxes( axes, _v0, _v1, _v2, _extents );
-
- }
-
- clampPoint( point, target ) {
-
- return target.copy( point ).clamp( this.min, this.max );
-
- }
-
- distanceToPoint( point ) {
-
- const clampedPoint = _vector.copy( point ).clamp( this.min, this.max );
-
- return clampedPoint.sub( point ).length();
-
- }
-
- getBoundingSphere( target ) {
-
- this.getCenter( target.center );
-
- target.radius = this.getSize( _vector ).length() * 0.5;
-
- return target;
-
- }
-
- intersect( box ) {
-
- this.min.max( box.min );
- this.max.min( box.max );
-
- // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
- if ( this.isEmpty() ) this.makeEmpty();
-
- return this;
-
- }
-
- union( box ) {
-
- this.min.min( box.min );
- this.max.max( box.max );
-
- return this;
-
- }
-
- applyMatrix4( matrix ) {
-
- // transform of empty box is an empty box.
- if ( this.isEmpty() ) return this;
-
- // NOTE: I am using a binary pattern to specify all 2^3 combinations below
- _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
- _points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
- _points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
- _points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
- _points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
- _points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
- _points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
- _points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
-
- this.setFromPoints( _points );
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.min.add( offset );
- this.max.add( offset );
-
- return this;
-
- }
-
- equals( box ) {
-
- return box.min.equals( this.min ) && box.max.equals( this.max );
-
- }
-
-}
-
-Box3.prototype.isBox3 = true;
-
-const _points = [
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3(),
- /*@__PURE__*/ new Vector3()
-];
-
-const _vector = /*@__PURE__*/ new Vector3();
-
-const _box = /*@__PURE__*/ new Box3();
-
-// triangle centered vertices
-
-const _v0 = /*@__PURE__*/ new Vector3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _v2 = /*@__PURE__*/ new Vector3();
-
-// triangle edge vectors
-
-const _f0 = /*@__PURE__*/ new Vector3();
-const _f1 = /*@__PURE__*/ new Vector3();
-const _f2 = /*@__PURE__*/ new Vector3();
-
-const _center = /*@__PURE__*/ new Vector3();
-const _extents = /*@__PURE__*/ new Vector3();
-const _triangleNormal = /*@__PURE__*/ new Vector3();
-const _testAxis = /*@__PURE__*/ new Vector3();
-
-function satForAxes( axes, v0, v1, v2, extents ) {
-
- for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {
-
- _testAxis.fromArray( axes, i );
- // project the aabb onto the seperating axis
- const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );
- // project all 3 vertices of the triangle onto the seperating axis
- const p0 = v0.dot( _testAxis );
- const p1 = v1.dot( _testAxis );
- const p2 = v2.dot( _testAxis );
- // actual test, basically see if either of the most extreme of the triangle points intersects r
- if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
-
- // points of the projected triangle are outside the projected half-length of the aabb
- // the axis is seperating and we can exit
- return false;
-
- }
-
- }
-
- return true;
-
-}
-
-export { Box3 };
diff --git a/GameDev/bin/Release/xmleditor/math/Color.js b/GameDev/bin/Release/xmleditor/math/Color.js
deleted file mode 100644
index 295c60e1..00000000
--- a/GameDev/bin/Release/xmleditor/math/Color.js
+++ /dev/null
@@ -1,604 +0,0 @@
-import * as MathUtils from './MathUtils.js';
-
-const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,
- 'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,
- 'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,
- 'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,
- 'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,
- 'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,
- 'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,
- 'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,
- 'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,
- 'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,
- 'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,
- 'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,
- 'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,
- 'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,
- 'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,
- 'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,
- 'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,
- 'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,
- 'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,
- 'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,
- 'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,
- 'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,
- 'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,
- 'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };
-
-const _hslA = { h: 0, s: 0, l: 0 };
-const _hslB = { h: 0, s: 0, l: 0 };
-
-function hue2rgb( p, q, t ) {
-
- if ( t < 0 ) t += 1;
- if ( t > 1 ) t -= 1;
- if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
- if ( t < 1 / 2 ) return q;
- if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
- return p;
-
-}
-
-function SRGBToLinear( c ) {
-
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
-
-}
-
-function LinearToSRGB( c ) {
-
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
-
-}
-
-class Color {
-
- constructor( r, g, b ) {
-
- if ( g === undefined && b === undefined ) {
-
- // r is THREE.Color, hex or string
- return this.set( r );
-
- }
-
- return this.setRGB( r, g, b );
-
- }
-
- set( value ) {
-
- if ( value && value.isColor ) {
-
- this.copy( value );
-
- } else if ( typeof value === 'number' ) {
-
- this.setHex( value );
-
- } else if ( typeof value === 'string' ) {
-
- this.setStyle( value );
-
- }
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.r = scalar;
- this.g = scalar;
- this.b = scalar;
-
- return this;
-
- }
-
- setHex( hex ) {
-
- hex = Math.floor( hex );
-
- this.r = ( hex >> 16 & 255 ) / 255;
- this.g = ( hex >> 8 & 255 ) / 255;
- this.b = ( hex & 255 ) / 255;
-
- return this;
-
- }
-
- setRGB( r, g, b ) {
-
- this.r = r;
- this.g = g;
- this.b = b;
-
- return this;
-
- }
-
- setHSL( h, s, l ) {
-
- // h,s,l ranges are in 0.0 - 1.0
- h = MathUtils.euclideanModulo( h, 1 );
- s = MathUtils.clamp( s, 0, 1 );
- l = MathUtils.clamp( l, 0, 1 );
-
- if ( s === 0 ) {
-
- this.r = this.g = this.b = l;
-
- } else {
-
- const p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
- const q = ( 2 * l ) - p;
-
- this.r = hue2rgb( q, p, h + 1 / 3 );
- this.g = hue2rgb( q, p, h );
- this.b = hue2rgb( q, p, h - 1 / 3 );
-
- }
-
- return this;
-
- }
-
- setStyle( style ) {
-
- function handleAlpha( string ) {
-
- if ( string === undefined ) return;
-
- if ( parseFloat( string ) < 1 ) {
-
- console.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );
-
- }
-
- }
-
-
- let m;
-
- if ( m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec( style ) ) {
-
- // rgb / hsl
-
- let color;
- const name = m[ 1 ];
- const components = m[ 2 ];
-
- switch ( name ) {
-
- case 'rgb':
- case 'rgba':
-
- if ( color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
-
- // rgb(255,0,0) rgba(255,0,0,0.5)
- this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;
- this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;
- this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;
-
- handleAlpha( color[ 4 ] );
-
- return this;
-
- }
-
- if ( color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
-
- // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
- this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;
- this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;
- this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;
-
- handleAlpha( color[ 4 ] );
-
- return this;
-
- }
-
- break;
-
- case 'hsl':
- case 'hsla':
-
- if ( color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
-
- // hsl(120,50%,50%) hsla(120,50%,50%,0.5)
- const h = parseFloat( color[ 1 ] ) / 360;
- const s = parseInt( color[ 2 ], 10 ) / 100;
- const l = parseInt( color[ 3 ], 10 ) / 100;
-
- handleAlpha( color[ 4 ] );
-
- return this.setHSL( h, s, l );
-
- }
-
- break;
-
- }
-
- } else if ( m = /^\#([A-Fa-f\d]+)$/.exec( style ) ) {
-
- // hex color
-
- const hex = m[ 1 ];
- const size = hex.length;
-
- if ( size === 3 ) {
-
- // #ff0
- this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255;
- this.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255;
- this.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255;
-
- return this;
-
- } else if ( size === 6 ) {
-
- // #ff0000
- this.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255;
- this.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255;
- this.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255;
-
- return this;
-
- }
-
- }
-
- if ( style && style.length > 0 ) {
-
- return this.setColorName( style );
-
- }
-
- return this;
-
- }
-
- setColorName( style ) {
-
- // color keywords
- const hex = _colorKeywords[ style.toLowerCase() ];
-
- if ( hex !== undefined ) {
-
- // red
- this.setHex( hex );
-
- } else {
-
- // unknown color
- console.warn( 'THREE.Color: Unknown color ' + style );
-
- }
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this.r, this.g, this.b );
-
- }
-
- copy( color ) {
-
- this.r = color.r;
- this.g = color.g;
- this.b = color.b;
-
- return this;
-
- }
-
- copyGammaToLinear( color, gammaFactor = 2.0 ) {
-
- this.r = Math.pow( color.r, gammaFactor );
- this.g = Math.pow( color.g, gammaFactor );
- this.b = Math.pow( color.b, gammaFactor );
-
- return this;
-
- }
-
- copyLinearToGamma( color, gammaFactor = 2.0 ) {
-
- const safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;
-
- this.r = Math.pow( color.r, safeInverse );
- this.g = Math.pow( color.g, safeInverse );
- this.b = Math.pow( color.b, safeInverse );
-
- return this;
-
- }
-
- convertGammaToLinear( gammaFactor ) {
-
- this.copyGammaToLinear( this, gammaFactor );
-
- return this;
-
- }
-
- convertLinearToGamma( gammaFactor ) {
-
- this.copyLinearToGamma( this, gammaFactor );
-
- return this;
-
- }
-
- copySRGBToLinear( color ) {
-
- this.r = SRGBToLinear( color.r );
- this.g = SRGBToLinear( color.g );
- this.b = SRGBToLinear( color.b );
-
- return this;
-
- }
-
- copyLinearToSRGB( color ) {
-
- this.r = LinearToSRGB( color.r );
- this.g = LinearToSRGB( color.g );
- this.b = LinearToSRGB( color.b );
-
- return this;
-
- }
-
- convertSRGBToLinear() {
-
- this.copySRGBToLinear( this );
-
- return this;
-
- }
-
- convertLinearToSRGB() {
-
- this.copyLinearToSRGB( this );
-
- return this;
-
- }
-
- getHex() {
-
- return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;
-
- }
-
- getHexString() {
-
- return ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 );
-
- }
-
- getHSL( target ) {
-
- // h,s,l ranges are in 0.0 - 1.0
-
- const r = this.r, g = this.g, b = this.b;
-
- const max = Math.max( r, g, b );
- const min = Math.min( r, g, b );
-
- let hue, saturation;
- const lightness = ( min + max ) / 2.0;
-
- if ( min === max ) {
-
- hue = 0;
- saturation = 0;
-
- } else {
-
- const delta = max - min;
-
- saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );
-
- switch ( max ) {
-
- case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;
- case g: hue = ( b - r ) / delta + 2; break;
- case b: hue = ( r - g ) / delta + 4; break;
-
- }
-
- hue /= 6;
-
- }
-
- target.h = hue;
- target.s = saturation;
- target.l = lightness;
-
- return target;
-
- }
-
- getStyle() {
-
- return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';
-
- }
-
- offsetHSL( h, s, l ) {
-
- this.getHSL( _hslA );
-
- _hslA.h += h; _hslA.s += s; _hslA.l += l;
-
- this.setHSL( _hslA.h, _hslA.s, _hslA.l );
-
- return this;
-
- }
-
- add( color ) {
-
- this.r += color.r;
- this.g += color.g;
- this.b += color.b;
-
- return this;
-
- }
-
- addColors( color1, color2 ) {
-
- this.r = color1.r + color2.r;
- this.g = color1.g + color2.g;
- this.b = color1.b + color2.b;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.r += s;
- this.g += s;
- this.b += s;
-
- return this;
-
- }
-
- sub( color ) {
-
- this.r = Math.max( 0, this.r - color.r );
- this.g = Math.max( 0, this.g - color.g );
- this.b = Math.max( 0, this.b - color.b );
-
- return this;
-
- }
-
- multiply( color ) {
-
- this.r *= color.r;
- this.g *= color.g;
- this.b *= color.b;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- this.r *= s;
- this.g *= s;
- this.b *= s;
-
- return this;
-
- }
-
- lerp( color, alpha ) {
-
- this.r += ( color.r - this.r ) * alpha;
- this.g += ( color.g - this.g ) * alpha;
- this.b += ( color.b - this.b ) * alpha;
-
- return this;
-
- }
-
- lerpColors( color1, color2, alpha ) {
-
- this.r = color1.r + ( color2.r - color1.r ) * alpha;
- this.g = color1.g + ( color2.g - color1.g ) * alpha;
- this.b = color1.b + ( color2.b - color1.b ) * alpha;
-
- return this;
-
- }
-
- lerpHSL( color, alpha ) {
-
- this.getHSL( _hslA );
- color.getHSL( _hslB );
-
- const h = MathUtils.lerp( _hslA.h, _hslB.h, alpha );
- const s = MathUtils.lerp( _hslA.s, _hslB.s, alpha );
- const l = MathUtils.lerp( _hslA.l, _hslB.l, alpha );
-
- this.setHSL( h, s, l );
-
- return this;
-
- }
-
- equals( c ) {
-
- return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.r = array[ offset ];
- this.g = array[ offset + 1 ];
- this.b = array[ offset + 2 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.r;
- array[ offset + 1 ] = this.g;
- array[ offset + 2 ] = this.b;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index ) {
-
- this.r = attribute.getX( index );
- this.g = attribute.getY( index );
- this.b = attribute.getZ( index );
-
- if ( attribute.normalized === true ) {
-
- // assuming Uint8Array
-
- this.r /= 255;
- this.g /= 255;
- this.b /= 255;
-
- }
-
- return this;
-
- }
-
- toJSON() {
-
- return this.getHex();
-
- }
-
-}
-
-Color.NAMES = _colorKeywords;
-
-Color.prototype.isColor = true;
-Color.prototype.r = 1;
-Color.prototype.g = 1;
-Color.prototype.b = 1;
-
-export { Color };
diff --git a/GameDev/bin/Release/xmleditor/math/Cylindrical.js b/GameDev/bin/Release/xmleditor/math/Cylindrical.js
deleted file mode 100644
index d1288244..00000000
--- a/GameDev/bin/Release/xmleditor/math/Cylindrical.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
- */
-
-class Cylindrical {
-
- constructor( radius = 1, theta = 0, y = 0 ) {
-
- this.radius = radius; // distance from the origin to a point in the x-z plane
- this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
- this.y = y; // height above the x-z plane
-
- return this;
-
- }
-
- set( radius, theta, y ) {
-
- this.radius = radius;
- this.theta = theta;
- this.y = y;
-
- return this;
-
- }
-
- copy( other ) {
-
- this.radius = other.radius;
- this.theta = other.theta;
- this.y = other.y;
-
- return this;
-
- }
-
- setFromVector3( v ) {
-
- return this.setFromCartesianCoords( v.x, v.y, v.z );
-
- }
-
- setFromCartesianCoords( x, y, z ) {
-
- this.radius = Math.sqrt( x * x + z * z );
- this.theta = Math.atan2( x, z );
- this.y = y;
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Cylindrical };
diff --git a/GameDev/bin/Release/xmleditor/math/Euler.js b/GameDev/bin/Release/xmleditor/math/Euler.js
deleted file mode 100644
index 74c93a8a..00000000
--- a/GameDev/bin/Release/xmleditor/math/Euler.js
+++ /dev/null
@@ -1,322 +0,0 @@
-import { Quaternion } from './Quaternion.js';
-import { Vector3 } from './Vector3.js';
-import { Matrix4 } from './Matrix4.js';
-import { clamp } from './MathUtils.js';
-
-const _matrix = /*@__PURE__*/ new Matrix4();
-const _quaternion = /*@__PURE__*/ new Quaternion();
-
-class Euler {
-
- constructor( x = 0, y = 0, z = 0, order = Euler.DefaultOrder ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._order = order;
-
- }
-
- get x() {
-
- return this._x;
-
- }
-
- set x( value ) {
-
- this._x = value;
- this._onChangeCallback();
-
- }
-
- get y() {
-
- return this._y;
-
- }
-
- set y( value ) {
-
- this._y = value;
- this._onChangeCallback();
-
- }
-
- get z() {
-
- return this._z;
-
- }
-
- set z( value ) {
-
- this._z = value;
- this._onChangeCallback();
-
- }
-
- get order() {
-
- return this._order;
-
- }
-
- set order( value ) {
-
- this._order = value;
- this._onChangeCallback();
-
- }
-
- set( x, y, z, order = this._order ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._order = order;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this._x, this._y, this._z, this._order );
-
- }
-
- copy( euler ) {
-
- this._x = euler._x;
- this._y = euler._y;
- this._z = euler._z;
- this._order = euler._order;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromRotationMatrix( m, order = this._order, update = true ) {
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- const te = m.elements;
- const m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];
- const m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];
- const m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
-
- switch ( order ) {
-
- case 'XYZ':
-
- this._y = Math.asin( clamp( m13, - 1, 1 ) );
-
- if ( Math.abs( m13 ) < 0.9999999 ) {
-
- this._x = Math.atan2( - m23, m33 );
- this._z = Math.atan2( - m12, m11 );
-
- } else {
-
- this._x = Math.atan2( m32, m22 );
- this._z = 0;
-
- }
-
- break;
-
- case 'YXZ':
-
- this._x = Math.asin( - clamp( m23, - 1, 1 ) );
-
- if ( Math.abs( m23 ) < 0.9999999 ) {
-
- this._y = Math.atan2( m13, m33 );
- this._z = Math.atan2( m21, m22 );
-
- } else {
-
- this._y = Math.atan2( - m31, m11 );
- this._z = 0;
-
- }
-
- break;
-
- case 'ZXY':
-
- this._x = Math.asin( clamp( m32, - 1, 1 ) );
-
- if ( Math.abs( m32 ) < 0.9999999 ) {
-
- this._y = Math.atan2( - m31, m33 );
- this._z = Math.atan2( - m12, m22 );
-
- } else {
-
- this._y = 0;
- this._z = Math.atan2( m21, m11 );
-
- }
-
- break;
-
- case 'ZYX':
-
- this._y = Math.asin( - clamp( m31, - 1, 1 ) );
-
- if ( Math.abs( m31 ) < 0.9999999 ) {
-
- this._x = Math.atan2( m32, m33 );
- this._z = Math.atan2( m21, m11 );
-
- } else {
-
- this._x = 0;
- this._z = Math.atan2( - m12, m22 );
-
- }
-
- break;
-
- case 'YZX':
-
- this._z = Math.asin( clamp( m21, - 1, 1 ) );
-
- if ( Math.abs( m21 ) < 0.9999999 ) {
-
- this._x = Math.atan2( - m23, m22 );
- this._y = Math.atan2( - m31, m11 );
-
- } else {
-
- this._x = 0;
- this._y = Math.atan2( m13, m33 );
-
- }
-
- break;
-
- case 'XZY':
-
- this._z = Math.asin( - clamp( m12, - 1, 1 ) );
-
- if ( Math.abs( m12 ) < 0.9999999 ) {
-
- this._x = Math.atan2( m32, m22 );
- this._y = Math.atan2( m13, m11 );
-
- } else {
-
- this._x = Math.atan2( - m23, m33 );
- this._y = 0;
-
- }
-
- break;
-
- default:
-
- console.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );
-
- }
-
- this._order = order;
-
- if ( update === true ) this._onChangeCallback();
-
- return this;
-
- }
-
- setFromQuaternion( q, order, update ) {
-
- _matrix.makeRotationFromQuaternion( q );
-
- return this.setFromRotationMatrix( _matrix, order, update );
-
- }
-
- setFromVector3( v, order = this._order ) {
-
- return this.set( v.x, v.y, v.z, order );
-
- }
-
- reorder( newOrder ) {
-
- // WARNING: this discards revolution information -bhouston
-
- _quaternion.setFromEuler( this );
-
- return this.setFromQuaternion( _quaternion, newOrder );
-
- }
-
- equals( euler ) {
-
- return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );
-
- }
-
- fromArray( array ) {
-
- this._x = array[ 0 ];
- this._y = array[ 1 ];
- this._z = array[ 2 ];
- if ( array[ 3 ] !== undefined ) this._order = array[ 3 ];
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this._x;
- array[ offset + 1 ] = this._y;
- array[ offset + 2 ] = this._z;
- array[ offset + 3 ] = this._order;
-
- return array;
-
- }
-
- toVector3( optionalResult ) {
-
- if ( optionalResult ) {
-
- return optionalResult.set( this._x, this._y, this._z );
-
- } else {
-
- return new Vector3( this._x, this._y, this._z );
-
- }
-
- }
-
- _onChange( callback ) {
-
- this._onChangeCallback = callback;
-
- return this;
-
- }
-
- _onChangeCallback() {}
-
-}
-
-Euler.prototype.isEuler = true;
-
-Euler.DefaultOrder = 'XYZ';
-Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];
-
-export { Euler };
diff --git a/GameDev/bin/Release/xmleditor/math/Frustum.js b/GameDev/bin/Release/xmleditor/math/Frustum.js
deleted file mode 100644
index fc6b928a..00000000
--- a/GameDev/bin/Release/xmleditor/math/Frustum.js
+++ /dev/null
@@ -1,162 +0,0 @@
-import { Vector3 } from './Vector3.js';
-import { Sphere } from './Sphere.js';
-import { Plane } from './Plane.js';
-
-const _sphere = /*@__PURE__*/ new Sphere();
-const _vector = /*@__PURE__*/ new Vector3();
-
-class Frustum {
-
- constructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {
-
- this.planes = [ p0, p1, p2, p3, p4, p5 ];
-
- }
-
- set( p0, p1, p2, p3, p4, p5 ) {
-
- const planes = this.planes;
-
- planes[ 0 ].copy( p0 );
- planes[ 1 ].copy( p1 );
- planes[ 2 ].copy( p2 );
- planes[ 3 ].copy( p3 );
- planes[ 4 ].copy( p4 );
- planes[ 5 ].copy( p5 );
-
- return this;
-
- }
-
- copy( frustum ) {
-
- const planes = this.planes;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- planes[ i ].copy( frustum.planes[ i ] );
-
- }
-
- return this;
-
- }
-
- setFromProjectionMatrix( m ) {
-
- const planes = this.planes;
- const me = m.elements;
- const me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];
- const me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];
- const me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];
- const me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];
-
- planes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();
- planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();
- planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();
- planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();
- planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();
- planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
-
- return this;
-
- }
-
- intersectsObject( object ) {
-
- const geometry = object.geometry;
-
- if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
-
- _sphere.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
-
- return this.intersectsSphere( _sphere );
-
- }
-
- intersectsSprite( sprite ) {
-
- _sphere.center.set( 0, 0, 0 );
- _sphere.radius = 0.7071067811865476;
- _sphere.applyMatrix4( sprite.matrixWorld );
-
- return this.intersectsSphere( _sphere );
-
- }
-
- intersectsSphere( sphere ) {
-
- const planes = this.planes;
- const center = sphere.center;
- const negRadius = - sphere.radius;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- const distance = planes[ i ].distanceToPoint( center );
-
- if ( distance < negRadius ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- intersectsBox( box ) {
-
- const planes = this.planes;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- const plane = planes[ i ];
-
- // corner at max distance
-
- _vector.x = plane.normal.x > 0 ? box.max.x : box.min.x;
- _vector.y = plane.normal.y > 0 ? box.max.y : box.min.y;
- _vector.z = plane.normal.z > 0 ? box.max.z : box.min.z;
-
- if ( plane.distanceToPoint( _vector ) < 0 ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- containsPoint( point ) {
-
- const planes = this.planes;
-
- for ( let i = 0; i < 6; i ++ ) {
-
- if ( planes[ i ].distanceToPoint( point ) < 0 ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-
-export { Frustum };
diff --git a/GameDev/bin/Release/xmleditor/math/Interpolant.js b/GameDev/bin/Release/xmleditor/math/Interpolant.js
deleted file mode 100644
index dcc550f5..00000000
--- a/GameDev/bin/Release/xmleditor/math/Interpolant.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Abstract base class of interpolants over parametric samples.
- *
- * The parameter domain is one dimensional, typically the time or a path
- * along a curve defined by the data.
- *
- * The sample values can have any dimensionality and derived classes may
- * apply special interpretations to the data.
- *
- * This class provides the interval seek in a Template Method, deferring
- * the actual interpolation to derived classes.
- *
- * Time complexity is O(1) for linear access crossing at most two points
- * and O(log N) for random access, where N is the number of positions.
- *
- * References:
- *
- * http://www.oodesign.com/template-method-pattern.html
- *
- */
-
-class Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- this.parameterPositions = parameterPositions;
- this._cachedIndex = 0;
-
- this.resultBuffer = resultBuffer !== undefined ?
- resultBuffer : new sampleValues.constructor( sampleSize );
- this.sampleValues = sampleValues;
- this.valueSize = sampleSize;
-
- this.settings = null;
- this.DefaultSettings_ = {};
-
- }
-
- evaluate( t ) {
-
- const pp = this.parameterPositions;
- let i1 = this._cachedIndex,
- t1 = pp[ i1 ],
- t0 = pp[ i1 - 1 ];
-
- validate_interval: {
-
- seek: {
-
- let right;
-
- linear_scan: {
-
- //- See http://jsperf.com/comparison-to-undefined/3
- //- slower code:
- //-
- //- if ( t >= t1 || t1 === undefined ) {
- forward_scan: if ( ! ( t < t1 ) ) {
-
- for ( let giveUpAt = i1 + 2; ; ) {
-
- if ( t1 === undefined ) {
-
- if ( t < t0 ) break forward_scan;
-
- // after end
-
- i1 = pp.length;
- this._cachedIndex = i1;
- return this.afterEnd_( i1 - 1, t, t0 );
-
- }
-
- if ( i1 === giveUpAt ) break; // this loop
-
- t0 = t1;
- t1 = pp[ ++ i1 ];
-
- if ( t < t1 ) {
-
- // we have arrived at the sought interval
- break seek;
-
- }
-
- }
-
- // prepare binary search on the right side of the index
- right = pp.length;
- break linear_scan;
-
- }
-
- //- slower code:
- //- if ( t < t0 || t0 === undefined ) {
- if ( ! ( t >= t0 ) ) {
-
- // looping?
-
- const t1global = pp[ 1 ];
-
- if ( t < t1global ) {
-
- i1 = 2; // + 1, using the scan for the details
- t0 = t1global;
-
- }
-
- // linear reverse scan
-
- for ( let giveUpAt = i1 - 2; ; ) {
-
- if ( t0 === undefined ) {
-
- // before start
-
- this._cachedIndex = 0;
- return this.beforeStart_( 0, t, t1 );
-
- }
-
- if ( i1 === giveUpAt ) break; // this loop
-
- t1 = t0;
- t0 = pp[ -- i1 - 1 ];
-
- if ( t >= t0 ) {
-
- // we have arrived at the sought interval
- break seek;
-
- }
-
- }
-
- // prepare binary search on the left side of the index
- right = i1;
- i1 = 0;
- break linear_scan;
-
- }
-
- // the interval is valid
-
- break validate_interval;
-
- } // linear scan
-
- // binary search
-
- while ( i1 < right ) {
-
- const mid = ( i1 + right ) >>> 1;
-
- if ( t < pp[ mid ] ) {
-
- right = mid;
-
- } else {
-
- i1 = mid + 1;
-
- }
-
- }
-
- t1 = pp[ i1 ];
- t0 = pp[ i1 - 1 ];
-
- // check boundary cases, again
-
- if ( t0 === undefined ) {
-
- this._cachedIndex = 0;
- return this.beforeStart_( 0, t, t1 );
-
- }
-
- if ( t1 === undefined ) {
-
- i1 = pp.length;
- this._cachedIndex = i1;
- return this.afterEnd_( i1 - 1, t0, t );
-
- }
-
- } // seek
-
- this._cachedIndex = i1;
-
- this.intervalChanged_( i1, t0, t1 );
-
- } // validate_interval
-
- return this.interpolate_( i1, t0, t, t1 );
-
- }
-
- getSettings_() {
-
- return this.settings || this.DefaultSettings_;
-
- }
-
- copySampleValue_( index ) {
-
- // copies a sample value to the result buffer
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
- offset = index * stride;
-
- for ( let i = 0; i !== stride; ++ i ) {
-
- result[ i ] = values[ offset + i ];
-
- }
-
- return result;
-
- }
-
- // Template methods for derived classes:
-
- interpolate_( /* i1, t0, t, t1 */ ) {
-
- throw new Error( 'call to abstract method' );
- // implementations shall return this.resultBuffer
-
- }
-
- intervalChanged_( /* i1, t0, t1 */ ) {
-
- // empty
-
- }
-
-}
-
-// ALIAS DEFINITIONS
-
-Interpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_;
-Interpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_;
-
-export { Interpolant };
diff --git a/GameDev/bin/Release/xmleditor/math/Line3.js b/GameDev/bin/Release/xmleditor/math/Line3.js
deleted file mode 100644
index bd41206e..00000000
--- a/GameDev/bin/Release/xmleditor/math/Line3.js
+++ /dev/null
@@ -1,115 +0,0 @@
-import { Vector3 } from './Vector3.js';
-import * as MathUtils from './MathUtils.js';
-
-const _startP = /*@__PURE__*/ new Vector3();
-const _startEnd = /*@__PURE__*/ new Vector3();
-
-class Line3 {
-
- constructor( start = new Vector3(), end = new Vector3() ) {
-
- this.start = start;
- this.end = end;
-
- }
-
- set( start, end ) {
-
- this.start.copy( start );
- this.end.copy( end );
-
- return this;
-
- }
-
- copy( line ) {
-
- this.start.copy( line.start );
- this.end.copy( line.end );
-
- return this;
-
- }
-
- getCenter( target ) {
-
- return target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );
-
- }
-
- delta( target ) {
-
- return target.subVectors( this.end, this.start );
-
- }
-
- distanceSq() {
-
- return this.start.distanceToSquared( this.end );
-
- }
-
- distance() {
-
- return this.start.distanceTo( this.end );
-
- }
-
- at( t, target ) {
-
- return this.delta( target ).multiplyScalar( t ).add( this.start );
-
- }
-
- closestPointToPointParameter( point, clampToLine ) {
-
- _startP.subVectors( point, this.start );
- _startEnd.subVectors( this.end, this.start );
-
- const startEnd2 = _startEnd.dot( _startEnd );
- const startEnd_startP = _startEnd.dot( _startP );
-
- let t = startEnd_startP / startEnd2;
-
- if ( clampToLine ) {
-
- t = MathUtils.clamp( t, 0, 1 );
-
- }
-
- return t;
-
- }
-
- closestPointToPoint( point, clampToLine, target ) {
-
- const t = this.closestPointToPointParameter( point, clampToLine );
-
- return this.delta( target ).multiplyScalar( t ).add( this.start );
-
- }
-
- applyMatrix4( matrix ) {
-
- this.start.applyMatrix4( matrix );
- this.end.applyMatrix4( matrix );
-
- return this;
-
- }
-
- equals( line ) {
-
- return line.start.equals( this.start ) && line.end.equals( this.end );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Line3 };
diff --git a/GameDev/bin/Release/xmleditor/math/MathUtils.js b/GameDev/bin/Release/xmleditor/math/MathUtils.js
deleted file mode 100644
index 3de8f5ff..00000000
--- a/GameDev/bin/Release/xmleditor/math/MathUtils.js
+++ /dev/null
@@ -1,258 +0,0 @@
-const _lut = [];
-
-for ( let i = 0; i < 256; i ++ ) {
-
- _lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 );
-
-}
-
-let _seed = 1234567;
-
-
-const DEG2RAD = Math.PI / 180;
-const RAD2DEG = 180 / Math.PI;
-
-// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
-function generateUUID() {
-
- const d0 = Math.random() * 0xffffffff | 0;
- const d1 = Math.random() * 0xffffffff | 0;
- const d2 = Math.random() * 0xffffffff | 0;
- const d3 = Math.random() * 0xffffffff | 0;
- const uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +
- _lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +
- _lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +
- _lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];
-
- // .toUpperCase() here flattens concatenated strings to save heap memory space.
- return uuid.toUpperCase();
-
-}
-
-function clamp( value, min, max ) {
-
- return Math.max( min, Math.min( max, value ) );
-
-}
-
-// compute euclidian modulo of m % n
-// https://en.wikipedia.org/wiki/Modulo_operation
-function euclideanModulo( n, m ) {
-
- return ( ( n % m ) + m ) % m;
-
-}
-
-// Linear mapping from range to range
-function mapLinear( x, a1, a2, b1, b2 ) {
-
- return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );
-
-}
-
-// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
-function inverseLerp( x, y, value ) {
-
- if ( x !== y ) {
-
- return ( value - x ) / ( y - x );
-
- } else {
-
- return 0;
-
- }
-
-}
-
-// https://en.wikipedia.org/wiki/Linear_interpolation
-function lerp( x, y, t ) {
-
- return ( 1 - t ) * x + t * y;
-
-}
-
-// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
-function damp( x, y, lambda, dt ) {
-
- return lerp( x, y, 1 - Math.exp( - lambda * dt ) );
-
-}
-
-// https://www.desmos.com/calculator/vcsjnyz7x4
-function pingpong( x, length = 1 ) {
-
- return length - Math.abs( euclideanModulo( x, length * 2 ) - length );
-
-}
-
-// http://en.wikipedia.org/wiki/Smoothstep
-function smoothstep( x, min, max ) {
-
- if ( x <= min ) return 0;
- if ( x >= max ) return 1;
-
- x = ( x - min ) / ( max - min );
-
- return x * x * ( 3 - 2 * x );
-
-}
-
-function smootherstep( x, min, max ) {
-
- if ( x <= min ) return 0;
- if ( x >= max ) return 1;
-
- x = ( x - min ) / ( max - min );
-
- return x * x * x * ( x * ( x * 6 - 15 ) + 10 );
-
-}
-
-// Random integer from interval
-function randInt( low, high ) {
-
- return low + Math.floor( Math.random() * ( high - low + 1 ) );
-
-}
-
-// Random float from interval
-function randFloat( low, high ) {
-
- return low + Math.random() * ( high - low );
-
-}
-
-// Random float from <-range/2, range/2> interval
-function randFloatSpread( range ) {
-
- return range * ( 0.5 - Math.random() );
-
-}
-
-// Deterministic pseudo-random float in the interval [ 0, 1 ]
-function seededRandom( s ) {
-
- if ( s !== undefined ) _seed = s % 2147483647;
-
- // Park-Miller algorithm
-
- _seed = _seed * 16807 % 2147483647;
-
- return ( _seed - 1 ) / 2147483646;
-
-}
-
-function degToRad( degrees ) {
-
- return degrees * DEG2RAD;
-
-}
-
-function radToDeg( radians ) {
-
- return radians * RAD2DEG;
-
-}
-
-function isPowerOfTwo( value ) {
-
- return ( value & ( value - 1 ) ) === 0 && value !== 0;
-
-}
-
-function ceilPowerOfTwo( value ) {
-
- return Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );
-
-}
-
-function floorPowerOfTwo( value ) {
-
- return Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );
-
-}
-
-function setQuaternionFromProperEuler( q, a, b, c, order ) {
-
- // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
-
- // rotations are applied to the axes in the order specified by 'order'
- // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
- // angles are in radians
-
- const cos = Math.cos;
- const sin = Math.sin;
-
- const c2 = cos( b / 2 );
- const s2 = sin( b / 2 );
-
- const c13 = cos( ( a + c ) / 2 );
- const s13 = sin( ( a + c ) / 2 );
-
- const c1_3 = cos( ( a - c ) / 2 );
- const s1_3 = sin( ( a - c ) / 2 );
-
- const c3_1 = cos( ( c - a ) / 2 );
- const s3_1 = sin( ( c - a ) / 2 );
-
- switch ( order ) {
-
- case 'XYX':
- q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
- break;
-
- case 'YZY':
- q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
- break;
-
- case 'ZXZ':
- q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
- break;
-
- case 'XZX':
- q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
- break;
-
- case 'YXY':
- q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
- break;
-
- case 'ZYZ':
- q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
- break;
-
- default:
- console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );
-
- }
-
-}
-
-
-
-
-export {
- DEG2RAD,
- RAD2DEG,
- generateUUID,
- clamp,
- euclideanModulo,
- mapLinear,
- inverseLerp,
- lerp,
- damp,
- pingpong,
- smoothstep,
- smootherstep,
- randInt,
- randFloat,
- randFloatSpread,
- seededRandom,
- degToRad,
- radToDeg,
- isPowerOfTwo,
- ceilPowerOfTwo,
- floorPowerOfTwo,
- setQuaternionFromProperEuler,
-};
diff --git a/GameDev/bin/Release/xmleditor/math/Matrix3.js b/GameDev/bin/Release/xmleditor/math/Matrix3.js
deleted file mode 100644
index 9005740e..00000000
--- a/GameDev/bin/Release/xmleditor/math/Matrix3.js
+++ /dev/null
@@ -1,339 +0,0 @@
-class Matrix3 {
-
- constructor() {
-
- this.elements = [
-
- 1, 0, 0,
- 0, 1, 0,
- 0, 0, 1
-
- ];
-
- if ( arguments.length > 0 ) {
-
- console.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );
-
- }
-
- }
-
- set( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
-
- const te = this.elements;
-
- te[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;
- te[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;
- te[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;
-
- return this;
-
- }
-
- identity() {
-
- this.set(
-
- 1, 0, 0,
- 0, 1, 0,
- 0, 0, 1
-
- );
-
- return this;
-
- }
-
- copy( m ) {
-
- const te = this.elements;
- const me = m.elements;
-
- te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];
- te[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];
- te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];
-
- return this;
-
- }
-
- extractBasis( xAxis, yAxis, zAxis ) {
-
- xAxis.setFromMatrix3Column( this, 0 );
- yAxis.setFromMatrix3Column( this, 1 );
- zAxis.setFromMatrix3Column( this, 2 );
-
- return this;
-
- }
-
- setFromMatrix4( m ) {
-
- const me = m.elements;
-
- this.set(
-
- me[ 0 ], me[ 4 ], me[ 8 ],
- me[ 1 ], me[ 5 ], me[ 9 ],
- me[ 2 ], me[ 6 ], me[ 10 ]
-
- );
-
- return this;
-
- }
-
- multiply( m ) {
-
- return this.multiplyMatrices( this, m );
-
- }
-
- premultiply( m ) {
-
- return this.multiplyMatrices( m, this );
-
- }
-
- multiplyMatrices( a, b ) {
-
- const ae = a.elements;
- const be = b.elements;
- const te = this.elements;
-
- const a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];
- const a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];
- const a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];
-
- const b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];
- const b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];
- const b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];
-
- te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;
- te[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;
- te[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;
-
- te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;
- te[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;
- te[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;
-
- te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;
- te[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;
- te[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- const te = this.elements;
-
- te[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;
- te[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;
- te[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;
-
- return this;
-
- }
-
- determinant() {
-
- const te = this.elements;
-
- const a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],
- d = te[ 3 ], e = te[ 4 ], f = te[ 5 ],
- g = te[ 6 ], h = te[ 7 ], i = te[ 8 ];
-
- return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;
-
- }
-
- invert() {
-
- const te = this.elements,
-
- n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],
- n12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],
- n13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],
-
- t11 = n33 * n22 - n32 * n23,
- t12 = n32 * n13 - n33 * n12,
- t13 = n23 * n12 - n22 * n13,
-
- det = n11 * t11 + n21 * t12 + n31 * t13;
-
- if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
-
- const detInv = 1 / det;
-
- te[ 0 ] = t11 * detInv;
- te[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;
- te[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;
-
- te[ 3 ] = t12 * detInv;
- te[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;
- te[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;
-
- te[ 6 ] = t13 * detInv;
- te[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;
- te[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;
-
- return this;
-
- }
-
- transpose() {
-
- let tmp;
- const m = this.elements;
-
- tmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;
- tmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;
- tmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;
-
- return this;
-
- }
-
- getNormalMatrix( matrix4 ) {
-
- return this.setFromMatrix4( matrix4 ).invert().transpose();
-
- }
-
- transposeIntoArray( r ) {
-
- const m = this.elements;
-
- r[ 0 ] = m[ 0 ];
- r[ 1 ] = m[ 3 ];
- r[ 2 ] = m[ 6 ];
- r[ 3 ] = m[ 1 ];
- r[ 4 ] = m[ 4 ];
- r[ 5 ] = m[ 7 ];
- r[ 6 ] = m[ 2 ];
- r[ 7 ] = m[ 5 ];
- r[ 8 ] = m[ 8 ];
-
- return this;
-
- }
-
- setUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {
-
- const c = Math.cos( rotation );
- const s = Math.sin( rotation );
-
- this.set(
- sx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,
- - sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,
- 0, 0, 1
- );
-
- return this;
-
- }
-
- scale( sx, sy ) {
-
- const te = this.elements;
-
- te[ 0 ] *= sx; te[ 3 ] *= sx; te[ 6 ] *= sx;
- te[ 1 ] *= sy; te[ 4 ] *= sy; te[ 7 ] *= sy;
-
- return this;
-
- }
-
- rotate( theta ) {
-
- const c = Math.cos( theta );
- const s = Math.sin( theta );
-
- const te = this.elements;
-
- const a11 = te[ 0 ], a12 = te[ 3 ], a13 = te[ 6 ];
- const a21 = te[ 1 ], a22 = te[ 4 ], a23 = te[ 7 ];
-
- te[ 0 ] = c * a11 + s * a21;
- te[ 3 ] = c * a12 + s * a22;
- te[ 6 ] = c * a13 + s * a23;
-
- te[ 1 ] = - s * a11 + c * a21;
- te[ 4 ] = - s * a12 + c * a22;
- te[ 7 ] = - s * a13 + c * a23;
-
- return this;
-
- }
-
- translate( tx, ty ) {
-
- const te = this.elements;
-
- te[ 0 ] += tx * te[ 2 ]; te[ 3 ] += tx * te[ 5 ]; te[ 6 ] += tx * te[ 8 ];
- te[ 1 ] += ty * te[ 2 ]; te[ 4 ] += ty * te[ 5 ]; te[ 7 ] += ty * te[ 8 ];
-
- return this;
-
- }
-
- equals( matrix ) {
-
- const te = this.elements;
- const me = matrix.elements;
-
- for ( let i = 0; i < 9; i ++ ) {
-
- if ( te[ i ] !== me[ i ] ) return false;
-
- }
-
- return true;
-
- }
-
- fromArray( array, offset = 0 ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.elements[ i ] = array[ i + offset ];
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const te = this.elements;
-
- array[ offset ] = te[ 0 ];
- array[ offset + 1 ] = te[ 1 ];
- array[ offset + 2 ] = te[ 2 ];
-
- array[ offset + 3 ] = te[ 3 ];
- array[ offset + 4 ] = te[ 4 ];
- array[ offset + 5 ] = te[ 5 ];
-
- array[ offset + 6 ] = te[ 6 ];
- array[ offset + 7 ] = te[ 7 ];
- array[ offset + 8 ] = te[ 8 ];
-
- return array;
-
- }
-
- clone() {
-
- return new this.constructor().fromArray( this.elements );
-
- }
-
-}
-
-Matrix3.prototype.isMatrix3 = true;
-
-export { Matrix3 };
diff --git a/GameDev/bin/Release/xmleditor/math/Matrix4.js b/GameDev/bin/Release/xmleditor/math/Matrix4.js
deleted file mode 100644
index 5383e24c..00000000
--- a/GameDev/bin/Release/xmleditor/math/Matrix4.js
+++ /dev/null
@@ -1,885 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-class Matrix4 {
-
- constructor() {
-
- this.elements = [
-
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- ];
-
- if ( arguments.length > 0 ) {
-
- console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );
-
- }
-
- }
-
- set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
-
- const te = this.elements;
-
- te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;
- te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;
- te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;
- te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;
-
- return this;
-
- }
-
- identity() {
-
- this.set(
-
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- clone() {
-
- return new Matrix4().fromArray( this.elements );
-
- }
-
- copy( m ) {
-
- const te = this.elements;
- const me = m.elements;
-
- te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];
- te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];
- te[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];
- te[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];
-
- return this;
-
- }
-
- copyPosition( m ) {
-
- const te = this.elements, me = m.elements;
-
- te[ 12 ] = me[ 12 ];
- te[ 13 ] = me[ 13 ];
- te[ 14 ] = me[ 14 ];
-
- return this;
-
- }
-
- setFromMatrix3( m ) {
-
- const me = m.elements;
-
- this.set(
-
- me[ 0 ], me[ 3 ], me[ 6 ], 0,
- me[ 1 ], me[ 4 ], me[ 7 ], 0,
- me[ 2 ], me[ 5 ], me[ 8 ], 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- extractBasis( xAxis, yAxis, zAxis ) {
-
- xAxis.setFromMatrixColumn( this, 0 );
- yAxis.setFromMatrixColumn( this, 1 );
- zAxis.setFromMatrixColumn( this, 2 );
-
- return this;
-
- }
-
- makeBasis( xAxis, yAxis, zAxis ) {
-
- this.set(
- xAxis.x, yAxis.x, zAxis.x, 0,
- xAxis.y, yAxis.y, zAxis.y, 0,
- xAxis.z, yAxis.z, zAxis.z, 0,
- 0, 0, 0, 1
- );
-
- return this;
-
- }
-
- extractRotation( m ) {
-
- // this method does not support reflection matrices
-
- const te = this.elements;
- const me = m.elements;
-
- const scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();
- const scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();
- const scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();
-
- te[ 0 ] = me[ 0 ] * scaleX;
- te[ 1 ] = me[ 1 ] * scaleX;
- te[ 2 ] = me[ 2 ] * scaleX;
- te[ 3 ] = 0;
-
- te[ 4 ] = me[ 4 ] * scaleY;
- te[ 5 ] = me[ 5 ] * scaleY;
- te[ 6 ] = me[ 6 ] * scaleY;
- te[ 7 ] = 0;
-
- te[ 8 ] = me[ 8 ] * scaleZ;
- te[ 9 ] = me[ 9 ] * scaleZ;
- te[ 10 ] = me[ 10 ] * scaleZ;
- te[ 11 ] = 0;
-
- te[ 12 ] = 0;
- te[ 13 ] = 0;
- te[ 14 ] = 0;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- makeRotationFromEuler( euler ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- console.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );
-
- }
-
- const te = this.elements;
-
- const x = euler.x, y = euler.y, z = euler.z;
- const a = Math.cos( x ), b = Math.sin( x );
- const c = Math.cos( y ), d = Math.sin( y );
- const e = Math.cos( z ), f = Math.sin( z );
-
- if ( euler.order === 'XYZ' ) {
-
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
-
- te[ 0 ] = c * e;
- te[ 4 ] = - c * f;
- te[ 8 ] = d;
-
- te[ 1 ] = af + be * d;
- te[ 5 ] = ae - bf * d;
- te[ 9 ] = - b * c;
-
- te[ 2 ] = bf - ae * d;
- te[ 6 ] = be + af * d;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'YXZ' ) {
-
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
-
- te[ 0 ] = ce + df * b;
- te[ 4 ] = de * b - cf;
- te[ 8 ] = a * d;
-
- te[ 1 ] = a * f;
- te[ 5 ] = a * e;
- te[ 9 ] = - b;
-
- te[ 2 ] = cf * b - de;
- te[ 6 ] = df + ce * b;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'ZXY' ) {
-
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
-
- te[ 0 ] = ce - df * b;
- te[ 4 ] = - a * f;
- te[ 8 ] = de + cf * b;
-
- te[ 1 ] = cf + de * b;
- te[ 5 ] = a * e;
- te[ 9 ] = df - ce * b;
-
- te[ 2 ] = - a * d;
- te[ 6 ] = b;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'ZYX' ) {
-
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
-
- te[ 0 ] = c * e;
- te[ 4 ] = be * d - af;
- te[ 8 ] = ae * d + bf;
-
- te[ 1 ] = c * f;
- te[ 5 ] = bf * d + ae;
- te[ 9 ] = af * d - be;
-
- te[ 2 ] = - d;
- te[ 6 ] = b * c;
- te[ 10 ] = a * c;
-
- } else if ( euler.order === 'YZX' ) {
-
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
- te[ 0 ] = c * e;
- te[ 4 ] = bd - ac * f;
- te[ 8 ] = bc * f + ad;
-
- te[ 1 ] = f;
- te[ 5 ] = a * e;
- te[ 9 ] = - b * e;
-
- te[ 2 ] = - d * e;
- te[ 6 ] = ad * f + bc;
- te[ 10 ] = ac - bd * f;
-
- } else if ( euler.order === 'XZY' ) {
-
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
-
- te[ 0 ] = c * e;
- te[ 4 ] = - f;
- te[ 8 ] = d * e;
-
- te[ 1 ] = ac * f + bd;
- te[ 5 ] = a * e;
- te[ 9 ] = ad * f - bc;
-
- te[ 2 ] = bc * f - ad;
- te[ 6 ] = b * e;
- te[ 10 ] = bd * f + ac;
-
- }
-
- // bottom row
- te[ 3 ] = 0;
- te[ 7 ] = 0;
- te[ 11 ] = 0;
-
- // last column
- te[ 12 ] = 0;
- te[ 13 ] = 0;
- te[ 14 ] = 0;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- makeRotationFromQuaternion( q ) {
-
- return this.compose( _zero, q, _one );
-
- }
-
- lookAt( eye, target, up ) {
-
- const te = this.elements;
-
- _z.subVectors( eye, target );
-
- if ( _z.lengthSq() === 0 ) {
-
- // eye and target are in the same position
-
- _z.z = 1;
-
- }
-
- _z.normalize();
- _x.crossVectors( up, _z );
-
- if ( _x.lengthSq() === 0 ) {
-
- // up and z are parallel
-
- if ( Math.abs( up.z ) === 1 ) {
-
- _z.x += 0.0001;
-
- } else {
-
- _z.z += 0.0001;
-
- }
-
- _z.normalize();
- _x.crossVectors( up, _z );
-
- }
-
- _x.normalize();
- _y.crossVectors( _z, _x );
-
- te[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;
- te[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;
- te[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;
-
- return this;
-
- }
-
- multiply( m, n ) {
-
- if ( n !== undefined ) {
-
- console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );
- return this.multiplyMatrices( m, n );
-
- }
-
- return this.multiplyMatrices( this, m );
-
- }
-
- premultiply( m ) {
-
- return this.multiplyMatrices( m, this );
-
- }
-
- multiplyMatrices( a, b ) {
-
- const ae = a.elements;
- const be = b.elements;
- const te = this.elements;
-
- const a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];
- const a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];
- const a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];
- const a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];
-
- const b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];
- const b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];
- const b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];
- const b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];
-
- te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
- te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
- te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
- te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
-
- te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
- te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
- te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
- te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
-
- te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
- te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
- te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
- te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
-
- te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
- te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
- te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
- te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-
- return this;
-
- }
-
- multiplyScalar( s ) {
-
- const te = this.elements;
-
- te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;
- te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;
- te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;
- te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;
-
- return this;
-
- }
-
- determinant() {
-
- const te = this.elements;
-
- const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];
- const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];
- const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];
- const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];
-
- //TODO: make this more efficient
- //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
-
- return (
- n41 * (
- + n14 * n23 * n32
- - n13 * n24 * n32
- - n14 * n22 * n33
- + n12 * n24 * n33
- + n13 * n22 * n34
- - n12 * n23 * n34
- ) +
- n42 * (
- + n11 * n23 * n34
- - n11 * n24 * n33
- + n14 * n21 * n33
- - n13 * n21 * n34
- + n13 * n24 * n31
- - n14 * n23 * n31
- ) +
- n43 * (
- + n11 * n24 * n32
- - n11 * n22 * n34
- - n14 * n21 * n32
- + n12 * n21 * n34
- + n14 * n22 * n31
- - n12 * n24 * n31
- ) +
- n44 * (
- - n13 * n22 * n31
- - n11 * n23 * n32
- + n11 * n22 * n33
- + n13 * n21 * n32
- - n12 * n21 * n33
- + n12 * n23 * n31
- )
-
- );
-
- }
-
- transpose() {
-
- const te = this.elements;
- let tmp;
-
- tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;
- tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;
- tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;
-
- tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;
- tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;
- tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;
-
- return this;
-
- }
-
- setPosition( x, y, z ) {
-
- const te = this.elements;
-
- if ( x.isVector3 ) {
-
- te[ 12 ] = x.x;
- te[ 13 ] = x.y;
- te[ 14 ] = x.z;
-
- } else {
-
- te[ 12 ] = x;
- te[ 13 ] = y;
- te[ 14 ] = z;
-
- }
-
- return this;
-
- }
-
- invert() {
-
- // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
- const te = this.elements,
-
- n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],
- n12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],
- n13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],
- n14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],
-
- t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
- t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
- t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
- t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
-
- const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
-
- if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
-
- const detInv = 1 / det;
-
- te[ 0 ] = t11 * detInv;
- te[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;
- te[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;
- te[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;
-
- te[ 4 ] = t12 * detInv;
- te[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;
- te[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;
- te[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;
-
- te[ 8 ] = t13 * detInv;
- te[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;
- te[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;
- te[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;
-
- te[ 12 ] = t14 * detInv;
- te[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;
- te[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;
- te[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;
-
- return this;
-
- }
-
- scale( v ) {
-
- const te = this.elements;
- const x = v.x, y = v.y, z = v.z;
-
- te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;
- te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;
- te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;
- te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;
-
- return this;
-
- }
-
- getMaxScaleOnAxis() {
-
- const te = this.elements;
-
- const scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];
- const scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];
- const scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];
-
- return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );
-
- }
-
- makeTranslation( x, y, z ) {
-
- this.set(
-
- 1, 0, 0, x,
- 0, 1, 0, y,
- 0, 0, 1, z,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationX( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- 1, 0, 0, 0,
- 0, c, - s, 0,
- 0, s, c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationY( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- c, 0, s, 0,
- 0, 1, 0, 0,
- - s, 0, c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationZ( theta ) {
-
- const c = Math.cos( theta ), s = Math.sin( theta );
-
- this.set(
-
- c, - s, 0, 0,
- s, c, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeRotationAxis( axis, angle ) {
-
- // Based on http://www.gamedev.net/reference/articles/article1199.asp
-
- const c = Math.cos( angle );
- const s = Math.sin( angle );
- const t = 1 - c;
- const x = axis.x, y = axis.y, z = axis.z;
- const tx = t * x, ty = t * y;
-
- this.set(
-
- tx * x + c, tx * y - s * z, tx * z + s * y, 0,
- tx * y + s * z, ty * y + c, ty * z - s * x, 0,
- tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeScale( x, y, z ) {
-
- this.set(
-
- x, 0, 0, 0,
- 0, y, 0, 0,
- 0, 0, z, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- makeShear( xy, xz, yx, yz, zx, zy ) {
-
- this.set(
-
- 1, yx, zx, 0,
- xy, 1, zy, 0,
- xz, yz, 1, 0,
- 0, 0, 0, 1
-
- );
-
- return this;
-
- }
-
- compose( position, quaternion, scale ) {
-
- const te = this.elements;
-
- const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;
- const x2 = x + x, y2 = y + y, z2 = z + z;
- const xx = x * x2, xy = x * y2, xz = x * z2;
- const yy = y * y2, yz = y * z2, zz = z * z2;
- const wx = w * x2, wy = w * y2, wz = w * z2;
-
- const sx = scale.x, sy = scale.y, sz = scale.z;
-
- te[ 0 ] = ( 1 - ( yy + zz ) ) * sx;
- te[ 1 ] = ( xy + wz ) * sx;
- te[ 2 ] = ( xz - wy ) * sx;
- te[ 3 ] = 0;
-
- te[ 4 ] = ( xy - wz ) * sy;
- te[ 5 ] = ( 1 - ( xx + zz ) ) * sy;
- te[ 6 ] = ( yz + wx ) * sy;
- te[ 7 ] = 0;
-
- te[ 8 ] = ( xz + wy ) * sz;
- te[ 9 ] = ( yz - wx ) * sz;
- te[ 10 ] = ( 1 - ( xx + yy ) ) * sz;
- te[ 11 ] = 0;
-
- te[ 12 ] = position.x;
- te[ 13 ] = position.y;
- te[ 14 ] = position.z;
- te[ 15 ] = 1;
-
- return this;
-
- }
-
- decompose( position, quaternion, scale ) {
-
- const te = this.elements;
-
- let sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
- const sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
- const sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
-
- // if determine is negative, we need to invert one scale
- const det = this.determinant();
- if ( det < 0 ) sx = - sx;
-
- position.x = te[ 12 ];
- position.y = te[ 13 ];
- position.z = te[ 14 ];
-
- // scale the rotation part
- _m1.copy( this );
-
- const invSX = 1 / sx;
- const invSY = 1 / sy;
- const invSZ = 1 / sz;
-
- _m1.elements[ 0 ] *= invSX;
- _m1.elements[ 1 ] *= invSX;
- _m1.elements[ 2 ] *= invSX;
-
- _m1.elements[ 4 ] *= invSY;
- _m1.elements[ 5 ] *= invSY;
- _m1.elements[ 6 ] *= invSY;
-
- _m1.elements[ 8 ] *= invSZ;
- _m1.elements[ 9 ] *= invSZ;
- _m1.elements[ 10 ] *= invSZ;
-
- quaternion.setFromRotationMatrix( _m1 );
-
- scale.x = sx;
- scale.y = sy;
- scale.z = sz;
-
- return this;
-
- }
-
- makePerspective( left, right, top, bottom, near, far ) {
-
- if ( far === undefined ) {
-
- console.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' );
-
- }
-
- const te = this.elements;
- const x = 2 * near / ( right - left );
- const y = 2 * near / ( top - bottom );
-
- const a = ( right + left ) / ( right - left );
- const b = ( top + bottom ) / ( top - bottom );
- const c = - ( far + near ) / ( far - near );
- const d = - 2 * far * near / ( far - near );
-
- te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
- te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
-
- return this;
-
- }
-
- makeOrthographic( left, right, top, bottom, near, far ) {
-
- const te = this.elements;
- const w = 1.0 / ( right - left );
- const h = 1.0 / ( top - bottom );
- const p = 1.0 / ( far - near );
-
- const x = ( right + left ) * w;
- const y = ( top + bottom ) * h;
- const z = ( far + near ) * p;
-
- te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
- te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z;
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
-
- return this;
-
- }
-
- equals( matrix ) {
-
- const te = this.elements;
- const me = matrix.elements;
-
- for ( let i = 0; i < 16; i ++ ) {
-
- if ( te[ i ] !== me[ i ] ) return false;
-
- }
-
- return true;
-
- }
-
- fromArray( array, offset = 0 ) {
-
- for ( let i = 0; i < 16; i ++ ) {
-
- this.elements[ i ] = array[ i + offset ];
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const te = this.elements;
-
- array[ offset ] = te[ 0 ];
- array[ offset + 1 ] = te[ 1 ];
- array[ offset + 2 ] = te[ 2 ];
- array[ offset + 3 ] = te[ 3 ];
-
- array[ offset + 4 ] = te[ 4 ];
- array[ offset + 5 ] = te[ 5 ];
- array[ offset + 6 ] = te[ 6 ];
- array[ offset + 7 ] = te[ 7 ];
-
- array[ offset + 8 ] = te[ 8 ];
- array[ offset + 9 ] = te[ 9 ];
- array[ offset + 10 ] = te[ 10 ];
- array[ offset + 11 ] = te[ 11 ];
-
- array[ offset + 12 ] = te[ 12 ];
- array[ offset + 13 ] = te[ 13 ];
- array[ offset + 14 ] = te[ 14 ];
- array[ offset + 15 ] = te[ 15 ];
-
- return array;
-
- }
-
-}
-
-Matrix4.prototype.isMatrix4 = true;
-
-const _v1 = /*@__PURE__*/ new Vector3();
-const _m1 = /*@__PURE__*/ new Matrix4();
-const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
-const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
-const _x = /*@__PURE__*/ new Vector3();
-const _y = /*@__PURE__*/ new Vector3();
-const _z = /*@__PURE__*/ new Vector3();
-
-export { Matrix4 };
diff --git a/GameDev/bin/Release/xmleditor/math/Plane.js b/GameDev/bin/Release/xmleditor/math/Plane.js
deleted file mode 100644
index fc8a471b..00000000
--- a/GameDev/bin/Release/xmleditor/math/Plane.js
+++ /dev/null
@@ -1,205 +0,0 @@
-import { Matrix3 } from './Matrix3.js';
-import { Vector3 } from './Vector3.js';
-
-const _vector1 = /*@__PURE__*/ new Vector3();
-const _vector2 = /*@__PURE__*/ new Vector3();
-const _normalMatrix = /*@__PURE__*/ new Matrix3();
-
-class Plane {
-
- constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
-
- // normal is assumed to be normalized
-
- this.normal = normal;
- this.constant = constant;
-
- }
-
- set( normal, constant ) {
-
- this.normal.copy( normal );
- this.constant = constant;
-
- return this;
-
- }
-
- setComponents( x, y, z, w ) {
-
- this.normal.set( x, y, z );
- this.constant = w;
-
- return this;
-
- }
-
- setFromNormalAndCoplanarPoint( normal, point ) {
-
- this.normal.copy( normal );
- this.constant = - point.dot( this.normal );
-
- return this;
-
- }
-
- setFromCoplanarPoints( a, b, c ) {
-
- const normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
-
- // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
-
- this.setFromNormalAndCoplanarPoint( normal, a );
-
- return this;
-
- }
-
- copy( plane ) {
-
- this.normal.copy( plane.normal );
- this.constant = plane.constant;
-
- return this;
-
- }
-
- normalize() {
-
- // Note: will lead to a divide by zero if the plane is invalid.
-
- const inverseNormalLength = 1.0 / this.normal.length();
- this.normal.multiplyScalar( inverseNormalLength );
- this.constant *= inverseNormalLength;
-
- return this;
-
- }
-
- negate() {
-
- this.constant *= - 1;
- this.normal.negate();
-
- return this;
-
- }
-
- distanceToPoint( point ) {
-
- return this.normal.dot( point ) + this.constant;
-
- }
-
- distanceToSphere( sphere ) {
-
- return this.distanceToPoint( sphere.center ) - sphere.radius;
-
- }
-
- projectPoint( point, target ) {
-
- return target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );
-
- }
-
- intersectLine( line, target ) {
-
- const direction = line.delta( _vector1 );
-
- const denominator = this.normal.dot( direction );
-
- if ( denominator === 0 ) {
-
- // line is coplanar, return origin
- if ( this.distanceToPoint( line.start ) === 0 ) {
-
- return target.copy( line.start );
-
- }
-
- // Unsure if this is the correct method to handle this case.
- return null;
-
- }
-
- const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
-
- if ( t < 0 || t > 1 ) {
-
- return null;
-
- }
-
- return target.copy( direction ).multiplyScalar( t ).add( line.start );
-
- }
-
- intersectsLine( line ) {
-
- // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
-
- const startSign = this.distanceToPoint( line.start );
- const endSign = this.distanceToPoint( line.end );
-
- return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
-
- }
-
- intersectsBox( box ) {
-
- return box.intersectsPlane( this );
-
- }
-
- intersectsSphere( sphere ) {
-
- return sphere.intersectsPlane( this );
-
- }
-
- coplanarPoint( target ) {
-
- return target.copy( this.normal ).multiplyScalar( - this.constant );
-
- }
-
- applyMatrix4( matrix, optionalNormalMatrix ) {
-
- const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
-
- const referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
-
- const normal = this.normal.applyMatrix3( normalMatrix ).normalize();
-
- this.constant = - referencePoint.dot( normal );
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.constant -= offset.dot( this.normal );
-
- return this;
-
- }
-
- equals( plane ) {
-
- return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-Plane.prototype.isPlane = true;
-
-export { Plane };
diff --git a/GameDev/bin/Release/xmleditor/math/Quaternion.js b/GameDev/bin/Release/xmleditor/math/Quaternion.js
deleted file mode 100644
index 485fe865..00000000
--- a/GameDev/bin/Release/xmleditor/math/Quaternion.js
+++ /dev/null
@@ -1,689 +0,0 @@
-import * as MathUtils from './MathUtils.js';
-
-class Quaternion {
-
- constructor( x = 0, y = 0, z = 0, w = 1 ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._w = w;
-
- }
-
- static slerp( qa, qb, qm, t ) {
-
- console.warn( 'THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.' );
- return qm.slerpQuaternions( qa, qb, t );
-
- }
-
- static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {
-
- // fuzz-free, array-based Quaternion SLERP operation
-
- let x0 = src0[ srcOffset0 + 0 ],
- y0 = src0[ srcOffset0 + 1 ],
- z0 = src0[ srcOffset0 + 2 ],
- w0 = src0[ srcOffset0 + 3 ];
-
- const x1 = src1[ srcOffset1 + 0 ],
- y1 = src1[ srcOffset1 + 1 ],
- z1 = src1[ srcOffset1 + 2 ],
- w1 = src1[ srcOffset1 + 3 ];
-
- if ( t === 0 ) {
-
- dst[ dstOffset + 0 ] = x0;
- dst[ dstOffset + 1 ] = y0;
- dst[ dstOffset + 2 ] = z0;
- dst[ dstOffset + 3 ] = w0;
- return;
-
- }
-
- if ( t === 1 ) {
-
- dst[ dstOffset + 0 ] = x1;
- dst[ dstOffset + 1 ] = y1;
- dst[ dstOffset + 2 ] = z1;
- dst[ dstOffset + 3 ] = w1;
- return;
-
- }
-
- if ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {
-
- let s = 1 - t;
- const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
- dir = ( cos >= 0 ? 1 : - 1 ),
- sqrSin = 1 - cos * cos;
-
- // Skip the Slerp for tiny steps to avoid numeric problems:
- if ( sqrSin > Number.EPSILON ) {
-
- const sin = Math.sqrt( sqrSin ),
- len = Math.atan2( sin, cos * dir );
-
- s = Math.sin( s * len ) / sin;
- t = Math.sin( t * len ) / sin;
-
- }
-
- const tDir = t * dir;
-
- x0 = x0 * s + x1 * tDir;
- y0 = y0 * s + y1 * tDir;
- z0 = z0 * s + z1 * tDir;
- w0 = w0 * s + w1 * tDir;
-
- // Normalize in case we just did a lerp:
- if ( s === 1 - t ) {
-
- const f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );
-
- x0 *= f;
- y0 *= f;
- z0 *= f;
- w0 *= f;
-
- }
-
- }
-
- dst[ dstOffset ] = x0;
- dst[ dstOffset + 1 ] = y0;
- dst[ dstOffset + 2 ] = z0;
- dst[ dstOffset + 3 ] = w0;
-
- }
-
- static multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {
-
- const x0 = src0[ srcOffset0 ];
- const y0 = src0[ srcOffset0 + 1 ];
- const z0 = src0[ srcOffset0 + 2 ];
- const w0 = src0[ srcOffset0 + 3 ];
-
- const x1 = src1[ srcOffset1 ];
- const y1 = src1[ srcOffset1 + 1 ];
- const z1 = src1[ srcOffset1 + 2 ];
- const w1 = src1[ srcOffset1 + 3 ];
-
- dst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
- dst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
- dst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
- dst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;
-
- return dst;
-
- }
-
- get x() {
-
- return this._x;
-
- }
-
- set x( value ) {
-
- this._x = value;
- this._onChangeCallback();
-
- }
-
- get y() {
-
- return this._y;
-
- }
-
- set y( value ) {
-
- this._y = value;
- this._onChangeCallback();
-
- }
-
- get z() {
-
- return this._z;
-
- }
-
- set z( value ) {
-
- this._z = value;
- this._onChangeCallback();
-
- }
-
- get w() {
-
- return this._w;
-
- }
-
- set w( value ) {
-
- this._w = value;
- this._onChangeCallback();
-
- }
-
- set( x, y, z, w ) {
-
- this._x = x;
- this._y = y;
- this._z = z;
- this._w = w;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor( this._x, this._y, this._z, this._w );
-
- }
-
- copy( quaternion ) {
-
- this._x = quaternion.x;
- this._y = quaternion.y;
- this._z = quaternion.z;
- this._w = quaternion.w;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromEuler( euler, update ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- throw new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' );
-
- }
-
- const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
-
- // http://www.mathworks.com/matlabcentral/fileexchange/
- // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
- // content/SpinCalc.m
-
- const cos = Math.cos;
- const sin = Math.sin;
-
- const c1 = cos( x / 2 );
- const c2 = cos( y / 2 );
- const c3 = cos( z / 2 );
-
- const s1 = sin( x / 2 );
- const s2 = sin( y / 2 );
- const s3 = sin( z / 2 );
-
- switch ( order ) {
-
- case 'XYZ':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'YXZ':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- case 'ZXY':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'ZYX':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- case 'YZX':
- this._x = s1 * c2 * c3 + c1 * s2 * s3;
- this._y = c1 * s2 * c3 + s1 * c2 * s3;
- this._z = c1 * c2 * s3 - s1 * s2 * c3;
- this._w = c1 * c2 * c3 - s1 * s2 * s3;
- break;
-
- case 'XZY':
- this._x = s1 * c2 * c3 - c1 * s2 * s3;
- this._y = c1 * s2 * c3 - s1 * c2 * s3;
- this._z = c1 * c2 * s3 + s1 * s2 * c3;
- this._w = c1 * c2 * c3 + s1 * s2 * s3;
- break;
-
- default:
- console.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );
-
- }
-
- if ( update !== false ) this._onChangeCallback();
-
- return this;
-
- }
-
- setFromAxisAngle( axis, angle ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
-
- // assumes axis is normalized
-
- const halfAngle = angle / 2, s = Math.sin( halfAngle );
-
- this._x = axis.x * s;
- this._y = axis.y * s;
- this._z = axis.z * s;
- this._w = Math.cos( halfAngle );
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromRotationMatrix( m ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- const te = m.elements,
-
- m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],
- m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],
- m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],
-
- trace = m11 + m22 + m33;
-
- if ( trace > 0 ) {
-
- const s = 0.5 / Math.sqrt( trace + 1.0 );
-
- this._w = 0.25 / s;
- this._x = ( m32 - m23 ) * s;
- this._y = ( m13 - m31 ) * s;
- this._z = ( m21 - m12 ) * s;
-
- } else if ( m11 > m22 && m11 > m33 ) {
-
- const s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );
-
- this._w = ( m32 - m23 ) / s;
- this._x = 0.25 * s;
- this._y = ( m12 + m21 ) / s;
- this._z = ( m13 + m31 ) / s;
-
- } else if ( m22 > m33 ) {
-
- const s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );
-
- this._w = ( m13 - m31 ) / s;
- this._x = ( m12 + m21 ) / s;
- this._y = 0.25 * s;
- this._z = ( m23 + m32 ) / s;
-
- } else {
-
- const s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );
-
- this._w = ( m21 - m12 ) / s;
- this._x = ( m13 + m31 ) / s;
- this._y = ( m23 + m32 ) / s;
- this._z = 0.25 * s;
-
- }
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- setFromUnitVectors( vFrom, vTo ) {
-
- // assumes direction vectors vFrom and vTo are normalized
-
- let r = vFrom.dot( vTo ) + 1;
-
- if ( r < Number.EPSILON ) {
-
- // vFrom and vTo point in opposite directions
-
- r = 0;
-
- if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {
-
- this._x = - vFrom.y;
- this._y = vFrom.x;
- this._z = 0;
- this._w = r;
-
- } else {
-
- this._x = 0;
- this._y = - vFrom.z;
- this._z = vFrom.y;
- this._w = r;
-
- }
-
- } else {
-
- // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
-
- this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
- this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
- this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
- this._w = r;
-
- }
-
- return this.normalize();
-
- }
-
- angleTo( q ) {
-
- return 2 * Math.acos( Math.abs( MathUtils.clamp( this.dot( q ), - 1, 1 ) ) );
-
- }
-
- rotateTowards( q, step ) {
-
- const angle = this.angleTo( q );
-
- if ( angle === 0 ) return this;
-
- const t = Math.min( 1, step / angle );
-
- this.slerp( q, t );
-
- return this;
-
- }
-
- identity() {
-
- return this.set( 0, 0, 0, 1 );
-
- }
-
- invert() {
-
- // quaternion is assumed to have unit length
-
- return this.conjugate();
-
- }
-
- conjugate() {
-
- this._x *= - 1;
- this._y *= - 1;
- this._z *= - 1;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- dot( v ) {
-
- return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;
-
- }
-
- lengthSq() {
-
- return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
-
- }
-
- length() {
-
- return Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );
-
- }
-
- normalize() {
-
- let l = this.length();
-
- if ( l === 0 ) {
-
- this._x = 0;
- this._y = 0;
- this._z = 0;
- this._w = 1;
-
- } else {
-
- l = 1 / l;
-
- this._x = this._x * l;
- this._y = this._y * l;
- this._z = this._z * l;
- this._w = this._w * l;
-
- }
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- multiply( q, p ) {
-
- if ( p !== undefined ) {
-
- console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );
- return this.multiplyQuaternions( q, p );
-
- }
-
- return this.multiplyQuaternions( this, q );
-
- }
-
- premultiply( q ) {
-
- return this.multiplyQuaternions( q, this );
-
- }
-
- multiplyQuaternions( a, b ) {
-
- // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
-
- const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;
- const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;
-
- this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
- this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
- this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
- this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- slerp( qb, t ) {
-
- if ( t === 0 ) return this;
- if ( t === 1 ) return this.copy( qb );
-
- const x = this._x, y = this._y, z = this._z, w = this._w;
-
- // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
-
- let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
-
- if ( cosHalfTheta < 0 ) {
-
- this._w = - qb._w;
- this._x = - qb._x;
- this._y = - qb._y;
- this._z = - qb._z;
-
- cosHalfTheta = - cosHalfTheta;
-
- } else {
-
- this.copy( qb );
-
- }
-
- if ( cosHalfTheta >= 1.0 ) {
-
- this._w = w;
- this._x = x;
- this._y = y;
- this._z = z;
-
- return this;
-
- }
-
- const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
-
- if ( sqrSinHalfTheta <= Number.EPSILON ) {
-
- const s = 1 - t;
- this._w = s * w + t * this._w;
- this._x = s * x + t * this._x;
- this._y = s * y + t * this._y;
- this._z = s * z + t * this._z;
-
- this.normalize();
- this._onChangeCallback();
-
- return this;
-
- }
-
- const sinHalfTheta = Math.sqrt( sqrSinHalfTheta );
- const halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );
- const ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
- ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
-
- this._w = ( w * ratioA + this._w * ratioB );
- this._x = ( x * ratioA + this._x * ratioB );
- this._y = ( y * ratioA + this._y * ratioB );
- this._z = ( z * ratioA + this._z * ratioB );
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- slerpQuaternions( qa, qb, t ) {
-
- this.copy( qa ).slerp( qb, t );
-
- }
-
- random() {
-
- // Derived from http://planning.cs.uiuc.edu/node198.html
- // Note, this source uses w, x, y, z ordering,
- // so we swap the order below.
-
- const u1 = Math.random();
- const sqrt1u1 = Math.sqrt( 1 - u1 );
- const sqrtu1 = Math.sqrt( u1 );
-
- const u2 = 2 * Math.PI * Math.random();
-
- const u3 = 2 * Math.PI * Math.random();
-
- return this.set(
- sqrt1u1 * Math.cos( u2 ),
- sqrtu1 * Math.sin( u3 ),
- sqrtu1 * Math.cos( u3 ),
- sqrt1u1 * Math.sin( u2 ),
- );
-
- }
-
- equals( quaternion ) {
-
- return ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this._x = array[ offset ];
- this._y = array[ offset + 1 ];
- this._z = array[ offset + 2 ];
- this._w = array[ offset + 3 ];
-
- this._onChangeCallback();
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this._x;
- array[ offset + 1 ] = this._y;
- array[ offset + 2 ] = this._z;
- array[ offset + 3 ] = this._w;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index ) {
-
- this._x = attribute.getX( index );
- this._y = attribute.getY( index );
- this._z = attribute.getZ( index );
- this._w = attribute.getW( index );
-
- return this;
-
- }
-
- _onChange( callback ) {
-
- this._onChangeCallback = callback;
-
- return this;
-
- }
-
- _onChangeCallback() {}
-
-}
-
-Quaternion.prototype.isQuaternion = true;
-
-export { Quaternion };
diff --git a/GameDev/bin/Release/xmleditor/math/Ray.js b/GameDev/bin/Release/xmleditor/math/Ray.js
deleted file mode 100644
index 5798c7bf..00000000
--- a/GameDev/bin/Release/xmleditor/math/Ray.js
+++ /dev/null
@@ -1,496 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-const _vector = /*@__PURE__*/ new Vector3();
-const _segCenter = /*@__PURE__*/ new Vector3();
-const _segDir = /*@__PURE__*/ new Vector3();
-const _diff = /*@__PURE__*/ new Vector3();
-
-const _edge1 = /*@__PURE__*/ new Vector3();
-const _edge2 = /*@__PURE__*/ new Vector3();
-const _normal = /*@__PURE__*/ new Vector3();
-
-class Ray {
-
- constructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {
-
- this.origin = origin;
- this.direction = direction;
-
- }
-
- set( origin, direction ) {
-
- this.origin.copy( origin );
- this.direction.copy( direction );
-
- return this;
-
- }
-
- copy( ray ) {
-
- this.origin.copy( ray.origin );
- this.direction.copy( ray.direction );
-
- return this;
-
- }
-
- at( t, target ) {
-
- return target.copy( this.direction ).multiplyScalar( t ).add( this.origin );
-
- }
-
- lookAt( v ) {
-
- this.direction.copy( v ).sub( this.origin ).normalize();
-
- return this;
-
- }
-
- recast( t ) {
-
- this.origin.copy( this.at( t, _vector ) );
-
- return this;
-
- }
-
- closestPointToPoint( point, target ) {
-
- target.subVectors( point, this.origin );
-
- const directionDistance = target.dot( this.direction );
-
- if ( directionDistance < 0 ) {
-
- return target.copy( this.origin );
-
- }
-
- return target.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );
-
- }
-
- distanceToPoint( point ) {
-
- return Math.sqrt( this.distanceSqToPoint( point ) );
-
- }
-
- distanceSqToPoint( point ) {
-
- const directionDistance = _vector.subVectors( point, this.origin ).dot( this.direction );
-
- // point behind the ray
-
- if ( directionDistance < 0 ) {
-
- return this.origin.distanceToSquared( point );
-
- }
-
- _vector.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );
-
- return _vector.distanceToSquared( point );
-
- }
-
- distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {
-
- // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
- // It returns the min distance between the ray and the segment
- // defined by v0 and v1
- // It can also set two optional targets :
- // - The closest point on the ray
- // - The closest point on the segment
-
- _segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );
- _segDir.copy( v1 ).sub( v0 ).normalize();
- _diff.copy( this.origin ).sub( _segCenter );
-
- const segExtent = v0.distanceTo( v1 ) * 0.5;
- const a01 = - this.direction.dot( _segDir );
- const b0 = _diff.dot( this.direction );
- const b1 = - _diff.dot( _segDir );
- const c = _diff.lengthSq();
- const det = Math.abs( 1 - a01 * a01 );
- let s0, s1, sqrDist, extDet;
-
- if ( det > 0 ) {
-
- // The ray and segment are not parallel.
-
- s0 = a01 * b1 - b0;
- s1 = a01 * b0 - b1;
- extDet = segExtent * det;
-
- if ( s0 >= 0 ) {
-
- if ( s1 >= - extDet ) {
-
- if ( s1 <= extDet ) {
-
- // region 0
- // Minimum at interior points of ray and segment.
-
- const invDet = 1 / det;
- s0 *= invDet;
- s1 *= invDet;
- sqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;
-
- } else {
-
- // region 1
-
- s1 = segExtent;
- s0 = Math.max( 0, - ( a01 * s1 + b0 ) );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- } else {
-
- // region 5
-
- s1 = - segExtent;
- s0 = Math.max( 0, - ( a01 * s1 + b0 ) );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- } else {
-
- if ( s1 <= - extDet ) {
-
- // region 4
-
- s0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );
- s1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- } else if ( s1 <= extDet ) {
-
- // region 3
-
- s0 = 0;
- s1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );
- sqrDist = s1 * ( s1 + 2 * b1 ) + c;
-
- } else {
-
- // region 2
-
- s0 = Math.max( 0, - ( a01 * segExtent + b0 ) );
- s1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- }
-
- } else {
-
- // Ray and segment are parallel.
-
- s1 = ( a01 > 0 ) ? - segExtent : segExtent;
- s0 = Math.max( 0, - ( a01 * s1 + b0 ) );
- sqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;
-
- }
-
- if ( optionalPointOnRay ) {
-
- optionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin );
-
- }
-
- if ( optionalPointOnSegment ) {
-
- optionalPointOnSegment.copy( _segDir ).multiplyScalar( s1 ).add( _segCenter );
-
- }
-
- return sqrDist;
-
- }
-
- intersectSphere( sphere, target ) {
-
- _vector.subVectors( sphere.center, this.origin );
- const tca = _vector.dot( this.direction );
- const d2 = _vector.dot( _vector ) - tca * tca;
- const radius2 = sphere.radius * sphere.radius;
-
- if ( d2 > radius2 ) return null;
-
- const thc = Math.sqrt( radius2 - d2 );
-
- // t0 = first intersect point - entrance on front of sphere
- const t0 = tca - thc;
-
- // t1 = second intersect point - exit point on back of sphere
- const t1 = tca + thc;
-
- // test to see if both t0 and t1 are behind the ray - if so, return null
- if ( t0 < 0 && t1 < 0 ) return null;
-
- // test to see if t0 is behind the ray:
- // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
- // in order to always return an intersect point that is in front of the ray.
- if ( t0 < 0 ) return this.at( t1, target );
-
- // else t0 is in front of the ray, so return the first collision point scaled by t0
- return this.at( t0, target );
-
- }
-
- intersectsSphere( sphere ) {
-
- return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
-
- }
-
- distanceToPlane( plane ) {
-
- const denominator = plane.normal.dot( this.direction );
-
- if ( denominator === 0 ) {
-
- // line is coplanar, return origin
- if ( plane.distanceToPoint( this.origin ) === 0 ) {
-
- return 0;
-
- }
-
- // Null is preferable to undefined since undefined means.... it is undefined
-
- return null;
-
- }
-
- const t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;
-
- // Return if the ray never intersects the plane
-
- return t >= 0 ? t : null;
-
- }
-
- intersectPlane( plane, target ) {
-
- const t = this.distanceToPlane( plane );
-
- if ( t === null ) {
-
- return null;
-
- }
-
- return this.at( t, target );
-
- }
-
- intersectsPlane( plane ) {
-
- // check if the ray lies on the plane first
-
- const distToPoint = plane.distanceToPoint( this.origin );
-
- if ( distToPoint === 0 ) {
-
- return true;
-
- }
-
- const denominator = plane.normal.dot( this.direction );
-
- if ( denominator * distToPoint < 0 ) {
-
- return true;
-
- }
-
- // ray origin is behind the plane (and is pointing behind it)
-
- return false;
-
- }
-
- intersectBox( box, target ) {
-
- let tmin, tmax, tymin, tymax, tzmin, tzmax;
-
- const invdirx = 1 / this.direction.x,
- invdiry = 1 / this.direction.y,
- invdirz = 1 / this.direction.z;
-
- const origin = this.origin;
-
- if ( invdirx >= 0 ) {
-
- tmin = ( box.min.x - origin.x ) * invdirx;
- tmax = ( box.max.x - origin.x ) * invdirx;
-
- } else {
-
- tmin = ( box.max.x - origin.x ) * invdirx;
- tmax = ( box.min.x - origin.x ) * invdirx;
-
- }
-
- if ( invdiry >= 0 ) {
-
- tymin = ( box.min.y - origin.y ) * invdiry;
- tymax = ( box.max.y - origin.y ) * invdiry;
-
- } else {
-
- tymin = ( box.max.y - origin.y ) * invdiry;
- tymax = ( box.min.y - origin.y ) * invdiry;
-
- }
-
- if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;
-
- // These lines also handle the case where tmin or tmax is NaN
- // (result of 0 * Infinity). x !== x returns true if x is NaN
-
- if ( tymin > tmin || tmin !== tmin ) tmin = tymin;
-
- if ( tymax < tmax || tmax !== tmax ) tmax = tymax;
-
- if ( invdirz >= 0 ) {
-
- tzmin = ( box.min.z - origin.z ) * invdirz;
- tzmax = ( box.max.z - origin.z ) * invdirz;
-
- } else {
-
- tzmin = ( box.max.z - origin.z ) * invdirz;
- tzmax = ( box.min.z - origin.z ) * invdirz;
-
- }
-
- if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;
-
- if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;
-
- if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;
-
- //return point closest to the ray (positive side)
-
- if ( tmax < 0 ) return null;
-
- return this.at( tmin >= 0 ? tmin : tmax, target );
-
- }
-
- intersectsBox( box ) {
-
- return this.intersectBox( box, _vector ) !== null;
-
- }
-
- intersectTriangle( a, b, c, backfaceCulling, target ) {
-
- // Compute the offset origin, edges, and normal.
-
- // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
-
- _edge1.subVectors( b, a );
- _edge2.subVectors( c, a );
- _normal.crossVectors( _edge1, _edge2 );
-
- // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
- // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
- // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
- // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
- // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
- let DdN = this.direction.dot( _normal );
- let sign;
-
- if ( DdN > 0 ) {
-
- if ( backfaceCulling ) return null;
- sign = 1;
-
- } else if ( DdN < 0 ) {
-
- sign = - 1;
- DdN = - DdN;
-
- } else {
-
- return null;
-
- }
-
- _diff.subVectors( this.origin, a );
- const DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );
-
- // b1 < 0, no intersection
- if ( DdQxE2 < 0 ) {
-
- return null;
-
- }
-
- const DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );
-
- // b2 < 0, no intersection
- if ( DdE1xQ < 0 ) {
-
- return null;
-
- }
-
- // b1+b2 > 1, no intersection
- if ( DdQxE2 + DdE1xQ > DdN ) {
-
- return null;
-
- }
-
- // Line intersects triangle, check if ray does.
- const QdN = - sign * _diff.dot( _normal );
-
- // t < 0, no intersection
- if ( QdN < 0 ) {
-
- return null;
-
- }
-
- // Ray intersects triangle.
- return this.at( QdN / DdN, target );
-
- }
-
- applyMatrix4( matrix4 ) {
-
- this.origin.applyMatrix4( matrix4 );
- this.direction.transformDirection( matrix4 );
-
- return this;
-
- }
-
- equals( ray ) {
-
- return ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Ray };
diff --git a/GameDev/bin/Release/xmleditor/math/Sphere.js b/GameDev/bin/Release/xmleditor/math/Sphere.js
deleted file mode 100644
index 657335ba..00000000
--- a/GameDev/bin/Release/xmleditor/math/Sphere.js
+++ /dev/null
@@ -1,219 +0,0 @@
-import { Box3 } from './Box3.js';
-import { Vector3 } from './Vector3.js';
-
-const _box = /*@__PURE__*/ new Box3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _toFarthestPoint = /*@__PURE__*/ new Vector3();
-const _toPoint = /*@__PURE__*/ new Vector3();
-
-class Sphere {
-
- constructor( center = new Vector3(), radius = - 1 ) {
-
- this.center = center;
- this.radius = radius;
-
- }
-
- set( center, radius ) {
-
- this.center.copy( center );
- this.radius = radius;
-
- return this;
-
- }
-
- setFromPoints( points, optionalCenter ) {
-
- const center = this.center;
-
- if ( optionalCenter !== undefined ) {
-
- center.copy( optionalCenter );
-
- } else {
-
- _box.setFromPoints( points ).getCenter( center );
-
- }
-
- let maxRadiusSq = 0;
-
- for ( let i = 0, il = points.length; i < il; i ++ ) {
-
- maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
-
- }
-
- this.radius = Math.sqrt( maxRadiusSq );
-
- return this;
-
- }
-
- copy( sphere ) {
-
- this.center.copy( sphere.center );
- this.radius = sphere.radius;
-
- return this;
-
- }
-
- isEmpty() {
-
- return ( this.radius < 0 );
-
- }
-
- makeEmpty() {
-
- this.center.set( 0, 0, 0 );
- this.radius = - 1;
-
- return this;
-
- }
-
- containsPoint( point ) {
-
- return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );
-
- }
-
- distanceToPoint( point ) {
-
- return ( point.distanceTo( this.center ) - this.radius );
-
- }
-
- intersectsSphere( sphere ) {
-
- const radiusSum = this.radius + sphere.radius;
-
- return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );
-
- }
-
- intersectsBox( box ) {
-
- return box.intersectsSphere( this );
-
- }
-
- intersectsPlane( plane ) {
-
- return Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;
-
- }
-
- clampPoint( point, target ) {
-
- const deltaLengthSq = this.center.distanceToSquared( point );
-
- target.copy( point );
-
- if ( deltaLengthSq > ( this.radius * this.radius ) ) {
-
- target.sub( this.center ).normalize();
- target.multiplyScalar( this.radius ).add( this.center );
-
- }
-
- return target;
-
- }
-
- getBoundingBox( target ) {
-
- if ( this.isEmpty() ) {
-
- // Empty sphere produces empty bounding box
- target.makeEmpty();
- return target;
-
- }
-
- target.set( this.center, this.center );
- target.expandByScalar( this.radius );
-
- return target;
-
- }
-
- applyMatrix4( matrix ) {
-
- this.center.applyMatrix4( matrix );
- this.radius = this.radius * matrix.getMaxScaleOnAxis();
-
- return this;
-
- }
-
- translate( offset ) {
-
- this.center.add( offset );
-
- return this;
-
- }
-
- expandByPoint( point ) {
-
- // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
-
- _toPoint.subVectors( point, this.center );
-
- const lengthSq = _toPoint.lengthSq();
-
- if ( lengthSq > ( this.radius * this.radius ) ) {
-
- const length = Math.sqrt( lengthSq );
- const missingRadiusHalf = ( length - this.radius ) * 0.5;
-
- // Nudge this sphere towards the target point. Add half the missing distance to radius,
- // and the other half to position. This gives a tighter enclosure, instead of if
- // the whole missing distance were just added to radius.
-
- this.center.add( _toPoint.multiplyScalar( missingRadiusHalf / length ) );
- this.radius += missingRadiusHalf;
-
- }
-
- return this;
-
- }
-
- union( sphere ) {
-
- // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
-
- // To enclose another sphere into this sphere, we only need to enclose two points:
- // 1) Enclose the farthest point on the other sphere into this sphere.
- // 2) Enclose the opposite point of the farthest point into this sphere.
-
- _toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius );
-
- this.expandByPoint( _v1.copy( sphere.center ).add( _toFarthestPoint ) );
- this.expandByPoint( _v1.copy( sphere.center ).sub( _toFarthestPoint ) );
-
- return this;
-
- }
-
- equals( sphere ) {
-
- return sphere.center.equals( this.center ) && ( sphere.radius === this.radius );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Sphere };
diff --git a/GameDev/bin/Release/xmleditor/math/Spherical.js b/GameDev/bin/Release/xmleditor/math/Spherical.js
deleted file mode 100644
index 9b7bb6c6..00000000
--- a/GameDev/bin/Release/xmleditor/math/Spherical.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
- *
- * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
- * The azimuthal angle (theta) is measured from the positive z-axis.
- */
-
-import * as MathUtils from './MathUtils.js';
-
-class Spherical {
-
- constructor( radius = 1, phi = 0, theta = 0 ) {
-
- this.radius = radius;
- this.phi = phi; // polar angle
- this.theta = theta; // azimuthal angle
-
- return this;
-
- }
-
- set( radius, phi, theta ) {
-
- this.radius = radius;
- this.phi = phi;
- this.theta = theta;
-
- return this;
-
- }
-
- copy( other ) {
-
- this.radius = other.radius;
- this.phi = other.phi;
- this.theta = other.theta;
-
- return this;
-
- }
-
- // restrict phi to be betwee EPS and PI-EPS
- makeSafe() {
-
- const EPS = 0.000001;
- this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
-
- return this;
-
- }
-
- setFromVector3( v ) {
-
- return this.setFromCartesianCoords( v.x, v.y, v.z );
-
- }
-
- setFromCartesianCoords( x, y, z ) {
-
- this.radius = Math.sqrt( x * x + y * y + z * z );
-
- if ( this.radius === 0 ) {
-
- this.theta = 0;
- this.phi = 0;
-
- } else {
-
- this.theta = Math.atan2( x, z );
- this.phi = Math.acos( MathUtils.clamp( y / this.radius, - 1, 1 ) );
-
- }
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
-}
-
-export { Spherical };
diff --git a/GameDev/bin/Release/xmleditor/math/SphericalHarmonics3.js b/GameDev/bin/Release/xmleditor/math/SphericalHarmonics3.js
deleted file mode 100644
index 2d8796fb..00000000
--- a/GameDev/bin/Release/xmleditor/math/SphericalHarmonics3.js
+++ /dev/null
@@ -1,243 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-/**
- * Primary reference:
- * https://graphics.stanford.edu/papers/envmap/envmap.pdf
- *
- * Secondary reference:
- * https://www.ppsloan.org/publications/StupidSH36.pdf
- */
-
-// 3-band SH defined by 9 coefficients
-
-class SphericalHarmonics3 {
-
- constructor() {
-
- this.coefficients = [];
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients.push( new Vector3() );
-
- }
-
- }
-
- set( coefficients ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].copy( coefficients[ i ] );
-
- }
-
- return this;
-
- }
-
- zero() {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].set( 0, 0, 0 );
-
- }
-
- return this;
-
- }
-
- // get the radiance in the direction of the normal
- // target is a Vector3
- getAt( normal, target ) {
-
- // normal is assumed to be unit length
-
- const x = normal.x, y = normal.y, z = normal.z;
-
- const coeff = this.coefficients;
-
- // band 0
- target.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );
-
- // band 1
- target.addScaledVector( coeff[ 1 ], 0.488603 * y );
- target.addScaledVector( coeff[ 2 ], 0.488603 * z );
- target.addScaledVector( coeff[ 3 ], 0.488603 * x );
-
- // band 2
- target.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );
- target.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );
- target.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );
- target.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );
- target.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );
-
- return target;
-
- }
-
- // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal
- // target is a Vector3
- // https://graphics.stanford.edu/papers/envmap/envmap.pdf
- getIrradianceAt( normal, target ) {
-
- // normal is assumed to be unit length
-
- const x = normal.x, y = normal.y, z = normal.z;
-
- const coeff = this.coefficients;
-
- // band 0
- target.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095
-
- // band 1
- target.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603
- target.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );
- target.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );
-
- // band 2
- target.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548
- target.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );
- target.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3
- target.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );
- target.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274
-
- return target;
-
- }
-
- add( sh ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].add( sh.coefficients[ i ] );
-
- }
-
- return this;
-
- }
-
- addScaledSH( sh, s ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );
-
- }
-
- return this;
-
- }
-
- scale( s ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].multiplyScalar( s );
-
- }
-
- return this;
-
- }
-
- lerp( sh, alpha ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- this.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );
-
- }
-
- return this;
-
- }
-
- equals( sh ) {
-
- for ( let i = 0; i < 9; i ++ ) {
-
- if ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {
-
- return false;
-
- }
-
- }
-
- return true;
-
- }
-
- copy( sh ) {
-
- return this.set( sh.coefficients );
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- const coefficients = this.coefficients;
-
- for ( let i = 0; i < 9; i ++ ) {
-
- coefficients[ i ].fromArray( array, offset + ( i * 3 ) );
-
- }
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- const coefficients = this.coefficients;
-
- for ( let i = 0; i < 9; i ++ ) {
-
- coefficients[ i ].toArray( array, offset + ( i * 3 ) );
-
- }
-
- return array;
-
- }
-
- // evaluate the basis functions
- // shBasis is an Array[ 9 ]
- static getBasisAt( normal, shBasis ) {
-
- // normal is assumed to be unit length
-
- const x = normal.x, y = normal.y, z = normal.z;
-
- // band 0
- shBasis[ 0 ] = 0.282095;
-
- // band 1
- shBasis[ 1 ] = 0.488603 * y;
- shBasis[ 2 ] = 0.488603 * z;
- shBasis[ 3 ] = 0.488603 * x;
-
- // band 2
- shBasis[ 4 ] = 1.092548 * x * y;
- shBasis[ 5 ] = 1.092548 * y * z;
- shBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );
- shBasis[ 7 ] = 1.092548 * x * z;
- shBasis[ 8 ] = 0.546274 * ( x * x - y * y );
-
- }
-
-}
-
-SphericalHarmonics3.prototype.isSphericalHarmonics3 = true;
-
-export { SphericalHarmonics3 };
diff --git a/GameDev/bin/Release/xmleditor/math/Triangle.js b/GameDev/bin/Release/xmleditor/math/Triangle.js
deleted file mode 100644
index 617ca629..00000000
--- a/GameDev/bin/Release/xmleditor/math/Triangle.js
+++ /dev/null
@@ -1,299 +0,0 @@
-import { Vector3 } from './Vector3.js';
-
-const _v0 = /*@__PURE__*/ new Vector3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _v2 = /*@__PURE__*/ new Vector3();
-const _v3 = /*@__PURE__*/ new Vector3();
-
-const _vab = /*@__PURE__*/ new Vector3();
-const _vac = /*@__PURE__*/ new Vector3();
-const _vbc = /*@__PURE__*/ new Vector3();
-const _vap = /*@__PURE__*/ new Vector3();
-const _vbp = /*@__PURE__*/ new Vector3();
-const _vcp = /*@__PURE__*/ new Vector3();
-
-class Triangle {
-
- constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
-
- this.a = a;
- this.b = b;
- this.c = c;
-
- }
-
- static getNormal( a, b, c, target ) {
-
- target.subVectors( c, b );
- _v0.subVectors( a, b );
- target.cross( _v0 );
-
- const targetLengthSq = target.lengthSq();
- if ( targetLengthSq > 0 ) {
-
- return target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );
-
- }
-
- return target.set( 0, 0, 0 );
-
- }
-
- // static/instance method to calculate barycentric coordinates
- // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
- static getBarycoord( point, a, b, c, target ) {
-
- _v0.subVectors( c, a );
- _v1.subVectors( b, a );
- _v2.subVectors( point, a );
-
- const dot00 = _v0.dot( _v0 );
- const dot01 = _v0.dot( _v1 );
- const dot02 = _v0.dot( _v2 );
- const dot11 = _v1.dot( _v1 );
- const dot12 = _v1.dot( _v2 );
-
- const denom = ( dot00 * dot11 - dot01 * dot01 );
-
- // collinear or singular triangle
- if ( denom === 0 ) {
-
- // arbitrary location outside of triangle?
- // not sure if this is the best idea, maybe should be returning undefined
- return target.set( - 2, - 1, - 1 );
-
- }
-
- const invDenom = 1 / denom;
- const u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;
- const v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;
-
- // barycentric coordinates must always sum to 1
- return target.set( 1 - u - v, v, u );
-
- }
-
- static containsPoint( point, a, b, c ) {
-
- this.getBarycoord( point, a, b, c, _v3 );
-
- return ( _v3.x >= 0 ) && ( _v3.y >= 0 ) && ( ( _v3.x + _v3.y ) <= 1 );
-
- }
-
- static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) {
-
- this.getBarycoord( point, p1, p2, p3, _v3 );
-
- target.set( 0, 0 );
- target.addScaledVector( uv1, _v3.x );
- target.addScaledVector( uv2, _v3.y );
- target.addScaledVector( uv3, _v3.z );
-
- return target;
-
- }
-
- static isFrontFacing( a, b, c, direction ) {
-
- _v0.subVectors( c, b );
- _v1.subVectors( a, b );
-
- // strictly front facing
- return ( _v0.cross( _v1 ).dot( direction ) < 0 ) ? true : false;
-
- }
-
- set( a, b, c ) {
-
- this.a.copy( a );
- this.b.copy( b );
- this.c.copy( c );
-
- return this;
-
- }
-
- setFromPointsAndIndices( points, i0, i1, i2 ) {
-
- this.a.copy( points[ i0 ] );
- this.b.copy( points[ i1 ] );
- this.c.copy( points[ i2 ] );
-
- return this;
-
- }
-
- setFromAttributeAndIndices( attribute, i0, i1, i2 ) {
-
- this.a.fromBufferAttribute( attribute, i0 );
- this.b.fromBufferAttribute( attribute, i1 );
- this.c.fromBufferAttribute( attribute, i2 );
-
- return this;
-
- }
-
- clone() {
-
- return new this.constructor().copy( this );
-
- }
-
- copy( triangle ) {
-
- this.a.copy( triangle.a );
- this.b.copy( triangle.b );
- this.c.copy( triangle.c );
-
- return this;
-
- }
-
- getArea() {
-
- _v0.subVectors( this.c, this.b );
- _v1.subVectors( this.a, this.b );
-
- return _v0.cross( _v1 ).length() * 0.5;
-
- }
-
- getMidpoint( target ) {
-
- return target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );
-
- }
-
- getNormal( target ) {
-
- return Triangle.getNormal( this.a, this.b, this.c, target );
-
- }
-
- getPlane( target ) {
-
- return target.setFromCoplanarPoints( this.a, this.b, this.c );
-
- }
-
- getBarycoord( point, target ) {
-
- return Triangle.getBarycoord( point, this.a, this.b, this.c, target );
-
- }
-
- getUV( point, uv1, uv2, uv3, target ) {
-
- return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
-
- }
-
- containsPoint( point ) {
-
- return Triangle.containsPoint( point, this.a, this.b, this.c );
-
- }
-
- isFrontFacing( direction ) {
-
- return Triangle.isFrontFacing( this.a, this.b, this.c, direction );
-
- }
-
- intersectsBox( box ) {
-
- return box.intersectsTriangle( this );
-
- }
-
- closestPointToPoint( p, target ) {
-
- const a = this.a, b = this.b, c = this.c;
- let v, w;
-
- // algorithm thanks to Real-Time Collision Detection by Christer Ericson,
- // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,
- // under the accompanying license; see chapter 5.1.5 for detailed explanation.
- // basically, we're distinguishing which of the voronoi regions of the triangle
- // the point lies in with the minimum amount of redundant computation.
-
- _vab.subVectors( b, a );
- _vac.subVectors( c, a );
- _vap.subVectors( p, a );
- const d1 = _vab.dot( _vap );
- const d2 = _vac.dot( _vap );
- if ( d1 <= 0 && d2 <= 0 ) {
-
- // vertex region of A; barycentric coords (1, 0, 0)
- return target.copy( a );
-
- }
-
- _vbp.subVectors( p, b );
- const d3 = _vab.dot( _vbp );
- const d4 = _vac.dot( _vbp );
- if ( d3 >= 0 && d4 <= d3 ) {
-
- // vertex region of B; barycentric coords (0, 1, 0)
- return target.copy( b );
-
- }
-
- const vc = d1 * d4 - d3 * d2;
- if ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {
-
- v = d1 / ( d1 - d3 );
- // edge region of AB; barycentric coords (1-v, v, 0)
- return target.copy( a ).addScaledVector( _vab, v );
-
- }
-
- _vcp.subVectors( p, c );
- const d5 = _vab.dot( _vcp );
- const d6 = _vac.dot( _vcp );
- if ( d6 >= 0 && d5 <= d6 ) {
-
- // vertex region of C; barycentric coords (0, 0, 1)
- return target.copy( c );
-
- }
-
- const vb = d5 * d2 - d1 * d6;
- if ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {
-
- w = d2 / ( d2 - d6 );
- // edge region of AC; barycentric coords (1-w, 0, w)
- return target.copy( a ).addScaledVector( _vac, w );
-
- }
-
- const va = d3 * d6 - d5 * d4;
- if ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {
-
- _vbc.subVectors( c, b );
- w = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );
- // edge region of BC; barycentric coords (0, 1-w, w)
- return target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC
-
- }
-
- // face region
- const denom = 1 / ( va + vb + vc );
- // u = va * denom
- v = vb * denom;
- w = vc * denom;
-
- return target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );
-
- }
-
- equals( triangle ) {
-
- return triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );
-
- }
-
-}
-
-export { Triangle };
diff --git a/GameDev/bin/Release/xmleditor/math/Vector2.js b/GameDev/bin/Release/xmleditor/math/Vector2.js
deleted file mode 100644
index 88592aa3..00000000
--- a/GameDev/bin/Release/xmleditor/math/Vector2.js
+++ /dev/null
@@ -1,484 +0,0 @@
-class Vector2 {
-
- constructor( x = 0, y = 0 ) {
-
- this.x = x;
- this.y = y;
-
- }
-
- get width() {
-
- return this.x;
-
- }
-
- set width( value ) {
-
- this.x = value;
-
- }
-
- get height() {
-
- return this.y;
-
- }
-
- set height( value ) {
-
- this.y = value;
-
- }
-
- set( x, y ) {
-
- this.x = x;
- this.y = y;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- case 0: return this.x;
- case 1: return this.y;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
-
- return this;
-
- }
-
- multiply( v ) {
-
- this.x *= v.x;
- this.y *= v.y;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
-
- return this;
-
- }
-
- divide( v ) {
-
- this.x /= v.x;
- this.y /= v.y;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- applyMatrix3( m ) {
-
- const x = this.x, y = this.y;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];
- this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];
-
- return this;
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y;
-
- }
-
- cross( v ) {
-
- return this.x * v.y - this.y * v.x;
-
- }
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- angle() {
-
- // computes the angle in radians with respect to the positive x-axis
-
- const angle = Math.atan2( - this.y, - this.x ) + Math.PI;
-
- return angle;
-
- }
-
- distanceTo( v ) {
-
- return Math.sqrt( this.distanceToSquared( v ) );
-
- }
-
- distanceToSquared( v ) {
-
- const dx = this.x - v.x, dy = this.y - v.y;
- return dx * dx + dy * dy;
-
- }
-
- manhattanDistanceTo( v ) {
-
- return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
-
- return this;
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
-
- return this;
-
- }
-
- rotateAround( center, angle ) {
-
- const c = Math.cos( angle ), s = Math.sin( angle );
-
- const x = this.x - center.x;
- const y = this.y - center.y;
-
- this.x = x * c - y * s + center.x;
- this.y = x * s + y * c + center.y;
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
-
- }
-
-}
-
-Vector2.prototype.isVector2 = true;
-
-export { Vector2 };
diff --git a/GameDev/bin/Release/xmleditor/math/Vector3.js b/GameDev/bin/Release/xmleditor/math/Vector3.js
deleted file mode 100644
index d3303860..00000000
--- a/GameDev/bin/Release/xmleditor/math/Vector3.js
+++ /dev/null
@@ -1,745 +0,0 @@
-import * as MathUtils from './MathUtils.js';
-import { Quaternion } from './Quaternion.js';
-
-class Vector3 {
-
- constructor( x = 0, y = 0, z = 0 ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
-
- }
-
- set( x, y, z ) {
-
- if ( z === undefined ) z = this.z; // sprite.scale.set(x,y)
-
- this.x = x;
- this.y = y;
- this.z = z;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
- this.z = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setZ( z ) {
-
- this.z = z;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- case 2: this.z = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- case 0: return this.x;
- case 1: return this.y;
- case 2: return this.z;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y, this.z );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
- this.z = v.z;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
- this.z += v.z;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
- this.z += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
- this.z = a.z + b.z;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
- this.z += v.z * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
- this.z -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
- this.z = a.z - b.z;
-
- return this;
-
- }
-
- multiply( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );
- return this.multiplyVectors( v, w );
-
- }
-
- this.x *= v.x;
- this.y *= v.y;
- this.z *= v.z;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
- this.z *= scalar;
-
- return this;
-
- }
-
- multiplyVectors( a, b ) {
-
- this.x = a.x * b.x;
- this.y = a.y * b.y;
- this.z = a.z * b.z;
-
- return this;
-
- }
-
- applyEuler( euler ) {
-
- if ( ! ( euler && euler.isEuler ) ) {
-
- console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' );
-
- }
-
- return this.applyQuaternion( _quaternion.setFromEuler( euler ) );
-
- }
-
- applyAxisAngle( axis, angle ) {
-
- return this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) );
-
- }
-
- applyMatrix3( m ) {
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;
- this.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;
- this.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;
-
- return this;
-
- }
-
- applyNormalMatrix( m ) {
-
- return this.applyMatrix3( m ).normalize();
-
- }
-
- applyMatrix4( m ) {
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- const w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );
-
- this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;
- this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;
- this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;
-
- return this;
-
- }
-
- applyQuaternion( q ) {
-
- const x = this.x, y = this.y, z = this.z;
- const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
-
- // calculate quat * vector
-
- const ix = qw * x + qy * z - qz * y;
- const iy = qw * y + qz * x - qx * z;
- const iz = qw * z + qx * y - qy * x;
- const iw = - qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
-
- this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;
- this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;
- this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;
-
- return this;
-
- }
-
- project( camera ) {
-
- return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );
-
- }
-
- unproject( camera ) {
-
- return this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );
-
- }
-
- transformDirection( m ) {
-
- // input: THREE.Matrix4 affine matrix
- // vector interpreted as a direction
-
- const x = this.x, y = this.y, z = this.z;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;
- this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;
- this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;
-
- return this.normalize();
-
- }
-
- divide( v ) {
-
- this.x /= v.x;
- this.y /= v.y;
- this.z /= v.z;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
- this.z = Math.min( this.z, v.z );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
- this.z = Math.max( this.z, v.z );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
- this.z = Math.floor( this.z );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
- this.z = Math.ceil( this.z );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
- this.z = Math.round( this.z );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
- this.z = - this.z;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y + this.z * v.z;
-
- }
-
- // TODO lengthSquared?
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y + this.z * this.z;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
- this.z += ( v.z - this.z ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
- this.z = v1.z + ( v2.z - v1.z ) * alpha;
-
- return this;
-
- }
-
- cross( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );
- return this.crossVectors( v, w );
-
- }
-
- return this.crossVectors( this, v );
-
- }
-
- crossVectors( a, b ) {
-
- const ax = a.x, ay = a.y, az = a.z;
- const bx = b.x, by = b.y, bz = b.z;
-
- this.x = ay * bz - az * by;
- this.y = az * bx - ax * bz;
- this.z = ax * by - ay * bx;
-
- return this;
-
- }
-
- projectOnVector( v ) {
-
- const denominator = v.lengthSq();
-
- if ( denominator === 0 ) return this.set( 0, 0, 0 );
-
- const scalar = v.dot( this ) / denominator;
-
- return this.copy( v ).multiplyScalar( scalar );
-
- }
-
- projectOnPlane( planeNormal ) {
-
- _vector.copy( this ).projectOnVector( planeNormal );
-
- return this.sub( _vector );
-
- }
-
- reflect( normal ) {
-
- // reflect incident vector off plane orthogonal to normal
- // normal is assumed to have unit length
-
- return this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
-
- }
-
- angleTo( v ) {
-
- const denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );
-
- if ( denominator === 0 ) return Math.PI / 2;
-
- const theta = this.dot( v ) / denominator;
-
- // clamp, to handle numerical problems
-
- return Math.acos( MathUtils.clamp( theta, - 1, 1 ) );
-
- }
-
- distanceTo( v ) {
-
- return Math.sqrt( this.distanceToSquared( v ) );
-
- }
-
- distanceToSquared( v ) {
-
- const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
-
- return dx * dx + dy * dy + dz * dz;
-
- }
-
- manhattanDistanceTo( v ) {
-
- return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );
-
- }
-
- setFromSpherical( s ) {
-
- return this.setFromSphericalCoords( s.radius, s.phi, s.theta );
-
- }
-
- setFromSphericalCoords( radius, phi, theta ) {
-
- const sinPhiRadius = Math.sin( phi ) * radius;
-
- this.x = sinPhiRadius * Math.sin( theta );
- this.y = Math.cos( phi ) * radius;
- this.z = sinPhiRadius * Math.cos( theta );
-
- return this;
-
- }
-
- setFromCylindrical( c ) {
-
- return this.setFromCylindricalCoords( c.radius, c.theta, c.y );
-
- }
-
- setFromCylindricalCoords( radius, theta, y ) {
-
- this.x = radius * Math.sin( theta );
- this.y = y;
- this.z = radius * Math.cos( theta );
-
- return this;
-
- }
-
- setFromMatrixPosition( m ) {
-
- const e = m.elements;
-
- this.x = e[ 12 ];
- this.y = e[ 13 ];
- this.z = e[ 14 ];
-
- return this;
-
- }
-
- setFromMatrixScale( m ) {
-
- const sx = this.setFromMatrixColumn( m, 0 ).length();
- const sy = this.setFromMatrixColumn( m, 1 ).length();
- const sz = this.setFromMatrixColumn( m, 2 ).length();
-
- this.x = sx;
- this.y = sy;
- this.z = sz;
-
- return this;
-
- }
-
- setFromMatrixColumn( m, index ) {
-
- return this.fromArray( m.elements, index * 4 );
-
- }
-
- setFromMatrix3Column( m, index ) {
-
- return this.fromArray( m.elements, index * 3 );
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
- this.z = array[ offset + 2 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
- array[ offset + 2 ] = this.z;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
- this.z = attribute.getZ( index );
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
- this.z = Math.random();
-
- return this;
-
- }
-
- randomDirection() {
-
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
-
- const u = ( Math.random() - 0.5 ) * 2;
- const t = Math.random() * Math.PI * 2;
- const f = Math.sqrt( 1 - u ** 2 );
-
- this.x = f * Math.cos( t );
- this.y = f * Math.sin( t );
- this.z = u;
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
- yield this.z;
-
- }
-
-}
-
-Vector3.prototype.isVector3 = true;
-
-const _vector = /*@__PURE__*/ new Vector3();
-const _quaternion = /*@__PURE__*/ new Quaternion();
-
-export { Vector3 };
diff --git a/GameDev/bin/Release/xmleditor/math/Vector4.js b/GameDev/bin/Release/xmleditor/math/Vector4.js
deleted file mode 100644
index c9af047a..00000000
--- a/GameDev/bin/Release/xmleditor/math/Vector4.js
+++ /dev/null
@@ -1,664 +0,0 @@
-class Vector4 {
-
- constructor( x = 0, y = 0, z = 0, w = 1 ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
-
- }
-
- get width() {
-
- return this.z;
-
- }
-
- set width( value ) {
-
- this.z = value;
-
- }
-
- get height() {
-
- return this.w;
-
- }
-
- set height( value ) {
-
- this.w = value;
-
- }
-
- set( x, y, z, w ) {
-
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
-
- return this;
-
- }
-
- setScalar( scalar ) {
-
- this.x = scalar;
- this.y = scalar;
- this.z = scalar;
- this.w = scalar;
-
- return this;
-
- }
-
- setX( x ) {
-
- this.x = x;
-
- return this;
-
- }
-
- setY( y ) {
-
- this.y = y;
-
- return this;
-
- }
-
- setZ( z ) {
-
- this.z = z;
-
- return this;
-
- }
-
- setW( w ) {
-
- this.w = w;
-
- return this;
-
- }
-
- setComponent( index, value ) {
-
- switch ( index ) {
-
- case 0: this.x = value; break;
- case 1: this.y = value; break;
- case 2: this.z = value; break;
- case 3: this.w = value; break;
- default: throw new Error( 'index is out of range: ' + index );
-
- }
-
- return this;
-
- }
-
- getComponent( index ) {
-
- switch ( index ) {
-
- 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: ' + index );
-
- }
-
- }
-
- clone() {
-
- return new this.constructor( this.x, this.y, this.z, this.w );
-
- }
-
- copy( v ) {
-
- this.x = v.x;
- this.y = v.y;
- this.z = v.z;
- this.w = ( v.w !== undefined ) ? v.w : 1;
-
- return this;
-
- }
-
- add( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
- return this.addVectors( v, w );
-
- }
-
- this.x += v.x;
- this.y += v.y;
- this.z += v.z;
- this.w += v.w;
-
- return this;
-
- }
-
- addScalar( s ) {
-
- this.x += s;
- this.y += s;
- this.z += s;
- this.w += s;
-
- return this;
-
- }
-
- addVectors( a, b ) {
-
- this.x = a.x + b.x;
- this.y = a.y + b.y;
- this.z = a.z + b.z;
- this.w = a.w + b.w;
-
- return this;
-
- }
-
- addScaledVector( v, s ) {
-
- this.x += v.x * s;
- this.y += v.y * s;
- this.z += v.z * s;
- this.w += v.w * s;
-
- return this;
-
- }
-
- sub( v, w ) {
-
- if ( w !== undefined ) {
-
- console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
- return this.subVectors( v, w );
-
- }
-
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z;
- this.w -= v.w;
-
- return this;
-
- }
-
- subScalar( s ) {
-
- this.x -= s;
- this.y -= s;
- this.z -= s;
- this.w -= s;
-
- return this;
-
- }
-
- subVectors( a, b ) {
-
- this.x = a.x - b.x;
- this.y = a.y - b.y;
- this.z = a.z - b.z;
- this.w = a.w - b.w;
-
- return this;
-
- }
-
- multiply( v ) {
-
- this.x *= v.x;
- this.y *= v.y;
- this.z *= v.z;
- this.w *= v.w;
-
- return this;
-
- }
-
- multiplyScalar( scalar ) {
-
- this.x *= scalar;
- this.y *= scalar;
- this.z *= scalar;
- this.w *= scalar;
-
- return this;
-
- }
-
- applyMatrix4( m ) {
-
- const x = this.x, y = this.y, z = this.z, w = this.w;
- const e = m.elements;
-
- this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;
- this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;
- this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;
- this.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;
-
- return this;
-
- }
-
- divideScalar( scalar ) {
-
- return this.multiplyScalar( 1 / scalar );
-
- }
-
- setAxisAngleFromQuaternion( q ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
-
- // q is assumed to be normalized
-
- this.w = 2 * Math.acos( q.w );
-
- const s = Math.sqrt( 1 - q.w * q.w );
-
- if ( s < 0.0001 ) {
-
- this.x = 1;
- this.y = 0;
- this.z = 0;
-
- } else {
-
- this.x = q.x / s;
- this.y = q.y / s;
- this.z = q.z / s;
-
- }
-
- return this;
-
- }
-
- setAxisAngleFromRotationMatrix( m ) {
-
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
-
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
- let angle, x, y, z; // variables for result
- const epsilon = 0.01, // margin to allow for rounding errors
- epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees
-
- te = m.elements,
-
- m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],
- m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],
- m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
-
- if ( ( Math.abs( m12 - m21 ) < epsilon ) &&
- ( Math.abs( m13 - m31 ) < epsilon ) &&
- ( Math.abs( m23 - m32 ) < epsilon ) ) {
-
- // singularity found
- // first check for identity matrix which must have +1 for all terms
- // in leading diagonal and zero in other terms
-
- if ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&
- ( Math.abs( m13 + m31 ) < epsilon2 ) &&
- ( Math.abs( m23 + m32 ) < epsilon2 ) &&
- ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {
-
- // this singularity is identity matrix so angle = 0
-
- this.set( 1, 0, 0, 0 );
-
- return this; // zero angle, arbitrary axis
-
- }
-
- // otherwise this singularity is angle = 180
-
- angle = Math.PI;
-
- const xx = ( m11 + 1 ) / 2;
- const yy = ( m22 + 1 ) / 2;
- const zz = ( m33 + 1 ) / 2;
- const xy = ( m12 + m21 ) / 4;
- const xz = ( m13 + m31 ) / 4;
- const yz = ( m23 + m32 ) / 4;
-
- if ( ( xx > yy ) && ( xx > zz ) ) {
-
- // m11 is the largest diagonal term
-
- if ( xx < epsilon ) {
-
- x = 0;
- y = 0.707106781;
- z = 0.707106781;
-
- } else {
-
- x = Math.sqrt( xx );
- y = xy / x;
- z = xz / x;
-
- }
-
- } else if ( yy > zz ) {
-
- // m22 is the largest diagonal term
-
- if ( yy < epsilon ) {
-
- x = 0.707106781;
- y = 0;
- z = 0.707106781;
-
- } else {
-
- y = Math.sqrt( yy );
- x = xy / y;
- z = yz / y;
-
- }
-
- } else {
-
- // m33 is the largest diagonal term so base result on this
-
- if ( zz < epsilon ) {
-
- x = 0.707106781;
- y = 0.707106781;
- z = 0;
-
- } else {
-
- z = Math.sqrt( zz );
- x = xz / z;
- y = yz / z;
-
- }
-
- }
-
- this.set( x, y, z, angle );
-
- return this; // return 180 deg rotation
-
- }
-
- // as we have reached here there are no singularities so we can handle normally
-
- let s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +
- ( m13 - m31 ) * ( m13 - m31 ) +
- ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize
-
- if ( Math.abs( s ) < 0.001 ) s = 1;
-
- // prevent divide by zero, should not happen if matrix is orthogonal and should be
- // caught by singularity test above, but I've left it in just in case
-
- this.x = ( m32 - m23 ) / s;
- this.y = ( m13 - m31 ) / s;
- this.z = ( m21 - m12 ) / s;
- this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );
-
- return this;
-
- }
-
- min( v ) {
-
- this.x = Math.min( this.x, v.x );
- this.y = Math.min( this.y, v.y );
- this.z = Math.min( this.z, v.z );
- this.w = Math.min( this.w, v.w );
-
- return this;
-
- }
-
- max( v ) {
-
- this.x = Math.max( this.x, v.x );
- this.y = Math.max( this.y, v.y );
- this.z = Math.max( this.z, v.z );
- this.w = Math.max( this.w, v.w );
-
- return this;
-
- }
-
- clamp( min, max ) {
-
- // assumes min < max, componentwise
-
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
- this.w = Math.max( min.w, Math.min( max.w, this.w ) );
-
- return this;
-
- }
-
- clampScalar( minVal, maxVal ) {
-
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
- this.w = Math.max( minVal, Math.min( maxVal, this.w ) );
-
- return this;
-
- }
-
- clampLength( min, max ) {
-
- const length = this.length();
-
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
-
- }
-
- floor() {
-
- this.x = Math.floor( this.x );
- this.y = Math.floor( this.y );
- this.z = Math.floor( this.z );
- this.w = Math.floor( this.w );
-
- return this;
-
- }
-
- ceil() {
-
- this.x = Math.ceil( this.x );
- this.y = Math.ceil( this.y );
- this.z = Math.ceil( this.z );
- this.w = Math.ceil( this.w );
-
- return this;
-
- }
-
- round() {
-
- this.x = Math.round( this.x );
- this.y = Math.round( this.y );
- this.z = Math.round( this.z );
- this.w = Math.round( this.w );
-
- return this;
-
- }
-
- roundToZero() {
-
- 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 );
-
- return this;
-
- }
-
- negate() {
-
- this.x = - this.x;
- this.y = - this.y;
- this.z = - this.z;
- this.w = - this.w;
-
- return this;
-
- }
-
- dot( v ) {
-
- return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
-
- }
-
- lengthSq() {
-
- return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
-
- }
-
- length() {
-
- return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
-
- }
-
- manhattanLength() {
-
- return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );
-
- }
-
- normalize() {
-
- return this.divideScalar( this.length() || 1 );
-
- }
-
- setLength( length ) {
-
- return this.normalize().multiplyScalar( length );
-
- }
-
- lerp( v, alpha ) {
-
- this.x += ( v.x - this.x ) * alpha;
- this.y += ( v.y - this.y ) * alpha;
- this.z += ( v.z - this.z ) * alpha;
- this.w += ( v.w - this.w ) * alpha;
-
- return this;
-
- }
-
- lerpVectors( v1, v2, alpha ) {
-
- this.x = v1.x + ( v2.x - v1.x ) * alpha;
- this.y = v1.y + ( v2.y - v1.y ) * alpha;
- this.z = v1.z + ( v2.z - v1.z ) * alpha;
- this.w = v1.w + ( v2.w - v1.w ) * alpha;
-
- return this;
-
- }
-
- equals( v ) {
-
- return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );
-
- }
-
- fromArray( array, offset = 0 ) {
-
- this.x = array[ offset ];
- this.y = array[ offset + 1 ];
- this.z = array[ offset + 2 ];
- this.w = array[ offset + 3 ];
-
- return this;
-
- }
-
- toArray( array = [], offset = 0 ) {
-
- array[ offset ] = this.x;
- array[ offset + 1 ] = this.y;
- array[ offset + 2 ] = this.z;
- array[ offset + 3 ] = this.w;
-
- return array;
-
- }
-
- fromBufferAttribute( attribute, index, offset ) {
-
- if ( offset !== undefined ) {
-
- console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );
-
- }
-
- this.x = attribute.getX( index );
- this.y = attribute.getY( index );
- this.z = attribute.getZ( index );
- this.w = attribute.getW( index );
-
- return this;
-
- }
-
- random() {
-
- this.x = Math.random();
- this.y = Math.random();
- this.z = Math.random();
- this.w = Math.random();
-
- return this;
-
- }
-
- *[ Symbol.iterator ]() {
-
- yield this.x;
- yield this.y;
- yield this.z;
- yield this.w;
-
- }
-
-}
-
-Vector4.prototype.isVector4 = true;
-
-export { Vector4 };
diff --git a/GameDev/bin/Release/xmleditor/math/interpolants/CubicInterpolant.js b/GameDev/bin/Release/xmleditor/math/interpolants/CubicInterpolant.js
deleted file mode 100644
index 3484dbfa..00000000
--- a/GameDev/bin/Release/xmleditor/math/interpolants/CubicInterpolant.js
+++ /dev/null
@@ -1,151 +0,0 @@
-import { ZeroCurvatureEnding } from '../../constants.js';
-import { Interpolant } from '../Interpolant.js';
-import { WrapAroundEnding, ZeroSlopeEnding } from '../../constants.js';
-
-/**
- * Fast and simple cubic spline interpolant.
- *
- * It was derived from a Hermitian construction setting the first derivative
- * at each sample position to the linear slope between neighboring positions
- * over their parameter interval.
- */
-
-class CubicInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- this._weightPrev = - 0;
- this._offsetPrev = - 0;
- this._weightNext = - 0;
- this._offsetNext = - 0;
-
- this.DefaultSettings_ = {
-
- endingStart: ZeroCurvatureEnding,
- endingEnd: ZeroCurvatureEnding
-
- };
-
- }
-
- intervalChanged_( i1, t0, t1 ) {
-
- const pp = this.parameterPositions;
- let iPrev = i1 - 2,
- iNext = i1 + 1,
-
- tPrev = pp[ iPrev ],
- tNext = pp[ iNext ];
-
- if ( tPrev === undefined ) {
-
- switch ( this.getSettings_().endingStart ) {
-
- case ZeroSlopeEnding:
-
- // f'(t0) = 0
- iPrev = i1;
- tPrev = 2 * t0 - t1;
-
- break;
-
- case WrapAroundEnding:
-
- // use the other end of the curve
- iPrev = pp.length - 2;
- tPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];
-
- break;
-
- default: // ZeroCurvatureEnding
-
- // f''(t0) = 0 a.k.a. Natural Spline
- iPrev = i1;
- tPrev = t1;
-
- }
-
- }
-
- if ( tNext === undefined ) {
-
- switch ( this.getSettings_().endingEnd ) {
-
- case ZeroSlopeEnding:
-
- // f'(tN) = 0
- iNext = i1;
- tNext = 2 * t1 - t0;
-
- break;
-
- case WrapAroundEnding:
-
- // use the other end of the curve
- iNext = 1;
- tNext = t1 + pp[ 1 ] - pp[ 0 ];
-
- break;
-
- default: // ZeroCurvatureEnding
-
- // f''(tN) = 0, a.k.a. Natural Spline
- iNext = i1 - 1;
- tNext = t0;
-
- }
-
- }
-
- const halfDt = ( t1 - t0 ) * 0.5,
- stride = this.valueSize;
-
- this._weightPrev = halfDt / ( t0 - tPrev );
- this._weightNext = halfDt / ( tNext - t1 );
- this._offsetPrev = iPrev * stride;
- this._offsetNext = iNext * stride;
-
- }
-
- interpolate_( i1, t0, t, t1 ) {
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
-
- o1 = i1 * stride, o0 = o1 - stride,
- oP = this._offsetPrev, oN = this._offsetNext,
- wP = this._weightPrev, wN = this._weightNext,
-
- p = ( t - t0 ) / ( t1 - t0 ),
- pp = p * p,
- ppp = pp * p;
-
- // evaluate polynomials
-
- const sP = - wP * ppp + 2 * wP * pp - wP * p;
- const s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;
- const s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;
- const sN = wN * ppp - wN * pp;
-
- // combine data linearly
-
- for ( let i = 0; i !== stride; ++ i ) {
-
- result[ i ] =
- sP * values[ oP + i ] +
- s0 * values[ o0 + i ] +
- s1 * values[ o1 + i ] +
- sN * values[ oN + i ];
-
- }
-
- return result;
-
- }
-
-}
-
-export { CubicInterpolant };
diff --git a/GameDev/bin/Release/xmleditor/math/interpolants/DiscreteInterpolant.js b/GameDev/bin/Release/xmleditor/math/interpolants/DiscreteInterpolant.js
deleted file mode 100644
index 38ff2702..00000000
--- a/GameDev/bin/Release/xmleditor/math/interpolants/DiscreteInterpolant.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Interpolant } from '../Interpolant.js';
-
-/**
- *
- * Interpolant that evaluates to the sample value at the position preceeding
- * the parameter.
- */
-
-class DiscreteInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- }
-
- interpolate_( i1 /*, t0, t, t1 */ ) {
-
- return this.copySampleValue_( i1 - 1 );
-
- }
-
-}
-
-
-export { DiscreteInterpolant };
diff --git a/GameDev/bin/Release/xmleditor/math/interpolants/LinearInterpolant.js b/GameDev/bin/Release/xmleditor/math/interpolants/LinearInterpolant.js
deleted file mode 100644
index dae736e2..00000000
--- a/GameDev/bin/Release/xmleditor/math/interpolants/LinearInterpolant.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Interpolant } from '../Interpolant.js';
-
-class LinearInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- }
-
- interpolate_( i1, t0, t, t1 ) {
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
-
- offset1 = i1 * stride,
- offset0 = offset1 - stride,
-
- weight1 = ( t - t0 ) / ( t1 - t0 ),
- weight0 = 1 - weight1;
-
- for ( let i = 0; i !== stride; ++ i ) {
-
- result[ i ] =
- values[ offset0 + i ] * weight0 +
- values[ offset1 + i ] * weight1;
-
- }
-
- return result;
-
- }
-
-}
-
-
-export { LinearInterpolant };
diff --git a/GameDev/bin/Release/xmleditor/math/interpolants/QuaternionLinearInterpolant.js b/GameDev/bin/Release/xmleditor/math/interpolants/QuaternionLinearInterpolant.js
deleted file mode 100644
index 3b8bd4f2..00000000
--- a/GameDev/bin/Release/xmleditor/math/interpolants/QuaternionLinearInterpolant.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import { Interpolant } from '../Interpolant.js';
-import { Quaternion } from '../Quaternion.js';
-
-/**
- * Spherical linear unit quaternion interpolant.
- */
-
-class QuaternionLinearInterpolant extends Interpolant {
-
- constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
-
- super( parameterPositions, sampleValues, sampleSize, resultBuffer );
-
- }
-
- interpolate_( i1, t0, t, t1 ) {
-
- const result = this.resultBuffer,
- values = this.sampleValues,
- stride = this.valueSize,
-
- alpha = ( t - t0 ) / ( t1 - t0 );
-
- let offset = i1 * stride;
-
- for ( let end = offset + stride; offset !== end; offset += 4 ) {
-
- Quaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );
-
- }
-
- return result;
-
- }
-
-}
-
-
-export { QuaternionLinearInterpolant };
diff --git a/GameDev/bin/Release/xmleditor/project.json b/GameDev/bin/Release/xmleditor/project.json
deleted file mode 100644
index 0e10adf8..00000000
--- a/GameDev/bin/Release/xmleditor/project.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "project_name": "xmleditor",
- "targets": [
- {
- "name": "Target",
- "input": "index.js",
- "output": "bundle_index.js",
- "dirty": false
- }
- ]
-}
\ No newline at end of file
diff --git a/GameDev/bin/Release/xmleditor/txml.js b/GameDev/bin/Release/xmleditor/txml.js
deleted file mode 100644
index e1a81018..00000000
--- a/GameDev/bin/Release/xmleditor/txml.js
+++ /dev/null
@@ -1,482 +0,0 @@
-'use strict';
-
-// ==ClosureCompiler==
-// @output_file_name default.js
-// @compilation_level SIMPLE_OPTIMIZATIONS
-// ==/ClosureCompiler==
-// module.exports = {
-// parse: parse,
-// simplify: simplify,
-// simplifyLostLess: simplifyLostLess,
-// filter: filter,
-// stringify: stringify,
-// toContentString: toContentString,
-// getElementById: getElementById,
-// getElementsByClassName: getElementsByClassName,
-// transformStream: transformStream,
-// };
-
-/**
- * @author: Tobias Nickel
- * @created: 06.04.2015
- * I needed a small xmlparser chat can be used in a worker.
- */
-
-/**
- * @typedef tNode
- * @property {string} tagName
- * @property {object} attributes
- * @property {(tNode|string)[]} children
- **/
-
-/**
- * @typedef TParseOptions
- * @property {number} [pos]
- * @property {string[]} [noChildNodes]
- * @property {boolean} [setPos]
- * @property {boolean} [keepComments]
- * @property {boolean} [keepWhitespace]
- * @property {boolean} [simplify]
- * @property {(a: tNode, b: tNode) => boolean} [filter]
- */
-
-/**
- * parseXML / html into a DOM Object. with no validation and some failur tolerance
- * @param {string} S your XML to parse
- * @param {TParseOptions} [options] all other options:
- * @return {(tNode | string)[]}
- */
-function parse(S, options) {
- "txml";
- options = options || {};
-
- var pos = options.pos || 0;
- var keepComments = !!options.keepComments;
- var keepWhitespace = !!options.keepWhitespace;
-
- var openBracket = "<";
- var openBracketCC = "<".charCodeAt(0);
- var closeBracket = ">";
- var closeBracketCC = ">".charCodeAt(0);
- var minusCC = "-".charCodeAt(0);
- var slashCC = "/".charCodeAt(0);
- var exclamationCC = '!'.charCodeAt(0);
- var singleQuoteCC = "'".charCodeAt(0);
- var doubleQuoteCC = '"'.charCodeAt(0);
- var openCornerBracketCC = '['.charCodeAt(0);
- var closeCornerBracketCC = ']'.charCodeAt(0);
-
-
- /**
- * parsing a list of entries
- */
- function parseChildren(tagName) {
- var children = [];
- while (S[pos]) {
- if (S.charCodeAt(pos) == openBracketCC) {
- if (S.charCodeAt(pos + 1) === slashCC) {
- var closeStart = pos + 2;
- pos = S.indexOf(closeBracket, pos);
-
- var closeTag = S.substring(closeStart, pos);
- if (closeTag.indexOf(tagName) == -1) {
- var parsedText = S.substring(0, pos).split('\n');
- throw new Error(
- 'Unexpected close tag\nLine: ' + (parsedText.length - 1) +
- '\nColumn: ' + (parsedText[parsedText.length - 1].length + 1) +
- '\nChar: ' + S[pos]
- );
- }
-
- if (pos + 1) pos += 1;
-
- return children;
- } else if (S.charCodeAt(pos + 1) === exclamationCC) {
- if (S.charCodeAt(pos + 2) == minusCC) {
- //comment support
- const startCommentPos = pos;
- while (pos !== -1 && !(S.charCodeAt(pos) === closeBracketCC && S.charCodeAt(pos - 1) == minusCC && S.charCodeAt(pos - 2) == minusCC && pos != -1)) {
- pos = S.indexOf(closeBracket, pos + 1);
- }
- if (pos === -1) {
- pos = S.length;
- }
- if (keepComments) {
- children.push(S.substring(startCommentPos, pos + 1));
- }
- } else if (
- S.charCodeAt(pos + 2) === openCornerBracketCC &&
- S.charCodeAt(pos + 8) === openCornerBracketCC &&
- S.substr(pos + 3, 5).toLowerCase() === 'cdata'
- ) {
- // cdata
- var cdataEndIndex = S.indexOf(']]>', pos);
- if (cdataEndIndex == -1) {
- children.push(S.substr(pos + 9));
- pos = S.length;
- } else {
- children.push(S.substring(pos + 9, cdataEndIndex));
- pos = cdataEndIndex + 3;
- }
- continue;
- } else {
- // doctypesupport
- const startDoctype = pos + 1;
- pos += 2;
- var encapsuled = false;
- while ((S.charCodeAt(pos) !== closeBracketCC || encapsuled === true) && S[pos]) {
- if (S.charCodeAt(pos) === openCornerBracketCC) {
- encapsuled = true;
- } else if (encapsuled === true && S.charCodeAt(pos) === closeCornerBracketCC) {
- encapsuled = false;
- }
- pos++;
- }
- children.push(S.substring(startDoctype, pos));
- }
- pos++;
- continue;
- }
- var node = parseNode();
- children.push(node);
- if (node.tagName[0] === '?') {
- children.push(...node.children);
- node.children = [];
- }
- } else {
- var text = parseText();
- if (keepWhitespace) {
- if (text.length > 0) {
- children.push(text);
- }
- } else {
- var trimmed = text.trim();
- if (trimmed.length > 0) {
- children.push(trimmed);
- }
- }
- pos++;
- }
- }
- return children;
- }
-
- /**
- * returns the text outside of texts until the first '<'
- */
- function parseText() {
- var start = pos;
- pos = S.indexOf(openBracket, pos) - 1;
- if (pos === -2)
- pos = S.length;
- return S.slice(start, pos + 1);
- }
- /**
- * returns text until the first nonAlphabetic letter
- */
- var nameSpacer = '\r\n\t>/= ';
-
- function parseName() {
- var start = pos;
- while (nameSpacer.indexOf(S[pos]) === -1 && S[pos]) {
- pos++;
- }
- return S.slice(start, pos);
- }
- /**
- * is parsing a node, including tagName, Attributes and its children,
- * to parse children it uses the parseChildren again, that makes the parsing recursive
- */
- var NoChildNodes = options.noChildNodes || ['img', 'br', 'input', 'meta', 'link', 'hr'];
-
- function parseNode() {
- pos++;
- const tagName = parseName();
- const attributes = {};
- let children = [];
-
- // parsing attributes
- while (S.charCodeAt(pos) !== closeBracketCC && S[pos]) {
- var c = S.charCodeAt(pos);
- if ((c > 64 && c < 91) || (c > 96 && c < 123)) {
- //if('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(S[pos])!==-1 ){
- var name = parseName();
- // search beginning of the string
- var code = S.charCodeAt(pos);
- while (code && code !== singleQuoteCC && code !== doubleQuoteCC && !((code > 64 && code < 91) || (code > 96 && code < 123)) && code !== closeBracketCC) {
- pos++;
- code = S.charCodeAt(pos);
- }
- if (code === singleQuoteCC || code === doubleQuoteCC) {
- var value = parseString();
- if (pos === -1) {
- return {
- tagName,
- attributes,
- children,
- };
- }
- } else {
- value = null;
- pos--;
- }
- attributes[name] = value;
- }
- pos++;
- }
- // optional parsing of children
- if (S.charCodeAt(pos - 1) !== slashCC) {
- if (tagName == "script") {
- var start = pos + 1;
- pos = S.indexOf('', pos);
- children = [S.slice(start, pos)];
- pos += 9;
- } else if (tagName == "style") {
- var start = pos + 1;
- pos = S.indexOf('', pos);
- children = [S.slice(start, pos)];
- pos += 8;
- } else if (NoChildNodes.indexOf(tagName) === -1) {
- pos++;
- children = parseChildren(tagName);
- } else {
- pos++;
- }
- } else {
- pos++;
- }
- return {
- tagName,
- attributes,
- children,
- };
- }
-
- /**
- * is parsing a string, that starts with a char and with the same usually ' or "
- */
-
- function parseString() {
- var startChar = S[pos];
- var startpos = pos + 1;
- pos = S.indexOf(startChar, startpos);
- return S.slice(startpos, pos);
- }
-
- /**
- *
- */
- function findElements() {
- var r = new RegExp('\\s' + options.attrName + '\\s*=[\'"]' + options.attrValue + '[\'"]').exec(S);
- if (r) {
- return r.index;
- } else {
- return -1;
- }
- }
-
- var out = null;
- if (options.attrValue !== undefined) {
- options.attrName = options.attrName || 'id';
- var out = [];
-
- while ((pos = findElements()) !== -1) {
- pos = S.lastIndexOf('<', pos);
- if (pos !== -1) {
- out.push(parseNode());
- }
- S = S.substr(pos);
- pos = 0;
- }
- } else if (options.parseNode) {
- out = parseNode();
- } else {
- out = parseChildren('');
- }
-
- if (options.filter) {
- out = filter(out, options.filter);
- }
-
- if (options.simplify) {
- return simplify(Array.isArray(out) ? out : [out]);
- }
-
- if (options.setPos) {
- out.pos = pos;
- }
-
- return out;
-}
-
-/**
- * transform the DomObject to an object that is like the object of PHP`s simple_xmp_load_*() methods.
- * this format helps you to write that is more likely to keep your program working, even if there a small changes in the XML schema.
- * be aware, that it is not possible to reproduce the original xml from a simplified version, because the order of elements is not saved.
- * therefore your program will be more flexible and easier to read.
- *
- * @param {tNode[]} children the childrenList
- */
-function simplify(children) {
- var out = {};
- if (!children.length) {
- return '';
- }
-
- if (children.length === 1 && typeof children[0] == 'string') {
- return children[0];
- }
- // map each object
- children.forEach(function(child) {
- if (typeof child !== 'object') {
- return;
- }
- if (!out[child.tagName])
- out[child.tagName] = [];
- var kids = simplify(child.children);
- out[child.tagName].push(kids);
- if (Object.keys(child.attributes).length && typeof kids !== 'string') {
- kids._attributes = child.attributes;
- }
- });
-
- for (var i in out) {
- if (out[i].length == 1) {
- out[i] = out[i][0];
- }
- }
-
- return out;
-}
-
-/**
- * similar to simplify, but lost less
- *
- * @param {tNode[]} children the childrenList
- */
-function simplifyLostLess(children, parentAttributes = {}) {
- var out = {};
- if (!children.length) {
- return out;
- }
-
- if (children.length === 1 && typeof children[0] == 'string') {
- return Object.keys(parentAttributes).length ? {
- _attributes: parentAttributes,
- value: children[0]
- } : children[0];
- }
- // map each object
- children.forEach(function(child) {
- if (typeof child !== 'object') {
- return;
- }
- if (!out[child.tagName])
- out[child.tagName] = [];
- var kids = simplifyLostLess(child.children || [], child.attributes);
- out[child.tagName].push(kids);
- if (Object.keys(child.attributes).length) {
- kids._attributes = child.attributes;
- }
- });
-
- return out;
-}
-/**
- * behaves the same way as Array.filter, if the filter method return true, the element is in the resultList
- * @params children{Array} the children of a node
- * @param f{function} the filter method
- */
-function filter(children, f, dept = 0, path = '') {
- var out = [];
- children.forEach(function(child, i) {
- if (typeof(child) === 'object' && f(child, i, dept, path)) out.push(child);
- if (child.children) {
- var kids = filter(child.children, f, dept + 1, (path ? path + '.' : '') + i + '.' + child.tagName);
- out = out.concat(kids);
- }
- });
- return out;
-}
-/**
- * stringify a previously parsed string object.
- * this is useful,
- * 1. to remove whitespace
- * 2. to recreate xml data, with some changed data.
- * @param {tNode} O the object to Stringify
- */
-function stringify(O) {
- var out = '';
-
- function writeChildren(O) {
- if (O) {
- for (var i = 0; i < O.length; i++) {
- if (typeof O[i] == 'string') {
- out += O[i].trim();
- } else {
- writeNode(O[i]);
- }
- }
- }
- }
-
- function writeNode(N) {
- out += "<" + N.tagName;
- for (var i in N.attributes) {
- if (N.attributes[i] === null) {
- out += ' ' + i;
- } else if (N.attributes[i].indexOf('"') === -1) {
- out += ' ' + i + '="' + N.attributes[i].trim() + '"';
- } else {
- out += ' ' + i + "='" + N.attributes[i].trim() + "'";
- }
- }
- if (N.tagName[0] === '?') {
- out += '?>';
- return;
- }
- out += '>';
- writeChildren(N.children);
- out += '' + N.tagName + '>';
- }
- writeChildren(O);
-
- return out;
-}
-
-/**
- * use this method to read the text content, of some node.
- * It is great if you have mixed content like:
- * this text has some big text and a link
- * @return {string}
- */
-function toContentString(tDom) {
- if (Array.isArray(tDom)) {
- var out = '';
- tDom.forEach(function(e) {
- out += ' ' + toContentString(e);
- out = out.trim();
- });
- return out;
- } else if (typeof tDom === 'object') {
- return toContentString(tDom.children)
- } else {
- return ' ' + tDom;
- }
-}
-function getElementById(S, id, simplified) {
- var out = parse(S, {
- attrValue: id
- });
- return simplified ? tXml.simplify(out) : out[0];
-}
-function getElementsByClassName(S, classname, simplified) {
- const out = parse(S, {
- attrName: 'class',
- attrValue: '[a-zA-Z0-9- ]*' + classname + '[a-zA-Z0-9- ]*'
- });
- return simplified ? tXml.simplify(out) : out;
-}
-
-export { filter, getElementById, getElementsByClassName, parse, simplify, simplifyLostLess, stringify, toContentString };
-
diff --git a/GameDev/bin/Release/xmleditor/utils/Clock.js b/GameDev/bin/Release/xmleditor/utils/Clock.js
deleted file mode 100644
index 94cae91e..00000000
--- a/GameDev/bin/Release/xmleditor/utils/Clock.js
+++ /dev/null
@@ -1,68 +0,0 @@
-class Clock {
-
- constructor( autoStart = true ) {
-
- this.autoStart = autoStart;
-
- this.startTime = 0;
- this.oldTime = 0;
- this.elapsedTime = 0;
-
- this.running = false;
-
- }
-
- start() {
-
- this.startTime = now();
-
- this.oldTime = this.startTime;
- this.elapsedTime = 0;
- this.running = true;
-
- }
-
- stop() {
-
- this.getElapsedTime();
- this.running = false;
- this.autoStart = false;
-
- }
-
- getElapsedTime() {
-
- this.getDelta();
- return this.elapsedTime;
-
- }
-
- getDelta() {
-
- let diff = 0;
-
- if ( this.autoStart && ! this.running ) {
-
- this.start();
- return 0;
-
- }
-
- if ( this.running ) {
-
- const newTime = now();
-
- diff = ( newTime - this.oldTime ) / 1000;
- this.oldTime = newTime;
-
- this.elapsedTime += diff;
-
- }
-
- return diff;
-
- }
-
-}
-
-export { Clock };
diff --git a/GameDev/bin/Release/xmleditor/view.js b/GameDev/bin/Release/xmleditor/view.js
deleted file mode 100644
index 6f179efb..00000000
--- a/GameDev/bin/Release/xmleditor/view.js
+++ /dev/null
@@ -1,155 +0,0 @@
-import { EventDispatcher } from "./controls/EventDispatcher.js";
-
-class View extends EventDispatcher {
-
- get clientWidth() {
- return gamePlayer.width;
- }
-
- get clientHeight() {
- return gamePlayer.height;
- }
-
- setPointerCapture() {
- gamePlayer.message("setPointerCapture", "");
- }
-
- releasePointerCapture() {
- gamePlayer.message("releasePointerCapture", "");
- }
-}
-
-const view = new View();
-
-function makeMouseEvent(e, type) {
- let event = {
- type: type,
- pointerType: "mouse",
- pointerId: 0,
- clientX: e.x,
- clientY: e.y,
- deltaY: e.delta,
- button: e.button
- };
-
- return event;
-}
-
-function OnMouseDown(e) {
- let event = makeMouseEvent(e, "pointerdown");
- view.dispatchEvent(event);
-}
-
-function OnMouseUp(e) {
- let event = makeMouseEvent(e, "pointerup");
- view.dispatchEvent(event);
-}
-
-function OnMouseMove(e) {
- let event = makeMouseEvent(e, "pointermove");
- view.dispatchEvent(event);
-}
-
-function OnMouseWheel(e) {
- let event = makeMouseEvent(e, "wheel");
- view.dispatchEvent(event);
-}
-
-setCallback('OnMouseDown', OnMouseDown);
-setCallback('OnMouseUp', OnMouseUp);
-setCallback('OnMouseMove', OnMouseMove);
-setCallback('OnMouseWheel', OnMouseWheel);
-
-
-function makeTouchEvent(e, type) {
- let event = {
- type: type,
- pointerType: "touch",
- pointerId: e.pointerId,
- pageX: e.x,
- pageY: e.y,
- deltaY: 0,
- button: -1
- };
-
- return event;
-}
-
-function OnTouchDown(e) {
- let event = makeTouchEvent(e, "pointerdown");
- view.dispatchEvent(event);
-}
-
-function OnTouchUp(e) {
- let event = makeTouchEvent(e, "pointerup");
- view.dispatchEvent(event);
-}
-
-function OnTouchMove(e) {
- let event = makeTouchEvent(e, "pointermove");
- view.dispatchEvent(event);
-}
-
-setCallback('OnTouchDown', OnTouchDown);
-setCallback('OnTouchUp', OnTouchUp);
-setCallback('OnTouchMove', OnTouchMove);
-
-
-class UIViewDispatcher extends EventDispatcher {
-
- constructor(view3d){
- super();
- this.view = view3d;
- view3d.onMouseDown = (e)=>{
- let event = makeMouseEvent(e, "pointerdown");
- this.dispatchEvent(event);
- };
- view3d.onMouseUp = (e)=>{
- let event = makeMouseEvent(e, "pointerup");
- this.dispatchEvent(event);
- };
- view3d.onMouseMove = (e)=>{
- let event = makeMouseEvent(e, "pointermove");
- this.dispatchEvent(event);
- };
- view3d.onMouseWheel = (e)=>{
- let event = makeMouseEvent(e, "wheel");
- this.dispatchEvent(event);
- };
- view3d.onTouchDown = (e)=>{
- let event = makeTouchEvent(e, "pointerdown");
- print(JSON.stringify(event));
- this.dispatchEvent(event);
- }
- view3d.onTouchUp = (e)=>{
- let event = makeTouchEvent(e, "pointerup");
- print(JSON.stringify(event));
- this.dispatchEvent(event);
- }
- view3d.onTouchMove = (e)=>{
- let event = makeTouchEvent(e, "pointermove");
- print(JSON.stringify(event));
- this.dispatchEvent(event);
- }
- }
-
- get clientWidth() {
- return this.view.size.x;
- }
-
- get clientHeight() {
- return this.view.size.y;
- }
-
- setPointerCapture() {
- gamePlayer.message("setPointerCapture", "");
- }
-
- releasePointerCapture() {
- gamePlayer.message("releasePointerCapture", "");
- }
-}
-
-
-export { view, UIViewDispatcher };
-
diff --git a/GameDev/bin/Release/zlib.dll b/GameDev/bin/Release/zlib.dll
deleted file mode 100644
index ebe9bb48..00000000
Binary files a/GameDev/bin/Release/zlib.dll and /dev/null differ
diff --git a/GameDev/icons/avatar.png b/GameDev/icons/avatar.png
deleted file mode 100644
index 19b0bd42..00000000
Binary files a/GameDev/icons/avatar.png and /dev/null differ
diff --git a/GameDev/icons/box.png b/GameDev/icons/box.png
deleted file mode 100644
index 3ec13898..00000000
Binary files a/GameDev/icons/box.png and /dev/null differ
diff --git a/GameDev/icons/camera.png b/GameDev/icons/camera.png
deleted file mode 100644
index b77948e2..00000000
Binary files a/GameDev/icons/camera.png and /dev/null differ
diff --git a/GameDev/icons/control.png b/GameDev/icons/control.png
deleted file mode 100644
index a8b567ec..00000000
Binary files a/GameDev/icons/control.png and /dev/null differ
diff --git a/GameDev/icons/directional_light.png b/GameDev/icons/directional_light.png
deleted file mode 100644
index eb69db93..00000000
Binary files a/GameDev/icons/directional_light.png and /dev/null differ
diff --git a/GameDev/icons/doc.png b/GameDev/icons/doc.png
deleted file mode 100644
index 1d0858a6..00000000
Binary files a/GameDev/icons/doc.png and /dev/null differ
diff --git a/GameDev/icons/env_light.png b/GameDev/icons/env_light.png
deleted file mode 100644
index 6521cffc..00000000
Binary files a/GameDev/icons/env_light.png and /dev/null differ
diff --git a/GameDev/icons/fog.png b/GameDev/icons/fog.png
deleted file mode 100644
index ecc7851c..00000000
Binary files a/GameDev/icons/fog.png and /dev/null differ
diff --git a/GameDev/icons/folder.png b/GameDev/icons/folder.png
deleted file mode 100644
index 100a1aba..00000000
Binary files a/GameDev/icons/folder.png and /dev/null differ
diff --git a/GameDev/icons/group.png b/GameDev/icons/group.png
deleted file mode 100644
index 58c6c211..00000000
Binary files a/GameDev/icons/group.png and /dev/null differ
diff --git a/GameDev/icons/js.png b/GameDev/icons/js.png
deleted file mode 100644
index 0dd1df37..00000000
Binary files a/GameDev/icons/js.png and /dev/null differ
diff --git a/GameDev/icons/json.png b/GameDev/icons/json.png
deleted file mode 100644
index 17db63d3..00000000
Binary files a/GameDev/icons/json.png and /dev/null differ
diff --git a/GameDev/icons/model.png b/GameDev/icons/model.png
deleted file mode 100644
index 034578e0..00000000
Binary files a/GameDev/icons/model.png and /dev/null differ
diff --git a/GameDev/icons/object3d.png b/GameDev/icons/object3d.png
deleted file mode 100644
index 890ca18c..00000000
Binary files a/GameDev/icons/object3d.png and /dev/null differ
diff --git a/GameDev/icons/plane.png b/GameDev/icons/plane.png
deleted file mode 100644
index a2064c3f..00000000
Binary files a/GameDev/icons/plane.png and /dev/null differ
diff --git a/GameDev/icons/scene.png b/GameDev/icons/scene.png
deleted file mode 100644
index 74fd7e84..00000000
Binary files a/GameDev/icons/scene.png and /dev/null differ
diff --git a/GameDev/icons/sky.png b/GameDev/icons/sky.png
deleted file mode 100644
index 9bc32133..00000000
Binary files a/GameDev/icons/sky.png and /dev/null differ
diff --git a/GameDev/icons/sphere.png b/GameDev/icons/sphere.png
deleted file mode 100644
index bdf9e687..00000000
Binary files a/GameDev/icons/sphere.png and /dev/null differ
diff --git a/GameDev/icons/target.png b/GameDev/icons/target.png
deleted file mode 100644
index 251fce75..00000000
Binary files a/GameDev/icons/target.png and /dev/null differ
diff --git a/GameDev/icons/xml.png b/GameDev/icons/xml.png
deleted file mode 100644
index 88395d91..00000000
Binary files a/GameDev/icons/xml.png and /dev/null differ
diff --git a/GamePlayer/App.config b/GamePlayer/App.config
deleted file mode 100644
index 56efbc7b..00000000
--- a/GamePlayer/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/GamePlayer/App.xaml b/GamePlayer/App.xaml
deleted file mode 100644
index 5ad50234..00000000
--- a/GamePlayer/App.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
diff --git a/GamePlayer/App.xaml.cs b/GamePlayer/App.xaml.cs
deleted file mode 100644
index d5c43a80..00000000
--- a/GamePlayer/App.xaml.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.IO;
-using System.Windows;
-
-namespace GamePlayer
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- private void Application_Startup(object sender, StartupEventArgs e)
- {
- if (e.Args.Length > 1)
- {
- string path_proj = e.Args[0];
- int idx = int.Parse(e.Args[1]);
- this.MainWindow = new PlayerWindow(path_proj, idx);
- }
- else if (File.Exists(".\\client\\project.json"))
- {
- this.MainWindow = new PlayerWindow(".\\client\\project.json", 0);
- }
- else
- {
- this.MainWindow = new MainWindow();
- }
-
- this.MainWindow.Show();
- }
- }
-}
diff --git a/GamePlayer/GamePlayer.csproj b/GamePlayer/GamePlayer.csproj
deleted file mode 100644
index d6204444..00000000
--- a/GamePlayer/GamePlayer.csproj
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}
- WinExe
- GamePlayer
- GamePlayer
- v4.7.2
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- x64
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
- MSBuild:Compile
- Designer
-
-
-
-
- PlayerWindow.xaml
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
- {8accb6bd-c7b1-4a80-91d5-53cf222b716a}
- Three.V8.CLR
-
-
-
-
- 13.0.2
-
-
-
-
\ No newline at end of file
diff --git a/GamePlayer/MainWindow.xaml b/GamePlayer/MainWindow.xaml
deleted file mode 100644
index 506b329e..00000000
--- a/GamePlayer/MainWindow.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/GamePlayer/MainWindow.xaml.cs b/GamePlayer/MainWindow.xaml.cs
deleted file mode 100644
index 692cf026..00000000
--- a/GamePlayer/MainWindow.xaml.cs
+++ /dev/null
@@ -1,211 +0,0 @@
-using System;
-using System.Timers;
-using System.Windows;
-using System.Diagnostics;
-using Microsoft.Win32;
-using CLRBinding;
-
-namespace GamePlayer
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
- {
- private CGLControl glControl = null;
- private CGamePlayer game_player = null;
- private string default_script = "../../../game/bundle_game.js";
- private bool is_portrait = false;
-
-
- public MainWindow()
- {
- InitializeComponent();
- glControl = new CGLControl();
- glControl.SetFramerate(60.0f);
- glControl.Paint += GLControl_Paint;
- glControl.Dock = System.Windows.Forms.DockStyle.Fill;
- glControl.MouseDown += GLControl_MouseDown;
- glControl.MouseUp += GLControl_MouseUp;
- glControl.MouseMove += GLControl_MouseMove;
- glControl.MouseWheel += GLControl_MouseWheel;
- glControl.KeyPress += GLControl_KeyChar;
- glControl.ControlKey += GLControl_ControlKey;
- wf_host.Child = glControl;
-
- string exe_name = Process.GetCurrentProcess().ProcessName;
- game_player = new CGamePlayer(exe_name, glControl);
- game_player.LoadScript(default_script, null);
- }
-
- private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- glControl.MakeCurrent();
- game_player.Dispose();
- game_player = null;
- }
-
- private void GLControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
- if (game_player == null) return;
- game_player.Draw(glControl.Width, glControl.Height);
- }
-
- private void BtnLoad_Click(object sender, RoutedEventArgs e)
- {
- if (game_player == null) return;
- OpenFileDialog openFileDialog = new OpenFileDialog();
- openFileDialog.Filter = "Script Files|*.js";
- if (openFileDialog.ShowDialog() == true)
- {
- glControl.MakeCurrent();
- game_player.LoadScript(openFileDialog.FileName, null);
- }
- }
-
- private MouseEventArgs convert_args(System.Windows.Forms.MouseEventArgs e)
- {
- int button = -1;
- if (e.Button == System.Windows.Forms.MouseButtons.Left)
- {
- button = 0;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
- {
- button = 1;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.Right)
- {
- button = 2;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.XButton1)
- {
- button = 3;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.XButton2)
- {
- button = 4;
- }
-
- MouseEventArgs args;
- args.button = button;
- args.clicks = e.Clicks;
- args.delta = e.Delta;
- args.x = e.X;
- args.y = e.Y;
- return args;
- }
-
- private Timer press_timer = null;
- private int x_down;
- private int y_down;
-
- private void GLControl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.Focus();
- glControl.MakeCurrent();
- game_player.OnMouseDown(convert_args(e));
-
- if (e.Button == System.Windows.Forms.MouseButtons.Left)
- {
- x_down = e.X;
- y_down = e.Y;
-
- press_timer = new Timer();
- press_timer.Elapsed += (source, timer_event) =>
- {
- Dispatcher.Invoke(() =>
- {
- press_timer = null;
- game_player.OnLongPress(x_down, y_down);
- });
-
- };
- press_timer.AutoReset = false;
- press_timer.Interval = 500.0;
- press_timer.Start();
- }
- }
-
- private void GLControl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnMouseUp(convert_args(e));
-
- if (press_timer!=null)
- {
- press_timer.Stop();
- press_timer = null;
- }
- }
-
- private void GLControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnMouseMove(convert_args(e));
-
- if (press_timer != null)
- {
- int x = e.X;
- int y = e.Y;
-
- int dx = x - x_down;
- int dy = y - y_down;
- double dis = Math.Sqrt((double)(dx * dx) + (double)(dy * dy));
- if (dis>3.0)
- {
- press_timer.Stop();
- press_timer = null;
- }
-
- }
- }
-
- private void GLControl_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnMouseWheel(convert_args(e));
- }
-
- private void GLControl_ControlKey(uint code)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnControlKey(code);
- }
-
- private void GLControl_KeyChar(object sender, System.Windows.Forms.KeyPressEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnChar(e.KeyChar);
- e.Handled = true;
- }
-
- private void btn_rotate_Click(object sender, RoutedEventArgs e)
- {
- if (!is_portrait)
- {
- this.Width = 500;
- this.Height = 720;
- wf_host.Width = 360;
- wf_host.Height = 640;
- btn_rotate.Content = "To Landscape";
- is_portrait = true;
- }
- else
- {
- this.Width = 800;
- this.Height = 450;
- wf_host.Width = 640;
- wf_host.Height = 360;
- btn_rotate.Content = "To Portrait";
- is_portrait = false;
- }
- }
- }
-}
diff --git a/GamePlayer/PlayerWindow.xaml b/GamePlayer/PlayerWindow.xaml
deleted file mode 100644
index 0bfb1708..00000000
--- a/GamePlayer/PlayerWindow.xaml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/GamePlayer/PlayerWindow.xaml.cs b/GamePlayer/PlayerWindow.xaml.cs
deleted file mode 100644
index c20099c9..00000000
--- a/GamePlayer/PlayerWindow.xaml.cs
+++ /dev/null
@@ -1,238 +0,0 @@
-using System;
-using System.IO;
-using System.Timers;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-using System.Diagnostics;
-using Newtonsoft.Json.Linq;
-using CLRBinding;
-
-namespace GamePlayer
-{
- ///
- /// Interaction logic for PlayerWindow.xaml
- ///
- public partial class PlayerWindow : Window
- {
- private CGLControl glControl = null;
- private CGamePlayer game_player = null;
-
-
- public PlayerWindow(string path_proj, int idx)
- {
- InitializeComponent();
-
- JObject obj_proj = JObject.Parse(File.ReadAllText(path_proj));
- JObject obj_target = (JObject)obj_proj["targets"][idx];
-
- string dir_proj = Path.GetDirectoryName(path_proj);
- string path_output = Path.GetFullPath(dir_proj + "\\" + obj_target["output"].ToString());
-
- Title = obj_target["name"].ToString();
-
- if (obj_target.ContainsKey("width") && obj_target.ContainsKey("height"))
- {
- this.Width = int.Parse(obj_target["width"].ToString()) + 36.0;
- this.Height = int.Parse(obj_target["height"].ToString()) + 64.0;
- }
-
- glControl = new CGLControl();
- glControl.SetFramerate(60.0f);
- glControl.Paint += GLControl_Paint;
- glControl.Dock = System.Windows.Forms.DockStyle.Fill;
- glControl.MouseDown += GLControl_MouseDown;
- glControl.MouseUp += GLControl_MouseUp;
- glControl.MouseMove += GLControl_MouseMove;
- glControl.MouseWheel += GLControl_MouseWheel;
- glControl.KeyPress += GLControl_KeyChar;
- glControl.ControlKey += GLControl_ControlKey;
- wf_host.Child = glControl;
-
- string exe_name = Process.GetCurrentProcess().ProcessName;
- game_player = new CGamePlayer(exe_name, glControl);
- game_player.SetPrintCallbacks(console_std, console_err);
- game_player.LoadScript(path_output, null);
-
- }
-
- private Thickness thickness_zero = new Thickness(0);
- private FontFamily font_courier = new FontFamily("Courier New");
- private SolidColorBrush brush_red = new SolidColorBrush(Colors.Red);
-
- private void console_log(string str_line, Brush brush = null)
- {
- var line = new TextBox();
- line.BorderThickness = thickness_zero;
- line.IsReadOnly = true;
- line.FontFamily = font_courier;
- if (brush != null)
- {
- line.Foreground = brush;
- }
- line.Text = str_line;
- console.Children.Add(line);
- }
-
- private void console_std(string str)
- {
- string[] lines = str.Split(new char[]{'\n'});
- foreach(string str_line in lines)
- {
- console_log(str_line);
- }
- console_scroll.ScrollToBottom();
- }
-
- private void console_err(string str)
- {
- string[] lines = str.Split(new char[] { '\n' });
- foreach (string str_line in lines)
- {
- console_log(str_line, brush_red);
- }
- console_scroll.ScrollToBottom();
- }
-
- private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- glControl.MakeCurrent();
- game_player.Dispose();
- game_player = null;
- }
-
- private void GLControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
- if (game_player == null) return;
- game_player.Draw(glControl.Width, glControl.Height);
- }
-
- private MouseEventArgs convert_args(System.Windows.Forms.MouseEventArgs e)
- {
- int button = -1;
- if (e.Button == System.Windows.Forms.MouseButtons.Left)
- {
- button = 0;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
- {
- button = 1;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.Right)
- {
- button = 2;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.XButton1)
- {
- button = 3;
- }
- else if (e.Button == System.Windows.Forms.MouseButtons.XButton2)
- {
- button = 4;
- }
-
- MouseEventArgs args;
- args.button = button;
- args.clicks = e.Clicks;
- args.delta = e.Delta;
- args.x = e.X;
- args.y = e.Y;
- return args;
- }
-
- private Timer press_timer = null;
- private int x_down;
- private int y_down;
-
- private void GLControl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.Focus();
- glControl.MakeCurrent();
- game_player.OnMouseDown(convert_args(e));
-
- if (e.Button == System.Windows.Forms.MouseButtons.Left)
- {
- x_down = e.X;
- y_down = e.Y;
-
- press_timer = new Timer();
- press_timer.Elapsed += (source, timer_event) =>
- {
- Dispatcher.Invoke(() =>
- {
- press_timer = null;
- game_player.OnLongPress(x_down, y_down);
- });
-
- };
- press_timer.AutoReset = false;
- press_timer.Interval = 500.0;
- press_timer.Start();
- }
- }
-
- private void GLControl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnMouseUp(convert_args(e));
-
- if (press_timer != null)
- {
- press_timer.Stop();
- press_timer = null;
- }
- }
-
- private void GLControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnMouseMove(convert_args(e));
-
- if (press_timer != null)
- {
- int x = e.X;
- int y = e.Y;
-
- int dx = x - x_down;
- int dy = y - y_down;
- double dis = Math.Sqrt((double)(dx * dx) + (double)(dy * dy));
- if (dis > 3.0)
- {
- press_timer.Stop();
- press_timer = null;
- }
-
- }
- }
-
- private void GLControl_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnMouseWheel(convert_args(e));
- }
-
- private void GLControl_ControlKey(uint code)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnControlKey(code);
- }
-
- private void GLControl_KeyChar(object sender, System.Windows.Forms.KeyPressEventArgs e)
- {
- if (game_player == null) return;
- glControl.MakeCurrent();
- game_player.OnChar(e.KeyChar);
- e.Handled = true;
- }
-
- private void menu_clear_console_Click(object sender, RoutedEventArgs e)
- {
- console.Children.Clear();
- }
- }
-}
diff --git a/GamePlayer/Properties/AssemblyInfo.cs b/GamePlayer/Properties/AssemblyInfo.cs
deleted file mode 100644
index 099f71f4..00000000
--- a/GamePlayer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("GamePlayer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("GamePlayer")]
-[assembly: AssemblyCopyright("Copyright © 2022")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/GamePlayer/Properties/Resources.Designer.cs b/GamePlayer/Properties/Resources.Designer.cs
deleted file mode 100644
index c1c7e76b..00000000
--- a/GamePlayer/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-
-namespace GamePlayer.Properties
-{
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GamePlayer.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/GamePlayer/Properties/Resources.resx b/GamePlayer/Properties/Resources.resx
deleted file mode 100644
index af7dbebb..00000000
--- a/GamePlayer/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/GamePlayer/Properties/Settings.Designer.cs b/GamePlayer/Properties/Settings.Designer.cs
deleted file mode 100644
index a0ce3539..00000000
--- a/GamePlayer/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-
-namespace GamePlayer.Properties
-{
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/GamePlayer/Properties/Settings.settings b/GamePlayer/Properties/Settings.settings
deleted file mode 100644
index 033d7a5e..00000000
--- a/GamePlayer/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/GamePlayer/bin/Release/avcodec-58.dll b/GamePlayer/bin/Release/avcodec-58.dll
deleted file mode 100644
index fe98cee2..00000000
Binary files a/GamePlayer/bin/Release/avcodec-58.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/avdevice-58.dll b/GamePlayer/bin/Release/avdevice-58.dll
deleted file mode 100644
index 2fa0acf6..00000000
Binary files a/GamePlayer/bin/Release/avdevice-58.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/avfilter-7.dll b/GamePlayer/bin/Release/avfilter-7.dll
deleted file mode 100644
index 1e36c5ed..00000000
Binary files a/GamePlayer/bin/Release/avfilter-7.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/avformat-58.dll b/GamePlayer/bin/Release/avformat-58.dll
deleted file mode 100644
index 4f875564..00000000
Binary files a/GamePlayer/bin/Release/avformat-58.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/avutil-56.dll b/GamePlayer/bin/Release/avutil-56.dll
deleted file mode 100644
index 29fdb519..00000000
Binary files a/GamePlayer/bin/Release/avutil-56.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/icudtl.dat b/GamePlayer/bin/Release/icudtl.dat
deleted file mode 100644
index 0e35d1da..00000000
Binary files a/GamePlayer/bin/Release/icudtl.dat and /dev/null differ
diff --git a/GamePlayer/bin/Release/icui18n.dll b/GamePlayer/bin/Release/icui18n.dll
deleted file mode 100644
index ea9a114b..00000000
Binary files a/GamePlayer/bin/Release/icui18n.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/icuuc.dll b/GamePlayer/bin/Release/icuuc.dll
deleted file mode 100644
index 6be4c8f0..00000000
Binary files a/GamePlayer/bin/Release/icuuc.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/postproc-55.dll b/GamePlayer/bin/Release/postproc-55.dll
deleted file mode 100644
index e51df89e..00000000
Binary files a/GamePlayer/bin/Release/postproc-55.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/swresample-3.dll b/GamePlayer/bin/Release/swresample-3.dll
deleted file mode 100644
index b2492ed0..00000000
Binary files a/GamePlayer/bin/Release/swresample-3.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/swscale-5.dll b/GamePlayer/bin/Release/swscale-5.dll
deleted file mode 100644
index 3315062c..00000000
Binary files a/GamePlayer/bin/Release/swscale-5.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/v8.dll b/GamePlayer/bin/Release/v8.dll
deleted file mode 100644
index 7737c6ae..00000000
Binary files a/GamePlayer/bin/Release/v8.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/v8_libbase.dll b/GamePlayer/bin/Release/v8_libbase.dll
deleted file mode 100644
index 419e0f91..00000000
Binary files a/GamePlayer/bin/Release/v8_libbase.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/v8_libplatform.dll b/GamePlayer/bin/Release/v8_libplatform.dll
deleted file mode 100644
index fb940ec9..00000000
Binary files a/GamePlayer/bin/Release/v8_libplatform.dll and /dev/null differ
diff --git a/GamePlayer/bin/Release/zlib.dll b/GamePlayer/bin/Release/zlib.dll
deleted file mode 100644
index ebe9bb48..00000000
Binary files a/GamePlayer/bin/Release/zlib.dll and /dev/null differ
diff --git a/Three.V8.CLR/CLRBinding.cpp b/Three.V8.CLR/CLRBinding.cpp
deleted file mode 100644
index 3b49ec3e..00000000
--- a/Three.V8.CLR/CLRBinding.cpp
+++ /dev/null
@@ -1,339 +0,0 @@
-#include "CLRBinding.h"
-
-#pragma unmanaged
-#include
-#include
-#include
-#include "utils/Utils.h"
-#pragma comment(lib, "opengl32.lib")
-#pragma comment(lib, "gdi32.lib")
-#pragma managed
-
-using namespace System::IO;
-
-namespace CLRBinding
-{
-
- public delegate void TimerCallback();
- static void __stdcall s_timer_callback(PTP_CALLBACK_INSTANCE, PVOID p_func_invalidate, PTP_TIMER timer)
- {
- GCHandle handle = GCHandle::FromIntPtr((IntPtr)p_func_invalidate);
- TimerCallback^ func_invalidate = (TimerCallback^)handle.Target;
- func_invalidate();
- }
-
- CGLControl::CGLControl()
- {
- SetStyle(ControlStyles::Opaque, true);
- SetStyle(ControlStyles::UserPaint, true);
- SetStyle(ControlStyles::AllPaintingInWmPaint, true);
- SetStyle(ControlStyles::Selectable, true);
- DoubleBuffered = false;
-
-
- m_func_invalidate = GCHandle::Alloc(gcnew TimerCallback(this, &CGLControl::Invalidate), GCHandleType::Normal);
- IntPtr p_func_invalidate = GCHandle::ToIntPtr(m_func_invalidate);
- m_timer = CreateThreadpoolTimer(s_timer_callback, (void*)p_func_invalidate, nullptr);
-
- PIXELFORMATDESCRIPTOR pfd =
- {
- sizeof(PIXELFORMATDESCRIPTOR),
- 1,
- PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED | PFD_DOUBLEBUFFER, // Flags
- PFD_TYPE_RGBA, // The kind of framebuffer. RGBA or palette.
- 32, // Colordepth of the framebuffer.
- 0, 0, 0, 0, 0, 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 24, // Number of bits for the depthbuffer
- 8, // Number of bits for the stencilbuffer
- 0, // Number of Aux buffers in the framebuffer.
- PFD_MAIN_PLANE,
- 0,
- 0, 0, 0
- };
-
- HWND hwnd = (HWND)(void*)this->Handle;
- m_hdc = GetDC(hwnd);
- int pfm = ChoosePixelFormat(m_hdc, &pfd);
- SetPixelFormat(m_hdc, pfm, &pfd);
- m_hrc = wglCreateContext(m_hdc);
- wglMakeCurrent(m_hdc, m_hrc);
- glewInit();
- }
-
- CGLControl::!CGLControl()
- {
- if (m_hdc != nullptr)
- {
- wglMakeCurrent(m_hdc, NULL);
- wglDeleteContext(m_hrc);
- }
-
- SetThreadpoolTimer(m_timer, NULL, 0, 0);
- WaitForThreadpoolTimerCallbacks(m_timer, TRUE);
- CloseThreadpoolTimer(m_timer);
- m_func_invalidate.Free();
-
- }
-
- void CGLControl::MakeCurrent()
- {
- wglMakeCurrent(m_hdc, m_hrc);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- }
-
- void CGLControl::SetFramerate(float fps)
- {
- m_interval = (unsigned)(1000.0f / fps);
- m_time_scheduled = time_milli_sec();
- this->Invalidate();
- }
-
- void CGLControl::Pause()
- {
- m_paused = true;
- }
-
- void CGLControl::Resume()
- {
- m_paused = false;
- m_time_scheduled = time_milli_sec();
- this->Invalidate();
- }
-
- void CGLControl::OnPaint(PaintEventArgs^ e)
- {
- if (m_hdc != nullptr)
- {
- this->MakeCurrent();
- Control::OnPaint(e);
- SwapBuffers(m_hdc);
- }
-
- if (!m_paused && m_interval > 0)
- {
- unsigned interval = m_interval;
- uint64_t t = time_milli_sec();
- int delta = (int)(int64_t)(t - m_time_scheduled);
- if (delta > interval) interval = 0;
- else if (delta > 0) interval -= delta;
- m_time_scheduled = t + interval;
-
- if (interval > 0)
- {
- ULARGE_INTEGER due;
- due.QuadPart = (ULONGLONG)(-((int64_t)interval * 10000LL));
- ::FILETIME ft;
- ft.dwHighDateTime = due.HighPart;
- ft.dwLowDateTime = due.LowPart;
- SetThreadpoolTimer(m_timer, &ft, 0, 0);
- }
- else
- {
- this->Invalidate();
- }
- }
- }
-
- bool CGLControl::ProcessCmdKey(Message% msg, Keys keyData)
- {
- static std::unordered_set s_set =
- {
- 8, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46,
- };
-
- unsigned code = (unsigned)(keyData);
- if (s_set.find(code) != s_set.end())
- {
- ControlKey(code);
- return true;
- }
- return Control::ProcessCmdKey(msg, keyData);
- }
-
- static std::string g_HandleUserMessage(void* pplayer, const char* cname, const char* cmsg)
- {
- GCHandle handle_player = GCHandle::FromIntPtr((IntPtr)pplayer);
- CGamePlayer^ player = (CGamePlayer^)handle_player.Target;
-
- String^ name = gcnew String(cname, 0, strlen(cname), Encoding::UTF8);
- String^ msg = gcnew String(cmsg, 0, strlen(cmsg), Encoding::UTF8);
- String^ ret = player->UserMessage(name, msg);
-
- int len_ret = Encoding::UTF8->GetByteCount(ret);
- array^ bytes_ret = gcnew array(len_ret + 1);
- Encoding::UTF8->GetBytes(ret, 0, ret->Length, bytes_ret, 0);
- bytes_ret[len_ret] = 0;
- const char* cret = (const char*)(void*)(Marshal::UnsafeAddrOfPinnedArrayElement(bytes_ret, 0));
-
- return cret;
- }
-
- String^ CGamePlayer::SetCapture(String^ msg)
- {
- m_window->Capture = true;
- return "";
- }
-
- String^ CGamePlayer::ReleaseCapture(String^ msg)
- {
- m_window->Capture = false;
- return "";
- }
-
- CGamePlayer::CGamePlayer(String^ exec_path, Control^ window)
- {
- const char* cpath = (const char*)(void*)Marshal::StringToHGlobalAnsi(exec_path);
- m_native = new GamePlayer(cpath, window->Width, window->Height);
-
- m_window = window;
-
- m_handle_this = GCHandle::Alloc(this, GCHandleType::Normal);
- void* pplayer = (void*)GCHandle::ToIntPtr(m_handle_this);
- m_native->SetUserMessageCallback(pplayer, g_HandleUserMessage);
-
- m_msg_dict = gcnew Dictionary();
-
- AddUserMessageHandler("setPointerCapture", gcnew MessageCallback(this, &CGamePlayer::SetCapture));
- AddUserMessageHandler("releasePointerCapture", gcnew MessageCallback(this, &CGamePlayer::ReleaseCapture));
- }
-
- CGamePlayer::!CGamePlayer()
- {
- if (m_handle_this.IsAllocated)
- {
- m_handle_this.Free();
- }
- delete m_native;
- }
-
- void CGamePlayer::Draw(int width, int height)
- {
- m_native->Draw(width, height);
- m_native->Idle();
- }
-
- void CGamePlayer::LoadScript(String^ script_path, String^ resource_root)
- {
- if (resource_root == nullptr)
- {
- resource_root = Path::GetDirectoryName(script_path);
- script_path = Path::GetFileName(script_path);
- }
- const char* cscript_path = (const char*)(void*)Marshal::StringToHGlobalAnsi(script_path);
- const char* cresource_root = (const char*)(void*)Marshal::StringToHGlobalAnsi(resource_root);
- m_native->LoadScript(cresource_root, cscript_path);
- }
-
- void CGamePlayer::UnloadScript()
- {
- m_native->UnloadScript();
- }
-
- void CGamePlayer::OnMouseDown(MouseEventArgs e)
- {
- m_native->OnMouseDown(e.button, e.clicks, e.delta, e.x, e.y);
- }
-
- void CGamePlayer::OnMouseUp(MouseEventArgs e)
- {
- m_native->OnMouseUp(e.button, e.clicks, e.delta, e.x, e.y);
- }
-
- void CGamePlayer::OnMouseMove(MouseEventArgs e)
- {
- m_native->OnMouseMove(e.button, e.clicks, e.delta, e.x, e.y);
- }
-
- void CGamePlayer::OnMouseWheel(MouseEventArgs e)
- {
- m_native->OnMouseWheel(e.button, e.clicks, e.delta, e.x, e.y);
- }
-
- void CGamePlayer::OnLongPress(int x, int y)
- {
- m_native->OnLongPress(x, y);
- }
-
- void CGamePlayer::OnChar(int keyChar)
- {
- m_native->OnChar(keyChar);
- }
-
- void CGamePlayer::OnControlKey(unsigned code)
- {
- m_native->OnControlKey(code);
- }
-
- void CGamePlayer::AddUserMessageHandler(String^ name, MessageCallback^ callback)
- {
- m_msg_dict[name] = callback;
- }
-
- String^ CGamePlayer::UserMessage(String^ name, String^ msg)
- {
- if (m_msg_dict->ContainsKey(name))
- {
- return m_msg_dict[name](msg);
- }
- return "";
- }
-
- String^ CGamePlayer::SendMessageToUser(String^ name, String^ msg)
- {
- int len_name = Encoding::UTF8->GetByteCount(name);
- array^ bytes_name = gcnew array(len_name + 1);
- Encoding::UTF8->GetBytes(name, 0, name->Length, bytes_name, 0);
- bytes_name[len_name] = 0;
- const char* cname = (const char*)(void*)(Marshal::UnsafeAddrOfPinnedArrayElement(bytes_name, 0));
-
- int len_msg = Encoding::UTF8->GetByteCount(msg);
- array^ bytes_msg = gcnew array(len_msg + 1);
- Encoding::UTF8->GetBytes(msg, 0, msg->Length, bytes_msg, 0);
- bytes_msg[len_msg] = 0;
- const char* cmsg = (const char*)(void*)(Marshal::UnsafeAddrOfPinnedArrayElement(bytes_msg, 0));
-
- std::string cret = m_native->SendMessageToUser(cname, cmsg);
- return gcnew String(cret.c_str(), 0, cret.length(), Encoding::UTF8);
- }
-
- static void g_PrintStd(void* pplayer, const char* cstr)
- {
- GCHandle handle_player = GCHandle::FromIntPtr((IntPtr)pplayer);
- CGamePlayer^ player = (CGamePlayer^)handle_player.Target;
- String^ str = gcnew String(cstr, 0, strlen(cstr), Encoding::UTF8);
- player->PrintStd(str);
- }
-
- static void g_PrintErr(void* pplayer, const char* cstr)
- {
- GCHandle handle_player = GCHandle::FromIntPtr((IntPtr)pplayer);
- CGamePlayer^ player = (CGamePlayer^)handle_player.Target;
- String^ str = gcnew String(cstr, 0, strlen(cstr), Encoding::UTF8);
- player->PrintErr(str);
- }
-
- void CGamePlayer::SetPrintCallbacks(PrintCallback^ print_callback, PrintCallback^ error_callback)
- {
- void* pplayer = (void*)GCHandle::ToIntPtr(m_handle_this);
-
- m_print_callback = print_callback;
- m_error_callback = error_callback;
-
- m_native->SetPrintCallbacks(pplayer, g_PrintStd, g_PrintErr);
- }
-
- void CGamePlayer::PrintStd(String^ str)
- {
- m_print_callback(str);
- }
-
- void CGamePlayer::PrintErr(String^ str)
- {
- m_error_callback(str);
- }
-
-}
diff --git a/Three.V8.CLR/CLRBinding.h b/Three.V8.CLR/CLRBinding.h
deleted file mode 100644
index 6d102506..00000000
--- a/Three.V8.CLR/CLRBinding.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#pragma once
-
-#pragma unmanaged
-#include
-#include
-#include "binding.h"
-#include "GamePlayer.h"
-#pragma managed
-
-using namespace System;
-using namespace System::Text;
-using namespace System::Windows::Forms;
-using namespace System::Runtime::InteropServices;
-using namespace System::Collections::Generic;
-
-namespace CLRBinding
-{
- public delegate void ControlEvent(unsigned code);
-
- public ref class CGLControl : public Control
- {
- public:
- CGLControl();
- !CGLControl();
- ~CGLControl()
- {
- if (!m_finalized)
- {
- this->!CGLControl();
- m_finalized = true;
- }
- }
-
- void MakeCurrent();
- void SetFramerate(float fps);
- void Pause();
- void Resume();
-
- ControlEvent^ pControlKey = nullptr;
-
- event ControlEvent^ ControlKey
- {
- void add(ControlEvent^ p)
- {
- pControlKey = static_cast (Delegate::Combine(pControlKey, p));
- }
-
- void remove(ControlEvent^ p)
- {
- pControlKey = static_cast (Delegate::Remove(pControlKey, p));
- }
-
- void raise(unsigned code)
- {
- if (pControlKey != nullptr)
- pControlKey->Invoke(code);
- }
- }
-
-
- protected:
- virtual void OnPaint(PaintEventArgs^ e) override;
- virtual bool ProcessCmdKey(Message% msg, Keys keyData) override;
-
- private:
- HDC m_hdc = nullptr;
- HGLRC m_hrc = nullptr;
- unsigned m_interval = 0;
- bool m_paused = false;
- uint64_t m_time_scheduled;
- PTP_TIMER m_timer = nullptr;
- GCHandle m_func_invalidate;
- bool m_finalized = false;
- };
-
-
- public value struct MouseEventArgs
- {
- int button;
- int clicks;
- int delta;
- int x;
- int y;
- };
-
- public delegate void PrintCallback(String^ str);
- public delegate String^ MessageCallback(String^ msg);
-
- public ref class CGamePlayer
- {
- public:
- CGamePlayer(String^ exec_path, Control^ window);
- !CGamePlayer();
- ~CGamePlayer()
- {
- if (!m_finalized)
- {
- this->!CGamePlayer();
- m_finalized = true;
- }
- }
-
- void Draw(int width, int height);
- void LoadScript(String^ script_path, String^ resource_root);
- void UnloadScript();
-
- void OnMouseDown(MouseEventArgs e);
- void OnMouseUp(MouseEventArgs e);
- void OnMouseMove(MouseEventArgs e);
- void OnMouseWheel(MouseEventArgs e);
- void OnLongPress(int x, int y);
-
- void OnChar(int keyChar);
- void OnControlKey(unsigned code);
-
- void AddUserMessageHandler(String^ name, MessageCallback^ callback);
-
- String^ UserMessage(String^ name, String^ msg);
- String^ SendMessageToUser(String^ name, String^ msg);
-
- void SetPrintCallbacks(PrintCallback^ print_callback, PrintCallback^ error_callback);
- void PrintStd(String^ str);
- void PrintErr(String^ str);
-
- private:
- Control^ m_window = nullptr;
- GamePlayer* m_native = nullptr;
- bool m_finalized = false;
- GCHandle m_handle_this;
-
- Dictionary^ m_msg_dict;
-
- String^ SetCapture(String^ msg);
- String^ ReleaseCapture(String^ msg);
-
- PrintCallback^ m_print_callback = nullptr;
- PrintCallback^ m_error_callback = nullptr;
- };
-
-
-}
-
diff --git a/Three.V8.CLR/Three.V8.CLR.vcxproj b/Three.V8.CLR/Three.V8.CLR.vcxproj
deleted file mode 100644
index 7c977baa..00000000
--- a/Three.V8.CLR/Three.V8.CLR.vcxproj
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 16.0
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}
- v4.7.2
- ManagedCProj
- ThreeV8CLR
- 10.0
-
-
-
- Application
- true
- v143
- true
- Unicode
-
-
- Application
- false
- v143
- true
- Unicode
-
-
- Application
- true
- v143
- true
- Unicode
-
-
- DynamicLibrary
- false
- v143
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Level3
- NDEBUG; GLEW_STATIC=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
- ../ThreeEngine;../thirdparty/glew/include;../thirdparty/glm/glm;../Three.V8;../ThreeMM;%(AdditionalIncludeDirectories)
- stdcpp17
-
-
- glew.lib;draco.lib;crypt32.lib;portaudio.lib;libwebp.lib;libwebpdecoder.lib;libwebpdemux.lib;libwebpmux.lib;%(AdditionalDependencies)
- ../thirdparty/glew/lib;../thirdparty/draco/lib;../thirdparty/portaudio/lib;../thirdparty/webp/lib;%(AdditionalLibraryDirectories)
-
-
-
-
- Level3
- WIN32;_DEBUG;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
- Level3
- _DEBUG;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
- Level3
- WIN32;NDEBUG;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
- {ccbe3960-dad2-49af-952f-a8a86d75f190}
-
-
- {030c6452-10bf-48a4-b80f-0d4a996b83ae}
-
-
- {7f3bb2ff-13e9-45a0-b8e3-f663fc651efd}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Three.V8.CLR/Three.V8.CLR.vcxproj.filters b/Three.V8.CLR/Three.V8.CLR.vcxproj.filters
deleted file mode 100644
index b5fdfce7..00000000
--- a/Three.V8.CLR/Three.V8.CLR.vcxproj.filters
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Header Files
-
-
-
-
- Source Files
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Three.V8.CLR/Three.V8.CLR.vcxproj.user b/Three.V8.CLR/Three.V8.CLR.vcxproj.user
deleted file mode 100644
index 88a55094..00000000
--- a/Three.V8.CLR/Three.V8.CLR.vcxproj.user
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Three.V8.CLR/packages.config b/Three.V8.CLR/packages.config
deleted file mode 100644
index 38682059..00000000
--- a/Three.V8.CLR/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Three.V8.sln b/Three.V8.sln
index 3269837b..61464cdd 100644
--- a/Three.V8.sln
+++ b/Three.V8.sln
@@ -7,18 +7,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreeEngine", "ThreeEngine\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Three.V8", "Three.V8\Three.V8.vcxproj", "{CCBE3960-DAD2-49AF-952F-A8A86D75F190}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Three.V8.CLR", "Three.V8.CLR\Three.V8.CLR.vcxproj", "{8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.Cpp", "Test.Cpp\Test.Cpp.vcxproj", "{3F00C726-809A-4269-9281-33B6AACE99F9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.V8", "Test.V8\Test.V8.vcxproj", "{67D5CD91-A728-4719-8E9C-8610CF661CEB}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GamePlayer", "GamePlayer\GamePlayer.csproj", "{3765E14C-74FC-463A-A843-D5B67FE8A7C2}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreeMM", "ThreeMM\ThreeMM.vcxproj", "{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameDev", "GameDev\GameDev.csproj", "{50E53E1E-BC53-442C-AA8E-E1149F23D6E1}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lightmapper", "Lightmapper\Lightmapper.vcxproj", "{CD28457C-63C3-43E9-8C91-A015D91B7B49}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LightmapCompressor", "LightmapCompressor\LightmapCompressor.vcxproj", "{BE12DD92-F55E-4138-8755-A62107C35182}"
@@ -53,16 +47,6 @@ Global
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x64.Build.0 = Release|x64
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x86.ActiveCfg = Release|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x86.Build.0 = Release|Win32
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Debug|x64.ActiveCfg = Debug|x64
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Debug|x64.Build.0 = Debug|x64
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Debug|x86.ActiveCfg = Debug|Win32
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Debug|x86.Build.0 = Debug|Win32
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Release|Any CPU.ActiveCfg = Release|Win32
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Release|x64.ActiveCfg = Release|x64
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Release|x64.Build.0 = Release|x64
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Release|x86.ActiveCfg = Release|Win32
- {8ACCB6BD-C7B1-4A80-91D5-53CF222B716A}.Release|x86.Build.0 = Release|Win32
{3F00C726-809A-4269-9281-33B6AACE99F9}.Debug|Any CPU.ActiveCfg = Debug|Win32
{3F00C726-809A-4269-9281-33B6AACE99F9}.Debug|x64.ActiveCfg = Debug|x64
{3F00C726-809A-4269-9281-33B6AACE99F9}.Debug|x64.Build.0 = Debug|x64
@@ -83,18 +67,6 @@ Global
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x64.Build.0 = Release|x64
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x86.ActiveCfg = Release|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x86.Build.0 = Release|Win32
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Debug|x64.ActiveCfg = Debug|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Debug|x64.Build.0 = Debug|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Debug|x86.Build.0 = Debug|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Release|Any CPU.Build.0 = Release|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Release|x64.ActiveCfg = Release|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Release|x64.Build.0 = Release|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Release|x86.ActiveCfg = Release|Any CPU
- {3765E14C-74FC-463A-A843-D5B67FE8A7C2}.Release|x86.Build.0 = Release|Any CPU
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Debug|Any CPU.ActiveCfg = Debug|x64
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Debug|Any CPU.Build.0 = Debug|x64
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Debug|x64.ActiveCfg = Debug|x64
@@ -107,18 +79,6 @@ Global
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Release|x64.Build.0 = Release|x64
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Release|x86.ActiveCfg = Release|Win32
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Release|x86.Build.0 = Release|Win32
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Debug|x64.ActiveCfg = Debug|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Debug|x64.Build.0 = Debug|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Debug|x86.ActiveCfg = Debug|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Debug|x86.Build.0 = Debug|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Release|Any CPU.Build.0 = Release|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Release|x64.ActiveCfg = Release|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Release|x64.Build.0 = Release|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Release|x86.ActiveCfg = Release|Any CPU
- {50E53E1E-BC53-442C-AA8E-E1149F23D6E1}.Release|x86.Build.0 = Release|Any CPU
{CD28457C-63C3-43E9-8C91-A015D91B7B49}.Debug|Any CPU.ActiveCfg = Debug|x64
{CD28457C-63C3-43E9-8C91-A015D91B7B49}.Debug|Any CPU.Build.0 = Debug|x64
{CD28457C-63C3-43E9-8C91-A015D91B7B49}.Debug|x64.ActiveCfg = Debug|x64